const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C7pXoVEH.js","assets/sha3--8JbGYfk.js","assets/utils-CqP-FaiV.js","assets/clsx.m-DHulAg21.js","assets/index-D35K2REE.js","assets/events-DQ172AOg.js","assets/index-B8lqC164.js","assets/index-Bgc9HhbY.js","assets/index-EovvEqYV.js","assets/index.es-Bad1qmqc.js"])))=>i.map(i=>d[i]);
var vQe=Object.defineProperty;var hhe=t=>{throw TypeError(t)};var wQe=(t,e,n)=>e in t?vQe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Qn=(t,e,n)=>wQe(t,typeof e!="symbol"?e+"":e,n),AH=(t,e,n)=>e.has(t)||hhe("Cannot "+n);var Je=(t,e,n)=>(AH(t,e,"read from private field"),n?n.call(t):e.get(t)),Wn=(t,e,n)=>e.has(t)?hhe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),tn=(t,e,n,r)=>(AH(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Er=(t,e,n)=>(AH(t,e,"access private method"),n);var yb=(t,e,n,r)=>({set _(s){tn(t,e,s,n)},get _(){return Je(t,e,r)}});function RAe(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 Lu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function CQe(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 _H={exports:{}},qA={},EH={exports:{}},Wi={};/**
* @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 phe;function NQe(){if(phe)return Wi;phe=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(se){return se===null||typeof se!="object"?null:(se=f&&se[f]||se["@@iterator"],typeof se=="function"?se:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,v={};function C(se,pe,Se){this.props=se,this.context=pe,this.refs=v,this.updater=Se||g}C.prototype.isReactComponent={},C.prototype.setState=function(se,pe){if(typeof se!="object"&&typeof se!="function"&&se!=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,se,pe,"setState")},C.prototype.forceUpdate=function(se){this.updater.enqueueForceUpdate(this,se,"forceUpdate")};function S(){}S.prototype=C.prototype;function T(se,pe,Se){this.props=se,this.context=pe,this.refs=v,this.updater=Se||g}var I=T.prototype=new S;I.constructor=T,y(I,C.prototype),I.isPureReactComponent=!0;var L=Array.isArray,F=Object.prototype.hasOwnProperty,$={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function U(se,pe,Se){var ge,ve={},be=null,we=null;if(pe!=null)for(ge in pe.ref!==void 0&&(we=pe.ref),pe.key!==void 0&&(be=""+pe.key),pe)F.call(pe,ge)&&!O.hasOwnProperty(ge)&&(ve[ge]=pe[ge]);var je=arguments.length-2;if(je===1)ve.children=Se;else if(1<je){for(var Fe=Array(je),Re=0;Re<je;Re++)Fe[Re]=arguments[Re+2];ve.children=Fe}if(se&&se.defaultProps)for(ge in je=se.defaultProps,je)ve[ge]===void 0&&(ve[ge]=je[ge]);return{$$typeof:t,type:se,key:be,ref:we,props:ve,_owner:$.current}}function Y(se,pe){return{$$typeof:t,type:se.type,key:pe,ref:se.ref,props:se.props,_owner:se._owner}}function re(se){return typeof se=="object"&&se!==null&&se.$$typeof===t}function Q(se){var pe={"=":"=0",":":"=2"};return"$"+se.replace(/[=:]/g,function(Se){return pe[Se]})}var q=/\/+/g;function te(se,pe){return typeof se=="object"&&se!==null&&se.key!=null?Q(""+se.key):pe.toString(36)}function fe(se,pe,Se,ge,ve){var be=typeof se;(be==="undefined"||be==="boolean")&&(se=null);var we=!1;if(se===null)we=!0;else switch(be){case"string":case"number":we=!0;break;case"object":switch(se.$$typeof){case t:case e:we=!0}}if(we)return we=se,ve=ve(we),se=ge===""?"."+te(we,0):ge,L(ve)?(Se="",se!=null&&(Se=se.replace(q,"$&/")+"/"),fe(ve,pe,Se,"",function(Re){return Re})):ve!=null&&(re(ve)&&(ve=Y(ve,Se+(!ve.key||we&&we.key===ve.key?"":(""+ve.key).replace(q,"$&/")+"/")+se)),pe.push(ve)),1;if(we=0,ge=ge===""?".":ge+":",L(se))for(var je=0;je<se.length;je++){be=se[je];var Fe=ge+te(be,je);we+=fe(be,pe,Se,Fe,ve)}else if(Fe=x(se),typeof Fe=="function")for(se=Fe.call(se),je=0;!(be=se.next()).done;)be=be.value,Fe=ge+te(be,je++),we+=fe(be,pe,Se,Fe,ve);else if(be==="object")throw pe=String(se),Error("Objects are not valid as a React child (found: "+(pe==="[object Object]"?"object with keys {"+Object.keys(se).join(", ")+"}":pe)+"). If you meant to render a collection of children, use an array instead.");return we}function G(se,pe,Se){if(se==null)return se;var ge=[],ve=0;return fe(se,ge,"","",function(be){return pe.call(Se,be,ve++)}),ge}function ie(se){if(se._status===-1){var pe=se._result;pe=pe(),pe.then(function(Se){(se._status===0||se._status===-1)&&(se._status=1,se._result=Se)},function(Se){(se._status===0||se._status===-1)&&(se._status=2,se._result=Se)}),se._status===-1&&(se._status=0,se._result=pe)}if(se._status===1)return se._result.default;throw se._result}var oe={current:null},K={transition:null},H={ReactCurrentDispatcher:oe,ReactCurrentBatchConfig:K,ReactCurrentOwner:$};function ee(){throw Error("act(...) is not supported in production builds of React.")}return Wi.Children={map:G,forEach:function(se,pe,Se){G(se,function(){pe.apply(this,arguments)},Se)},count:function(se){var pe=0;return G(se,function(){pe++}),pe},toArray:function(se){return G(se,function(pe){return pe})||[]},only:function(se){if(!re(se))throw Error("React.Children.only expected to receive a single React element child.");return se}},Wi.Component=C,Wi.Fragment=n,Wi.Profiler=s,Wi.PureComponent=T,Wi.StrictMode=r,Wi.Suspense=c,Wi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,Wi.act=ee,Wi.cloneElement=function(se,pe,Se){if(se==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+se+".");var ge=y({},se.props),ve=se.key,be=se.ref,we=se._owner;if(pe!=null){if(pe.ref!==void 0&&(be=pe.ref,we=$.current),pe.key!==void 0&&(ve=""+pe.key),se.type&&se.type.defaultProps)var je=se.type.defaultProps;for(Fe in pe)F.call(pe,Fe)&&!O.hasOwnProperty(Fe)&&(ge[Fe]=pe[Fe]===void 0&&je!==void 0?je[Fe]:pe[Fe])}var Fe=arguments.length-2;if(Fe===1)ge.children=Se;else if(1<Fe){je=Array(Fe);for(var Re=0;Re<Fe;Re++)je[Re]=arguments[Re+2];ge.children=je}return{$$typeof:t,type:se.type,key:ve,ref:be,props:ge,_owner:we}},Wi.createContext=function(se){return se={$$typeof:o,_currentValue:se,_currentValue2:se,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},se.Provider={$$typeof:a,_context:se},se.Consumer=se},Wi.createElement=U,Wi.createFactory=function(se){var pe=U.bind(null,se);return pe.type=se,pe},Wi.createRef=function(){return{current:null}},Wi.forwardRef=function(se){return{$$typeof:l,render:se}},Wi.isValidElement=re,Wi.lazy=function(se){return{$$typeof:d,_payload:{_status:-1,_result:se},_init:ie}},Wi.memo=function(se,pe){return{$$typeof:u,type:se,compare:pe===void 0?null:pe}},Wi.startTransition=function(se){var pe=K.transition;K.transition={};try{se()}finally{K.transition=pe}},Wi.unstable_act=ee,Wi.useCallback=function(se,pe){return oe.current.useCallback(se,pe)},Wi.useContext=function(se){return oe.current.useContext(se)},Wi.useDebugValue=function(){},Wi.useDeferredValue=function(se){return oe.current.useDeferredValue(se)},Wi.useEffect=function(se,pe){return oe.current.useEffect(se,pe)},Wi.useId=function(){return oe.current.useId()},Wi.useImperativeHandle=function(se,pe,Se){return oe.current.useImperativeHandle(se,pe,Se)},Wi.useInsertionEffect=function(se,pe){return oe.current.useInsertionEffect(se,pe)},Wi.useLayoutEffect=function(se,pe){return oe.current.useLayoutEffect(se,pe)},Wi.useMemo=function(se,pe){return oe.current.useMemo(se,pe)},Wi.useReducer=function(se,pe,Se){return oe.current.useReducer(se,pe,Se)},Wi.useRef=function(se){return oe.current.useRef(se)},Wi.useState=function(se){return oe.current.useState(se)},Wi.useSyncExternalStore=function(se,pe,Se){return oe.current.useSyncExternalStore(se,pe,Se)},Wi.useTransition=function(){return oe.current.useTransition()},Wi.version="18.3.1",Wi}var mhe;function bx(){return mhe||(mhe=1,EH.exports=NQe()),EH.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 xhe;function SQe(){if(xhe)return qA;xhe=1;var t=bx(),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 qA.Fragment=n,qA.jsx=o,qA.jsxs=o,qA}var ghe;function jQe(){return ghe||(ghe=1,_H.exports=SQe()),_H.exports}var i=jQe(),gI={},kH={exports:{}},Hd={},TH={exports:{}},PH={};/**
* @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 bhe;function AQe(){return bhe||(bhe=1,function(t){function e(K,H){var ee=K.length;K.push(H);e:for(;0<ee;){var se=ee-1>>>1,pe=K[se];if(0<s(pe,H))K[se]=H,K[ee]=pe,ee=se;else break e}}function n(K){return K.length===0?null:K[0]}function r(K){if(K.length===0)return null;var H=K[0],ee=K.pop();if(ee!==H){K[0]=ee;e:for(var se=0,pe=K.length,Se=pe>>>1;se<Se;){var ge=2*(se+1)-1,ve=K[ge],be=ge+1,we=K[be];if(0>s(ve,ee))be<pe&&0>s(we,ve)?(K[se]=we,K[be]=ee,se=be):(K[se]=ve,K[ge]=ee,se=ge);else if(be<pe&&0>s(we,ee))K[se]=we,K[be]=ee,se=be;else break e}}return H}function s(K,H){var ee=K.sortIndex-H.sortIndex;return ee!==0?ee:K.id-H.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,S=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function I(K){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=K)r(u),H.sortIndex=H.expirationTime,e(c,H);else break;H=n(u)}}function L(K){if(v=!1,I(K),!y)if(n(c)!==null)y=!0,ie(F);else{var H=n(u);H!==null&&oe(L,H.startTime-K)}}function F(K,H){y=!1,v&&(v=!1,S(U),U=-1),g=!0;var ee=x;try{for(I(H),f=n(c);f!==null&&(!(f.expirationTime>H)||K&&!Q());){var se=f.callback;if(typeof se=="function"){f.callback=null,x=f.priorityLevel;var pe=se(f.expirationTime<=H);H=t.unstable_now(),typeof pe=="function"?f.callback=pe:f===n(c)&&r(c),I(H)}else r(c);f=n(c)}if(f!==null)var Se=!0;else{var ge=n(u);ge!==null&&oe(L,ge.startTime-H),Se=!1}return Se}finally{f=null,x=ee,g=!1}}var $=!1,O=null,U=-1,Y=5,re=-1;function Q(){return!(t.unstable_now()-re<Y)}function q(){if(O!==null){var K=t.unstable_now();re=K;var H=!0;try{H=O(!0,K)}finally{H?te():($=!1,O=null)}}else $=!1}var te;if(typeof T=="function")te=function(){T(q)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,G=fe.port2;fe.port1.onmessage=q,te=function(){G.postMessage(null)}}else te=function(){C(q,0)};function ie(K){O=K,$||($=!0,te())}function oe(K,H){U=C(function(){K(t.unstable_now())},H)}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(K){K.callback=null},t.unstable_continueExecution=function(){y||g||(y=!0,ie(F))},t.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<K?Math.floor(1e3/K):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_getFirstCallbackNode=function(){return n(c)},t.unstable_next=function(K){switch(x){case 1:case 2:case 3:var H=3;break;default:H=x}var ee=x;x=H;try{return K()}finally{x=ee}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(K,H){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var ee=x;x=K;try{return H()}finally{x=ee}},t.unstable_scheduleCallback=function(K,H,ee){var se=t.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?se+ee:se):ee=se,K){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=ee+pe,K={id:d++,callback:H,priorityLevel:K,startTime:ee,expirationTime:pe,sortIndex:-1},ee>se?(K.sortIndex=ee,e(u,K),n(c)===null&&K===n(u)&&(v?(S(U),U=-1):v=!0,oe(L,ee-se))):(K.sortIndex=pe,e(c,K),y||g||(y=!0,ie(F))),K},t.unstable_shouldYield=Q,t.unstable_wrapCallback=function(K){var H=x;return function(){var ee=x;x=H;try{return K.apply(this,arguments)}finally{x=ee}}}}(PH)),PH}var yhe;function _Qe(){return yhe||(yhe=1,TH.exports=AQe()),TH.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 vhe;function EQe(){if(vhe)return Hd;vhe=1;var t=bx(),e=_Qe();function n(_){for(var R="https://reactjs.org/docs/error-decoder.html?invariant="+_,ne=1;ne<arguments.length;ne++)R+="&args[]="+encodeURIComponent(arguments[ne]);return"Minified React error #"+_+"; 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(_,R){o(_,R),o(_+"Capture",R)}function o(_,R){for(s[_]=R,_=0;_<R.length;_++)r.add(R[_])}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(_){return c.call(f,_)?!0:c.call(d,_)?!1:u.test(_)?f[_]=!0:(d[_]=!0,!1)}function g(_,R,ne,ye){if(ne!==null&&ne.type===0)return!1;switch(typeof R){case"function":case"symbol":return!0;case"boolean":return ye?!1:ne!==null?!ne.acceptsBooleans:(_=_.toLowerCase().slice(0,5),_!=="data-"&&_!=="aria-");default:return!1}}function y(_,R,ne,ye){if(R===null||typeof R>"u"||g(_,R,ne,ye))return!0;if(ye)return!1;if(ne!==null)switch(ne.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(_,R,ne,ye,Ue,et,Mt){this.acceptsBooleans=R===2||R===3||R===4,this.attributeName=ye,this.attributeNamespace=Ue,this.mustUseProperty=ne,this.propertyName=_,this.type=R,this.sanitizeURL=et,this.removeEmptyString=Mt}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(_){C[_]=new v(_,0,!1,_,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(_){var R=_[0];C[R]=new v(R,1,!1,_[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(_){C[_]=new v(_,2,!1,_.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(_){C[_]=new v(_,2,!1,_,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(_){C[_]=new v(_,3,!1,_.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(_){C[_]=new v(_,3,!0,_,null,!1,!1)}),["capture","download"].forEach(function(_){C[_]=new v(_,4,!1,_,null,!1,!1)}),["cols","rows","size","span"].forEach(function(_){C[_]=new v(_,6,!1,_,null,!1,!1)}),["rowSpan","start"].forEach(function(_){C[_]=new v(_,5,!1,_.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function T(_){return _[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(_){var R=_.replace(S,T);C[R]=new v(R,1,!1,_,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(_){var R=_.replace(S,T);C[R]=new v(R,1,!1,_,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(_){var R=_.replace(S,T);C[R]=new v(R,1,!1,_,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(_){C[_]=new v(_,1,!1,_.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(_){C[_]=new v(_,1,!1,_.toLowerCase(),null,!0,!0)});function I(_,R,ne,ye){var Ue=C.hasOwnProperty(R)?C[R]:null;(Ue!==null?Ue.type!==0:ye||!(2<R.length)||R[0]!=="o"&&R[0]!=="O"||R[1]!=="n"&&R[1]!=="N")&&(y(R,ne,Ue,ye)&&(ne=null),ye||Ue===null?x(R)&&(ne===null?_.removeAttribute(R):_.setAttribute(R,""+ne)):Ue.mustUseProperty?_[Ue.propertyName]=ne===null?Ue.type===3?!1:"":ne:(R=Ue.attributeName,ye=Ue.attributeNamespace,ne===null?_.removeAttribute(R):(Ue=Ue.type,ne=Ue===3||Ue===4&&ne===!0?"":""+ne,ye?_.setAttributeNS(ye,R,ne):_.setAttribute(R,ne))))}var L=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,F=Symbol.for("react.element"),$=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),re=Symbol.for("react.provider"),Q=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),fe=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),oe=Symbol.for("react.offscreen"),K=Symbol.iterator;function H(_){return _===null||typeof _!="object"?null:(_=K&&_[K]||_["@@iterator"],typeof _=="function"?_:null)}var ee=Object.assign,se;function pe(_){if(se===void 0)try{throw Error()}catch(ne){var R=ne.stack.trim().match(/\n( *(at )?)/);se=R&&R[1]||""}return`
`+se+_}var Se=!1;function ge(_,R){if(!_||Se)return"";Se=!0;var ne=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(xr){var ye=xr}Reflect.construct(_,[],R)}else{try{R.call()}catch(xr){ye=xr}_.call(R.prototype)}else{try{throw Error()}catch(xr){ye=xr}_()}}catch(xr){if(xr&&ye&&typeof xr.stack=="string"){for(var Ue=xr.stack.split(`
`),et=ye.stack.split(`
`),Mt=Ue.length-1,_n=et.length-1;1<=Mt&&0<=_n&&Ue[Mt]!==et[_n];)_n--;for(;1<=Mt&&0<=_n;Mt--,_n--)if(Ue[Mt]!==et[_n]){if(Mt!==1||_n!==1)do if(Mt--,_n--,0>_n||Ue[Mt]!==et[_n]){var Un=`
`+Ue[Mt].replace(" at new "," at ");return _.displayName&&Un.includes("<anonymous>")&&(Un=Un.replace("<anonymous>",_.displayName)),Un}while(1<=Mt&&0<=_n);break}}}finally{Se=!1,Error.prepareStackTrace=ne}return(_=_?_.displayName||_.name:"")?pe(_):""}function ve(_){switch(_.tag){case 5:return pe(_.type);case 16:return pe("Lazy");case 13:return pe("Suspense");case 19:return pe("SuspenseList");case 0:case 2:case 15:return _=ge(_.type,!1),_;case 11:return _=ge(_.type.render,!1),_;case 1:return _=ge(_.type,!0),_;default:return""}}function be(_){if(_==null)return null;if(typeof _=="function")return _.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case O:return"Fragment";case $:return"Portal";case Y:return"Profiler";case U:return"StrictMode";case te:return"Suspense";case fe:return"SuspenseList"}if(typeof _=="object")switch(_.$$typeof){case Q:return(_.displayName||"Context")+".Consumer";case re:return(_._context.displayName||"Context")+".Provider";case q:var R=_.render;return _=_.displayName,_||(_=R.displayName||R.name||"",_=_!==""?"ForwardRef("+_+")":"ForwardRef"),_;case G:return R=_.displayName||null,R!==null?R:be(_.type)||"Memo";case ie:R=_._payload,_=_._init;try{return be(_(R))}catch{}}return null}function we(_){var R=_.type;switch(_.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 _=R.render,_=_.displayName||_.name||"",R.displayName||(_!==""?"ForwardRef("+_+")":"ForwardRef");case 7:return"Fragment";case 5:return R;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return be(R);case 8:return R===U?"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(_){switch(typeof _){case"boolean":case"number":case"string":case"undefined":return _;case"object":return _;default:return""}}function Fe(_){var R=_.type;return(_=_.nodeName)&&_.toLowerCase()==="input"&&(R==="checkbox"||R==="radio")}function Re(_){var R=Fe(_)?"checked":"value",ne=Object.getOwnPropertyDescriptor(_.constructor.prototype,R),ye=""+_[R];if(!_.hasOwnProperty(R)&&typeof ne<"u"&&typeof ne.get=="function"&&typeof ne.set=="function"){var Ue=ne.get,et=ne.set;return Object.defineProperty(_,R,{configurable:!0,get:function(){return Ue.call(this)},set:function(Mt){ye=""+Mt,et.call(this,Mt)}}),Object.defineProperty(_,R,{enumerable:ne.enumerable}),{getValue:function(){return ye},setValue:function(Mt){ye=""+Mt},stopTracking:function(){_._valueTracker=null,delete _[R]}}}}function Qe(_){_._valueTracker||(_._valueTracker=Re(_))}function Ye(_){if(!_)return!1;var R=_._valueTracker;if(!R)return!0;var ne=R.getValue(),ye="";return _&&(ye=Fe(_)?_.checked?"true":"false":_.value),_=ye,_!==ne?(R.setValue(_),!0):!1}function dt(_){if(_=_||(typeof document<"u"?document:void 0),typeof _>"u")return null;try{return _.activeElement||_.body}catch{return _.body}}function st(_,R){var ne=R.checked;return ee({},R,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:ne??_._wrapperState.initialChecked})}function at(_,R){var ne=R.defaultValue==null?"":R.defaultValue,ye=R.checked!=null?R.checked:R.defaultChecked;ne=je(R.value!=null?R.value:ne),_._wrapperState={initialChecked:ye,initialValue:ne,controlled:R.type==="checkbox"||R.type==="radio"?R.checked!=null:R.value!=null}}function He(_,R){R=R.checked,R!=null&&I(_,"checked",R,!1)}function qe(_,R){He(_,R);var ne=je(R.value),ye=R.type;if(ne!=null)ye==="number"?(ne===0&&_.value===""||_.value!=ne)&&(_.value=""+ne):_.value!==""+ne&&(_.value=""+ne);else if(ye==="submit"||ye==="reset"){_.removeAttribute("value");return}R.hasOwnProperty("value")?yt(_,R.type,ne):R.hasOwnProperty("defaultValue")&&yt(_,R.type,je(R.defaultValue)),R.checked==null&&R.defaultChecked!=null&&(_.defaultChecked=!!R.defaultChecked)}function vt(_,R,ne){if(R.hasOwnProperty("value")||R.hasOwnProperty("defaultValue")){var ye=R.type;if(!(ye!=="submit"&&ye!=="reset"||R.value!==void 0&&R.value!==null))return;R=""+_._wrapperState.initialValue,ne||R===_.value||(_.value=R),_.defaultValue=R}ne=_.name,ne!==""&&(_.name=""),_.defaultChecked=!!_._wrapperState.initialChecked,ne!==""&&(_.name=ne)}function yt(_,R,ne){(R!=="number"||dt(_.ownerDocument)!==_)&&(ne==null?_.defaultValue=""+_._wrapperState.initialValue:_.defaultValue!==""+ne&&(_.defaultValue=""+ne))}var Kt=Array.isArray;function jt(_,R,ne,ye){if(_=_.options,R){R={};for(var Ue=0;Ue<ne.length;Ue++)R["$"+ne[Ue]]=!0;for(ne=0;ne<_.length;ne++)Ue=R.hasOwnProperty("$"+_[ne].value),_[ne].selected!==Ue&&(_[ne].selected=Ue),Ue&&ye&&(_[ne].defaultSelected=!0)}else{for(ne=""+je(ne),R=null,Ue=0;Ue<_.length;Ue++){if(_[Ue].value===ne){_[Ue].selected=!0,ye&&(_[Ue].defaultSelected=!0);return}R!==null||_[Ue].disabled||(R=_[Ue])}R!==null&&(R.selected=!0)}}function un(_,R){if(R.dangerouslySetInnerHTML!=null)throw Error(n(91));return ee({},R,{value:void 0,defaultValue:void 0,children:""+_._wrapperState.initialValue})}function vn(_,R){var ne=R.value;if(ne==null){if(ne=R.children,R=R.defaultValue,ne!=null){if(R!=null)throw Error(n(92));if(Kt(ne)){if(1<ne.length)throw Error(n(93));ne=ne[0]}R=ne}R==null&&(R=""),ne=R}_._wrapperState={initialValue:je(ne)}}function Hn(_,R){var ne=je(R.value),ye=je(R.defaultValue);ne!=null&&(ne=""+ne,ne!==_.value&&(_.value=ne),R.defaultValue==null&&_.defaultValue!==ne&&(_.defaultValue=ne)),ye!=null&&(_.defaultValue=""+ye)}function ln(_){var R=_.textContent;R===_._wrapperState.initialValue&&R!==""&&R!==null&&(_.value=R)}function Nn(_){switch(_){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 dn(_,R){return _==null||_==="http://www.w3.org/1999/xhtml"?Nn(R):_==="http://www.w3.org/2000/svg"&&R==="foreignObject"?"http://www.w3.org/1999/xhtml":_}var rt,nt=function(_){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(R,ne,ye,Ue){MSApp.execUnsafeLocalFunction(function(){return _(R,ne,ye,Ue)})}:_}(function(_,R){if(_.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in _)_.innerHTML=R;else{for(rt=rt||document.createElement("div"),rt.innerHTML="<svg>"+R.valueOf().toString()+"</svg>",R=rt.firstChild;_.firstChild;)_.removeChild(_.firstChild);for(;R.firstChild;)_.appendChild(R.firstChild)}});function Ut(_,R){if(R){var ne=_.firstChild;if(ne&&ne===_.lastChild&&ne.nodeType===3){ne.nodeValue=R;return}}_.textContent=R}var wn={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},Jt=["Webkit","ms","Moz","O"];Object.keys(wn).forEach(function(_){Jt.forEach(function(R){R=R+_.charAt(0).toUpperCase()+_.substring(1),wn[R]=wn[_]})});function Vt(_,R,ne){return R==null||typeof R=="boolean"||R===""?"":ne||typeof R!="number"||R===0||wn.hasOwnProperty(_)&&wn[_]?(""+R).trim():R+"px"}function xt(_,R){_=_.style;for(var ne in R)if(R.hasOwnProperty(ne)){var ye=ne.indexOf("--")===0,Ue=Vt(ne,R[ne],ye);ne==="float"&&(ne="cssFloat"),ye?_.setProperty(ne,Ue):_[ne]=Ue}}var We=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 Pt(_,R){if(R){if(We[_]&&(R.children!=null||R.dangerouslySetInnerHTML!=null))throw Error(n(137,_));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 Ke(_,R){if(_.indexOf("-")===-1)return typeof R.is=="string";switch(_){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 ct=null;function Nt(_){return _=_.target||_.srcElement||window,_.correspondingUseElement&&(_=_.correspondingUseElement),_.nodeType===3?_.parentNode:_}var Ht=null,Rt=null,hn=null;function yn(_){if(_=bc(_)){if(typeof Ht!="function")throw Error(n(280));var R=_.stateNode;R&&(R=c6(R),Ht(_.stateNode,_.type,R))}}function Cn(_){Rt?hn?hn.push(_):hn=[_]:Rt=_}function En(){if(Rt){var _=Rt,R=hn;if(hn=Rt=null,yn(_),R)for(_=0;_<R.length;_++)yn(R[_])}}function Rn(_,R){return _(R)}function Mn(){}var Yn=!1;function Zn(_,R,ne){if(Yn)return _(R,ne);Yn=!0;try{return Rn(_,R,ne)}finally{Yn=!1,(Rt!==null||hn!==null)&&(Mn(),En())}}function Vn(_,R){var ne=_.stateNode;if(ne===null)return null;var ye=c6(ne);if(ye===null)return null;ne=ye[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":(ye=!ye.disabled)||(_=_.type,ye=!(_==="button"||_==="input"||_==="select"||_==="textarea")),_=!ye;break e;default:_=!1}if(_)return null;if(ne&&typeof ne!="function")throw Error(n(231,R,typeof ne));return ne}var tr=!1;if(l)try{var Sn={};Object.defineProperty(Sn,"passive",{get:function(){tr=!0}}),window.addEventListener("test",Sn,Sn),window.removeEventListener("test",Sn,Sn)}catch{tr=!1}function ze(_,R,ne,ye,Ue,et,Mt,_n,Un){var xr=Array.prototype.slice.call(arguments,3);try{R.apply(ne,xr)}catch(Kr){this.onError(Kr)}}var xe=!1,Ge=null,_e=!1,Be=null,qt={onError:function(_){xe=!0,Ge=_}};function It(_,R,ne,ye,Ue,et,Mt,_n,Un){xe=!1,Ge=null,ze.apply(qt,arguments)}function mt(_,R,ne,ye,Ue,et,Mt,_n,Un){if(It.apply(this,arguments),xe){if(xe){var xr=Ge;xe=!1,Ge=null}else throw Error(n(198));_e||(_e=!0,Be=xr)}}function Ft(_){var R=_,ne=_;if(_.alternate)for(;R.return;)R=R.return;else{_=R;do R=_,R.flags&4098&&(ne=R.return),_=R.return;while(_)}return R.tag===3?ne:null}function Tn(_){if(_.tag===13){var R=_.memoizedState;if(R===null&&(_=_.alternate,_!==null&&(R=_.memoizedState)),R!==null)return R.dehydrated}return null}function kn(_){if(Ft(_)!==_)throw Error(n(188))}function Gt(_){var R=_.alternate;if(!R){if(R=Ft(_),R===null)throw Error(n(188));return R!==_?null:_}for(var ne=_,ye=R;;){var Ue=ne.return;if(Ue===null)break;var et=Ue.alternate;if(et===null){if(ye=Ue.return,ye!==null){ne=ye;continue}break}if(Ue.child===et.child){for(et=Ue.child;et;){if(et===ne)return kn(Ue),_;if(et===ye)return kn(Ue),R;et=et.sibling}throw Error(n(188))}if(ne.return!==ye.return)ne=Ue,ye=et;else{for(var Mt=!1,_n=Ue.child;_n;){if(_n===ne){Mt=!0,ne=Ue,ye=et;break}if(_n===ye){Mt=!0,ye=Ue,ne=et;break}_n=_n.sibling}if(!Mt){for(_n=et.child;_n;){if(_n===ne){Mt=!0,ne=et,ye=Ue;break}if(_n===ye){Mt=!0,ye=et,ne=Ue;break}_n=_n.sibling}if(!Mt)throw Error(n(189))}}if(ne.alternate!==ye)throw Error(n(190))}if(ne.tag!==3)throw Error(n(188));return ne.stateNode.current===ne?_:R}function mn(_){return _=Gt(_),_!==null?gt(_):null}function gt(_){if(_.tag===5||_.tag===6)return _;for(_=_.child;_!==null;){var R=gt(_);if(R!==null)return R;_=_.sibling}return null}var Wt=e.unstable_scheduleCallback,jn=e.unstable_cancelCallback,kt=e.unstable_shouldYield,cn=e.unstable_requestPaint,Ce=e.unstable_now,m=e.unstable_getCurrentPriorityLevel,p=e.unstable_ImmediatePriority,N=e.unstable_UserBlockingPriority,A=e.unstable_NormalPriority,k=e.unstable_LowPriority,P=e.unstable_IdlePriority,D=null,V=null;function Z(_){if(V&&typeof V.onCommitFiberRoot=="function")try{V.onCommitFiberRoot(D,_,void 0,(_.current.flags&128)===128)}catch{}}var ce=Math.clz32?Math.clz32:Ne,ue=Math.log,me=Math.LN2;function Ne(_){return _>>>=0,_===0?32:31-(ue(_)/me|0)|0}var Ie=64,Le=4194304;function Xe(_){switch(_&-_){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 _&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return _&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return _}}function Oe(_,R){var ne=_.pendingLanes;if(ne===0)return 0;var ye=0,Ue=_.suspendedLanes,et=_.pingedLanes,Mt=ne&268435455;if(Mt!==0){var _n=Mt&~Ue;_n!==0?ye=Xe(_n):(et&=Mt,et!==0&&(ye=Xe(et)))}else Mt=ne&~Ue,Mt!==0?ye=Xe(Mt):et!==0&&(ye=Xe(et));if(ye===0)return 0;if(R!==0&&R!==ye&&!(R&Ue)&&(Ue=ye&-ye,et=R&-R,Ue>=et||Ue===16&&(et&4194240)!==0))return R;if(ye&4&&(ye|=ne&16),R=_.entangledLanes,R!==0)for(_=_.entanglements,R&=ye;0<R;)ne=31-ce(R),Ue=1<<ne,ye|=_[ne],R&=~Ue;return ye}function $e(_,R){switch(_){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 ae(_,R){for(var ne=_.suspendedLanes,ye=_.pingedLanes,Ue=_.expirationTimes,et=_.pendingLanes;0<et;){var Mt=31-ce(et),_n=1<<Mt,Un=Ue[Mt];Un===-1?(!(_n&ne)||_n&ye)&&(Ue[Mt]=$e(_n,R)):Un<=R&&(_.expiredLanes|=_n),et&=~_n}}function he(_){return _=_.pendingLanes&-1073741825,_!==0?_:_&1073741824?1073741824:0}function Pe(){var _=Ie;return Ie<<=1,!(Ie&4194240)&&(Ie=64),_}function Ve(_){for(var R=[],ne=0;31>ne;ne++)R.push(_);return R}function Te(_,R,ne){_.pendingLanes|=R,R!==536870912&&(_.suspendedLanes=0,_.pingedLanes=0),_=_.eventTimes,R=31-ce(R),_[R]=ne}function Ze(_,R){var ne=_.pendingLanes&~R;_.pendingLanes=R,_.suspendedLanes=0,_.pingedLanes=0,_.expiredLanes&=R,_.mutableReadLanes&=R,_.entangledLanes&=R,R=_.entanglements;var ye=_.eventTimes;for(_=_.expirationTimes;0<ne;){var Ue=31-ce(ne),et=1<<Ue;R[Ue]=0,ye[Ue]=-1,_[Ue]=-1,ne&=~et}}function it(_,R){var ne=_.entangledLanes|=R;for(_=_.entanglements;ne;){var ye=31-ce(ne),Ue=1<<ye;Ue&R|_[ye]&R&&(_[ye]|=R),ne&=~Ue}}var wt=0;function Dt(_){return _&=-_,1<_?4<_?_&268435455?16:536870912:4:1}var Qt,xn,pn,An,or,$t=!1,bt=[],rn=null,ur=null,gr=null,br=new Map,Br=new Map,Gr=[],Or="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 Lt(_,R){switch(_){case"focusin":case"focusout":rn=null;break;case"dragenter":case"dragleave":ur=null;break;case"mouseover":case"mouseout":gr=null;break;case"pointerover":case"pointerout":br.delete(R.pointerId);break;case"gotpointercapture":case"lostpointercapture":Br.delete(R.pointerId)}}function nn(_,R,ne,ye,Ue,et){return _===null||_.nativeEvent!==et?(_={blockedOn:R,domEventName:ne,eventSystemFlags:ye,nativeEvent:et,targetContainers:[Ue]},R!==null&&(R=bc(R),R!==null&&xn(R)),_):(_.eventSystemFlags|=ye,R=_.targetContainers,Ue!==null&&R.indexOf(Ue)===-1&&R.push(Ue),_)}function Ot(_,R,ne,ye,Ue){switch(R){case"focusin":return rn=nn(rn,_,R,ne,ye,Ue),!0;case"dragenter":return ur=nn(ur,_,R,ne,ye,Ue),!0;case"mouseover":return gr=nn(gr,_,R,ne,ye,Ue),!0;case"pointerover":var et=Ue.pointerId;return br.set(et,nn(br.get(et)||null,_,R,ne,ye,Ue)),!0;case"gotpointercapture":return et=Ue.pointerId,Br.set(et,nn(Br.get(et)||null,_,R,ne,ye,Ue)),!0}return!1}function en(_){var R=dh(_.target);if(R!==null){var ne=Ft(R);if(ne!==null){if(R=ne.tag,R===13){if(R=Tn(ne),R!==null){_.blockedOn=R,or(_.priority,function(){pn(ne)});return}}else if(R===3&&ne.stateNode.current.memoizedState.isDehydrated){_.blockedOn=ne.tag===3?ne.stateNode.containerInfo:null;return}}}_.blockedOn=null}function Fn(_){if(_.blockedOn!==null)return!1;for(var R=_.targetContainers;0<R.length;){var ne=vr(_.domEventName,_.eventSystemFlags,R[0],_.nativeEvent);if(ne===null){ne=_.nativeEvent;var ye=new ne.constructor(ne.type,ne);ct=ye,ne.target.dispatchEvent(ye),ct=null}else return R=bc(ne),R!==null&&xn(R),_.blockedOn=ne,!1;R.shift()}return!0}function yr(_,R,ne){Fn(_)&&ne.delete(R)}function hr(){$t=!1,rn!==null&&Fn(rn)&&(rn=null),ur!==null&&Fn(ur)&&(ur=null),gr!==null&&Fn(gr)&&(gr=null),br.forEach(yr),Br.forEach(yr)}function lt(_,R){_.blockedOn===R&&(_.blockedOn=null,$t||($t=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,hr)))}function Ct(_){function R(Ue){return lt(Ue,_)}if(0<bt.length){lt(bt[0],_);for(var ne=1;ne<bt.length;ne++){var ye=bt[ne];ye.blockedOn===_&&(ye.blockedOn=null)}}for(rn!==null&<(rn,_),ur!==null&<(ur,_),gr!==null&<(gr,_),br.forEach(R),Br.forEach(R),ne=0;ne<Gr.length;ne++)ye=Gr[ne],ye.blockedOn===_&&(ye.blockedOn=null);for(;0<Gr.length&&(ne=Gr[0],ne.blockedOn===null);)en(ne),ne.blockedOn===null&&Gr.shift()}var On=L.ReactCurrentBatchConfig,qn=!0;function _r(_,R,ne,ye){var Ue=wt,et=On.transition;On.transition=null;try{wt=1,Fr(_,R,ne,ye)}finally{wt=Ue,On.transition=et}}function jr(_,R,ne,ye){var Ue=wt,et=On.transition;On.transition=null;try{wt=4,Fr(_,R,ne,ye)}finally{wt=Ue,On.transition=et}}function Fr(_,R,ne,ye){if(qn){var Ue=vr(_,R,ne,ye);if(Ue===null)Y8(_,R,ye,nr,ne),Lt(_,ye);else if(Ot(Ue,_,R,ne,ye))ye.stopPropagation();else if(Lt(_,ye),R&4&&-1<Or.indexOf(_)){for(;Ue!==null;){var et=bc(Ue);if(et!==null&&Qt(et),et=vr(_,R,ne,ye),et===null&&Y8(_,R,ye,nr,ne),et===Ue)break;Ue=et}Ue!==null&&ye.stopPropagation()}else Y8(_,R,ye,null,ne)}}var nr=null;function vr(_,R,ne,ye){if(nr=null,_=Nt(ye),_=dh(_),_!==null)if(R=Ft(_),R===null)_=null;else if(ne=R.tag,ne===13){if(_=Tn(R),_!==null)return _;_=null}else if(ne===3){if(R.stateNode.current.memoizedState.isDehydrated)return R.tag===3?R.stateNode.containerInfo:null;_=null}else R!==_&&(_=null);return nr=_,null}function Yr(_){switch(_){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(m()){case p:return 1;case N:return 4;case A:case k:return 16;case P:return 536870912;default:return 16}default:return 16}}var dr=null,rs=null,gs=null;function ms(){if(gs)return gs;var _,R=rs,ne=R.length,ye,Ue="value"in dr?dr.value:dr.textContent,et=Ue.length;for(_=0;_<ne&&R[_]===Ue[_];_++);var Mt=ne-_;for(ye=1;ye<=Mt&&R[ne-ye]===Ue[et-ye];ye++);return gs=Ue.slice(_,1<ye?1-ye:void 0)}function At(_){var R=_.keyCode;return"charCode"in _?(_=_.charCode,_===0&&R===13&&(_=13)):_=R,_===10&&(_=13),32<=_||_===13?_:0}function pt(){return!0}function le(){return!1}function Me(_){function R(ne,ye,Ue,et,Mt){this._reactName=ne,this._targetInst=Ue,this.type=ye,this.nativeEvent=et,this.target=Mt,this.currentTarget=null;for(var _n in _)_.hasOwnProperty(_n)&&(ne=_[_n],this[_n]=ne?ne(et):et[_n]);return this.isDefaultPrevented=(et.defaultPrevented!=null?et.defaultPrevented:et.returnValue===!1)?pt:le,this.isPropagationStopped=le,this}return ee(R.prototype,{preventDefault:function(){this.defaultPrevented=!0;var ne=this.nativeEvent;ne&&(ne.preventDefault?ne.preventDefault():typeof ne.returnValue!="unknown"&&(ne.returnValue=!1),this.isDefaultPrevented=pt)},stopPropagation:function(){var ne=this.nativeEvent;ne&&(ne.stopPropagation?ne.stopPropagation():typeof ne.cancelBubble!="unknown"&&(ne.cancelBubble=!0),this.isPropagationStopped=pt)},persist:function(){},isPersistent:pt}),R}var ft={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(_){return _.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ut=Me(ft),on=ee({},ft,{view:0,detail:0}),bn=Me(on),Gn,rr,Jn,Xn=ee({},on,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mr,button:0,buttons:0,relatedTarget:function(_){return _.relatedTarget===void 0?_.fromElement===_.srcElement?_.toElement:_.fromElement:_.relatedTarget},movementX:function(_){return"movementX"in _?_.movementX:(_!==Jn&&(Jn&&_.type==="mousemove"?(Gn=_.screenX-Jn.screenX,rr=_.screenY-Jn.screenY):rr=Gn=0,Jn=_),Gn)},movementY:function(_){return"movementY"in _?_.movementY:rr}}),Zr=Me(Xn),$r=ee({},Xn,{dataTransfer:0}),wr=Me($r),pr=ee({},on,{relatedTarget:0}),ar=Me(pr),Vr=ee({},ft,{animationName:0,elapsedTime:0,pseudoElement:0}),Ur=Me(Vr),bs=ee({},ft,{clipboardData:function(_){return"clipboardData"in _?_.clipboardData:window.clipboardData}}),Sr=Me(bs),Pn=ee({},ft,{data:0}),Ln=Me(Pn),ht={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Yt={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"},lr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sr(_){var R=this.nativeEvent;return R.getModifierState?R.getModifierState(_):(_=lr[_])?!!R[_]:!1}function Mr(){return sr}var Lr=ee({},on,{key:function(_){if(_.key){var R=ht[_.key]||_.key;if(R!=="Unidentified")return R}return _.type==="keypress"?(_=At(_),_===13?"Enter":String.fromCharCode(_)):_.type==="keydown"||_.type==="keyup"?Yt[_.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mr,charCode:function(_){return _.type==="keypress"?At(_):0},keyCode:function(_){return _.type==="keydown"||_.type==="keyup"?_.keyCode:0},which:function(_){return _.type==="keypress"?At(_):_.type==="keydown"||_.type==="keyup"?_.keyCode:0}}),ss=Me(Lr),ys=ee({},Xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bt=Me(ys),mr=ee({},on,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mr}),er=Me(mr),qr=ee({},ft,{propertyName:0,elapsedTime:0,pseudoElement:0}),xs=Me(qr),ls=ee({},Xn,{deltaX:function(_){return"deltaX"in _?_.deltaX:"wheelDeltaX"in _?-_.wheelDeltaX:0},deltaY:function(_){return"deltaY"in _?_.deltaY:"wheelDeltaY"in _?-_.wheelDeltaY:"wheelDelta"in _?-_.wheelDelta:0},deltaZ:0,deltaMode:0}),hs=Me(ls),vs=[9,13,27,32],vi=l&&"CompositionEvent"in window,Ps=null;l&&"documentMode"in document&&(Ps=document.documentMode);var As=l&&"TextEvent"in window&&!Ps,Ts=l&&(!vi||Ps&&8<Ps&&11>=Ps),mc=" ",Ls=!1;function Pa(_,R){switch(_){case"keyup":return vs.indexOf(R.keyCode)!==-1;case"keydown":return R.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wu(_){return _=_.detail,typeof _=="object"&&"data"in _?_.data:null}var Sa=!1;function Xo(_,R){switch(_){case"compositionend":return Wu(R);case"keypress":return R.which!==32?null:(Ls=!0,mc);case"textInput":return _=R.data,_===mc&&Ls?null:_;default:return null}}function qu(_,R){if(Sa)return _==="compositionend"||!vi&&Pa(_,R)?(_=ms(),gs=rs=dr=null,Sa=!1,_):null;switch(_){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 Ts&&R.locale!=="ko"?null:R.data;default:return null}}var Ql={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 Ci(_){var R=_&&_.nodeName&&_.nodeName.toLowerCase();return R==="input"?!!Ql[_.type]:R==="textarea"}function Ed(_,R,ne,ye){Cn(ye),R=i6(R,"onChange"),0<R.length&&(ne=new ut("onChange","change",null,ne,ye),_.push({event:ne,listeners:R}))}var St=null,w=null;function E(_){SP(_,0)}function M(_){var R=_i(_);if(Ye(R))return _}function z(_,R){if(_==="change")return R}var W=!1;if(l){var J;if(l){var de="oninput"in document;if(!de){var Ee=document.createElement("div");Ee.setAttribute("oninput","return;"),de=typeof Ee.oninput=="function"}J=de}else J=!1;W=J&&(!document.documentMode||9<document.documentMode)}function De(){St&&(St.detachEvent("onpropertychange",ot),w=St=null)}function ot(_){if(_.propertyName==="value"&&M(w)){var R=[];Ed(R,w,_,Nt(_)),Zn(E,R)}}function _t(_,R,ne){_==="focusin"?(De(),St=R,w=ne,St.attachEvent("onpropertychange",ot)):_==="focusout"&&De()}function zt(_){if(_==="selectionchange"||_==="keyup"||_==="keydown")return M(w)}function gn(_,R){if(_==="click")return M(R)}function Tt(_,R){if(_==="input"||_==="change")return M(R)}function Zt(_,R){return _===R&&(_!==0||1/_===1/R)||_!==_&&R!==R}var sn=typeof Object.is=="function"?Object.is:Zt;function $n(_,R){if(sn(_,R))return!0;if(typeof _!="object"||_===null||typeof R!="object"||R===null)return!1;var ne=Object.keys(_),ye=Object.keys(R);if(ne.length!==ye.length)return!1;for(ye=0;ye<ne.length;ye++){var Ue=ne[ye];if(!c.call(R,Ue)||!sn(_[Ue],R[Ue]))return!1}return!0}function Cr(_){for(;_&&_.firstChild;)_=_.firstChild;return _}function kr(_,R){var ne=Cr(_);_=0;for(var ye;ne;){if(ne.nodeType===3){if(ye=_+ne.textContent.length,_<=R&&ye>=R)return{node:ne,offset:R-_};_=ye}e:{for(;ne;){if(ne.nextSibling){ne=ne.nextSibling;break e}ne=ne.parentNode}ne=void 0}ne=Cr(ne)}}function Pr(_,R){return _&&R?_===R?!0:_&&_.nodeType===3?!1:R&&R.nodeType===3?Pr(_,R.parentNode):"contains"in _?_.contains(R):_.compareDocumentPosition?!!(_.compareDocumentPosition(R)&16):!1:!1}function Is(){for(var _=window,R=dt();R instanceof _.HTMLIFrameElement;){try{var ne=typeof R.contentWindow.location.href=="string"}catch{ne=!1}if(ne)_=R.contentWindow;else break;R=dt(_.document)}return R}function ni(_){var R=_&&_.nodeName&&_.nodeName.toLowerCase();return R&&(R==="input"&&(_.type==="text"||_.type==="search"||_.type==="tel"||_.type==="url"||_.type==="password")||R==="textarea"||_.contentEditable==="true")}function xc(_){var R=Is(),ne=_.focusedElem,ye=_.selectionRange;if(R!==ne&&ne&&ne.ownerDocument&&Pr(ne.ownerDocument.documentElement,ne)){if(ye!==null&&ni(ne)){if(R=ye.start,_=ye.end,_===void 0&&(_=R),"selectionStart"in ne)ne.selectionStart=R,ne.selectionEnd=Math.min(_,ne.value.length);else if(_=(R=ne.ownerDocument||document)&&R.defaultView||window,_.getSelection){_=_.getSelection();var Ue=ne.textContent.length,et=Math.min(ye.start,Ue);ye=ye.end===void 0?et:Math.min(ye.end,Ue),!_.extend&&et>ye&&(Ue=ye,ye=et,et=Ue),Ue=kr(ne,et);var Mt=kr(ne,ye);Ue&&Mt&&(_.rangeCount!==1||_.anchorNode!==Ue.node||_.anchorOffset!==Ue.offset||_.focusNode!==Mt.node||_.focusOffset!==Mt.offset)&&(R=R.createRange(),R.setStart(Ue.node,Ue.offset),_.removeAllRanges(),et>ye?(_.addRange(R),_.extend(Mt.node,Mt.offset)):(R.setEnd(Mt.node,Mt.offset),_.addRange(R)))}}for(R=[],_=ne;_=_.parentNode;)_.nodeType===1&&R.push({element:_,left:_.scrollLeft,top:_.scrollTop});for(typeof ne.focus=="function"&&ne.focus(),ne=0;ne<R.length;ne++)_=R[ne],_.element.scrollLeft=_.left,_.element.scrollTop=_.top}}var ao=l&&"documentMode"in document&&11>=document.documentMode,oo=null,ga=null,Ia=null,Qo=!1;function kd(_,R,ne){var ye=ne.window===ne?ne.document:ne.nodeType===9?ne:ne.ownerDocument;Qo||oo==null||oo!==dt(ye)||(ye=oo,"selectionStart"in ye&&ni(ye)?ye={start:ye.selectionStart,end:ye.selectionEnd}:(ye=(ye.ownerDocument&&ye.ownerDocument.defaultView||window).getSelection(),ye={anchorNode:ye.anchorNode,anchorOffset:ye.anchorOffset,focusNode:ye.focusNode,focusOffset:ye.focusOffset}),Ia&&$n(Ia,ye)||(Ia=ye,ye=i6(ga,"onSelect"),0<ye.length&&(R=new ut("onSelect","select",null,R,ne),_.push({event:R,listeners:ye}),R.target=oo)))}function Mi(_,R){var ne={};return ne[_.toLowerCase()]=R.toLowerCase(),ne["Webkit"+_]="webkit"+R,ne["Moz"+_]="moz"+R,ne}var Rm={animationend:Mi("Animation","AnimationEnd"),animationiteration:Mi("Animation","AnimationIteration"),animationstart:Mi("Animation","AnimationStart"),transitionend:Mi("Transition","TransitionEnd")},G1={},q2={};l&&(q2=document.createElement("div").style,"AnimationEvent"in window||(delete Rm.animationend.animation,delete Rm.animationiteration.animation,delete Rm.animationstart.animation),"TransitionEvent"in window||delete Rm.transitionend.transition);function e6(_){if(G1[_])return G1[_];if(!Rm[_])return _;var R=Rm[_],ne;for(ne in R)if(R.hasOwnProperty(ne)&&ne in q2)return G1[_]=R[ne];return _}var wP=e6("animationend"),CP=e6("animationiteration"),G2=e6("animationstart"),Sp=e6("transitionend"),K2=new Map,G8="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(_,R){K2.set(_,R),a(R,[_])}for(var t6=0;t6<G8.length;t6++){var n6=G8[t6],r6=n6.toLowerCase(),NP=n6[0].toUpperCase()+n6.slice(1);Sf(r6,"on"+NP)}Sf(wP,"onAnimationEnd"),Sf(CP,"onAnimationIteration"),Sf(G2,"onAnimationStart"),Sf("dblclick","onDoubleClick"),Sf("focusin","onFocus"),Sf("focusout","onBlur"),Sf(Sp,"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 jp="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(" "),jx=new Set("cancel close invalid load scroll toggle".split(" ").concat(jp));function Y2(_,R,ne){var ye=_.type||"unknown-event";_.currentTarget=ne,mt(ye,R,void 0,_),_.currentTarget=null}function SP(_,R){R=(R&4)!==0;for(var ne=0;ne<_.length;ne++){var ye=_[ne],Ue=ye.event;ye=ye.listeners;e:{var et=void 0;if(R)for(var Mt=ye.length-1;0<=Mt;Mt--){var _n=ye[Mt],Un=_n.instance,xr=_n.currentTarget;if(_n=_n.listener,Un!==et&&Ue.isPropagationStopped())break e;Y2(Ue,_n,xr),et=Un}else for(Mt=0;Mt<ye.length;Mt++){if(_n=ye[Mt],Un=_n.instance,xr=_n.currentTarget,_n=_n.listener,Un!==et&&Ue.isPropagationStopped())break e;Y2(Ue,_n,xr),et=Un}}}if(_e)throw _=Be,_e=!1,Be=null,_}function Qa(_,R){var ne=R[l6];ne===void 0&&(ne=R[l6]=new Set);var ye=_+"__bubble";ne.has(ye)||(s6(R,_,2,!1),ne.add(ye))}function K8(_,R,ne){var ye=0;R&&(ye|=4),s6(ne,_,ye,R)}var Ax="_reactListening"+Math.random().toString(36).slice(2);function Dm(_){if(!_[Ax]){_[Ax]=!0,r.forEach(function(ne){ne!=="selectionchange"&&(jx.has(ne)||K8(ne,!1,_),K8(ne,!0,_))});var R=_.nodeType===9?_:_.ownerDocument;R===null||R[Ax]||(R[Ax]=!0,K8("selectionchange",!1,R))}}function s6(_,R,ne,ye){switch(Yr(R)){case 1:var Ue=_r;break;case 4:Ue=jr;break;default:Ue=Fr}ne=Ue.bind(null,R,ne,_),Ue=void 0,!tr||R!=="touchstart"&&R!=="touchmove"&&R!=="wheel"||(Ue=!0),ye?Ue!==void 0?_.addEventListener(R,ne,{capture:!0,passive:Ue}):_.addEventListener(R,ne,!0):Ue!==void 0?_.addEventListener(R,ne,{passive:Ue}):_.addEventListener(R,ne,!1)}function Y8(_,R,ne,ye,Ue){var et=ye;if(!(R&1)&&!(R&2)&&ye!==null)e:for(;;){if(ye===null)return;var Mt=ye.tag;if(Mt===3||Mt===4){var _n=ye.stateNode.containerInfo;if(_n===Ue||_n.nodeType===8&&_n.parentNode===Ue)break;if(Mt===4)for(Mt=ye.return;Mt!==null;){var Un=Mt.tag;if((Un===3||Un===4)&&(Un=Mt.stateNode.containerInfo,Un===Ue||Un.nodeType===8&&Un.parentNode===Ue))return;Mt=Mt.return}for(;_n!==null;){if(Mt=dh(_n),Mt===null)return;if(Un=Mt.tag,Un===5||Un===6){ye=et=Mt;continue e}_n=_n.parentNode}}ye=ye.return}Zn(function(){var xr=et,Kr=Nt(ne),Jr=[];e:{var Wr=K2.get(_);if(Wr!==void 0){var Ss=ut,Fs=_;switch(_){case"keypress":if(At(ne)===0)break e;case"keydown":case"keyup":Ss=ss;break;case"focusin":Fs="focus",Ss=ar;break;case"focusout":Fs="blur",Ss=ar;break;case"beforeblur":case"afterblur":Ss=ar;break;case"click":if(ne.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ss=Zr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ss=wr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ss=er;break;case wP:case CP:case G2:Ss=Ur;break;case Sp:Ss=xs;break;case"scroll":Ss=bn;break;case"wheel":Ss=hs;break;case"copy":case"cut":case"paste":Ss=Sr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ss=Bt}var Bs=(R&4)!==0,Io=!Bs&&_==="scroll",cr=Bs?Wr!==null?Wr+"Capture":null:Wr;Bs=[];for(var Kn=xr,fr;Kn!==null;){fr=Kn;var is=fr.stateNode;if(fr.tag===5&&is!==null&&(fr=is,cr!==null&&(is=Vn(Kn,cr),is!=null&&Bs.push(K1(Kn,is,fr)))),Io)break;Kn=Kn.return}0<Bs.length&&(Wr=new Ss(Wr,Fs,null,ne,Kr),Jr.push({event:Wr,listeners:Bs}))}}if(!(R&7)){e:{if(Wr=_==="mouseover"||_==="pointerover",Ss=_==="mouseout"||_==="pointerout",Wr&&ne!==ct&&(Fs=ne.relatedTarget||ne.fromElement)&&(dh(Fs)||Fs[Gu]))break e;if((Ss||Wr)&&(Wr=Kr.window===Kr?Kr:(Wr=Kr.ownerDocument)?Wr.defaultView||Wr.parentWindow:window,Ss?(Fs=ne.relatedTarget||ne.toElement,Ss=xr,Fs=Fs?dh(Fs):null,Fs!==null&&(Io=Ft(Fs),Fs!==Io||Fs.tag!==5&&Fs.tag!==6)&&(Fs=null)):(Ss=null,Fs=xr),Ss!==Fs)){if(Bs=Zr,is="onMouseLeave",cr="onMouseEnter",Kn="mouse",(_==="pointerout"||_==="pointerover")&&(Bs=Bt,is="onPointerLeave",cr="onPointerEnter",Kn="pointer"),Io=Ss==null?Wr:_i(Ss),fr=Fs==null?Wr:_i(Fs),Wr=new Bs(is,Kn+"leave",Ss,ne,Kr),Wr.target=Io,Wr.relatedTarget=fr,is=null,dh(Kr)===xr&&(Bs=new Bs(cr,Kn+"enter",Fs,ne,Kr),Bs.target=fr,Bs.relatedTarget=Io,is=Bs),Io=is,Ss&&Fs)t:{for(Bs=Ss,cr=Fs,Kn=0,fr=Bs;fr;fr=Y1(fr))Kn++;for(fr=0,is=cr;is;is=Y1(is))fr++;for(;0<Kn-fr;)Bs=Y1(Bs),Kn--;for(;0<fr-Kn;)cr=Y1(cr),fr--;for(;Kn--;){if(Bs===cr||cr!==null&&Bs===cr.alternate)break t;Bs=Y1(Bs),cr=Y1(cr)}Bs=null}else Bs=null;Ss!==null&&Zo(Jr,Wr,Ss,Bs,!1),Fs!==null&&Io!==null&&Zo(Jr,Io,Fs,Bs,!0)}}e:{if(Wr=xr?_i(xr):window,Ss=Wr.nodeName&&Wr.nodeName.toLowerCase(),Ss==="select"||Ss==="input"&&Wr.type==="file")var $s=z;else if(Ci(Wr))if(W)$s=Tt;else{$s=zt;var Ys=_t}else(Ss=Wr.nodeName)&&Ss.toLowerCase()==="input"&&(Wr.type==="checkbox"||Wr.type==="radio")&&($s=gn);if($s&&($s=$s(_,xr))){Ed(Jr,$s,ne,Kr);break e}Ys&&Ys(_,Wr,xr),_==="focusout"&&(Ys=Wr._wrapperState)&&Ys.controlled&&Wr.type==="number"&&yt(Wr,"number",Wr.value)}switch(Ys=xr?_i(xr):window,_){case"focusin":(Ci(Ys)||Ys.contentEditable==="true")&&(oo=Ys,ga=xr,Ia=null);break;case"focusout":Ia=ga=oo=null;break;case"mousedown":Qo=!0;break;case"contextmenu":case"mouseup":case"dragend":Qo=!1,kd(Jr,ne,Kr);break;case"selectionchange":if(ao)break;case"keydown":case"keyup":kd(Jr,ne,Kr)}var Xs;if(vi)e:{switch(_){case"compositionstart":var ti="onCompositionStart";break e;case"compositionend":ti="onCompositionEnd";break e;case"compositionupdate":ti="onCompositionUpdate";break e}ti=void 0}else Sa?Pa(_,ne)&&(ti="onCompositionEnd"):_==="keydown"&&ne.keyCode===229&&(ti="onCompositionStart");ti&&(Ts&&ne.locale!=="ko"&&(Sa||ti!=="onCompositionStart"?ti==="onCompositionEnd"&&Sa&&(Xs=ms()):(dr=Kr,rs="value"in dr?dr.value:dr.textContent,Sa=!0)),Ys=i6(xr,ti),0<Ys.length&&(ti=new Ln(ti,_,null,ne,Kr),Jr.push({event:ti,listeners:Ys}),Xs?ti.data=Xs:(Xs=Wu(ne),Xs!==null&&(ti.data=Xs)))),(Xs=As?Xo(_,ne):qu(_,ne))&&(xr=i6(xr,"onBeforeInput"),0<xr.length&&(Kr=new Ln("onBeforeInput","beforeinput",null,ne,Kr),Jr.push({event:Kr,listeners:xr}),Kr.data=Xs))}SP(Jr,R)})}function K1(_,R,ne){return{instance:_,listener:R,currentTarget:ne}}function i6(_,R){for(var ne=R+"Capture",ye=[];_!==null;){var Ue=_,et=Ue.stateNode;Ue.tag===5&&et!==null&&(Ue=et,et=Vn(_,ne),et!=null&&ye.unshift(K1(_,et,Ue)),et=Vn(_,R),et!=null&&ye.push(K1(_,et,Ue))),_=_.return}return ye}function Y1(_){if(_===null)return null;do _=_.return;while(_&&_.tag!==5);return _||null}function Zo(_,R,ne,ye,Ue){for(var et=R._reactName,Mt=[];ne!==null&&ne!==ye;){var _n=ne,Un=_n.alternate,xr=_n.stateNode;if(Un!==null&&Un===ye)break;_n.tag===5&&xr!==null&&(_n=xr,Ue?(Un=Vn(ne,et),Un!=null&&Mt.unshift(K1(ne,Un,_n))):Ue||(Un=Vn(ne,et),Un!=null&&Mt.push(K1(ne,Un,_n)))),ne=ne.return}Mt.length!==0&&_.push({event:R,listeners:Mt})}var gc=/\r\n?/g,Yz=/\u0000|\uFFFD/g;function jP(_){return(typeof _=="string"?_:""+_).replace(gc,`
`).replace(Yz,"")}function X2(_,R,ne){if(R=jP(R),jP(_)!==R&&ne)throw Error(n(425))}function a6(){}var Q2=null,_x=null;function Z2(_,R){return _==="textarea"||_==="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,J2=typeof clearTimeout=="function"?clearTimeout:void 0,X1=typeof Promise=="function"?Promise:void 0,o6=typeof queueMicrotask=="function"?queueMicrotask:typeof X1<"u"?function(_){return X1.resolve(null).then(_).catch(Q1)}:Bm;function Q1(_){setTimeout(function(){throw _})}function X8(_,R){var ne=R,ye=0;do{var Ue=ne.nextSibling;if(_.removeChild(ne),Ue&&Ue.nodeType===8)if(ne=Ue.data,ne==="/$"){if(ye===0){_.removeChild(Ue),Ct(R);return}ye--}else ne!=="$"&&ne!=="$?"&&ne!=="$!"||ye++;ne=Ue}while(ne);Ct(R)}function $m(_){for(;_!=null;_=_.nextSibling){var R=_.nodeType;if(R===1||R===3)break;if(R===8){if(R=_.data,R==="$"||R==="$!"||R==="$?")break;if(R==="/$")return null}}return _}function AP(_){_=_.previousSibling;for(var R=0;_;){if(_.nodeType===8){var ne=_.data;if(ne==="$"||ne==="$!"||ne==="$?"){if(R===0)return _;R--}else ne==="/$"&&R++}_=_.previousSibling}return null}var Z1=Math.random().toString(36).slice(2),uh="__reactFiber$"+Z1,Um="__reactProps$"+Z1,Gu="__reactContainer$"+Z1,l6="__reactEvents$"+Z1,Xt="__reactListeners$"+Z1,J1="__reactHandles$"+Z1;function dh(_){var R=_[uh];if(R)return R;for(var ne=_.parentNode;ne;){if(R=ne[Gu]||ne[uh]){if(ne=R.alternate,R.child!==null||ne!==null&&ne.child!==null)for(_=AP(_);_!==null;){if(ne=_[uh])return ne;_=AP(_)}return R}_=ne,ne=_.parentNode}return null}function bc(_){return _=_[uh]||_[Gu],!_||_.tag!==5&&_.tag!==6&&_.tag!==13&&_.tag!==3?null:_}function _i(_){if(_.tag===5||_.tag===6)return _.stateNode;throw Error(n(33))}function c6(_){return _[Um]||null}var Q8=[],eb=-1;function hu(_){return{current:_}}function Za(_){0>eb||(_.current=Q8[eb],Q8[eb]=null,eb--)}function Wa(_,R){eb++,Q8[eb]=_.current,_.current=R}var zm={},yc=hu(zm),pu=hu(!1),Vc=zm;function tb(_,R){var ne=_.type.contextTypes;if(!ne)return zm;var ye=_.stateNode;if(ye&&ye.__reactInternalMemoizedUnmaskedChildContext===R)return ye.__reactInternalMemoizedMaskedChildContext;var Ue={},et;for(et in ne)Ue[et]=R[et];return ye&&(_=_.stateNode,_.__reactInternalMemoizedUnmaskedChildContext=R,_.__reactInternalMemoizedMaskedChildContext=Ue),Ue}function mu(_){return _=_.childContextTypes,_!=null}function u6(){Za(pu),Za(yc)}function _P(_,R,ne){if(yc.current!==zm)throw Error(n(168));Wa(yc,R),Wa(pu,ne)}function EP(_,R,ne){var ye=_.stateNode;if(R=R.childContextTypes,typeof ye.getChildContext!="function")return ne;ye=ye.getChildContext();for(var Ue in ye)if(!(Ue in R))throw Error(n(108,we(_)||"Unknown",Ue));return ee({},ne,ye)}function Td(_){return _=(_=_.stateNode)&&_.__reactInternalMemoizedMergedChildContext||zm,Vc=yc.current,Wa(yc,_),Wa(pu,pu.current),!0}function kP(_,R,ne){var ye=_.stateNode;if(!ye)throw Error(n(169));ne?(_=EP(_,R,Vc),ye.__reactInternalMemoizedMergedChildContext=_,Za(pu),Za(yc),Wa(yc,_)):Za(pu),Wa(pu,ne)}var Ap=null,d6=!1,Z8=!1;function TP(_){Ap===null?Ap=[_]:Ap.push(_)}function Ex(_){d6=!0,TP(_)}function Hm(){if(!Z8&&Ap!==null){Z8=!0;var _=0,R=wt;try{var ne=Ap;for(wt=1;_<ne.length;_++){var ye=ne[_];do ye=ye(!0);while(ye!==null)}Ap=null,d6=!1}catch(Ue){throw Ap!==null&&(Ap=Ap.slice(_+1)),Wt(p,Hm),Ue}finally{wt=R,Z8=!1}}return null}var nb=[],vc=0,f6=null,h6=0,Pd=[],Id=0,kx=null,fh=1,hh="";function Tx(_,R){nb[vc++]=h6,nb[vc++]=f6,f6=_,h6=R}function PP(_,R,ne){Pd[Id++]=fh,Pd[Id++]=hh,Pd[Id++]=kx,kx=_;var ye=fh;_=hh;var Ue=32-ce(ye)-1;ye&=~(1<<Ue),ne+=1;var et=32-ce(R)+Ue;if(30<et){var Mt=Ue-Ue%5;et=(ye&(1<<Mt)-1).toString(32),ye>>=Mt,Ue-=Mt,fh=1<<32-ce(R)+Ue|ne<<Ue|ye,hh=et+_}else fh=1<<et|ne<<Ue|ye,hh=_}function ev(_){_.return!==null&&(Tx(_,1),PP(_,1,0))}function Px(_){for(;_===f6;)f6=nb[--vc],nb[vc]=null,h6=nb[--vc],nb[vc]=null;for(;_===kx;)kx=Pd[--Id],Pd[Id]=null,hh=Pd[--Id],Pd[Id]=null,fh=Pd[--Id],Pd[Id]=null}var wc=null,Ku=null,Ja=!1,jf=null;function ph(_,R){var ne=Bd(5,null,null,0);ne.elementType="DELETED",ne.stateNode=R,ne.return=_,R=_.deletions,R===null?(_.deletions=[ne],_.flags|=16):R.push(ne)}function p6(_,R){switch(_.tag){case 5:var ne=_.type;return R=R.nodeType!==1||ne.toLowerCase()!==R.nodeName.toLowerCase()?null:R,R!==null?(_.stateNode=R,wc=_,Ku=$m(R.firstChild),!0):!1;case 6:return R=_.pendingProps===""||R.nodeType!==3?null:R,R!==null?(_.stateNode=R,wc=_,Ku=null,!0):!1;case 13:return R=R.nodeType!==8?null:R,R!==null?(ne=kx!==null?{id:fh,overflow:hh}:null,_.memoizedState={dehydrated:R,treeContext:ne,retryLane:1073741824},ne=Bd(18,null,null,0),ne.stateNode=R,ne.return=_,_.child=ne,wc=_,Ku=null,!0):!1;default:return!1}}function _p(_){return(_.mode&1)!==0&&(_.flags&128)===0}function xu(_){if(Ja){var R=Ku;if(R){var ne=R;if(!p6(_,R)){if(_p(_))throw Error(n(418));R=$m(ne.nextSibling);var ye=wc;R&&p6(_,R)?ph(ye,ne):(_.flags=_.flags&-4097|2,Ja=!1,wc=_)}}else{if(_p(_))throw Error(n(418));_.flags=_.flags&-4097|2,Ja=!1,wc=_}}}function IP(_){for(_=_.return;_!==null&&_.tag!==5&&_.tag!==3&&_.tag!==13;)_=_.return;wc=_}function tv(_){if(_!==wc)return!1;if(!Ja)return IP(_),Ja=!0,!1;var R;if((R=_.tag!==3)&&!(R=_.tag!==5)&&(R=_.type,R=R!=="head"&&R!=="body"&&!Z2(_.type,_.memoizedProps)),R&&(R=Ku)){if(_p(_))throw J8(),Error(n(418));for(;R;)ph(_,R),R=$m(R.nextSibling)}if(IP(_),_.tag===13){if(_=_.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));e:{for(_=_.nextSibling,R=0;_;){if(_.nodeType===8){var ne=_.data;if(ne==="/$"){if(R===0){Ku=$m(_.nextSibling);break e}R--}else ne!=="$"&&ne!=="$!"&&ne!=="$?"||R++}_=_.nextSibling}Ku=null}}else Ku=wc?$m(_.stateNode.nextSibling):null;return!0}function J8(){for(var _=Ku;_;)_=$m(_.nextSibling)}function mh(){Ku=wc=null,Ja=!1}function xh(_){jf===null?jf=[_]:jf.push(_)}var FP=L.ReactCurrentBatchConfig;function nv(_,R,ne){if(_=ne.ref,_!==null&&typeof _!="function"&&typeof _!="object"){if(ne._owner){if(ne=ne._owner,ne){if(ne.tag!==1)throw Error(n(309));var ye=ne.stateNode}if(!ye)throw Error(n(147,_));var Ue=ye,et=""+_;return R!==null&&R.ref!==null&&typeof R.ref=="function"&&R.ref._stringRef===et?R.ref:(R=function(Mt){var _n=Ue.refs;Mt===null?delete _n[et]:_n[et]=Mt},R._stringRef=et,R)}if(typeof _!="string")throw Error(n(284));if(!ne._owner)throw Error(n(290,_))}return _}function Ix(_,R){throw _=Object.prototype.toString.call(R),Error(n(31,_==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":_))}function OP(_){var R=_._init;return R(_._payload)}function eA(_){function R(cr,Kn){if(_){var fr=cr.deletions;fr===null?(cr.deletions=[Kn],cr.flags|=16):fr.push(Kn)}}function ne(cr,Kn){if(!_)return null;for(;Kn!==null;)R(cr,Kn),Kn=Kn.sibling;return null}function ye(cr,Kn){for(cr=new Map;Kn!==null;)Kn.key!==null?cr.set(Kn.key,Kn):cr.set(Kn.index,Kn),Kn=Kn.sibling;return cr}function Ue(cr,Kn){return cr=If(cr,Kn),cr.index=0,cr.sibling=null,cr}function et(cr,Kn,fr){return cr.index=fr,_?(fr=cr.alternate,fr!==null?(fr=fr.index,fr<Kn?(cr.flags|=2,Kn):fr):(cr.flags|=2,Kn)):(cr.flags|=1048576,Kn)}function Mt(cr){return _&&cr.alternate===null&&(cr.flags|=2),cr}function _n(cr,Kn,fr,is){return Kn===null||Kn.tag!==6?(Kn=$A(fr,cr.mode,is),Kn.return=cr,Kn):(Kn=Ue(Kn,fr),Kn.return=cr,Kn)}function Un(cr,Kn,fr,is){var $s=fr.type;return $s===O?Kr(cr,Kn,fr.props.children,is,fr.key):Kn!==null&&(Kn.elementType===$s||typeof $s=="object"&&$s!==null&&$s.$$typeof===ie&&OP($s)===Kn.type)?(is=Ue(Kn,fr.props),is.ref=nv(cr,Kn,fr),is.return=cr,is):(is=Y6(fr.type,fr.key,fr.props,null,cr.mode,is),is.ref=nv(cr,Kn,fr),is.return=cr,is)}function xr(cr,Kn,fr,is){return Kn===null||Kn.tag!==4||Kn.stateNode.containerInfo!==fr.containerInfo||Kn.stateNode.implementation!==fr.implementation?(Kn=UA(fr,cr.mode,is),Kn.return=cr,Kn):(Kn=Ue(Kn,fr.children||[]),Kn.return=cr,Kn)}function Kr(cr,Kn,fr,is,$s){return Kn===null||Kn.tag!==7?(Kn=Hx(fr,cr.mode,is,$s),Kn.return=cr,Kn):(Kn=Ue(Kn,fr),Kn.return=cr,Kn)}function Jr(cr,Kn,fr){if(typeof Kn=="string"&&Kn!==""||typeof Kn=="number")return Kn=$A(""+Kn,cr.mode,fr),Kn.return=cr,Kn;if(typeof Kn=="object"&&Kn!==null){switch(Kn.$$typeof){case F:return fr=Y6(Kn.type,Kn.key,Kn.props,null,cr.mode,fr),fr.ref=nv(cr,null,Kn),fr.return=cr,fr;case $:return Kn=UA(Kn,cr.mode,fr),Kn.return=cr,Kn;case ie:var is=Kn._init;return Jr(cr,is(Kn._payload),fr)}if(Kt(Kn)||H(Kn))return Kn=Hx(Kn,cr.mode,fr,null),Kn.return=cr,Kn;Ix(cr,Kn)}return null}function Wr(cr,Kn,fr,is){var $s=Kn!==null?Kn.key:null;if(typeof fr=="string"&&fr!==""||typeof fr=="number")return $s!==null?null:_n(cr,Kn,""+fr,is);if(typeof fr=="object"&&fr!==null){switch(fr.$$typeof){case F:return fr.key===$s?Un(cr,Kn,fr,is):null;case $:return fr.key===$s?xr(cr,Kn,fr,is):null;case ie:return $s=fr._init,Wr(cr,Kn,$s(fr._payload),is)}if(Kt(fr)||H(fr))return $s!==null?null:Kr(cr,Kn,fr,is,null);Ix(cr,fr)}return null}function Ss(cr,Kn,fr,is,$s){if(typeof is=="string"&&is!==""||typeof is=="number")return cr=cr.get(fr)||null,_n(Kn,cr,""+is,$s);if(typeof is=="object"&&is!==null){switch(is.$$typeof){case F:return cr=cr.get(is.key===null?fr:is.key)||null,Un(Kn,cr,is,$s);case $:return cr=cr.get(is.key===null?fr:is.key)||null,xr(Kn,cr,is,$s);case ie:var Ys=is._init;return Ss(cr,Kn,fr,Ys(is._payload),$s)}if(Kt(is)||H(is))return cr=cr.get(fr)||null,Kr(Kn,cr,is,$s,null);Ix(Kn,is)}return null}function Fs(cr,Kn,fr,is){for(var $s=null,Ys=null,Xs=Kn,ti=Kn=0,gl=null;Xs!==null&&ti<fr.length;ti++){Xs.index>ti?(gl=Xs,Xs=null):gl=Xs.sibling;var pa=Wr(cr,Xs,fr[ti],is);if(pa===null){Xs===null&&(Xs=gl);break}_&&Xs&&pa.alternate===null&&R(cr,Xs),Kn=et(pa,Kn,ti),Ys===null?$s=pa:Ys.sibling=pa,Ys=pa,Xs=gl}if(ti===fr.length)return ne(cr,Xs),Ja&&Tx(cr,ti),$s;if(Xs===null){for(;ti<fr.length;ti++)Xs=Jr(cr,fr[ti],is),Xs!==null&&(Kn=et(Xs,Kn,ti),Ys===null?$s=Xs:Ys.sibling=Xs,Ys=Xs);return Ja&&Tx(cr,ti),$s}for(Xs=ye(cr,Xs);ti<fr.length;ti++)gl=Ss(Xs,cr,ti,fr[ti],is),gl!==null&&(_&&gl.alternate!==null&&Xs.delete(gl.key===null?ti:gl.key),Kn=et(gl,Kn,ti),Ys===null?$s=gl:Ys.sibling=gl,Ys=gl);return _&&Xs.forEach(function(t0){return R(cr,t0)}),Ja&&Tx(cr,ti),$s}function Bs(cr,Kn,fr,is){var $s=H(fr);if(typeof $s!="function")throw Error(n(150));if(fr=$s.call(fr),fr==null)throw Error(n(151));for(var Ys=$s=null,Xs=Kn,ti=Kn=0,gl=null,pa=fr.next();Xs!==null&&!pa.done;ti++,pa=fr.next()){Xs.index>ti?(gl=Xs,Xs=null):gl=Xs.sibling;var t0=Wr(cr,Xs,pa.value,is);if(t0===null){Xs===null&&(Xs=gl);break}_&&Xs&&t0.alternate===null&&R(cr,Xs),Kn=et(t0,Kn,ti),Ys===null?$s=t0:Ys.sibling=t0,Ys=t0,Xs=gl}if(pa.done)return ne(cr,Xs),Ja&&Tx(cr,ti),$s;if(Xs===null){for(;!pa.done;ti++,pa=fr.next())pa=Jr(cr,pa.value,is),pa!==null&&(Kn=et(pa,Kn,ti),Ys===null?$s=pa:Ys.sibling=pa,Ys=pa);return Ja&&Tx(cr,ti),$s}for(Xs=ye(cr,Xs);!pa.done;ti++,pa=fr.next())pa=Ss(Xs,cr,ti,pa.value,is),pa!==null&&(_&&pa.alternate!==null&&Xs.delete(pa.key===null?ti:pa.key),Kn=et(pa,Kn,ti),Ys===null?$s=pa:Ys.sibling=pa,Ys=pa);return _&&Xs.forEach(function(pH){return R(cr,pH)}),Ja&&Tx(cr,ti),$s}function Io(cr,Kn,fr,is){if(typeof fr=="object"&&fr!==null&&fr.type===O&&fr.key===null&&(fr=fr.props.children),typeof fr=="object"&&fr!==null){switch(fr.$$typeof){case F:e:{for(var $s=fr.key,Ys=Kn;Ys!==null;){if(Ys.key===$s){if($s=fr.type,$s===O){if(Ys.tag===7){ne(cr,Ys.sibling),Kn=Ue(Ys,fr.props.children),Kn.return=cr,cr=Kn;break e}}else if(Ys.elementType===$s||typeof $s=="object"&&$s!==null&&$s.$$typeof===ie&&OP($s)===Ys.type){ne(cr,Ys.sibling),Kn=Ue(Ys,fr.props),Kn.ref=nv(cr,Ys,fr),Kn.return=cr,cr=Kn;break e}ne(cr,Ys);break}else R(cr,Ys);Ys=Ys.sibling}fr.type===O?(Kn=Hx(fr.props.children,cr.mode,is,fr.key),Kn.return=cr,cr=Kn):(is=Y6(fr.type,fr.key,fr.props,null,cr.mode,is),is.ref=nv(cr,Kn,fr),is.return=cr,cr=is)}return Mt(cr);case $:e:{for(Ys=fr.key;Kn!==null;){if(Kn.key===Ys)if(Kn.tag===4&&Kn.stateNode.containerInfo===fr.containerInfo&&Kn.stateNode.implementation===fr.implementation){ne(cr,Kn.sibling),Kn=Ue(Kn,fr.children||[]),Kn.return=cr,cr=Kn;break e}else{ne(cr,Kn);break}else R(cr,Kn);Kn=Kn.sibling}Kn=UA(fr,cr.mode,is),Kn.return=cr,cr=Kn}return Mt(cr);case ie:return Ys=fr._init,Io(cr,Kn,Ys(fr._payload),is)}if(Kt(fr))return Fs(cr,Kn,fr,is);if(H(fr))return Bs(cr,Kn,fr,is);Ix(cr,fr)}return typeof fr=="string"&&fr!==""||typeof fr=="number"?(fr=""+fr,Kn!==null&&Kn.tag===6?(ne(cr,Kn.sibling),Kn=Ue(Kn,fr),Kn.return=cr,cr=Kn):(ne(cr,Kn),Kn=$A(fr,cr.mode,is),Kn.return=cr,cr=Kn),Mt(cr)):ne(cr,Kn)}return Io}var Po=eA(!0),m6=eA(!1),rv=hu(null),Yu=null,Vm=null,rb=null;function Ep(){rb=Vm=Yu=null}function x6(_){var R=rv.current;Za(rv),_._currentValue=R}function Zl(_,R,ne){for(;_!==null;){var ye=_.alternate;if((_.childLanes&R)!==R?(_.childLanes|=R,ye!==null&&(ye.childLanes|=R)):ye!==null&&(ye.childLanes&R)!==R&&(ye.childLanes|=R),_===ne)break;_=_.return}}function Wm(_,R){Yu=_,rb=Vm=null,_=_.dependencies,_!==null&&_.firstContext!==null&&(_.lanes&R&&(qc=!0),_.firstContext=null)}function Fd(_){var R=_._currentValue;if(rb!==_)if(_={context:_,memoizedValue:R,next:null},Vm===null){if(Yu===null)throw Error(n(308));Vm=_,Yu.dependencies={lanes:0,firstContext:_}}else Vm=Vm.next=_;return R}var Fx=null;function tA(_){Fx===null?Fx=[_]:Fx.push(_)}function g6(_,R,ne,ye){var Ue=R.interleaved;return Ue===null?(ne.next=ne,tA(R)):(ne.next=Ue.next,Ue.next=ne),R.interleaved=ne,kp(_,ye)}function kp(_,R){_.lanes|=R;var ne=_.alternate;for(ne!==null&&(ne.lanes|=R),ne=_,_=_.return;_!==null;)_.childLanes|=R,ne=_.alternate,ne!==null&&(ne.childLanes|=R),ne=_,_=_.return;return ne.tag===3?ne.stateNode:null}var Od=!1;function b6(_){_.updateQueue={baseState:_.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function MP(_,R){_=_.updateQueue,R.updateQueue===_&&(R.updateQueue={baseState:_.baseState,firstBaseUpdate:_.firstBaseUpdate,lastBaseUpdate:_.lastBaseUpdate,shared:_.shared,effects:_.effects})}function Tp(_,R){return{eventTime:_,lane:R,tag:0,payload:null,callback:null,next:null}}function Md(_,R,ne){var ye=_.updateQueue;if(ye===null)return null;if(ye=ye.shared,ea&2){var Ue=ye.pending;return Ue===null?R.next=R:(R.next=Ue.next,Ue.next=R),ye.pending=R,kp(_,ne)}return Ue=ye.interleaved,Ue===null?(R.next=R,tA(ye)):(R.next=Ue.next,Ue.next=R),ye.interleaved=R,kp(_,ne)}function y6(_,R,ne){if(R=R.updateQueue,R!==null&&(R=R.shared,(ne&4194240)!==0)){var ye=R.lanes;ye&=_.pendingLanes,ne|=ye,R.lanes=ne,it(_,ne)}}function LP(_,R){var ne=_.updateQueue,ye=_.alternate;if(ye!==null&&(ye=ye.updateQueue,ne===ye)){var Ue=null,et=null;if(ne=ne.firstBaseUpdate,ne!==null){do{var Mt={eventTime:ne.eventTime,lane:ne.lane,tag:ne.tag,payload:ne.payload,callback:ne.callback,next:null};et===null?Ue=et=Mt:et=et.next=Mt,ne=ne.next}while(ne!==null);et===null?Ue=et=R:et=et.next=R}else Ue=et=R;ne={baseState:ye.baseState,firstBaseUpdate:Ue,lastBaseUpdate:et,shared:ye.shared,effects:ye.effects},_.updateQueue=ne;return}_=ne.lastBaseUpdate,_===null?ne.firstBaseUpdate=R:_.next=R,ne.lastBaseUpdate=R}function sb(_,R,ne,ye){var Ue=_.updateQueue;Od=!1;var et=Ue.firstBaseUpdate,Mt=Ue.lastBaseUpdate,_n=Ue.shared.pending;if(_n!==null){Ue.shared.pending=null;var Un=_n,xr=Un.next;Un.next=null,Mt===null?et=xr:Mt.next=xr,Mt=Un;var Kr=_.alternate;Kr!==null&&(Kr=Kr.updateQueue,_n=Kr.lastBaseUpdate,_n!==Mt&&(_n===null?Kr.firstBaseUpdate=xr:_n.next=xr,Kr.lastBaseUpdate=Un))}if(et!==null){var Jr=Ue.baseState;Mt=0,Kr=xr=Un=null,_n=et;do{var Wr=_n.lane,Ss=_n.eventTime;if((ye&Wr)===Wr){Kr!==null&&(Kr=Kr.next={eventTime:Ss,lane:0,tag:_n.tag,payload:_n.payload,callback:_n.callback,next:null});e:{var Fs=_,Bs=_n;switch(Wr=R,Ss=ne,Bs.tag){case 1:if(Fs=Bs.payload,typeof Fs=="function"){Jr=Fs.call(Ss,Jr,Wr);break e}Jr=Fs;break e;case 3:Fs.flags=Fs.flags&-65537|128;case 0:if(Fs=Bs.payload,Wr=typeof Fs=="function"?Fs.call(Ss,Jr,Wr):Fs,Wr==null)break e;Jr=ee({},Jr,Wr);break e;case 2:Od=!0}}_n.callback!==null&&_n.lane!==0&&(_.flags|=64,Wr=Ue.effects,Wr===null?Ue.effects=[_n]:Wr.push(_n))}else Ss={eventTime:Ss,lane:Wr,tag:_n.tag,payload:_n.payload,callback:_n.callback,next:null},Kr===null?(xr=Kr=Ss,Un=Jr):Kr=Kr.next=Ss,Mt|=Wr;if(_n=_n.next,_n===null){if(_n=Ue.shared.pending,_n===null)break;Wr=_n,_n=Wr.next,Wr.next=null,Ue.lastBaseUpdate=Wr,Ue.shared.pending=null}}while(!0);if(Kr===null&&(Un=Jr),Ue.baseState=Un,Ue.firstBaseUpdate=xr,Ue.lastBaseUpdate=Kr,R=Ue.shared.interleaved,R!==null){Ue=R;do Mt|=Ue.lane,Ue=Ue.next;while(Ue!==R)}else et===null&&(Ue.shared.lanes=0);Xm|=Mt,_.lanes=Mt,_.memoizedState=Jr}}function nA(_,R,ne){if(_=R.effects,R.effects=null,_!==null)for(R=0;R<_.length;R++){var ye=_[R],Ue=ye.callback;if(Ue!==null){if(ye.callback=null,ye=ne,typeof Ue!="function")throw Error(n(191,Ue));Ue.call(ye)}}}var sv={},gh=hu(sv),iv=hu(sv),ib=hu(sv);function Pp(_){if(_===sv)throw Error(n(174));return _}function rA(_,R){switch(Wa(ib,R),Wa(iv,_),Wa(gh,sv),_=R.nodeType,_){case 9:case 11:R=(R=R.documentElement)?R.namespaceURI:dn(null,"");break;default:_=_===8?R.parentNode:R,R=_.namespaceURI||null,_=_.tagName,R=dn(R,_)}Za(gh),Wa(gh,R)}function qm(){Za(gh),Za(iv),Za(ib)}function sA(_){Pp(ib.current);var R=Pp(gh.current),ne=dn(R,_.type);R!==ne&&(Wa(iv,_),Wa(gh,ne))}function v6(_){iv.current===_&&(Za(gh),Za(iv))}var lo=hu(0);function Ox(_){for(var R=_;R!==null;){if(R.tag===13){var ne=R.memoizedState;if(ne!==null&&(ne=ne.dehydrated,ne===null||ne.data==="$?"||ne.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===_)break;for(;R.sibling===null;){if(R.return===null||R.return===_)return null;R=R.return}R.sibling.return=R.return,R=R.sibling}return null}var iA=[];function w6(){for(var _=0;_<iA.length;_++)iA[_]._workInProgressVersionPrimary=null;iA.length=0}var av=L.ReactCurrentDispatcher,aA=L.ReactCurrentBatchConfig,Gm=0,Co=null,zo=null,ml=null,ab=!1,ov=!1,Mx=0,Li=0;function Cc(){throw Error(n(321))}function oA(_,R){if(R===null)return!1;for(var ne=0;ne<R.length&&ne<_.length;ne++)if(!sn(_[ne],R[ne]))return!1;return!0}function Lx(_,R,ne,ye,Ue,et){if(Gm=et,Co=R,R.memoizedState=null,R.updateQueue=null,R.lanes=0,av.current=_===null||_.memoizedState===null?Qz:E6,_=ne(ye,Ue),ov){et=0;do{if(ov=!1,Mx=0,25<=et)throw Error(n(301));et+=1,ml=zo=null,R.updateQueue=null,av.current=ub,_=ne(ye,Ue)}while(ov)}if(av.current=_6,R=zo!==null&&zo.next!==null,Gm=0,ml=zo=Co=null,ab=!1,R)throw Error(n(300));return _}function C6(){var _=Mx!==0;return Mx=0,_}function bh(){var _={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ml===null?Co.memoizedState=ml=_:ml=ml.next=_,ml}function Ld(){if(zo===null){var _=Co.alternate;_=_!==null?_.memoizedState:null}else _=zo.next;var R=ml===null?Co.memoizedState:ml.next;if(R!==null)ml=R,zo=_;else{if(_===null)throw Error(n(310));zo=_,_={memoizedState:zo.memoizedState,baseState:zo.baseState,baseQueue:zo.baseQueue,queue:zo.queue,next:null},ml===null?Co.memoizedState=ml=_:ml=ml.next=_}return ml}function Nc(_,R){return typeof R=="function"?R(_):R}function lA(_){var R=Ld(),ne=R.queue;if(ne===null)throw Error(n(311));ne.lastRenderedReducer=_;var ye=zo,Ue=ye.baseQueue,et=ne.pending;if(et!==null){if(Ue!==null){var Mt=Ue.next;Ue.next=et.next,et.next=Mt}ye.baseQueue=Ue=et,ne.pending=null}if(Ue!==null){et=Ue.next,ye=ye.baseState;var _n=Mt=null,Un=null,xr=et;do{var Kr=xr.lane;if((Gm&Kr)===Kr)Un!==null&&(Un=Un.next={lane:0,action:xr.action,hasEagerState:xr.hasEagerState,eagerState:xr.eagerState,next:null}),ye=xr.hasEagerState?xr.eagerState:_(ye,xr.action);else{var Jr={lane:Kr,action:xr.action,hasEagerState:xr.hasEagerState,eagerState:xr.eagerState,next:null};Un===null?(_n=Un=Jr,Mt=ye):Un=Un.next=Jr,Co.lanes|=Kr,Xm|=Kr}xr=xr.next}while(xr!==null&&xr!==et);Un===null?Mt=ye:Un.next=_n,sn(ye,R.memoizedState)||(qc=!0),R.memoizedState=ye,R.baseState=Mt,R.baseQueue=Un,ne.lastRenderedState=ye}if(_=ne.interleaved,_!==null){Ue=_;do et=Ue.lane,Co.lanes|=et,Xm|=et,Ue=Ue.next;while(Ue!==_)}else Ue===null&&(ne.lanes=0);return[R.memoizedState,ne.dispatch]}function ob(_){var R=Ld(),ne=R.queue;if(ne===null)throw Error(n(311));ne.lastRenderedReducer=_;var ye=ne.dispatch,Ue=ne.pending,et=R.memoizedState;if(Ue!==null){ne.pending=null;var Mt=Ue=Ue.next;do et=_(et,Mt.action),Mt=Mt.next;while(Mt!==Ue);sn(et,R.memoizedState)||(qc=!0),R.memoizedState=et,R.baseQueue===null&&(R.baseState=et),ne.lastRenderedState=et}return[et,ye]}function N6(){}function cA(_,R){var ne=Co,ye=Ld(),Ue=R(),et=!sn(ye.memoizedState,Ue);if(et&&(ye.memoizedState=Ue,qc=!0),ye=ye.queue,yh(Ip.bind(null,ne,ye,_),[_]),ye.getSnapshot!==R||et||ml!==null&&ml.memoizedState.tag&1){if(ne.flags|=2048,lb(9,gu.bind(null,ne,ye,Ue,R),void 0,null),Ll===null)throw Error(n(349));Gm&30||uA(ne,R,Ue)}return Ue}function uA(_,R,ne){_.flags|=16384,_={getSnapshot:R,value:ne},R=Co.updateQueue,R===null?(R={lastEffect:null,stores:null},Co.updateQueue=R,R.stores=[_]):(ne=R.stores,ne===null?R.stores=[_]:ne.push(_))}function gu(_,R,ne,ye){R.value=ne,R.getSnapshot=ye,S6(R)&&dA(_)}function Ip(_,R,ne){return ne(function(){S6(R)&&dA(_)})}function S6(_){var R=_.getSnapshot;_=_.value;try{var ne=R();return!sn(_,ne)}catch{return!0}}function dA(_){var R=kp(_,1);R!==null&&Pf(R,_,1,-1)}function lv(_){var R=bh();return typeof _=="function"&&(_=_()),R.memoizedState=R.baseState=_,_={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Nc,lastRenderedState:_},R.queue=_,_=_.dispatch=zP.bind(null,Co,_),[R.memoizedState,_]}function lb(_,R,ne,ye){return _={tag:_,create:R,destroy:ne,deps:ye,next:null},R=Co.updateQueue,R===null?(R={lastEffect:null,stores:null},Co.updateQueue=R,R.lastEffect=_.next=_):(ne=R.lastEffect,ne===null?R.lastEffect=_.next=_:(ye=ne.next,ne.next=_,_.next=ye,R.lastEffect=_)),_}function j6(){return Ld().memoizedState}function cv(_,R,ne,ye){var Ue=bh();Co.flags|=_,Ue.memoizedState=lb(1|R,ne,void 0,ye===void 0?null:ye)}function cb(_,R,ne,ye){var Ue=Ld();ye=ye===void 0?null:ye;var et=void 0;if(zo!==null){var Mt=zo.memoizedState;if(et=Mt.destroy,ye!==null&&oA(ye,Mt.deps)){Ue.memoizedState=lb(R,ne,et,ye);return}}Co.flags|=_,Ue.memoizedState=lb(1|R,ne,et,ye)}function A6(_,R){return cv(8390656,8,_,R)}function yh(_,R){return cb(2048,8,_,R)}function RP(_,R){return cb(4,2,_,R)}function Fp(_,R){return cb(4,4,_,R)}function fA(_,R){if(typeof R=="function")return _=_(),R(_),function(){R(null)};if(R!=null)return _=_(),R.current=_,function(){R.current=null}}function hA(_,R,ne){return ne=ne!=null?ne.concat([_]):null,cb(4,4,fA.bind(null,R,_),ne)}function uv(){}function DP(_,R){var ne=Ld();R=R===void 0?null:R;var ye=ne.memoizedState;return ye!==null&&R!==null&&oA(R,ye[1])?ye[0]:(ne.memoizedState=[_,R],_)}function BP(_,R){var ne=Ld();R=R===void 0?null:R;var ye=ne.memoizedState;return ye!==null&&R!==null&&oA(R,ye[1])?ye[0]:(_=_(),ne.memoizedState=[_,R],_)}function $P(_,R,ne){return Gm&21?(sn(ne,R)||(ne=Pe(),Co.lanes|=ne,Xm|=ne,_.baseState=!0),R):(_.baseState&&(_.baseState=!1,qc=!0),_.memoizedState=ne)}function UP(_,R){var ne=wt;wt=ne!==0&&4>ne?ne:4,_(!0);var ye=aA.transition;aA.transition={};try{_(!1),R()}finally{wt=ne,aA.transition=ye}}function pA(){return Ld().memoizedState}function Xz(_,R,ne){var ye=Jm(_);if(ne={lane:ye,action:ne,hasEagerState:!1,eagerState:null,next:null},mA(_))Wc(R,ne);else if(ne=g6(_,R,ne,ye),ne!==null){var Ue=Yc();Pf(ne,_,ye,Ue),Af(ne,R,ye)}}function zP(_,R,ne){var ye=Jm(_),Ue={lane:ye,action:ne,hasEagerState:!1,eagerState:null,next:null};if(mA(_))Wc(R,Ue);else{var et=_.alternate;if(_.lanes===0&&(et===null||et.lanes===0)&&(et=R.lastRenderedReducer,et!==null))try{var Mt=R.lastRenderedState,_n=et(Mt,ne);if(Ue.hasEagerState=!0,Ue.eagerState=_n,sn(_n,Mt)){var Un=R.interleaved;Un===null?(Ue.next=Ue,tA(R)):(Ue.next=Un.next,Un.next=Ue),R.interleaved=Ue;return}}catch{}finally{}ne=g6(_,R,Ue,ye),ne!==null&&(Ue=Yc(),Pf(ne,_,ye,Ue),Af(ne,R,ye))}}function mA(_){var R=_.alternate;return _===Co||R!==null&&R===Co}function Wc(_,R){ov=ab=!0;var ne=_.pending;ne===null?R.next=R:(R.next=ne.next,ne.next=R),_.pending=R}function Af(_,R,ne){if(ne&4194240){var ye=R.lanes;ye&=_.pendingLanes,ne|=ye,R.lanes=ne,it(_,ne)}}var _6={readContext:Fd,useCallback:Cc,useContext:Cc,useEffect:Cc,useImperativeHandle:Cc,useInsertionEffect:Cc,useLayoutEffect:Cc,useMemo:Cc,useReducer:Cc,useRef:Cc,useState:Cc,useDebugValue:Cc,useDeferredValue:Cc,useTransition:Cc,useMutableSource:Cc,useSyncExternalStore:Cc,useId:Cc,unstable_isNewReconciler:!1},Qz={readContext:Fd,useCallback:function(_,R){return bh().memoizedState=[_,R===void 0?null:R],_},useContext:Fd,useEffect:A6,useImperativeHandle:function(_,R,ne){return ne=ne!=null?ne.concat([_]):null,cv(4194308,4,fA.bind(null,R,_),ne)},useLayoutEffect:function(_,R){return cv(4194308,4,_,R)},useInsertionEffect:function(_,R){return cv(4,2,_,R)},useMemo:function(_,R){var ne=bh();return R=R===void 0?null:R,_=_(),ne.memoizedState=[_,R],_},useReducer:function(_,R,ne){var ye=bh();return R=ne!==void 0?ne(R):R,ye.memoizedState=ye.baseState=R,_={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_,lastRenderedState:R},ye.queue=_,_=_.dispatch=Xz.bind(null,Co,_),[ye.memoizedState,_]},useRef:function(_){var R=bh();return _={current:_},R.memoizedState=_},useState:lv,useDebugValue:uv,useDeferredValue:function(_){return bh().memoizedState=_},useTransition:function(){var _=lv(!1),R=_[0];return _=UP.bind(null,_[1]),bh().memoizedState=_,[R,_]},useMutableSource:function(){},useSyncExternalStore:function(_,R,ne){var ye=Co,Ue=bh();if(Ja){if(ne===void 0)throw Error(n(407));ne=ne()}else{if(ne=R(),Ll===null)throw Error(n(349));Gm&30||uA(ye,R,ne)}Ue.memoizedState=ne;var et={value:ne,getSnapshot:R};return Ue.queue=et,A6(Ip.bind(null,ye,et,_),[_]),ye.flags|=2048,lb(9,gu.bind(null,ye,et,ne,R),void 0,null),ne},useId:function(){var _=bh(),R=Ll.identifierPrefix;if(Ja){var ne=hh,ye=fh;ne=(ye&~(1<<32-ce(ye)-1)).toString(32)+ne,R=":"+R+"R"+ne,ne=Mx++,0<ne&&(R+="H"+ne.toString(32)),R+=":"}else ne=Li++,R=":"+R+"r"+ne.toString(32)+":";return _.memoizedState=R},unstable_isNewReconciler:!1},E6={readContext:Fd,useCallback:DP,useContext:Fd,useEffect:yh,useImperativeHandle:hA,useInsertionEffect:RP,useLayoutEffect:Fp,useMemo:BP,useReducer:lA,useRef:j6,useState:function(){return lA(Nc)},useDebugValue:uv,useDeferredValue:function(_){var R=Ld();return $P(R,zo.memoizedState,_)},useTransition:function(){var _=lA(Nc)[0],R=Ld().memoizedState;return[_,R]},useMutableSource:N6,useSyncExternalStore:cA,useId:pA,unstable_isNewReconciler:!1},ub={readContext:Fd,useCallback:DP,useContext:Fd,useEffect:yh,useImperativeHandle:hA,useInsertionEffect:RP,useLayoutEffect:Fp,useMemo:BP,useReducer:ob,useRef:j6,useState:function(){return ob(Nc)},useDebugValue:uv,useDeferredValue:function(_){var R=Ld();return zo===null?R.memoizedState=_:$P(R,zo.memoizedState,_)},useTransition:function(){var _=ob(Nc)[0],R=Ld().memoizedState;return[_,R]},useMutableSource:N6,useSyncExternalStore:cA,useId:pA,unstable_isNewReconciler:!1};function Rd(_,R){if(_&&_.defaultProps){R=ee({},R),_=_.defaultProps;for(var ne in _)R[ne]===void 0&&(R[ne]=_[ne]);return R}return R}function k6(_,R,ne,ye){R=_.memoizedState,ne=ne(ye,R),ne=ne==null?R:ee({},R,ne),_.memoizedState=ne,_.lanes===0&&(_.updateQueue.baseState=ne)}var T6={isMounted:function(_){return(_=_._reactInternals)?Ft(_)===_:!1},enqueueSetState:function(_,R,ne){_=_._reactInternals;var ye=Yc(),Ue=Jm(_),et=Tp(ye,Ue);et.payload=R,ne!=null&&(et.callback=ne),R=Md(_,et,Ue),R!==null&&(Pf(R,_,Ue,ye),y6(R,_,Ue))},enqueueReplaceState:function(_,R,ne){_=_._reactInternals;var ye=Yc(),Ue=Jm(_),et=Tp(ye,Ue);et.tag=1,et.payload=R,ne!=null&&(et.callback=ne),R=Md(_,et,Ue),R!==null&&(Pf(R,_,Ue,ye),y6(R,_,Ue))},enqueueForceUpdate:function(_,R){_=_._reactInternals;var ne=Yc(),ye=Jm(_),Ue=Tp(ne,ye);Ue.tag=2,R!=null&&(Ue.callback=R),R=Md(_,Ue,ye),R!==null&&(Pf(R,_,ye,ne),y6(R,_,ye))}};function xA(_,R,ne,ye,Ue,et,Mt){return _=_.stateNode,typeof _.shouldComponentUpdate=="function"?_.shouldComponentUpdate(ye,et,Mt):R.prototype&&R.prototype.isPureReactComponent?!$n(ne,ye)||!$n(Ue,et):!0}function Rx(_,R,ne){var ye=!1,Ue=zm,et=R.contextType;return typeof et=="object"&&et!==null?et=Fd(et):(Ue=mu(R)?Vc:yc.current,ye=R.contextTypes,et=(ye=ye!=null)?tb(_,Ue):zm),R=new R(ne,et),_.memoizedState=R.state!==null&&R.state!==void 0?R.state:null,R.updater=T6,_.stateNode=R,R._reactInternals=_,ye&&(_=_.stateNode,_.__reactInternalMemoizedUnmaskedChildContext=Ue,_.__reactInternalMemoizedMaskedChildContext=et),R}function db(_,R,ne,ye){_=R.state,typeof R.componentWillReceiveProps=="function"&&R.componentWillReceiveProps(ne,ye),typeof R.UNSAFE_componentWillReceiveProps=="function"&&R.UNSAFE_componentWillReceiveProps(ne,ye),R.state!==_&&T6.enqueueReplaceState(R,R.state,null)}function gA(_,R,ne,ye){var Ue=_.stateNode;Ue.props=ne,Ue.state=_.memoizedState,Ue.refs={},b6(_);var et=R.contextType;typeof et=="object"&&et!==null?Ue.context=Fd(et):(et=mu(R)?Vc:yc.current,Ue.context=tb(_,et)),Ue.state=_.memoizedState,et=R.getDerivedStateFromProps,typeof et=="function"&&(k6(_,R,et,ne),Ue.state=_.memoizedState),typeof R.getDerivedStateFromProps=="function"||typeof Ue.getSnapshotBeforeUpdate=="function"||typeof Ue.UNSAFE_componentWillMount!="function"&&typeof Ue.componentWillMount!="function"||(R=Ue.state,typeof Ue.componentWillMount=="function"&&Ue.componentWillMount(),typeof Ue.UNSAFE_componentWillMount=="function"&&Ue.UNSAFE_componentWillMount(),R!==Ue.state&&T6.enqueueReplaceState(Ue,Ue.state,null),sb(_,ne,Ue,ye),Ue.state=_.memoizedState),typeof Ue.componentDidMount=="function"&&(_.flags|=4194308)}function Dx(_,R){try{var ne="",ye=R;do ne+=ve(ye),ye=ye.return;while(ye);var Ue=ne}catch(et){Ue=`
Error generating stack: `+et.message+`
`+et.stack}return{value:_,source:R,stack:Ue,digest:null}}function P6(_,R,ne){return{value:_,source:null,stack:ne??null,digest:R??null}}function fb(_,R){try{console.error(R.value)}catch(ne){setTimeout(function(){throw ne})}}var HP=typeof WeakMap=="function"?WeakMap:Map;function dv(_,R,ne){ne=Tp(-1,ne),ne.tag=3,ne.payload={element:null};var ye=R.value;return ne.callback=function(){z6||(z6=!0,FA=ye),fb(_,R)},ne}function I6(_,R,ne){ne=Tp(-1,ne),ne.tag=3;var ye=_.type.getDerivedStateFromError;if(typeof ye=="function"){var Ue=R.value;ne.payload=function(){return ye(Ue)},ne.callback=function(){fb(_,R)}}var et=_.stateNode;return et!==null&&typeof et.componentDidCatch=="function"&&(ne.callback=function(){fb(_,R),typeof ye!="function"&&(Qm===null?Qm=new Set([this]):Qm.add(this));var Mt=R.stack;this.componentDidCatch(R.value,{componentStack:Mt!==null?Mt:""})}),ne}function fv(_,R,ne){var ye=_.pingCache;if(ye===null){ye=_.pingCache=new HP;var Ue=new Set;ye.set(R,Ue)}else Ue=ye.get(R),Ue===void 0&&(Ue=new Set,ye.set(R,Ue));Ue.has(ne)||(Ue.add(ne),_=iH.bind(null,_,R,ne),R.then(_,_))}function VP(_){do{var R;if((R=_.tag===13)&&(R=_.memoizedState,R=R!==null?R.dehydrated!==null:!0),R)return _;_=_.return}while(_!==null);return null}function bA(_,R,ne,ye,Ue){return _.mode&1?(_.flags|=65536,_.lanes=Ue,_):(_===R?_.flags|=65536:(_.flags|=128,ne.flags|=131072,ne.flags&=-52805,ne.tag===1&&(ne.alternate===null?ne.tag=17:(R=Tp(-1,1),R.tag=2,Md(ne,R,1))),ne.lanes|=1),_)}var F6=L.ReactCurrentOwner,qc=!1;function Jl(_,R,ne,ye){R.child=_===null?m6(R,null,ne,ye):Po(R,_.child,ne,ye)}function WP(_,R,ne,ye,Ue){ne=ne.render;var et=R.ref;return Wm(R,Ue),ye=Lx(_,R,ne,ye,et,Ue),ne=C6(),_!==null&&!qc?(R.updateQueue=_.updateQueue,R.flags&=-2053,_.lanes&=~Ue,_f(_,R,Ue)):(Ja&&ne&&ev(R),R.flags|=1,Jl(_,R,ye,Ue),R.child)}function yA(_,R,ne,ye,Ue){if(_===null){var et=ne.type;return typeof et=="function"&&!K6(et)&&et.defaultProps===void 0&&ne.compare===null&&ne.defaultProps===void 0?(R.tag=15,R.type=et,vh(_,R,et,ye,Ue)):(_=Y6(ne.type,null,ye,R,R.mode,Ue),_.ref=R.ref,_.return=R,R.child=_)}if(et=_.child,!(_.lanes&Ue)){var Mt=et.memoizedProps;if(ne=ne.compare,ne=ne!==null?ne:$n,ne(Mt,ye)&&_.ref===R.ref)return _f(_,R,Ue)}return R.flags|=1,_=If(et,ye),_.ref=R.ref,_.return=R,R.child=_}function vh(_,R,ne,ye,Ue){if(_!==null){var et=_.memoizedProps;if($n(et,ye)&&_.ref===R.ref)if(qc=!1,R.pendingProps=ye=et,(_.lanes&Ue)!==0)_.flags&131072&&(qc=!0);else return R.lanes=_.lanes,_f(_,R,Ue)}return CA(_,R,ne,ye,Ue)}function vA(_,R,ne){var ye=R.pendingProps,Ue=ye.children,et=_!==null?_.memoizedState:null;if(ye.mode==="hidden")if(!(R.mode&1))R.memoizedState={baseLanes:0,cachePool:null,transitions:null},Wa(xb,Qu),Qu|=ne;else{if(!(ne&1073741824))return _=et!==null?et.baseLanes|ne:ne,R.lanes=R.childLanes=1073741824,R.memoizedState={baseLanes:_,cachePool:null,transitions:null},R.updateQueue=null,Wa(xb,Qu),Qu|=_,null;R.memoizedState={baseLanes:0,cachePool:null,transitions:null},ye=et!==null?et.baseLanes:ne,Wa(xb,Qu),Qu|=ye}else et!==null?(ye=et.baseLanes|ne,R.memoizedState=null):ye=ne,Wa(xb,Qu),Qu|=ye;return Jl(_,R,Ue,ne),R.child}function wA(_,R){var ne=R.ref;(_===null&&ne!==null||_!==null&&_.ref!==ne)&&(R.flags|=512,R.flags|=2097152)}function CA(_,R,ne,ye,Ue){var et=mu(ne)?Vc:yc.current;return et=tb(R,et),Wm(R,Ue),ne=Lx(_,R,ne,ye,et,Ue),ye=C6(),_!==null&&!qc?(R.updateQueue=_.updateQueue,R.flags&=-2053,_.lanes&=~Ue,_f(_,R,Ue)):(Ja&&ye&&ev(R),R.flags|=1,Jl(_,R,ne,Ue),R.child)}function NA(_,R,ne,ye,Ue){if(mu(ne)){var et=!0;Td(R)}else et=!1;if(Wm(R,Ue),R.stateNode===null)M6(_,R),Rx(R,ne,ye),gA(R,ne,ye,Ue),ye=!0;else if(_===null){var Mt=R.stateNode,_n=R.memoizedProps;Mt.props=_n;var Un=Mt.context,xr=ne.contextType;typeof xr=="object"&&xr!==null?xr=Fd(xr):(xr=mu(ne)?Vc:yc.current,xr=tb(R,xr));var Kr=ne.getDerivedStateFromProps,Jr=typeof Kr=="function"||typeof Mt.getSnapshotBeforeUpdate=="function";Jr||typeof Mt.UNSAFE_componentWillReceiveProps!="function"&&typeof Mt.componentWillReceiveProps!="function"||(_n!==ye||Un!==xr)&&db(R,Mt,ye,xr),Od=!1;var Wr=R.memoizedState;Mt.state=Wr,sb(R,ye,Mt,Ue),Un=R.memoizedState,_n!==ye||Wr!==Un||pu.current||Od?(typeof Kr=="function"&&(k6(R,ne,Kr,ye),Un=R.memoizedState),(_n=Od||xA(R,ne,_n,ye,Wr,Un,xr))?(Jr||typeof Mt.UNSAFE_componentWillMount!="function"&&typeof Mt.componentWillMount!="function"||(typeof Mt.componentWillMount=="function"&&Mt.componentWillMount(),typeof Mt.UNSAFE_componentWillMount=="function"&&Mt.UNSAFE_componentWillMount()),typeof Mt.componentDidMount=="function"&&(R.flags|=4194308)):(typeof Mt.componentDidMount=="function"&&(R.flags|=4194308),R.memoizedProps=ye,R.memoizedState=Un),Mt.props=ye,Mt.state=Un,Mt.context=xr,ye=_n):(typeof Mt.componentDidMount=="function"&&(R.flags|=4194308),ye=!1)}else{Mt=R.stateNode,MP(_,R),_n=R.memoizedProps,xr=R.type===R.elementType?_n:Rd(R.type,_n),Mt.props=xr,Jr=R.pendingProps,Wr=Mt.context,Un=ne.contextType,typeof Un=="object"&&Un!==null?Un=Fd(Un):(Un=mu(ne)?Vc:yc.current,Un=tb(R,Un));var Ss=ne.getDerivedStateFromProps;(Kr=typeof Ss=="function"||typeof Mt.getSnapshotBeforeUpdate=="function")||typeof Mt.UNSAFE_componentWillReceiveProps!="function"&&typeof Mt.componentWillReceiveProps!="function"||(_n!==Jr||Wr!==Un)&&db(R,Mt,ye,Un),Od=!1,Wr=R.memoizedState,Mt.state=Wr,sb(R,ye,Mt,Ue);var Fs=R.memoizedState;_n!==Jr||Wr!==Fs||pu.current||Od?(typeof Ss=="function"&&(k6(R,ne,Ss,ye),Fs=R.memoizedState),(xr=Od||xA(R,ne,xr,ye,Wr,Fs,Un)||!1)?(Kr||typeof Mt.UNSAFE_componentWillUpdate!="function"&&typeof Mt.componentWillUpdate!="function"||(typeof Mt.componentWillUpdate=="function"&&Mt.componentWillUpdate(ye,Fs,Un),typeof Mt.UNSAFE_componentWillUpdate=="function"&&Mt.UNSAFE_componentWillUpdate(ye,Fs,Un)),typeof Mt.componentDidUpdate=="function"&&(R.flags|=4),typeof Mt.getSnapshotBeforeUpdate=="function"&&(R.flags|=1024)):(typeof Mt.componentDidUpdate!="function"||_n===_.memoizedProps&&Wr===_.memoizedState||(R.flags|=4),typeof Mt.getSnapshotBeforeUpdate!="function"||_n===_.memoizedProps&&Wr===_.memoizedState||(R.flags|=1024),R.memoizedProps=ye,R.memoizedState=Fs),Mt.props=ye,Mt.state=Fs,Mt.context=Un,ye=xr):(typeof Mt.componentDidUpdate!="function"||_n===_.memoizedProps&&Wr===_.memoizedState||(R.flags|=4),typeof Mt.getSnapshotBeforeUpdate!="function"||_n===_.memoizedProps&&Wr===_.memoizedState||(R.flags|=1024),ye=!1)}return SA(_,R,ne,ye,et,Ue)}function SA(_,R,ne,ye,Ue,et){wA(_,R);var Mt=(R.flags&128)!==0;if(!ye&&!Mt)return Ue&&kP(R,ne,!1),_f(_,R,et);ye=R.stateNode,F6.current=R;var _n=Mt&&typeof ne.getDerivedStateFromError!="function"?null:ye.render();return R.flags|=1,_!==null&&Mt?(R.child=Po(R,_.child,null,et),R.child=Po(R,null,_n,et)):Jl(_,R,_n,et),R.memoizedState=ye.state,Ue&&kP(R,ne,!0),R.child}function qP(_){var R=_.stateNode;R.pendingContext?_P(_,R.pendingContext,R.pendingContext!==R.context):R.context&&_P(_,R.context,!1),rA(_,R.containerInfo)}function wh(_,R,ne,ye,Ue){return mh(),xh(Ue),R.flags|=256,Jl(_,R,ne,ye),R.child}var hv={dehydrated:null,treeContext:null,retryLane:0};function pv(_){return{baseLanes:_,cachePool:null,transitions:null}}function O6(_,R,ne){var ye=R.pendingProps,Ue=lo.current,et=!1,Mt=(R.flags&128)!==0,_n;if((_n=Mt)||(_n=_!==null&&_.memoizedState===null?!1:(Ue&2)!==0),_n?(et=!0,R.flags&=-129):(_===null||_.memoizedState!==null)&&(Ue|=1),Wa(lo,Ue&1),_===null)return xu(R),_=R.memoizedState,_!==null&&(_=_.dehydrated,_!==null)?(R.mode&1?_.data==="$!"?R.lanes=8:R.lanes=1073741824:R.lanes=1,null):(Mt=ye.children,_=ye.fallback,et?(ye=R.mode,et=R.child,Mt={mode:"hidden",children:Mt},!(ye&1)&&et!==null?(et.childLanes=0,et.pendingProps=Mt):et=X6(Mt,ye,0,null),_=Hx(_,ye,ne,null),et.return=R,_.return=R,et.sibling=_,R.child=et,R.child.memoizedState=pv(ne),R.memoizedState=hv,_):hb(R,Mt));if(Ue=_.memoizedState,Ue!==null&&(_n=Ue.dehydrated,_n!==null))return Zs(_,R,Mt,ye,_n,Ue,ne);if(et){et=ye.fallback,Mt=R.mode,Ue=_.child,_n=Ue.sibling;var Un={mode:"hidden",children:ye.children};return!(Mt&1)&&R.child!==Ue?(ye=R.child,ye.childLanes=0,ye.pendingProps=Un,R.deletions=null):(ye=If(Ue,Un),ye.subtreeFlags=Ue.subtreeFlags&14680064),_n!==null?et=If(_n,et):(et=Hx(et,Mt,ne,null),et.flags|=2),et.return=R,ye.return=R,ye.sibling=et,R.child=ye,ye=et,et=R.child,Mt=_.child.memoizedState,Mt=Mt===null?pv(ne):{baseLanes:Mt.baseLanes|ne,cachePool:null,transitions:Mt.transitions},et.memoizedState=Mt,et.childLanes=_.childLanes&~ne,R.memoizedState=hv,ye}return et=_.child,_=et.sibling,ye=If(et,{mode:"visible",children:ye.children}),!(R.mode&1)&&(ye.lanes=ne),ye.return=R,ye.sibling=null,_!==null&&(ne=R.deletions,ne===null?(R.deletions=[_],R.flags|=16):ne.push(_)),R.child=ye,R.memoizedState=null,ye}function hb(_,R){return R=X6({mode:"visible",children:R},_.mode,0,null),R.return=_,_.child=R}function Op(_,R,ne,ye){return ye!==null&&xh(ye),Po(R,_.child,null,ne),_=hb(R,R.pendingProps.children),_.flags|=2,R.memoizedState=null,_}function Zs(_,R,ne,ye,Ue,et,Mt){if(ne)return R.flags&256?(R.flags&=-257,ye=P6(Error(n(422))),Op(_,R,Mt,ye)):R.memoizedState!==null?(R.child=_.child,R.flags|=128,null):(et=ye.fallback,Ue=R.mode,ye=X6({mode:"visible",children:ye.children},Ue,0,null),et=Hx(et,Ue,Mt,null),et.flags|=2,ye.return=R,et.return=R,ye.sibling=et,R.child=ye,R.mode&1&&Po(R,_.child,null,Mt),R.child.memoizedState=pv(Mt),R.memoizedState=hv,et);if(!(R.mode&1))return Op(_,R,Mt,null);if(Ue.data==="$!"){if(ye=Ue.nextSibling&&Ue.nextSibling.dataset,ye)var _n=ye.dgst;return ye=_n,et=Error(n(419)),ye=P6(et,ye,void 0),Op(_,R,Mt,ye)}if(_n=(Mt&_.childLanes)!==0,qc||_n){if(ye=Ll,ye!==null){switch(Mt&-Mt){case 4:Ue=2;break;case 16:Ue=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:Ue=32;break;case 536870912:Ue=268435456;break;default:Ue=0}Ue=Ue&(ye.suspendedLanes|Mt)?0:Ue,Ue!==0&&Ue!==et.retryLane&&(et.retryLane=Ue,kp(_,Ue),Pf(ye,_,Ue,-1))}return BA(),ye=P6(Error(n(421))),Op(_,R,Mt,ye)}return Ue.data==="$?"?(R.flags|=128,R.child=_.child,R=aH.bind(null,_),Ue._reactRetry=R,null):(_=et.treeContext,Ku=$m(Ue.nextSibling),wc=R,Ja=!0,jf=null,_!==null&&(Pd[Id++]=fh,Pd[Id++]=hh,Pd[Id++]=kx,fh=_.id,hh=_.overflow,kx=R),R=hb(R,ye.children),R.flags|=4096,R)}function mv(_,R,ne){_.lanes|=R;var ye=_.alternate;ye!==null&&(ye.lanes|=R),Zl(_.return,R,ne)}function xv(_,R,ne,ye,Ue){var et=_.memoizedState;et===null?_.memoizedState={isBackwards:R,rendering:null,renderingStartTime:0,last:ye,tail:ne,tailMode:Ue}:(et.isBackwards=R,et.rendering=null,et.renderingStartTime=0,et.last=ye,et.tail=ne,et.tailMode=Ue)}function Km(_,R,ne){var ye=R.pendingProps,Ue=ye.revealOrder,et=ye.tail;if(Jl(_,R,ye.children,ne),ye=lo.current,ye&2)ye=ye&1|2,R.flags|=128;else{if(_!==null&&_.flags&128)e:for(_=R.child;_!==null;){if(_.tag===13)_.memoizedState!==null&&mv(_,ne,R);else if(_.tag===19)mv(_,ne,R);else if(_.child!==null){_.child.return=_,_=_.child;continue}if(_===R)break e;for(;_.sibling===null;){if(_.return===null||_.return===R)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}ye&=1}if(Wa(lo,ye),!(R.mode&1))R.memoizedState=null;else switch(Ue){case"forwards":for(ne=R.child,Ue=null;ne!==null;)_=ne.alternate,_!==null&&Ox(_)===null&&(Ue=ne),ne=ne.sibling;ne=Ue,ne===null?(Ue=R.child,R.child=null):(Ue=ne.sibling,ne.sibling=null),xv(R,!1,Ue,ne,et);break;case"backwards":for(ne=null,Ue=R.child,R.child=null;Ue!==null;){if(_=Ue.alternate,_!==null&&Ox(_)===null){R.child=Ue;break}_=Ue.sibling,Ue.sibling=ne,ne=Ue,Ue=_}xv(R,!0,ne,null,et);break;case"together":xv(R,!1,null,null,void 0);break;default:R.memoizedState=null}return R.child}function M6(_,R){!(R.mode&1)&&_!==null&&(_.alternate=null,R.alternate=null,R.flags|=2)}function _f(_,R,ne){if(_!==null&&(R.dependencies=_.dependencies),Xm|=R.lanes,!(ne&R.childLanes))return null;if(_!==null&&R.child!==_.child)throw Error(n(153));if(R.child!==null){for(_=R.child,ne=If(_,_.pendingProps),R.child=ne,ne.return=R;_.sibling!==null;)_=_.sibling,ne=ne.sibling=If(_,_.pendingProps),ne.return=R;ne.sibling=null}return R.child}function GP(_,R,ne){switch(R.tag){case 3:qP(R),mh();break;case 5:sA(R);break;case 1:mu(R.type)&&Td(R);break;case 4:rA(R,R.stateNode.containerInfo);break;case 10:var ye=R.type._context,Ue=R.memoizedProps.value;Wa(rv,ye._currentValue),ye._currentValue=Ue;break;case 13:if(ye=R.memoizedState,ye!==null)return ye.dehydrated!==null?(Wa(lo,lo.current&1),R.flags|=128,null):ne&R.child.childLanes?O6(_,R,ne):(Wa(lo,lo.current&1),_=_f(_,R,ne),_!==null?_.sibling:null);Wa(lo,lo.current&1);break;case 19:if(ye=(ne&R.childLanes)!==0,_.flags&128){if(ye)return Km(_,R,ne);R.flags|=128}if(Ue=R.memoizedState,Ue!==null&&(Ue.rendering=null,Ue.tail=null,Ue.lastEffect=null),Wa(lo,lo.current),ye)break;return null;case 22:case 23:return R.lanes=0,vA(_,R,ne)}return _f(_,R,ne)}var ec,jA,KP,AA;ec=function(_,R){for(var ne=R.child;ne!==null;){if(ne.tag===5||ne.tag===6)_.appendChild(ne.stateNode);else if(ne.tag!==4&&ne.child!==null){ne.child.return=ne,ne=ne.child;continue}if(ne===R)break;for(;ne.sibling===null;){if(ne.return===null||ne.return===R)return;ne=ne.return}ne.sibling.return=ne.return,ne=ne.sibling}},jA=function(){},KP=function(_,R,ne,ye){var Ue=_.memoizedProps;if(Ue!==ye){_=R.stateNode,Pp(gh.current);var et=null;switch(ne){case"input":Ue=st(_,Ue),ye=st(_,ye),et=[];break;case"select":Ue=ee({},Ue,{value:void 0}),ye=ee({},ye,{value:void 0}),et=[];break;case"textarea":Ue=un(_,Ue),ye=un(_,ye),et=[];break;default:typeof Ue.onClick!="function"&&typeof ye.onClick=="function"&&(_.onclick=a6)}Pt(ne,ye);var Mt;ne=null;for(xr in Ue)if(!ye.hasOwnProperty(xr)&&Ue.hasOwnProperty(xr)&&Ue[xr]!=null)if(xr==="style"){var _n=Ue[xr];for(Mt in _n)_n.hasOwnProperty(Mt)&&(ne||(ne={}),ne[Mt]="")}else xr!=="dangerouslySetInnerHTML"&&xr!=="children"&&xr!=="suppressContentEditableWarning"&&xr!=="suppressHydrationWarning"&&xr!=="autoFocus"&&(s.hasOwnProperty(xr)?et||(et=[]):(et=et||[]).push(xr,null));for(xr in ye){var Un=ye[xr];if(_n=Ue!=null?Ue[xr]:void 0,ye.hasOwnProperty(xr)&&Un!==_n&&(Un!=null||_n!=null))if(xr==="style")if(_n){for(Mt in _n)!_n.hasOwnProperty(Mt)||Un&&Un.hasOwnProperty(Mt)||(ne||(ne={}),ne[Mt]="");for(Mt in Un)Un.hasOwnProperty(Mt)&&_n[Mt]!==Un[Mt]&&(ne||(ne={}),ne[Mt]=Un[Mt])}else ne||(et||(et=[]),et.push(xr,ne)),ne=Un;else xr==="dangerouslySetInnerHTML"?(Un=Un?Un.__html:void 0,_n=_n?_n.__html:void 0,Un!=null&&_n!==Un&&(et=et||[]).push(xr,Un)):xr==="children"?typeof Un!="string"&&typeof Un!="number"||(et=et||[]).push(xr,""+Un):xr!=="suppressContentEditableWarning"&&xr!=="suppressHydrationWarning"&&(s.hasOwnProperty(xr)?(Un!=null&&xr==="onScroll"&&Qa("scroll",_),et||_n===Un||(et=[])):(et=et||[]).push(xr,Un))}ne&&(et=et||[]).push("style",ne);var xr=et;(R.updateQueue=xr)&&(R.flags|=4)}},AA=function(_,R,ne,ye){ne!==ye&&(R.flags|=4)};function gv(_,R){if(!Ja)switch(_.tailMode){case"hidden":R=_.tail;for(var ne=null;R!==null;)R.alternate!==null&&(ne=R),R=R.sibling;ne===null?_.tail=null:ne.sibling=null;break;case"collapsed":ne=_.tail;for(var ye=null;ne!==null;)ne.alternate!==null&&(ye=ne),ne=ne.sibling;ye===null?R||_.tail===null?_.tail=null:_.tail.sibling=null:ye.sibling=null}}function tc(_){var R=_.alternate!==null&&_.alternate.child===_.child,ne=0,ye=0;if(R)for(var Ue=_.child;Ue!==null;)ne|=Ue.lanes|Ue.childLanes,ye|=Ue.subtreeFlags&14680064,ye|=Ue.flags&14680064,Ue.return=_,Ue=Ue.sibling;else for(Ue=_.child;Ue!==null;)ne|=Ue.lanes|Ue.childLanes,ye|=Ue.subtreeFlags,ye|=Ue.flags,Ue.return=_,Ue=Ue.sibling;return _.subtreeFlags|=ye,_.childLanes=ne,R}function Zz(_,R,ne){var ye=R.pendingProps;switch(Px(R),R.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tc(R),null;case 1:return mu(R.type)&&u6(),tc(R),null;case 3:return ye=R.stateNode,qm(),Za(pu),Za(yc),w6(),ye.pendingContext&&(ye.context=ye.pendingContext,ye.pendingContext=null),(_===null||_.child===null)&&(tv(R)?R.flags|=4:_===null||_.memoizedState.isDehydrated&&!(R.flags&256)||(R.flags|=1024,jf!==null&&(LA(jf),jf=null))),jA(_,R),tc(R),null;case 5:v6(R);var Ue=Pp(ib.current);if(ne=R.type,_!==null&&R.stateNode!=null)KP(_,R,ne,ye,Ue),_.ref!==R.ref&&(R.flags|=512,R.flags|=2097152);else{if(!ye){if(R.stateNode===null)throw Error(n(166));return tc(R),null}if(_=Pp(gh.current),tv(R)){ye=R.stateNode,ne=R.type;var et=R.memoizedProps;switch(ye[uh]=R,ye[Um]=et,_=(R.mode&1)!==0,ne){case"dialog":Qa("cancel",ye),Qa("close",ye);break;case"iframe":case"object":case"embed":Qa("load",ye);break;case"video":case"audio":for(Ue=0;Ue<jp.length;Ue++)Qa(jp[Ue],ye);break;case"source":Qa("error",ye);break;case"img":case"image":case"link":Qa("error",ye),Qa("load",ye);break;case"details":Qa("toggle",ye);break;case"input":at(ye,et),Qa("invalid",ye);break;case"select":ye._wrapperState={wasMultiple:!!et.multiple},Qa("invalid",ye);break;case"textarea":vn(ye,et),Qa("invalid",ye)}Pt(ne,et),Ue=null;for(var Mt in et)if(et.hasOwnProperty(Mt)){var _n=et[Mt];Mt==="children"?typeof _n=="string"?ye.textContent!==_n&&(et.suppressHydrationWarning!==!0&&X2(ye.textContent,_n,_),Ue=["children",_n]):typeof _n=="number"&&ye.textContent!==""+_n&&(et.suppressHydrationWarning!==!0&&X2(ye.textContent,_n,_),Ue=["children",""+_n]):s.hasOwnProperty(Mt)&&_n!=null&&Mt==="onScroll"&&Qa("scroll",ye)}switch(ne){case"input":Qe(ye),vt(ye,et,!0);break;case"textarea":Qe(ye),ln(ye);break;case"select":case"option":break;default:typeof et.onClick=="function"&&(ye.onclick=a6)}ye=Ue,R.updateQueue=ye,ye!==null&&(R.flags|=4)}else{Mt=Ue.nodeType===9?Ue:Ue.ownerDocument,_==="http://www.w3.org/1999/xhtml"&&(_=Nn(ne)),_==="http://www.w3.org/1999/xhtml"?ne==="script"?(_=Mt.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild)):typeof ye.is=="string"?_=Mt.createElement(ne,{is:ye.is}):(_=Mt.createElement(ne),ne==="select"&&(Mt=_,ye.multiple?Mt.multiple=!0:ye.size&&(Mt.size=ye.size))):_=Mt.createElementNS(_,ne),_[uh]=R,_[Um]=ye,ec(_,R,!1,!1),R.stateNode=_;e:{switch(Mt=Ke(ne,ye),ne){case"dialog":Qa("cancel",_),Qa("close",_),Ue=ye;break;case"iframe":case"object":case"embed":Qa("load",_),Ue=ye;break;case"video":case"audio":for(Ue=0;Ue<jp.length;Ue++)Qa(jp[Ue],_);Ue=ye;break;case"source":Qa("error",_),Ue=ye;break;case"img":case"image":case"link":Qa("error",_),Qa("load",_),Ue=ye;break;case"details":Qa("toggle",_),Ue=ye;break;case"input":at(_,ye),Ue=st(_,ye),Qa("invalid",_);break;case"option":Ue=ye;break;case"select":_._wrapperState={wasMultiple:!!ye.multiple},Ue=ee({},ye,{value:void 0}),Qa("invalid",_);break;case"textarea":vn(_,ye),Ue=un(_,ye),Qa("invalid",_);break;default:Ue=ye}Pt(ne,Ue),_n=Ue;for(et in _n)if(_n.hasOwnProperty(et)){var Un=_n[et];et==="style"?xt(_,Un):et==="dangerouslySetInnerHTML"?(Un=Un?Un.__html:void 0,Un!=null&&nt(_,Un)):et==="children"?typeof Un=="string"?(ne!=="textarea"||Un!=="")&&Ut(_,Un):typeof Un=="number"&&Ut(_,""+Un):et!=="suppressContentEditableWarning"&&et!=="suppressHydrationWarning"&&et!=="autoFocus"&&(s.hasOwnProperty(et)?Un!=null&&et==="onScroll"&&Qa("scroll",_):Un!=null&&I(_,et,Un,Mt))}switch(ne){case"input":Qe(_),vt(_,ye,!1);break;case"textarea":Qe(_),ln(_);break;case"option":ye.value!=null&&_.setAttribute("value",""+je(ye.value));break;case"select":_.multiple=!!ye.multiple,et=ye.value,et!=null?jt(_,!!ye.multiple,et,!1):ye.defaultValue!=null&&jt(_,!!ye.multiple,ye.defaultValue,!0);break;default:typeof Ue.onClick=="function"&&(_.onclick=a6)}switch(ne){case"button":case"input":case"select":case"textarea":ye=!!ye.autoFocus;break e;case"img":ye=!0;break e;default:ye=!1}}ye&&(R.flags|=4)}R.ref!==null&&(R.flags|=512,R.flags|=2097152)}return tc(R),null;case 6:if(_&&R.stateNode!=null)AA(_,R,_.memoizedProps,ye);else{if(typeof ye!="string"&&R.stateNode===null)throw Error(n(166));if(ne=Pp(ib.current),Pp(gh.current),tv(R)){if(ye=R.stateNode,ne=R.memoizedProps,ye[uh]=R,(et=ye.nodeValue!==ne)&&(_=wc,_!==null))switch(_.tag){case 3:X2(ye.nodeValue,ne,(_.mode&1)!==0);break;case 5:_.memoizedProps.suppressHydrationWarning!==!0&&X2(ye.nodeValue,ne,(_.mode&1)!==0)}et&&(R.flags|=4)}else ye=(ne.nodeType===9?ne:ne.ownerDocument).createTextNode(ye),ye[uh]=R,R.stateNode=ye}return tc(R),null;case 13:if(Za(lo),ye=R.memoizedState,_===null||_.memoizedState!==null&&_.memoizedState.dehydrated!==null){if(Ja&&Ku!==null&&R.mode&1&&!(R.flags&128))J8(),mh(),R.flags|=98560,et=!1;else if(et=tv(R),ye!==null&&ye.dehydrated!==null){if(_===null){if(!et)throw Error(n(318));if(et=R.memoizedState,et=et!==null?et.dehydrated:null,!et)throw Error(n(317));et[uh]=R}else mh(),!(R.flags&128)&&(R.memoizedState=null),R.flags|=4;tc(R),et=!1}else jf!==null&&(LA(jf),jf=null),et=!0;if(!et)return R.flags&65536?R:null}return R.flags&128?(R.lanes=ne,R):(ye=ye!==null,ye!==(_!==null&&_.memoizedState!==null)&&ye&&(R.child.flags|=8192,R.mode&1&&(_===null||lo.current&1?xl===0&&(xl=3):BA())),R.updateQueue!==null&&(R.flags|=4),tc(R),null);case 4:return qm(),jA(_,R),_===null&&Dm(R.stateNode.containerInfo),tc(R),null;case 10:return x6(R.type._context),tc(R),null;case 17:return mu(R.type)&&u6(),tc(R),null;case 19:if(Za(lo),et=R.memoizedState,et===null)return tc(R),null;if(ye=(R.flags&128)!==0,Mt=et.rendering,Mt===null)if(ye)gv(et,!1);else{if(xl!==0||_!==null&&_.flags&128)for(_=R.child;_!==null;){if(Mt=Ox(_),Mt!==null){for(R.flags|=128,gv(et,!1),ye=Mt.updateQueue,ye!==null&&(R.updateQueue=ye,R.flags|=4),R.subtreeFlags=0,ye=ne,ne=R.child;ne!==null;)et=ne,_=ye,et.flags&=14680066,Mt=et.alternate,Mt===null?(et.childLanes=0,et.lanes=_,et.child=null,et.subtreeFlags=0,et.memoizedProps=null,et.memoizedState=null,et.updateQueue=null,et.dependencies=null,et.stateNode=null):(et.childLanes=Mt.childLanes,et.lanes=Mt.lanes,et.child=Mt.child,et.subtreeFlags=0,et.deletions=null,et.memoizedProps=Mt.memoizedProps,et.memoizedState=Mt.memoizedState,et.updateQueue=Mt.updateQueue,et.type=Mt.type,_=Mt.dependencies,et.dependencies=_===null?null:{lanes:_.lanes,firstContext:_.firstContext}),ne=ne.sibling;return Wa(lo,lo.current&1|2),R.child}_=_.sibling}et.tail!==null&&Ce()>Bx&&(R.flags|=128,ye=!0,gv(et,!1),R.lanes=4194304)}else{if(!ye)if(_=Ox(Mt),_!==null){if(R.flags|=128,ye=!0,ne=_.updateQueue,ne!==null&&(R.updateQueue=ne,R.flags|=4),gv(et,!0),et.tail===null&&et.tailMode==="hidden"&&!Mt.alternate&&!Ja)return tc(R),null}else 2*Ce()-et.renderingStartTime>Bx&&ne!==1073741824&&(R.flags|=128,ye=!0,gv(et,!1),R.lanes=4194304);et.isBackwards?(Mt.sibling=R.child,R.child=Mt):(ne=et.last,ne!==null?ne.sibling=Mt:R.child=Mt,et.last=Mt)}return et.tail!==null?(R=et.tail,et.rendering=R,et.tail=R.sibling,et.renderingStartTime=Ce(),R.sibling=null,ne=lo.current,Wa(lo,ye?ne&1|2:ne&1),R):(tc(R),null);case 22:case 23:return DA(),ye=R.memoizedState!==null,_!==null&&_.memoizedState!==null!==ye&&(R.flags|=8192),ye&&R.mode&1?Qu&1073741824&&(tc(R),R.subtreeFlags&6&&(R.flags|=8192)):tc(R),null;case 24:return null;case 25:return null}throw Error(n(156,R.tag))}function Jz(_,R){switch(Px(R),R.tag){case 1:return mu(R.type)&&u6(),_=R.flags,_&65536?(R.flags=_&-65537|128,R):null;case 3:return qm(),Za(pu),Za(yc),w6(),_=R.flags,_&65536&&!(_&128)?(R.flags=_&-65537|128,R):null;case 5:return v6(R),null;case 13:if(Za(lo),_=R.memoizedState,_!==null&&_.dehydrated!==null){if(R.alternate===null)throw Error(n(340));mh()}return _=R.flags,_&65536?(R.flags=_&-65537|128,R):null;case 19:return Za(lo),null;case 4:return qm(),null;case 10:return x6(R.type._context),null;case 22:case 23:return DA(),null;case 24:return null;default:return null}}var L6=!1,co=!1,Gc=typeof WeakSet=="function"?WeakSet:Set,_s=null;function pb(_,R){var ne=_.ref;if(ne!==null)if(typeof ne=="function")try{ne(null)}catch(ye){No(_,R,ye)}else ne.current=null}function bv(_,R,ne){try{ne()}catch(ye){No(_,R,ye)}}var YP=!1;function eH(_,R){if(Q2=qn,_=Is(),ni(_)){if("selectionStart"in _)var ne={start:_.selectionStart,end:_.selectionEnd};else e:{ne=(ne=_.ownerDocument)&&ne.defaultView||window;var ye=ne.getSelection&&ne.getSelection();if(ye&&ye.rangeCount!==0){ne=ye.anchorNode;var Ue=ye.anchorOffset,et=ye.focusNode;ye=ye.focusOffset;try{ne.nodeType,et.nodeType}catch{ne=null;break e}var Mt=0,_n=-1,Un=-1,xr=0,Kr=0,Jr=_,Wr=null;t:for(;;){for(var Ss;Jr!==ne||Ue!==0&&Jr.nodeType!==3||(_n=Mt+Ue),Jr!==et||ye!==0&&Jr.nodeType!==3||(Un=Mt+ye),Jr.nodeType===3&&(Mt+=Jr.nodeValue.length),(Ss=Jr.firstChild)!==null;)Wr=Jr,Jr=Ss;for(;;){if(Jr===_)break t;if(Wr===ne&&++xr===Ue&&(_n=Mt),Wr===et&&++Kr===ye&&(Un=Mt),(Ss=Jr.nextSibling)!==null)break;Jr=Wr,Wr=Jr.parentNode}Jr=Ss}ne=_n===-1||Un===-1?null:{start:_n,end:Un}}else ne=null}ne=ne||{start:0,end:0}}else ne=null;for(_x={focusedElem:_,selectionRange:ne},qn=!1,_s=R;_s!==null;)if(R=_s,_=R.child,(R.subtreeFlags&1028)!==0&&_!==null)_.return=R,_s=_;else for(;_s!==null;){R=_s;try{var Fs=R.alternate;if(R.flags&1024)switch(R.tag){case 0:case 11:case 15:break;case 1:if(Fs!==null){var Bs=Fs.memoizedProps,Io=Fs.memoizedState,cr=R.stateNode,Kn=cr.getSnapshotBeforeUpdate(R.elementType===R.type?Bs:Rd(R.type,Bs),Io);cr.__reactInternalSnapshotBeforeUpdate=Kn}break;case 3:var fr=R.stateNode.containerInfo;fr.nodeType===1?fr.textContent="":fr.nodeType===9&&fr.documentElement&&fr.removeChild(fr.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(is){No(R,R.return,is)}if(_=R.sibling,_!==null){_.return=R.return,_s=_;break}_s=R.return}return Fs=YP,YP=!1,Fs}function Mp(_,R,ne){var ye=R.updateQueue;if(ye=ye!==null?ye.lastEffect:null,ye!==null){var Ue=ye=ye.next;do{if((Ue.tag&_)===_){var et=Ue.destroy;Ue.destroy=void 0,et!==void 0&&bv(R,ne,et)}Ue=Ue.next}while(Ue!==ye)}}function yv(_,R){if(R=R.updateQueue,R=R!==null?R.lastEffect:null,R!==null){var ne=R=R.next;do{if((ne.tag&_)===_){var ye=ne.create;ne.destroy=ye()}ne=ne.next}while(ne!==R)}}function R6(_){var R=_.ref;if(R!==null){var ne=_.stateNode;switch(_.tag){case 5:_=ne;break;default:_=ne}typeof R=="function"?R(_):R.current=_}}function XP(_){var R=_.alternate;R!==null&&(_.alternate=null,XP(R)),_.child=null,_.deletions=null,_.sibling=null,_.tag===5&&(R=_.stateNode,R!==null&&(delete R[uh],delete R[Um],delete R[l6],delete R[Xt],delete R[J1])),_.stateNode=null,_.return=null,_.dependencies=null,_.memoizedProps=null,_.memoizedState=null,_.pendingProps=null,_.stateNode=null,_.updateQueue=null}function QP(_){return _.tag===5||_.tag===3||_.tag===4}function ZP(_){e:for(;;){for(;_.sibling===null;){if(_.return===null||QP(_.return))return null;_=_.return}for(_.sibling.return=_.return,_=_.sibling;_.tag!==5&&_.tag!==6&&_.tag!==18;){if(_.flags&2||_.child===null||_.tag===4)continue e;_.child.return=_,_=_.child}if(!(_.flags&2))return _.stateNode}}function _A(_,R,ne){var ye=_.tag;if(ye===5||ye===6)_=_.stateNode,R?ne.nodeType===8?ne.parentNode.insertBefore(_,R):ne.insertBefore(_,R):(ne.nodeType===8?(R=ne.parentNode,R.insertBefore(_,ne)):(R=ne,R.appendChild(_)),ne=ne._reactRootContainer,ne!=null||R.onclick!==null||(R.onclick=a6));else if(ye!==4&&(_=_.child,_!==null))for(_A(_,R,ne),_=_.sibling;_!==null;)_A(_,R,ne),_=_.sibling}function D6(_,R,ne){var ye=_.tag;if(ye===5||ye===6)_=_.stateNode,R?ne.insertBefore(_,R):ne.appendChild(_);else if(ye!==4&&(_=_.child,_!==null))for(D6(_,R,ne),_=_.sibling;_!==null;)D6(_,R,ne),_=_.sibling}var Ml=null,Ef=!1;function Ch(_,R,ne){for(ne=ne.child;ne!==null;)EA(_,R,ne),ne=ne.sibling}function EA(_,R,ne){if(V&&typeof V.onCommitFiberUnmount=="function")try{V.onCommitFiberUnmount(D,ne)}catch{}switch(ne.tag){case 5:co||pb(ne,R);case 6:var ye=Ml,Ue=Ef;Ml=null,Ch(_,R,ne),Ml=ye,Ef=Ue,Ml!==null&&(Ef?(_=Ml,ne=ne.stateNode,_.nodeType===8?_.parentNode.removeChild(ne):_.removeChild(ne)):Ml.removeChild(ne.stateNode));break;case 18:Ml!==null&&(Ef?(_=Ml,ne=ne.stateNode,_.nodeType===8?X8(_.parentNode,ne):_.nodeType===1&&X8(_,ne),Ct(_)):X8(Ml,ne.stateNode));break;case 4:ye=Ml,Ue=Ef,Ml=ne.stateNode.containerInfo,Ef=!0,Ch(_,R,ne),Ml=ye,Ef=Ue;break;case 0:case 11:case 14:case 15:if(!co&&(ye=ne.updateQueue,ye!==null&&(ye=ye.lastEffect,ye!==null))){Ue=ye=ye.next;do{var et=Ue,Mt=et.destroy;et=et.tag,Mt!==void 0&&(et&2||et&4)&&bv(ne,R,Mt),Ue=Ue.next}while(Ue!==ye)}Ch(_,R,ne);break;case 1:if(!co&&(pb(ne,R),ye=ne.stateNode,typeof ye.componentWillUnmount=="function"))try{ye.props=ne.memoizedProps,ye.state=ne.memoizedState,ye.componentWillUnmount()}catch(_n){No(ne,R,_n)}Ch(_,R,ne);break;case 21:Ch(_,R,ne);break;case 22:ne.mode&1?(co=(ye=co)||ne.memoizedState!==null,Ch(_,R,ne),co=ye):Ch(_,R,ne);break;default:Ch(_,R,ne)}}function mb(_){var R=_.updateQueue;if(R!==null){_.updateQueue=null;var ne=_.stateNode;ne===null&&(ne=_.stateNode=new Gc),R.forEach(function(ye){var Ue=oH.bind(null,_,ye);ne.has(ye)||(ne.add(ye),ye.then(Ue,Ue))})}}function Xu(_,R){var ne=R.deletions;if(ne!==null)for(var ye=0;ye<ne.length;ye++){var Ue=ne[ye];try{var et=_,Mt=R,_n=Mt;e:for(;_n!==null;){switch(_n.tag){case 5:Ml=_n.stateNode,Ef=!1;break e;case 3:Ml=_n.stateNode.containerInfo,Ef=!0;break e;case 4:Ml=_n.stateNode.containerInfo,Ef=!0;break e}_n=_n.return}if(Ml===null)throw Error(n(160));EA(et,Mt,Ue),Ml=null,Ef=!1;var Un=Ue.alternate;Un!==null&&(Un.return=null),Ue.return=null}catch(xr){No(Ue,R,xr)}}if(R.subtreeFlags&12854)for(R=R.child;R!==null;)kA(R,_),R=R.sibling}function kA(_,R){var ne=_.alternate,ye=_.flags;switch(_.tag){case 0:case 11:case 14:case 15:if(Xu(R,_),kf(_),ye&4){try{Mp(3,_,_.return),yv(3,_)}catch(Bs){No(_,_.return,Bs)}try{Mp(5,_,_.return)}catch(Bs){No(_,_.return,Bs)}}break;case 1:Xu(R,_),kf(_),ye&512&&ne!==null&&pb(ne,ne.return);break;case 5:if(Xu(R,_),kf(_),ye&512&&ne!==null&&pb(ne,ne.return),_.flags&32){var Ue=_.stateNode;try{Ut(Ue,"")}catch(Bs){No(_,_.return,Bs)}}if(ye&4&&(Ue=_.stateNode,Ue!=null)){var et=_.memoizedProps,Mt=ne!==null?ne.memoizedProps:et,_n=_.type,Un=_.updateQueue;if(_.updateQueue=null,Un!==null)try{_n==="input"&&et.type==="radio"&&et.name!=null&&He(Ue,et),Ke(_n,Mt);var xr=Ke(_n,et);for(Mt=0;Mt<Un.length;Mt+=2){var Kr=Un[Mt],Jr=Un[Mt+1];Kr==="style"?xt(Ue,Jr):Kr==="dangerouslySetInnerHTML"?nt(Ue,Jr):Kr==="children"?Ut(Ue,Jr):I(Ue,Kr,Jr,xr)}switch(_n){case"input":qe(Ue,et);break;case"textarea":Hn(Ue,et);break;case"select":var Wr=Ue._wrapperState.wasMultiple;Ue._wrapperState.wasMultiple=!!et.multiple;var Ss=et.value;Ss!=null?jt(Ue,!!et.multiple,Ss,!1):Wr!==!!et.multiple&&(et.defaultValue!=null?jt(Ue,!!et.multiple,et.defaultValue,!0):jt(Ue,!!et.multiple,et.multiple?[]:"",!1))}Ue[Um]=et}catch(Bs){No(_,_.return,Bs)}}break;case 6:if(Xu(R,_),kf(_),ye&4){if(_.stateNode===null)throw Error(n(162));Ue=_.stateNode,et=_.memoizedProps;try{Ue.nodeValue=et}catch(Bs){No(_,_.return,Bs)}}break;case 3:if(Xu(R,_),kf(_),ye&4&&ne!==null&&ne.memoizedState.isDehydrated)try{Ct(R.containerInfo)}catch(Bs){No(_,_.return,Bs)}break;case 4:Xu(R,_),kf(_);break;case 13:Xu(R,_),kf(_),Ue=_.child,Ue.flags&8192&&(et=Ue.memoizedState!==null,Ue.stateNode.isHidden=et,!et||Ue.alternate!==null&&Ue.alternate.memoizedState!==null||(IA=Ce())),ye&4&&mb(_);break;case 22:if(Kr=ne!==null&&ne.memoizedState!==null,_.mode&1?(co=(xr=co)||Kr,Xu(R,_),co=xr):Xu(R,_),kf(_),ye&8192){if(xr=_.memoizedState!==null,(_.stateNode.isHidden=xr)&&!Kr&&_.mode&1)for(_s=_,Kr=_.child;Kr!==null;){for(Jr=_s=Kr;_s!==null;){switch(Wr=_s,Ss=Wr.child,Wr.tag){case 0:case 11:case 14:case 15:Mp(4,Wr,Wr.return);break;case 1:pb(Wr,Wr.return);var Fs=Wr.stateNode;if(typeof Fs.componentWillUnmount=="function"){ye=Wr,ne=Wr.return;try{R=ye,Fs.props=R.memoizedProps,Fs.state=R.memoizedState,Fs.componentWillUnmount()}catch(Bs){No(ye,ne,Bs)}}break;case 5:pb(Wr,Wr.return);break;case 22:if(Wr.memoizedState!==null){Ym(Jr);continue}}Ss!==null?(Ss.return=Wr,_s=Ss):Ym(Jr)}Kr=Kr.sibling}e:for(Kr=null,Jr=_;;){if(Jr.tag===5){if(Kr===null){Kr=Jr;try{Ue=Jr.stateNode,xr?(et=Ue.style,typeof et.setProperty=="function"?et.setProperty("display","none","important"):et.display="none"):(_n=Jr.stateNode,Un=Jr.memoizedProps.style,Mt=Un!=null&&Un.hasOwnProperty("display")?Un.display:null,_n.style.display=Vt("display",Mt))}catch(Bs){No(_,_.return,Bs)}}}else if(Jr.tag===6){if(Kr===null)try{Jr.stateNode.nodeValue=xr?"":Jr.memoizedProps}catch(Bs){No(_,_.return,Bs)}}else if((Jr.tag!==22&&Jr.tag!==23||Jr.memoizedState===null||Jr===_)&&Jr.child!==null){Jr.child.return=Jr,Jr=Jr.child;continue}if(Jr===_)break e;for(;Jr.sibling===null;){if(Jr.return===null||Jr.return===_)break e;Kr===Jr&&(Kr=null),Jr=Jr.return}Kr===Jr&&(Kr=null),Jr.sibling.return=Jr.return,Jr=Jr.sibling}}break;case 19:Xu(R,_),kf(_),ye&4&&mb(_);break;case 21:break;default:Xu(R,_),kf(_)}}function kf(_){var R=_.flags;if(R&2){try{e:{for(var ne=_.return;ne!==null;){if(QP(ne)){var ye=ne;break e}ne=ne.return}throw Error(n(160))}switch(ye.tag){case 5:var Ue=ye.stateNode;ye.flags&32&&(Ut(Ue,""),ye.flags&=-33);var et=ZP(_);D6(_,et,Ue);break;case 3:case 4:var Mt=ye.stateNode.containerInfo,_n=ZP(_);_A(_,_n,Mt);break;default:throw Error(n(161))}}catch(Un){No(_,_.return,Un)}_.flags&=-3}R&4096&&(_.flags&=-4097)}function B6(_,R,ne){_s=_,TA(_)}function TA(_,R,ne){for(var ye=(_.mode&1)!==0;_s!==null;){var Ue=_s,et=Ue.child;if(Ue.tag===22&&ye){var Mt=Ue.memoizedState!==null||L6;if(!Mt){var _n=Ue.alternate,Un=_n!==null&&_n.memoizedState!==null||co;_n=L6;var xr=co;if(L6=Mt,(co=Un)&&!xr)for(_s=Ue;_s!==null;)Mt=_s,Un=Mt.child,Mt.tag===22&&Mt.memoizedState!==null?JP(Ue):Un!==null?(Un.return=Mt,_s=Un):JP(Ue);for(;et!==null;)_s=et,TA(et),et=et.sibling;_s=Ue,L6=_n,co=xr}Tf(_)}else Ue.subtreeFlags&8772&&et!==null?(et.return=Ue,_s=et):Tf(_)}}function Tf(_){for(;_s!==null;){var R=_s;if(R.flags&8772){var ne=R.alternate;try{if(R.flags&8772)switch(R.tag){case 0:case 11:case 15:co||yv(5,R);break;case 1:var ye=R.stateNode;if(R.flags&4&&!co)if(ne===null)ye.componentDidMount();else{var Ue=R.elementType===R.type?ne.memoizedProps:Rd(R.type,ne.memoizedProps);ye.componentDidUpdate(Ue,ne.memoizedState,ye.__reactInternalSnapshotBeforeUpdate)}var et=R.updateQueue;et!==null&&nA(R,et,ye);break;case 3:var Mt=R.updateQueue;if(Mt!==null){if(ne=null,R.child!==null)switch(R.child.tag){case 5:ne=R.child.stateNode;break;case 1:ne=R.child.stateNode}nA(R,Mt,ne)}break;case 5:var _n=R.stateNode;if(ne===null&&R.flags&4){ne=_n;var Un=R.memoizedProps;switch(R.type){case"button":case"input":case"select":case"textarea":Un.autoFocus&&ne.focus();break;case"img":Un.src&&(ne.src=Un.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(R.memoizedState===null){var xr=R.alternate;if(xr!==null){var Kr=xr.memoizedState;if(Kr!==null){var Jr=Kr.dehydrated;Jr!==null&&Ct(Jr)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}co||R.flags&512&&R6(R)}catch(Wr){No(R,R.return,Wr)}}if(R===_){_s=null;break}if(ne=R.sibling,ne!==null){ne.return=R.return,_s=ne;break}_s=R.return}}function Ym(_){for(;_s!==null;){var R=_s;if(R===_){_s=null;break}var ne=R.sibling;if(ne!==null){ne.return=R.return,_s=ne;break}_s=R.return}}function JP(_){for(;_s!==null;){var R=_s;try{switch(R.tag){case 0:case 11:case 15:var ne=R.return;try{yv(4,R)}catch(Un){No(R,ne,Un)}break;case 1:var ye=R.stateNode;if(typeof ye.componentDidMount=="function"){var Ue=R.return;try{ye.componentDidMount()}catch(Un){No(R,Ue,Un)}}var et=R.return;try{R6(R)}catch(Un){No(R,et,Un)}break;case 5:var Mt=R.return;try{R6(R)}catch(Un){No(R,Mt,Un)}}}catch(Un){No(R,R.return,Un)}if(R===_){_s=null;break}var _n=R.sibling;if(_n!==null){_n.return=R.return,_s=_n;break}_s=R.return}}var eI=Math.ceil,$6=L.ReactCurrentDispatcher,PA=L.ReactCurrentOwner,Dd=L.ReactCurrentBatchConfig,ea=0,Ll=null,Jo=null,nc=0,Qu=0,xb=hu(0),xl=0,vv=null,Xm=0,wv=0,U6=0,Cv=null,bu=null,IA=0,Bx=1/0,Lp=null,z6=!1,FA=null,Qm=null,H6=!1,Zm=null,Kc=0,Nv=0,OA=null,V6=-1,Sv=0;function Yc(){return ea&6?Ce():V6!==-1?V6:V6=Ce()}function Jm(_){return _.mode&1?ea&2&&nc!==0?nc&-nc:FP.transition!==null?(Sv===0&&(Sv=Pe()),Sv):(_=wt,_!==0||(_=window.event,_=_===void 0?16:Yr(_.type)),_):1}function Pf(_,R,ne,ye){if(50<Nv)throw Nv=0,OA=null,Error(n(185));Te(_,ne,ye),(!(ea&2)||_!==Ll)&&(_===Ll&&(!(ea&2)&&(wv|=ne),xl===4&&e0(_,nc)),yu(_,ye),ne===1&&ea===0&&!(R.mode&1)&&(Bx=Ce()+500,d6&&Hm()))}function yu(_,R){var ne=_.callbackNode;ae(_,R);var ye=Oe(_,_===Ll?nc:0);if(ye===0)ne!==null&&jn(ne),_.callbackNode=null,_.callbackPriority=0;else if(R=ye&-ye,_.callbackPriority!==R){if(ne!=null&&jn(ne),R===1)_.tag===0?Ex(tI.bind(null,_)):TP(tI.bind(null,_)),o6(function(){!(ea&6)&&Hm()}),ne=null;else{switch(Dt(ye)){case 1:ne=p;break;case 4:ne=N;break;case 16:ne=A;break;case 536870912:ne=P;break;default:ne=A}ne=lI(ne,W6.bind(null,_))}_.callbackPriority=R,_.callbackNode=ne}}function W6(_,R){if(V6=-1,Sv=0,ea&6)throw Error(n(327));var ne=_.callbackNode;if(gb()&&_.callbackNode!==ne)return null;var ye=Oe(_,_===Ll?nc:0);if(ye===0)return null;if(ye&30||ye&_.expiredLanes||R)R=q6(_,ye);else{R=ye;var Ue=ea;ea|=2;var et=rI();(Ll!==_||nc!==R)&&(Lp=null,Bx=Ce()+500,Ux(_,R));do try{rH();break}catch(_n){nI(_,_n)}while(!0);Ep(),$6.current=et,ea=Ue,Jo!==null?R=0:(Ll=null,nc=0,R=xl)}if(R!==0){if(R===2&&(Ue=he(_),Ue!==0&&(ye=Ue,R=MA(_,Ue))),R===1)throw ne=vv,Ux(_,0),e0(_,ye),yu(_,Ce()),ne;if(R===6)e0(_,ye);else{if(Ue=_.current.alternate,!(ye&30)&&!tH(Ue)&&(R=q6(_,ye),R===2&&(et=he(_),et!==0&&(ye=et,R=MA(_,et))),R===1))throw ne=vv,Ux(_,0),e0(_,ye),yu(_,Ce()),ne;switch(_.finishedWork=Ue,_.finishedLanes=ye,R){case 0:case 1:throw Error(n(345));case 2:zx(_,bu,Lp);break;case 3:if(e0(_,ye),(ye&130023424)===ye&&(R=IA+500-Ce(),10<R)){if(Oe(_,0)!==0)break;if(Ue=_.suspendedLanes,(Ue&ye)!==ye){Yc(),_.pingedLanes|=_.suspendedLanes&Ue;break}_.timeoutHandle=Bm(zx.bind(null,_,bu,Lp),R);break}zx(_,bu,Lp);break;case 4:if(e0(_,ye),(ye&4194240)===ye)break;for(R=_.eventTimes,Ue=-1;0<ye;){var Mt=31-ce(ye);et=1<<Mt,Mt=R[Mt],Mt>Ue&&(Ue=Mt),ye&=~et}if(ye=Ue,ye=Ce()-ye,ye=(120>ye?120:480>ye?480:1080>ye?1080:1920>ye?1920:3e3>ye?3e3:4320>ye?4320:1960*eI(ye/1960))-ye,10<ye){_.timeoutHandle=Bm(zx.bind(null,_,bu,Lp),ye);break}zx(_,bu,Lp);break;case 5:zx(_,bu,Lp);break;default:throw Error(n(329))}}}return yu(_,Ce()),_.callbackNode===ne?W6.bind(null,_):null}function MA(_,R){var ne=Cv;return _.current.memoizedState.isDehydrated&&(Ux(_,R).flags|=256),_=q6(_,R),_!==2&&(R=bu,bu=ne,R!==null&&LA(R)),_}function LA(_){bu===null?bu=_:bu.push.apply(bu,_)}function tH(_){for(var R=_;;){if(R.flags&16384){var ne=R.updateQueue;if(ne!==null&&(ne=ne.stores,ne!==null))for(var ye=0;ye<ne.length;ye++){var Ue=ne[ye],et=Ue.getSnapshot;Ue=Ue.value;try{if(!sn(et(),Ue))return!1}catch{return!1}}}if(ne=R.child,R.subtreeFlags&16384&&ne!==null)ne.return=R,R=ne;else{if(R===_)break;for(;R.sibling===null;){if(R.return===null||R.return===_)return!0;R=R.return}R.sibling.return=R.return,R=R.sibling}}return!0}function e0(_,R){for(R&=~U6,R&=~wv,_.suspendedLanes|=R,_.pingedLanes&=~R,_=_.expirationTimes;0<R;){var ne=31-ce(R),ye=1<<ne;_[ne]=-1,R&=~ye}}function tI(_){if(ea&6)throw Error(n(327));gb();var R=Oe(_,0);if(!(R&1))return yu(_,Ce()),null;var ne=q6(_,R);if(_.tag!==0&&ne===2){var ye=he(_);ye!==0&&(R=ye,ne=MA(_,ye))}if(ne===1)throw ne=vv,Ux(_,0),e0(_,R),yu(_,Ce()),ne;if(ne===6)throw Error(n(345));return _.finishedWork=_.current.alternate,_.finishedLanes=R,zx(_,bu,Lp),yu(_,Ce()),null}function RA(_,R){var ne=ea;ea|=1;try{return _(R)}finally{ea=ne,ea===0&&(Bx=Ce()+500,d6&&Hm())}}function $x(_){Zm!==null&&Zm.tag===0&&!(ea&6)&&gb();var R=ea;ea|=1;var ne=Dd.transition,ye=wt;try{if(Dd.transition=null,wt=1,_)return _()}finally{wt=ye,Dd.transition=ne,ea=R,!(ea&6)&&Hm()}}function DA(){Qu=xb.current,Za(xb)}function Ux(_,R){_.finishedWork=null,_.finishedLanes=0;var ne=_.timeoutHandle;if(ne!==-1&&(_.timeoutHandle=-1,J2(ne)),Jo!==null)for(ne=Jo.return;ne!==null;){var ye=ne;switch(Px(ye),ye.tag){case 1:ye=ye.type.childContextTypes,ye!=null&&u6();break;case 3:qm(),Za(pu),Za(yc),w6();break;case 5:v6(ye);break;case 4:qm();break;case 13:Za(lo);break;case 19:Za(lo);break;case 10:x6(ye.type._context);break;case 22:case 23:DA()}ne=ne.return}if(Ll=_,Jo=_=If(_.current,null),nc=Qu=R,xl=0,vv=null,U6=wv=Xm=0,bu=Cv=null,Fx!==null){for(R=0;R<Fx.length;R++)if(ne=Fx[R],ye=ne.interleaved,ye!==null){ne.interleaved=null;var Ue=ye.next,et=ne.pending;if(et!==null){var Mt=et.next;et.next=Ue,ye.next=Mt}ne.pending=ye}Fx=null}return _}function nI(_,R){do{var ne=Jo;try{if(Ep(),av.current=_6,ab){for(var ye=Co.memoizedState;ye!==null;){var Ue=ye.queue;Ue!==null&&(Ue.pending=null),ye=ye.next}ab=!1}if(Gm=0,ml=zo=Co=null,ov=!1,Mx=0,PA.current=null,ne===null||ne.return===null){xl=1,vv=R,Jo=null;break}e:{var et=_,Mt=ne.return,_n=ne,Un=R;if(R=nc,_n.flags|=32768,Un!==null&&typeof Un=="object"&&typeof Un.then=="function"){var xr=Un,Kr=_n,Jr=Kr.tag;if(!(Kr.mode&1)&&(Jr===0||Jr===11||Jr===15)){var Wr=Kr.alternate;Wr?(Kr.updateQueue=Wr.updateQueue,Kr.memoizedState=Wr.memoizedState,Kr.lanes=Wr.lanes):(Kr.updateQueue=null,Kr.memoizedState=null)}var Ss=VP(Mt);if(Ss!==null){Ss.flags&=-257,bA(Ss,Mt,_n,et,R),Ss.mode&1&&fv(et,xr,R),R=Ss,Un=xr;var Fs=R.updateQueue;if(Fs===null){var Bs=new Set;Bs.add(Un),R.updateQueue=Bs}else Fs.add(Un);break e}else{if(!(R&1)){fv(et,xr,R),BA();break e}Un=Error(n(426))}}else if(Ja&&_n.mode&1){var Io=VP(Mt);if(Io!==null){!(Io.flags&65536)&&(Io.flags|=256),bA(Io,Mt,_n,et,R),xh(Dx(Un,_n));break e}}et=Un=Dx(Un,_n),xl!==4&&(xl=2),Cv===null?Cv=[et]:Cv.push(et),et=Mt;do{switch(et.tag){case 3:et.flags|=65536,R&=-R,et.lanes|=R;var cr=dv(et,Un,R);LP(et,cr);break e;case 1:_n=Un;var Kn=et.type,fr=et.stateNode;if(!(et.flags&128)&&(typeof Kn.getDerivedStateFromError=="function"||fr!==null&&typeof fr.componentDidCatch=="function"&&(Qm===null||!Qm.has(fr)))){et.flags|=65536,R&=-R,et.lanes|=R;var is=I6(et,_n,R);LP(et,is);break e}}et=et.return}while(et!==null)}iI(ne)}catch($s){R=$s,Jo===ne&&ne!==null&&(Jo=ne=ne.return);continue}break}while(!0)}function rI(){var _=$6.current;return $6.current=_6,_===null?_6:_}function BA(){(xl===0||xl===3||xl===2)&&(xl=4),Ll===null||!(Xm&268435455)&&!(wv&268435455)||e0(Ll,nc)}function q6(_,R){var ne=ea;ea|=2;var ye=rI();(Ll!==_||nc!==R)&&(Lp=null,Ux(_,R));do try{nH();break}catch(Ue){nI(_,Ue)}while(!0);if(Ep(),ea=ne,$6.current=ye,Jo!==null)throw Error(n(261));return Ll=null,nc=0,xl}function nH(){for(;Jo!==null;)sI(Jo)}function rH(){for(;Jo!==null&&!kt();)sI(Jo)}function sI(_){var R=oI(_.alternate,_,Qu);_.memoizedProps=_.pendingProps,R===null?iI(_):Jo=R,PA.current=null}function iI(_){var R=_;do{var ne=R.alternate;if(_=R.return,R.flags&32768){if(ne=Jz(ne,R),ne!==null){ne.flags&=32767,Jo=ne;return}if(_!==null)_.flags|=32768,_.subtreeFlags=0,_.deletions=null;else{xl=6,Jo=null;return}}else if(ne=Zz(ne,R,Qu),ne!==null){Jo=ne;return}if(R=R.sibling,R!==null){Jo=R;return}Jo=R=_}while(R!==null);xl===0&&(xl=5)}function zx(_,R,ne){var ye=wt,Ue=Dd.transition;try{Dd.transition=null,wt=1,sH(_,R,ne,ye)}finally{Dd.transition=Ue,wt=ye}return null}function sH(_,R,ne,ye){do gb();while(Zm!==null);if(ea&6)throw Error(n(327));ne=_.finishedWork;var Ue=_.finishedLanes;if(ne===null)return null;if(_.finishedWork=null,_.finishedLanes=0,ne===_.current)throw Error(n(177));_.callbackNode=null,_.callbackPriority=0;var et=ne.lanes|ne.childLanes;if(Ze(_,et),_===Ll&&(Jo=Ll=null,nc=0),!(ne.subtreeFlags&2064)&&!(ne.flags&2064)||H6||(H6=!0,lI(A,function(){return gb(),null})),et=(ne.flags&15990)!==0,ne.subtreeFlags&15990||et){et=Dd.transition,Dd.transition=null;var Mt=wt;wt=1;var _n=ea;ea|=4,PA.current=null,eH(_,ne),kA(ne,_),xc(_x),qn=!!Q2,_x=Q2=null,_.current=ne,B6(ne),cn(),ea=_n,wt=Mt,Dd.transition=et}else _.current=ne;if(H6&&(H6=!1,Zm=_,Kc=Ue),et=_.pendingLanes,et===0&&(Qm=null),Z(ne.stateNode),yu(_,Ce()),R!==null)for(ye=_.onRecoverableError,ne=0;ne<R.length;ne++)Ue=R[ne],ye(Ue.value,{componentStack:Ue.stack,digest:Ue.digest});if(z6)throw z6=!1,_=FA,FA=null,_;return Kc&1&&_.tag!==0&&gb(),et=_.pendingLanes,et&1?_===OA?Nv++:(Nv=0,OA=_):Nv=0,Hm(),null}function gb(){if(Zm!==null){var _=Dt(Kc),R=Dd.transition,ne=wt;try{if(Dd.transition=null,wt=16>_?16:_,Zm===null)var ye=!1;else{if(_=Zm,Zm=null,Kc=0,ea&6)throw Error(n(331));var Ue=ea;for(ea|=4,_s=_.current;_s!==null;){var et=_s,Mt=et.child;if(_s.flags&16){var _n=et.deletions;if(_n!==null){for(var Un=0;Un<_n.length;Un++){var xr=_n[Un];for(_s=xr;_s!==null;){var Kr=_s;switch(Kr.tag){case 0:case 11:case 15:Mp(8,Kr,et)}var Jr=Kr.child;if(Jr!==null)Jr.return=Kr,_s=Jr;else for(;_s!==null;){Kr=_s;var Wr=Kr.sibling,Ss=Kr.return;if(XP(Kr),Kr===xr){_s=null;break}if(Wr!==null){Wr.return=Ss,_s=Wr;break}_s=Ss}}}var Fs=et.alternate;if(Fs!==null){var Bs=Fs.child;if(Bs!==null){Fs.child=null;do{var Io=Bs.sibling;Bs.sibling=null,Bs=Io}while(Bs!==null)}}_s=et}}if(et.subtreeFlags&2064&&Mt!==null)Mt.return=et,_s=Mt;else e:for(;_s!==null;){if(et=_s,et.flags&2048)switch(et.tag){case 0:case 11:case 15:Mp(9,et,et.return)}var cr=et.sibling;if(cr!==null){cr.return=et.return,_s=cr;break e}_s=et.return}}var Kn=_.current;for(_s=Kn;_s!==null;){Mt=_s;var fr=Mt.child;if(Mt.subtreeFlags&2064&&fr!==null)fr.return=Mt,_s=fr;else e:for(Mt=Kn;_s!==null;){if(_n=_s,_n.flags&2048)try{switch(_n.tag){case 0:case 11:case 15:yv(9,_n)}}catch($s){No(_n,_n.return,$s)}if(_n===Mt){_s=null;break e}var is=_n.sibling;if(is!==null){is.return=_n.return,_s=is;break e}_s=_n.return}}if(ea=Ue,Hm(),V&&typeof V.onPostCommitFiberRoot=="function")try{V.onPostCommitFiberRoot(D,_)}catch{}ye=!0}return ye}finally{wt=ne,Dd.transition=R}}return!1}function G6(_,R,ne){R=Dx(ne,R),R=dv(_,R,1),_=Md(_,R,1),R=Yc(),_!==null&&(Te(_,1,R),yu(_,R))}function No(_,R,ne){if(_.tag===3)G6(_,_,ne);else for(;R!==null;){if(R.tag===3){G6(R,_,ne);break}else if(R.tag===1){var ye=R.stateNode;if(typeof R.type.getDerivedStateFromError=="function"||typeof ye.componentDidCatch=="function"&&(Qm===null||!Qm.has(ye))){_=Dx(ne,_),_=I6(R,_,1),R=Md(R,_,1),_=Yc(),R!==null&&(Te(R,1,_),yu(R,_));break}}R=R.return}}function iH(_,R,ne){var ye=_.pingCache;ye!==null&&ye.delete(R),R=Yc(),_.pingedLanes|=_.suspendedLanes&ne,Ll===_&&(nc&ne)===ne&&(xl===4||xl===3&&(nc&130023424)===nc&&500>Ce()-IA?Ux(_,0):U6|=ne),yu(_,R)}function aI(_,R){R===0&&(_.mode&1?(R=Le,Le<<=1,!(Le&130023424)&&(Le=4194304)):R=1);var ne=Yc();_=kp(_,R),_!==null&&(Te(_,R,ne),yu(_,ne))}function aH(_){var R=_.memoizedState,ne=0;R!==null&&(ne=R.retryLane),aI(_,ne)}function oH(_,R){var ne=0;switch(_.tag){case 13:var ye=_.stateNode,Ue=_.memoizedState;Ue!==null&&(ne=Ue.retryLane);break;case 19:ye=_.stateNode;break;default:throw Error(n(314))}ye!==null&&ye.delete(R),aI(_,ne)}var oI;oI=function(_,R,ne){if(_!==null)if(_.memoizedProps!==R.pendingProps||pu.current)qc=!0;else{if(!(_.lanes&ne)&&!(R.flags&128))return qc=!1,GP(_,R,ne);qc=!!(_.flags&131072)}else qc=!1,Ja&&R.flags&1048576&&PP(R,h6,R.index);switch(R.lanes=0,R.tag){case 2:var ye=R.type;M6(_,R),_=R.pendingProps;var Ue=tb(R,yc.current);Wm(R,ne),Ue=Lx(null,R,ye,_,Ue,ne);var et=C6();return R.flags|=1,typeof Ue=="object"&&Ue!==null&&typeof Ue.render=="function"&&Ue.$$typeof===void 0?(R.tag=1,R.memoizedState=null,R.updateQueue=null,mu(ye)?(et=!0,Td(R)):et=!1,R.memoizedState=Ue.state!==null&&Ue.state!==void 0?Ue.state:null,b6(R),Ue.updater=T6,R.stateNode=Ue,Ue._reactInternals=R,gA(R,ye,_,ne),R=SA(null,R,ye,!0,et,ne)):(R.tag=0,Ja&&et&&ev(R),Jl(null,R,Ue,ne),R=R.child),R;case 16:ye=R.elementType;e:{switch(M6(_,R),_=R.pendingProps,Ue=ye._init,ye=Ue(ye._payload),R.type=ye,Ue=R.tag=cH(ye),_=Rd(ye,_),Ue){case 0:R=CA(null,R,ye,_,ne);break e;case 1:R=NA(null,R,ye,_,ne);break e;case 11:R=WP(null,R,ye,_,ne);break e;case 14:R=yA(null,R,ye,Rd(ye.type,_),ne);break e}throw Error(n(306,ye,""))}return R;case 0:return ye=R.type,Ue=R.pendingProps,Ue=R.elementType===ye?Ue:Rd(ye,Ue),CA(_,R,ye,Ue,ne);case 1:return ye=R.type,Ue=R.pendingProps,Ue=R.elementType===ye?Ue:Rd(ye,Ue),NA(_,R,ye,Ue,ne);case 3:e:{if(qP(R),_===null)throw Error(n(387));ye=R.pendingProps,et=R.memoizedState,Ue=et.element,MP(_,R),sb(R,ye,null,ne);var Mt=R.memoizedState;if(ye=Mt.element,et.isDehydrated)if(et={element:ye,isDehydrated:!1,cache:Mt.cache,pendingSuspenseBoundaries:Mt.pendingSuspenseBoundaries,transitions:Mt.transitions},R.updateQueue.baseState=et,R.memoizedState=et,R.flags&256){Ue=Dx(Error(n(423)),R),R=wh(_,R,ye,ne,Ue);break e}else if(ye!==Ue){Ue=Dx(Error(n(424)),R),R=wh(_,R,ye,ne,Ue);break e}else for(Ku=$m(R.stateNode.containerInfo.firstChild),wc=R,Ja=!0,jf=null,ne=m6(R,null,ye,ne),R.child=ne;ne;)ne.flags=ne.flags&-3|4096,ne=ne.sibling;else{if(mh(),ye===Ue){R=_f(_,R,ne);break e}Jl(_,R,ye,ne)}R=R.child}return R;case 5:return sA(R),_===null&&xu(R),ye=R.type,Ue=R.pendingProps,et=_!==null?_.memoizedProps:null,Mt=Ue.children,Z2(ye,Ue)?Mt=null:et!==null&&Z2(ye,et)&&(R.flags|=32),wA(_,R),Jl(_,R,Mt,ne),R.child;case 6:return _===null&&xu(R),null;case 13:return O6(_,R,ne);case 4:return rA(R,R.stateNode.containerInfo),ye=R.pendingProps,_===null?R.child=Po(R,null,ye,ne):Jl(_,R,ye,ne),R.child;case 11:return ye=R.type,Ue=R.pendingProps,Ue=R.elementType===ye?Ue:Rd(ye,Ue),WP(_,R,ye,Ue,ne);case 7:return Jl(_,R,R.pendingProps,ne),R.child;case 8:return Jl(_,R,R.pendingProps.children,ne),R.child;case 12:return Jl(_,R,R.pendingProps.children,ne),R.child;case 10:e:{if(ye=R.type._context,Ue=R.pendingProps,et=R.memoizedProps,Mt=Ue.value,Wa(rv,ye._currentValue),ye._currentValue=Mt,et!==null)if(sn(et.value,Mt)){if(et.children===Ue.children&&!pu.current){R=_f(_,R,ne);break e}}else for(et=R.child,et!==null&&(et.return=R);et!==null;){var _n=et.dependencies;if(_n!==null){Mt=et.child;for(var Un=_n.firstContext;Un!==null;){if(Un.context===ye){if(et.tag===1){Un=Tp(-1,ne&-ne),Un.tag=2;var xr=et.updateQueue;if(xr!==null){xr=xr.shared;var Kr=xr.pending;Kr===null?Un.next=Un:(Un.next=Kr.next,Kr.next=Un),xr.pending=Un}}et.lanes|=ne,Un=et.alternate,Un!==null&&(Un.lanes|=ne),Zl(et.return,ne,R),_n.lanes|=ne;break}Un=Un.next}}else if(et.tag===10)Mt=et.type===R.type?null:et.child;else if(et.tag===18){if(Mt=et.return,Mt===null)throw Error(n(341));Mt.lanes|=ne,_n=Mt.alternate,_n!==null&&(_n.lanes|=ne),Zl(Mt,ne,R),Mt=et.sibling}else Mt=et.child;if(Mt!==null)Mt.return=et;else for(Mt=et;Mt!==null;){if(Mt===R){Mt=null;break}if(et=Mt.sibling,et!==null){et.return=Mt.return,Mt=et;break}Mt=Mt.return}et=Mt}Jl(_,R,Ue.children,ne),R=R.child}return R;case 9:return Ue=R.type,ye=R.pendingProps.children,Wm(R,ne),Ue=Fd(Ue),ye=ye(Ue),R.flags|=1,Jl(_,R,ye,ne),R.child;case 14:return ye=R.type,Ue=Rd(ye,R.pendingProps),Ue=Rd(ye.type,Ue),yA(_,R,ye,Ue,ne);case 15:return vh(_,R,R.type,R.pendingProps,ne);case 17:return ye=R.type,Ue=R.pendingProps,Ue=R.elementType===ye?Ue:Rd(ye,Ue),M6(_,R),R.tag=1,mu(ye)?(_=!0,Td(R)):_=!1,Wm(R,ne),Rx(R,ye,Ue),gA(R,ye,Ue,ne),SA(null,R,ye,!0,_,ne);case 19:return Km(_,R,ne);case 22:return vA(_,R,ne)}throw Error(n(156,R.tag))};function lI(_,R){return Wt(_,R)}function lH(_,R,ne,ye){this.tag=_,this.key=ne,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=ye,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bd(_,R,ne,ye){return new lH(_,R,ne,ye)}function K6(_){return _=_.prototype,!(!_||!_.isReactComponent)}function cH(_){if(typeof _=="function")return K6(_)?1:0;if(_!=null){if(_=_.$$typeof,_===q)return 11;if(_===G)return 14}return 2}function If(_,R){var ne=_.alternate;return ne===null?(ne=Bd(_.tag,R,_.key,_.mode),ne.elementType=_.elementType,ne.type=_.type,ne.stateNode=_.stateNode,ne.alternate=_,_.alternate=ne):(ne.pendingProps=R,ne.type=_.type,ne.flags=0,ne.subtreeFlags=0,ne.deletions=null),ne.flags=_.flags&14680064,ne.childLanes=_.childLanes,ne.lanes=_.lanes,ne.child=_.child,ne.memoizedProps=_.memoizedProps,ne.memoizedState=_.memoizedState,ne.updateQueue=_.updateQueue,R=_.dependencies,ne.dependencies=R===null?null:{lanes:R.lanes,firstContext:R.firstContext},ne.sibling=_.sibling,ne.index=_.index,ne.ref=_.ref,ne}function Y6(_,R,ne,ye,Ue,et){var Mt=2;if(ye=_,typeof _=="function")K6(_)&&(Mt=1);else if(typeof _=="string")Mt=5;else e:switch(_){case O:return Hx(ne.children,Ue,et,R);case U:Mt=8,Ue|=8;break;case Y:return _=Bd(12,ne,R,Ue|2),_.elementType=Y,_.lanes=et,_;case te:return _=Bd(13,ne,R,Ue),_.elementType=te,_.lanes=et,_;case fe:return _=Bd(19,ne,R,Ue),_.elementType=fe,_.lanes=et,_;case oe:return X6(ne,Ue,et,R);default:if(typeof _=="object"&&_!==null)switch(_.$$typeof){case re:Mt=10;break e;case Q:Mt=9;break e;case q:Mt=11;break e;case G:Mt=14;break e;case ie:Mt=16,ye=null;break e}throw Error(n(130,_==null?_:typeof _,""))}return R=Bd(Mt,ne,R,Ue),R.elementType=_,R.type=ye,R.lanes=et,R}function Hx(_,R,ne,ye){return _=Bd(7,_,ye,R),_.lanes=ne,_}function X6(_,R,ne,ye){return _=Bd(22,_,ye,R),_.elementType=oe,_.lanes=ne,_.stateNode={isHidden:!1},_}function $A(_,R,ne){return _=Bd(6,_,null,R),_.lanes=ne,_}function UA(_,R,ne){return R=Bd(4,_.children!==null?_.children:[],_.key,R),R.lanes=ne,R.stateNode={containerInfo:_.containerInfo,pendingChildren:null,implementation:_.implementation},R}function uH(_,R,ne,ye,Ue){this.tag=R,this.containerInfo=_,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ve(0),this.expirationTimes=Ve(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ve(0),this.identifierPrefix=ye,this.onRecoverableError=Ue,this.mutableSourceEagerHydrationData=null}function zA(_,R,ne,ye,Ue,et,Mt,_n,Un){return _=new uH(_,R,ne,_n,Un),R===1?(R=1,et===!0&&(R|=8)):R=0,et=Bd(3,null,null,R),_.current=et,et.stateNode=_,et.memoizedState={element:ye,isDehydrated:ne,cache:null,transitions:null,pendingSuspenseBoundaries:null},b6(et),_}function dH(_,R,ne){var ye=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:ye==null?null:""+ye,children:_,containerInfo:R,implementation:ne}}function cI(_){if(!_)return zm;_=_._reactInternals;e:{if(Ft(_)!==_||_.tag!==1)throw Error(n(170));var R=_;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(_.tag===1){var ne=_.type;if(mu(ne))return EP(_,ne,R)}return R}function uI(_,R,ne,ye,Ue,et,Mt,_n,Un){return _=zA(ne,ye,!0,_,Ue,et,Mt,_n,Un),_.context=cI(null),ne=_.current,ye=Yc(),Ue=Jm(ne),et=Tp(ye,Ue),et.callback=R??null,Md(ne,et,Ue),_.current.lanes=Ue,Te(_,Ue,ye),yu(_,ye),_}function Q6(_,R,ne,ye){var Ue=R.current,et=Yc(),Mt=Jm(Ue);return ne=cI(ne),R.context===null?R.context=ne:R.pendingContext=ne,R=Tp(et,Mt),R.payload={element:_},ye=ye===void 0?null:ye,ye!==null&&(R.callback=ye),_=Md(Ue,R,Mt),_!==null&&(Pf(_,Ue,Mt,et),y6(_,Ue,Mt)),Mt}function Z6(_){if(_=_.current,!_.child)return null;switch(_.child.tag){case 5:return _.child.stateNode;default:return _.child.stateNode}}function dI(_,R){if(_=_.memoizedState,_!==null&&_.dehydrated!==null){var ne=_.retryLane;_.retryLane=ne!==0&&ne<R?ne:R}}function HA(_,R){dI(_,R),(_=_.alternate)&&dI(_,R)}var fI=typeof reportError=="function"?reportError:function(_){console.error(_)};function VA(_){this._internalRoot=_}jv.prototype.render=VA.prototype.render=function(_){var R=this._internalRoot;if(R===null)throw Error(n(409));Q6(_,R,null,null)},jv.prototype.unmount=VA.prototype.unmount=function(){var _=this._internalRoot;if(_!==null){this._internalRoot=null;var R=_.containerInfo;$x(function(){Q6(null,_,null,null)}),R[Gu]=null}};function jv(_){this._internalRoot=_}jv.prototype.unstable_scheduleHydration=function(_){if(_){var R=An();_={blockedOn:null,target:_,priority:R};for(var ne=0;ne<Gr.length&&R!==0&&R<Gr[ne].priority;ne++);Gr.splice(ne,0,_),ne===0&&en(_)}};function J6(_){return!(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11)}function eC(_){return!(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11&&(_.nodeType!==8||_.nodeValue!==" react-mount-point-unstable "))}function hI(){}function fH(_,R,ne,ye,Ue){if(Ue){if(typeof ye=="function"){var et=ye;ye=function(){var xr=Z6(Mt);et.call(xr)}}var Mt=uI(R,ye,_,0,null,!1,!1,"",hI);return _._reactRootContainer=Mt,_[Gu]=Mt.current,Dm(_.nodeType===8?_.parentNode:_),$x(),Mt}for(;Ue=_.lastChild;)_.removeChild(Ue);if(typeof ye=="function"){var _n=ye;ye=function(){var xr=Z6(Un);_n.call(xr)}}var Un=zA(_,0,!1,null,null,!1,!1,"",hI);return _._reactRootContainer=Un,_[Gu]=Un.current,Dm(_.nodeType===8?_.parentNode:_),$x(function(){Q6(R,Un,ne,ye)}),Un}function tC(_,R,ne,ye,Ue){var et=ne._reactRootContainer;if(et){var Mt=et;if(typeof Ue=="function"){var _n=Ue;Ue=function(){var Un=Z6(Mt);_n.call(Un)}}Q6(R,Mt,_,Ue)}else Mt=fH(ne,R,_,Ue,ye);return Z6(Mt)}Qt=function(_){switch(_.tag){case 3:var R=_.stateNode;if(R.current.memoizedState.isDehydrated){var ne=Xe(R.pendingLanes);ne!==0&&(it(R,ne|1),yu(R,Ce()),!(ea&6)&&(Bx=Ce()+500,Hm()))}break;case 13:$x(function(){var ye=kp(_,1);if(ye!==null){var Ue=Yc();Pf(ye,_,1,Ue)}}),HA(_,1)}},xn=function(_){if(_.tag===13){var R=kp(_,134217728);if(R!==null){var ne=Yc();Pf(R,_,134217728,ne)}HA(_,134217728)}},pn=function(_){if(_.tag===13){var R=Jm(_),ne=kp(_,R);if(ne!==null){var ye=Yc();Pf(ne,_,R,ye)}HA(_,R)}},An=function(){return wt},or=function(_,R){var ne=wt;try{return wt=_,R()}finally{wt=ne}},Ht=function(_,R,ne){switch(R){case"input":if(qe(_,ne),R=ne.name,ne.type==="radio"&&R!=null){for(ne=_;ne.parentNode;)ne=ne.parentNode;for(ne=ne.querySelectorAll("input[name="+JSON.stringify(""+R)+'][type="radio"]'),R=0;R<ne.length;R++){var ye=ne[R];if(ye!==_&&ye.form===_.form){var Ue=c6(ye);if(!Ue)throw Error(n(90));Ye(ye),qe(ye,Ue)}}}break;case"textarea":Hn(_,ne);break;case"select":R=ne.value,R!=null&&jt(_,!!ne.multiple,R,!1)}},Rn=RA,Mn=$x;var nC={usingClientEntryPoint:!1,Events:[bc,_i,c6,Cn,En,RA]},Av={findFiberByHostInstance:dh,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hH={bundleType:Av.bundleType,version:Av.version,rendererPackageName:Av.rendererPackageName,rendererConfig:Av.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:L.ReactCurrentDispatcher,findHostInstanceByFiber:function(_){return _=mn(_),_===null?null:_.stateNode},findFiberByHostInstance:Av.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 rC=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rC.isDisabled&&rC.supportsFiber)try{D=rC.inject(hH),V=rC}catch{}}return Hd.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=nC,Hd.createPortal=function(_,R){var ne=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!J6(R))throw Error(n(200));return dH(_,R,null,ne)},Hd.createRoot=function(_,R){if(!J6(_))throw Error(n(299));var ne=!1,ye="",Ue=fI;return R!=null&&(R.unstable_strictMode===!0&&(ne=!0),R.identifierPrefix!==void 0&&(ye=R.identifierPrefix),R.onRecoverableError!==void 0&&(Ue=R.onRecoverableError)),R=zA(_,1,!1,null,null,ne,!1,ye,Ue),_[Gu]=R.current,Dm(_.nodeType===8?_.parentNode:_),new VA(R)},Hd.findDOMNode=function(_){if(_==null)return null;if(_.nodeType===1)return _;var R=_._reactInternals;if(R===void 0)throw typeof _.render=="function"?Error(n(188)):(_=Object.keys(_).join(","),Error(n(268,_)));return _=mn(R),_=_===null?null:_.stateNode,_},Hd.flushSync=function(_){return $x(_)},Hd.hydrate=function(_,R,ne){if(!eC(R))throw Error(n(200));return tC(null,_,R,!0,ne)},Hd.hydrateRoot=function(_,R,ne){if(!J6(_))throw Error(n(405));var ye=ne!=null&&ne.hydratedSources||null,Ue=!1,et="",Mt=fI;if(ne!=null&&(ne.unstable_strictMode===!0&&(Ue=!0),ne.identifierPrefix!==void 0&&(et=ne.identifierPrefix),ne.onRecoverableError!==void 0&&(Mt=ne.onRecoverableError)),R=uI(R,null,_,1,ne??null,Ue,!1,et,Mt),_[Gu]=R.current,Dm(_),ye)for(_=0;_<ye.length;_++)ne=ye[_],Ue=ne._getVersion,Ue=Ue(ne._source),R.mutableSourceEagerHydrationData==null?R.mutableSourceEagerHydrationData=[ne,Ue]:R.mutableSourceEagerHydrationData.push(ne,Ue);return new jv(R)},Hd.render=function(_,R,ne){if(!eC(R))throw Error(n(200));return tC(null,_,R,!1,ne)},Hd.unmountComponentAtNode=function(_){if(!eC(_))throw Error(n(40));return _._reactRootContainer?($x(function(){tC(null,null,_,!1,function(){_._reactRootContainer=null,_[Gu]=null})}),!0):!1},Hd.unstable_batchedUpdates=RA,Hd.unstable_renderSubtreeIntoContainer=function(_,R,ne,ye){if(!eC(ne))throw Error(n(200));if(_==null||_._reactInternals===void 0)throw Error(n(38));return tC(_,R,ne,!1,ye)},Hd.version="18.3.1-next-f1338f8080-20240426",Hd}var whe;function DAe(){if(whe)return kH.exports;whe=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(),kH.exports=EQe(),kH.exports}var Che;function kQe(){if(Che)return gI;Che=1;var t=DAe();return gI.createRoot=t.createRoot,gI.hydrateRoot=t.hydrateRoot,gI}var die=kQe(),h=bx();const ke=Pi(h),Gy=RAe({__proto__:null,default:ke},[h]);var Ea=DAe();const fie=Pi(Ea);/**
* @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 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)}var Ay;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Ay||(Ay={}));const Nhe="popstate";function TQe(t){t===void 0&&(t={});function e(r,s){let{pathname:a,search:o,hash:l}=r.location;return WZ("",{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:VM(s)}return IQe(e,n,null,t)}function Yo(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function BAe(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function PQe(){return Math.random().toString(36).substr(2,8)}function She(t,e){return{usr:t.state,key:t.key,idx:e}}function WZ(t,e,n,r){return n===void 0&&(n=null),u9({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ij(e):e,{state:n,key:e&&e.key||r||PQe()})}function VM(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 Ij(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 IQe(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:a=!1}=r,o=s.history,l=Ay.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(u9({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Ay.Pop;let C=d(),S=C==null?null:C-u;u=C,c&&c({action:l,location:v.location,delta:S})}function x(C,S){l=Ay.Push;let T=WZ(v.location,C,S);u=d()+1;let I=She(T,u),L=v.createHref(T);try{o.pushState(I,"",L)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;s.location.assign(L)}a&&c&&c({action:l,location:v.location,delta:1})}function g(C,S){l=Ay.Replace;let T=WZ(v.location,C,S);u=d();let I=She(T,u),L=v.createHref(T);o.replaceState(I,"",L),a&&c&&c({action:l,location:v.location,delta:0})}function y(C){let S=s.location.origin!=="null"?s.location.origin:s.location.href,T=typeof C=="string"?C:VM(C);return T=T.replace(/ $/,"%20"),Yo(S,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,S)}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(Nhe,f),c=C,()=>{s.removeEventListener(Nhe,f),c=null}},createHref(C){return e(s,C)},createURL:y,encodeLocation(C){let S=y(C);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:x,replace:g,go(C){return o.go(C)}};return v}var jhe;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(jhe||(jhe={}));function FQe(t,e,n){return n===void 0&&(n="/"),OQe(t,e,n)}function OQe(t,e,n,r){let s=typeof e=="string"?Ij(e):e,a=ZN(s.pathname||"/",n);if(a==null)return null;let o=$Ae(t);MQe(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=qQe(a);l=VQe(o[c],u)}return l}function $Ae(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("/")&&(Yo(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=Ry([r,c.relativePath]),d=n.concat(c);a.children&&a.children.length>0&&(Yo(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),$Ae(a.children,e,d,u)),!(a.path==null&&!a.index)&&e.push({path:u,score:zQe(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 UAe(a.path))s(a,o,c)}),e}function UAe(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=UAe(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 MQe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:HQe(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const LQe=/^:[\w-]+$/,RQe=3,DQe=2,BQe=1,$Qe=10,UQe=-2,Ahe=t=>t==="*";function zQe(t,e){let n=t.split("/"),r=n.length;return n.some(Ahe)&&(r+=UQe),e&&(r+=DQe),n.filter(s=>!Ahe(s)).reduce((s,a)=>s+(LQe.test(a)?RQe:a===""?BQe:$Qe),r)}function HQe(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=qZ({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:Ry([a,f.pathname]),pathnameBase:XQe(Ry([a,f.pathnameBase])),route:x}),f.pathnameBase!=="/"&&(a=Ry([a,f.pathnameBase]))}return o}function qZ(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),BAe(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 qQe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return BAe(!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 ZN(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 GQe(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?Ij(t):t;return{pathname:n?n.startsWith("/")?n:KQe(n,e):e,search:QQe(r),hash:ZQe(s)}}function KQe(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 IH(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 YQe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function hie(t,e){let n=YQe(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function pie(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=Ij(t):(s=u9({},t),Yo(!s.pathname||!s.pathname.includes("?"),IH("?","pathname","search",s)),Yo(!s.pathname||!s.pathname.includes("#"),IH("#","pathname","hash",s)),Yo(!s.search||!s.search.includes("#"),IH("#","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=GQe(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Ry=t=>t.join("/").replace(/\/\/+/g,"/"),XQe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),QQe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ZQe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function JQe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const zAe=["post","put","patch","delete"];new Set(zAe);const eZe=["get",...zAe];new Set(eZe);/**
* 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 d9(){return d9=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},d9.apply(this,arguments)}const PB=h.createContext(null),HAe=h.createContext(null),F1=h.createContext(null),IB=h.createContext(null),yx=h.createContext({outlet:null,matches:[],isDataRoute:!1}),VAe=h.createContext(null);function tZe(t,e){let{relative:n}=e===void 0?{}:e;Fj()||Yo(!1);let{basename:r,navigator:s}=h.useContext(F1),{hash:a,pathname:o,search:l}=FB(t,{relative:n}),c=o;return r!=="/"&&(c=o==="/"?r:Ry([r,o])),s.createHref({pathname:c,search:l,hash:a})}function Fj(){return h.useContext(IB)!=null}function Pl(){return Fj()||Yo(!1),h.useContext(IB).location}function WAe(t){h.useContext(F1).static||h.useLayoutEffect(t)}function yo(){let{isDataRoute:t}=h.useContext(yx);return t?xZe():nZe()}function nZe(){Fj()||Yo(!1);let t=h.useContext(PB),{basename:e,future:n,navigator:r}=h.useContext(F1),{matches:s}=h.useContext(yx),{pathname:a}=Pl(),o=JSON.stringify(hie(s,n.v7_relativeSplatPath)),l=h.useRef(!1);return WAe(()=>{l.current=!0}),h.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=pie(u,JSON.parse(o),a,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Ry([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,o,a,t])}const rZe=h.createContext(null);function sZe(t){let e=h.useContext(yx).outlet;return e&&h.createElement(rZe.Provider,{value:t},e)}function v2(){let{matches:t}=h.useContext(yx),e=t[t.length-1];return e?e.params:{}}function FB(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=h.useContext(F1),{matches:s}=h.useContext(yx),{pathname:a}=Pl(),o=JSON.stringify(hie(s,r.v7_relativeSplatPath));return h.useMemo(()=>pie(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function iZe(t,e){return aZe(t,e)}function aZe(t,e,n,r){Fj()||Yo(!1);let{navigator:s}=h.useContext(F1),{matches:a}=h.useContext(yx),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=Pl(),d;if(e){var f;let C=typeof e=="string"?Ij(e):e;c==="/"||(f=C.pathname)!=null&&f.startsWith(c)||Yo(!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=FQe(t,{pathname:g}),v=dZe(y&&y.map(C=>Object.assign({},C,{params:Object.assign({},l,C.params),pathname:Ry([c,s.encodeLocation?s.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?c:Ry([c,s.encodeLocation?s.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),a,n,r);return e&&v?h.createElement(IB.Provider,{value:{location:d9({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Ay.Pop}},v):v}function oZe(){let t=mZe(),e=JQe(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 h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},e),n?h.createElement("pre",{style:s},n):null,null)}const lZe=h.createElement(oZe,null);class cZe extends h.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?h.createElement(yx.Provider,{value:this.props.routeContext},h.createElement(VAe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function uZe(t){let{routeContext:e,match:n,children:r}=t,s=h.useContext(PB);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(yx.Provider,{value:e},r)}function dZe(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||Yo(!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||lZe,c&&(u<0&&x===0?(y=!0,C=null):u===x&&(y=!0,C=f.route.hydrateFallbackElement||null)));let S=e.concat(o.slice(0,x+1)),T=()=>{let I;return g?I=v:y?I=C:f.route.Component?I=h.createElement(f.route.Component,null):f.route.element?I=f.route.element:I=d,h.createElement(uZe,{match:f,routeContext:{outlet:d,matches:S,isDataRoute:n!=null},children:I})};return n&&(f.route.ErrorBoundary||f.route.errorElement||x===0)?h.createElement(cZe,{location:n.location,revalidation:n.revalidation,component:v,error:g,children:T(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):T()},null)}var qAe=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(qAe||{}),WM=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}(WM||{});function fZe(t){let e=h.useContext(PB);return e||Yo(!1),e}function hZe(t){let e=h.useContext(HAe);return e||Yo(!1),e}function pZe(t){let e=h.useContext(yx);return e||Yo(!1),e}function GAe(t){let e=pZe(),n=e.matches[e.matches.length-1];return n.route.id||Yo(!1),n.route.id}function mZe(){var t;let e=h.useContext(VAe),n=hZe(WM.UseRouteError),r=GAe(WM.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function xZe(){let{router:t}=fZe(qAe.UseNavigateStable),e=GAe(WM.UseNavigateStable),n=h.useRef(!1);return WAe(()=>{n.current=!0}),h.useCallback(function(s,a){a===void 0&&(a={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,d9({fromRouteId:e},a)))},[t,e])}function _he(t){let{to:e,replace:n,state:r,relative:s}=t;Fj()||Yo(!1);let{future:a,static:o}=h.useContext(F1),{matches:l}=h.useContext(yx),{pathname:c}=Pl(),u=yo(),d=pie(e,hie(l,a.v7_relativeSplatPath),c,s==="path"),f=JSON.stringify(d);return h.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:s}),[u,f,s,n,r]),null}function gZe(t){return sZe(t.context)}function Xi(t){Yo(!1)}function bZe(t){let{basename:e="/",children:n=null,location:r,navigationType:s=Ay.Pop,navigator:a,static:o=!1,future:l}=t;Fj()&&Yo(!1);let c=e.replace(/^\/*/,"/"),u=h.useMemo(()=>({basename:c,navigator:a,static:o,future:d9({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=Ij(r));let{pathname:d="/",search:f="",hash:x="",state:g=null,key:y="default"}=r,v=h.useMemo(()=>{let C=ZN(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:h.createElement(F1.Provider,{value:u},h.createElement(IB.Provider,{children:n,value:v}))}function yZe(t){let{children:e,location:n}=t;return iZe(GZ(e),n)}new Promise(()=>{});function GZ(t,e){e===void 0&&(e=[]);let n=[];return h.Children.forEach(t,(r,s)=>{if(!h.isValidElement(r))return;let a=[...e,s];if(r.type===h.Fragment){n.push.apply(n,GZ(r.props.children,a));return}r.type!==Xi&&Yo(!1),!r.props.index||!r.props.children||Yo(!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=GZ(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 qM(){return qM=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},qM.apply(this,arguments)}function KAe(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 vZe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function wZe(t,e){return t.button===0&&(!e||e==="_self")&&!vZe(t)}function KZ(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 CZe(t,e){let n=KZ(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(a=>{n.append(s,a)})}),n}const NZe=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],SZe=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],jZe="6";try{window.__reactRouterVersion=jZe}catch{}const AZe=h.createContext({isTransitioning:!1}),_Ze="startTransition",Ehe=Gy[_Ze];function EZe(t){let{basename:e,children:n,future:r,window:s}=t,a=h.useRef();a.current==null&&(a.current=TQe({window:s,v5Compat:!0}));let o=a.current,[l,c]=h.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=h.useCallback(f=>{u&&Ehe?Ehe(()=>c(f)):c(f)},[c,u]);return h.useLayoutEffect(()=>o.listen(d),[o,d]),h.createElement(bZe,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const kZe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",TZe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ga=h.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=KAe(e,NZe),{basename:g}=h.useContext(F1),y,v=!1;if(typeof u=="string"&&TZe.test(u)&&(y=u,kZe))try{let I=new URL(window.location.href),L=u.startsWith("//")?new URL(I.protocol+u):new URL(u),F=ZN(L.pathname,g);L.origin===I.origin&&F!=null?u=F+L.search+L.hash:v=!0}catch{}let C=tZe(u,{relative:s}),S=IZe(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,unstable_viewTransition:f});function T(I){r&&r(I),I.defaultPrevented||S(I)}return h.createElement("a",qM({},x,{href:y||C,onClick:v||a?r:T,ref:n,target:c}))}),khe=h.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=KAe(e,SZe),x=FB(c,{relative:f.relative}),g=Pl(),y=h.useContext(HAe),{navigator:v,basename:C}=h.useContext(F1),S=y!=null&&FZe(x)&&u===!0,T=v.encodeLocation?v.encodeLocation(x).pathname:x.pathname,I=g.pathname,L=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;s||(I=I.toLowerCase(),L=L?L.toLowerCase():null,T=T.toLowerCase()),L&&C&&(L=ZN(L,C)||L);const F=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let $=I===T||!o&&I.startsWith(T)&&I.charAt(F)==="/",O=L!=null&&(L===T||!o&&L.startsWith(T)&&L.charAt(T.length)==="/"),U={isActive:$,isPending:O,isTransitioning:S},Y=$?r:void 0,re;typeof a=="function"?re=a(U):re=[a,$?"active":null,O?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let Q=typeof l=="function"?l(U):l;return h.createElement(Ga,qM({},f,{"aria-current":Y,className:re,ref:n,style:Q,to:c,unstable_viewTransition:u}),typeof d=="function"?d(U):d)});var YZ;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(YZ||(YZ={}));var The;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(The||(The={}));function PZe(t){let e=h.useContext(PB);return e||Yo(!1),e}function IZe(t,e){let{target:n,replace:r,state:s,preventScrollReset:a,relative:o,unstable_viewTransition:l}=e===void 0?{}:e,c=yo(),u=Pl(),d=FB(t,{relative:o});return h.useCallback(f=>{if(wZe(f,n)){f.preventDefault();let x=r!==void 0?r:VM(u)===VM(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 YAe(t){let e=h.useRef(KZ(t)),n=h.useRef(!1),r=Pl(),s=h.useMemo(()=>CZe(r.search,n.current?null:e.current),[r.search]),a=yo(),o=h.useCallback((l,c)=>{const u=KZ(typeof l=="function"?l(s):l);n.current=!0,a("?"+u,c)},[a,s]);return[s,o]}function FZe(t,e){e===void 0&&(e={});let n=h.useContext(AZe);n==null&&Yo(!1);let{basename:r}=PZe(YZ.useViewTransitionState),s=FB(t,{relative:e.relative});if(!n.isTransitioning)return!1;let a=ZN(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=ZN(n.nextLocation.pathname,r)||n.nextLocation.pathname;return qZ(s.pathname,o)!=null||qZ(s.pathname,a)!=null}let OZe={data:""},MZe=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||OZe,LZe=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,RZe=/\/\*[^]*?\*\/| +/g,Phe=/\n+/g,Kb=(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"?Kb(o,a):a+"{"+Kb(o,a[1]=="k"?"":e)+"}":typeof o=="object"?r+=Kb(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+=Kb.p?Kb.p(a,o):a+":"+o+";")}return n+(e&&s?e+"{"+s+"}":s)+r},Gx={},XAe=t=>{if(typeof t=="object"){let e="";for(let n in t)e+=n+XAe(t[n]);return e}return t},DZe=(t,e,n,r,s)=>{let a=XAe(t),o=Gx[a]||(Gx[a]=(c=>{let u=0,d=11;for(;u<c.length;)d=101*d+c.charCodeAt(u++)>>>0;return"go"+d})(a));if(!Gx[o]){let c=a!==t?t:(u=>{let d,f,x=[{}];for(;d=LZe.exec(u.replace(RZe,""));)d[4]?x.shift():d[3]?(f=d[3].replace(Phe," ").trim(),x.unshift(x[0][f]=x[0][f]||{})):x[0][d[1]]=d[2].replace(Phe," ").trim();return x[0]})(t);Gx[o]=Kb(s?{["@keyframes "+o]:c}:c,n?"":"."+o)}let l=n&&Gx.g?Gx.g:null;return n&&(Gx.g=Gx[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)})(Gx[o],e,r,l),o},BZe=(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?"":Kb(l,""):l===!1?"":l}return r+s+(o??"")},"");function OB(t){let e=this||{},n=t.call?t(e.p):t;return DZe(n.unshift?n.raw?BZe(n,[].slice.call(arguments,1),e.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(e.p):s),{}):n,MZe(e.target),e.g,e.o,e.k)}let QAe,XZ,QZ;OB.bind({g:1});let p1=OB.bind({k:1});function $Ze(t,e,n,r){Kb.p=e,QAe=t,XZ=n,QZ=r}function w2(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:XZ&&XZ()},l),n.o=/ *go\d+/.test(c),l.className=OB.apply(n,r)+(c?" "+c:"");let u=t;return t[0]&&(u=l.as||t,delete l.as),QZ&&u[0]&&QZ(l),QAe(u,l)}return s}}var UZe=t=>typeof t=="function",GM=(t,e)=>UZe(t)?t(e):t,zZe=(()=>{let t=0;return()=>(++t).toString()})(),ZAe=(()=>{let t;return()=>{if(t===void 0&&typeof window<"u"){let e=matchMedia("(prefers-reduced-motion: reduce)");t=!e||e.matches}return t}})(),HZe=20,FO=new Map,VZe=1e3,Ihe=t=>{if(FO.has(t))return;let e=setTimeout(()=>{FO.delete(t),A5({type:4,toastId:t})},VZe);FO.set(t,e)},WZe=t=>{let e=FO.get(t);e&&clearTimeout(e)},ZZ=(t,e)=>{switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,HZe)};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)?ZZ(t,{type:1,toast:n}):ZZ(t,{type:0,toast:n});case 3:let{toastId:r}=e;return r?Ihe(r):t.toasts.forEach(a=>{Ihe(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}))}}},OO=[],MO={toasts:[],pausedAt:void 0},A5=t=>{MO=ZZ(MO,t),OO.forEach(e=>{e(MO)})},qZe={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},GZe=(t={})=>{let[e,n]=h.useState(MO);h.useEffect(()=>(OO.push(n),()=>{let s=OO.indexOf(n);s>-1&&OO.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)||qZe[s.type],style:{...t.style,...(o=t[s.type])==null?void 0:o.style,...s.style}}});return{...e,toasts:r}},KZe=(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)||zZe()}),lT=t=>(e,n)=>{let r=KZe(e,t,n);return A5({type:2,toast:r}),r.id},Xf=(t,e)=>lT("blank")(t,e);Xf.error=lT("error");Xf.success=lT("success");Xf.loading=lT("loading");Xf.custom=lT("custom");Xf.dismiss=t=>{A5({type:3,toastId:t})};Xf.remove=t=>A5({type:4,toastId:t});Xf.promise=(t,e,n)=>{let r=Xf.loading(e.loading,{...n,...n==null?void 0:n.loading});return t.then(s=>(Xf.success(GM(e.success,s),{id:r,...n,...n==null?void 0:n.success}),s)).catch(s=>{Xf.error(GM(e.error,s),{id:r,...n,...n==null?void 0:n.error})}),t};var YZe=(t,e)=>{A5({type:1,toast:{id:t,height:e}})},XZe=()=>{A5({type:5,time:Date.now()})},QZe=t=>{let{toasts:e,pausedAt:n}=GZe(t);h.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&&Xf.dismiss(l.id);return}return setTimeout(()=>Xf.dismiss(l.id),c)});return()=>{o.forEach(l=>l&&clearTimeout(l))}},[e,n]);let r=h.useCallback(()=>{n&&A5({type:6,time:Date.now()})},[n]),s=h.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:YZe,startPause:XZe,endPause:r,calculateOffset:s}}},ZZe=p1`
from {
transform: scale(0) rotate(45deg);
opacity: 0;
}
to {
transform: scale(1) rotate(45deg);
opacity: 1;
}`,JZe=p1`
from {
transform: scale(0);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}`,eJe=p1`
from {
transform: scale(0) rotate(90deg);
opacity: 0;
}
to {
transform: scale(1) rotate(90deg);
opacity: 1;
}`,tJe=w2("div")`
width: 20px;
opacity: 0;
height: 20px;
border-radius: 10px;
background: ${t=>t.primary||"#ff4b4b"};
position: relative;
transform: rotate(45deg);
animation: ${ZZe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
animation-delay: 100ms;
&:after,
&:before {
content: '';
animation: ${JZe} 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: ${eJe} 0.15s ease-out forwards;
animation-delay: 180ms;
transform: rotate(90deg);
}
`,nJe=p1`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`,JAe=w2("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: ${nJe} 1s linear infinite;
`,rJe=p1`
from {
transform: scale(0) rotate(45deg);
opacity: 0;
}
to {
transform: scale(1) rotate(45deg);
opacity: 1;
}`,sJe=p1`
0% {
height: 0;
width: 0;
opacity: 0;
}
40% {
height: 0;
width: 6px;
opacity: 1;
}
100% {
opacity: 1;
height: 10px;
}`,iJe=w2("div")`
width: 20px;
opacity: 0;
height: 20px;
border-radius: 10px;
background: ${t=>t.primary||"#61d345"};
position: relative;
transform: rotate(45deg);
animation: ${rJe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
animation-delay: 100ms;
&:after {
content: '';
box-sizing: border-box;
animation: ${sJe} 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;
}
`,aJe=w2("div")`
position: absolute;
`,oJe=w2("div")`
position: relative;
display: flex;
justify-content: center;
align-items: center;
min-width: 20px;
min-height: 20px;
`,lJe=p1`
from {
transform: scale(0.6);
opacity: 0.4;
}
to {
transform: scale(1);
opacity: 1;
}`,cJe=w2("div")`
position: relative;
transform: scale(0.6);
opacity: 0.4;
min-width: 20px;
animation: ${lJe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
`,uJe=({toast:t})=>{let{icon:e,type:n,iconTheme:r}=t;return e!==void 0?typeof e=="string"?h.createElement(cJe,null,e):e:n==="blank"?null:h.createElement(oJe,null,h.createElement(JAe,{...r}),n!=="loading"&&h.createElement(aJe,null,n==="error"?h.createElement(tJe,{...r}):h.createElement(iJe,{...r})))},dJe=t=>`
0% {transform: translate3d(0,${t*-200}%,0) scale(.6); opacity:.5;}
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
`,fJe=t=>`
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
100% {transform: translate3d(0,${t*-150}%,-1px) scale(.6); opacity:0;}
`,hJe="0%{opacity:0;} 100%{opacity:1;}",pJe="0%{opacity:1;} 100%{opacity:0;}",mJe=w2("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;
`,xJe=w2("div")`
display: flex;
justify-content: center;
margin: 4px 10px;
color: inherit;
flex: 1 1 auto;
white-space: pre-line;
`,gJe=(t,e)=>{let n=t.includes("top")?1:-1,[r,s]=ZAe()?[hJe,pJe]:[dJe(n),fJe(n)];return{animation:e?`${p1(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${p1(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},bJe=h.memo(({toast:t,position:e,style:n,children:r})=>{let s=t.height?gJe(t.position||e||"top-center",t.visible):{opacity:0},a=h.createElement(uJe,{toast:t}),o=h.createElement(xJe,{...t.ariaProps},GM(t.message,t));return h.createElement(mJe,{className:t.className,style:{...s,...n,...t.style}},typeof r=="function"?r({icon:a,message:o}):h.createElement(h.Fragment,null,a,o))});$Ze(h.createElement);var yJe=({id:t,className:e,style:n,onHeightUpdate:r,children:s})=>{let a=h.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 h.createElement("div",{ref:a,className:e,style:n},s)},vJe=(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:ZAe()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(n?1:-1)}px)`,...r,...s}},wJe=OB`
z-index: 9999;
> * {
pointer-events: auto;
}
`,bI=16,CJe=({reverseOrder:t,position:e="top-center",toastOptions:n,gutter:r,children:s,containerStyle:a,containerClassName:o})=>{let{toasts:l,handlers:c}=QZe(n);return h.createElement("div",{style:{position:"fixed",zIndex:9999,top:bI,left:bI,right:bI,bottom:bI,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=vJe(d,f);return h.createElement(yJe,{id:u.id,key:u.id,onHeightUpdate:c.updateHeight,className:u.visible?wJe:"",style:x},u.type==="custom"?GM(u.message,u):s?s(u):h.createElement(bJe,{toast:u,position:d}))}))},fn=Xf;const e7e=typeof document<"u"?ke.useLayoutEffect:()=>{};function NJe(t){const e=h.useRef(null);return e7e(()=>{e.current=t},[t]),h.useCallback((...n)=>{const r=e.current;return r==null?void 0:r(...n)},[])}const cT=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},dw=t=>t&&"window"in t&&t.window===t?t:cT(t).defaultView||window;function SJe(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 jJe(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 t7e(t){let e=null;return()=>(e==null&&(e=t()),e)}const AJe=t7e(function(){return jJe(/^Mac/i)}),_Je=t7e(function(){return SJe(/Android/i)});function EJe(t){return t.mozInputSource===0&&t.isTrusted?!0:_Je()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}class kJe{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 n7e(t){let e=h.useRef({isFocused:!1,observer:null});e7e(()=>{const r=e.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=NJe(r=>{t==null||t(r)});return h.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 kJe("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 TJe(t){let{isDisabled:e,onFocus:n,onBlur:r,onFocusChange:s}=t;const a=h.useCallback(c=>{if(c.target===c.currentTarget)return r&&r(c),s&&s(!1),!0},[r,s]),o=n7e(a),l=h.useCallback(c=>{const u=cT(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 uT=null,JZ=new Set,N_=new Map,L3=!1,eJ=!1;const PJe={Tab:!0,Escape:!0};function mie(t,e){for(let n of JZ)n(t,e)}function IJe(t){return!(t.metaKey||!AJe()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function KM(t){L3=!0,IJe(t)&&(uT="keyboard",mie("keyboard",t))}function ep(t){uT="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(L3=!0,mie("pointer",t))}function r7e(t){EJe(t)&&(L3=!0,uT="virtual")}function s7e(t){t.target===window||t.target===document||(!L3&&!eJ&&(uT="virtual",mie("virtual",t)),L3=!1,eJ=!1)}function i7e(){L3=!1,eJ=!0}function tJ(t){if(typeof window>"u"||N_.get(dw(t)))return;const e=dw(t),n=cT(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){L3=!0,r.apply(this,arguments)},n.addEventListener("keydown",KM,!0),n.addEventListener("keyup",KM,!0),n.addEventListener("click",r7e,!0),e.addEventListener("focus",s7e,!0),e.addEventListener("blur",i7e,!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",()=>{a7e(t)},{once:!0}),N_.set(e,{focus:r})}const a7e=(t,e)=>{const n=dw(t),r=cT(t);e&&r.removeEventListener("DOMContentLoaded",e),N_.has(n)&&(n.HTMLElement.prototype.focus=N_.get(n).focus,r.removeEventListener("keydown",KM,!0),r.removeEventListener("keyup",KM,!0),r.removeEventListener("click",r7e,!0),n.removeEventListener("focus",s7e,!0),n.removeEventListener("blur",i7e,!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)),N_.delete(n))};function FJe(t){const e=cT(t);let n;return e.readyState!=="loading"?tJ(t):(n=()=>{tJ(t)},e.addEventListener("DOMContentLoaded",n)),()=>a7e(t,n)}typeof document<"u"&&FJe();function o7e(){return uT!=="pointer"}const OJe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function MJe(t,e,n){var r;const s=typeof window<"u"?dw(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,a=typeof window<"u"?dw(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<"u"?dw(n==null?void 0:n.target).HTMLElement:HTMLElement,l=typeof window<"u"?dw(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return t=t||(n==null?void 0:n.target)instanceof s&&!OJe.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&&!PJe[n.key])}function LJe(t,e,n){tJ(),h.useEffect(()=>{let r=(s,a)=>{MJe(!!(n!=null&&n.isTextInput),s,a)&&t(o7e())};return JZ.add(r),()=>{JZ.delete(r)}},e)}function RJe(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:s}=t,a=h.useRef({isFocusWithin:!1}),o=h.useCallback(u=>{a.current.isFocusWithin&&!u.currentTarget.contains(u.relatedTarget)&&(a.current.isFocusWithin=!1,n&&n(u),s&&s(!1))},[n,s,a]),l=n7e(o),c=h.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 YM=!1,FH=0;function nJ(){YM=!0,setTimeout(()=>{YM=!1},50)}function Fhe(t){t.pointerType==="touch"&&nJ()}function DJe(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",Fhe):document.addEventListener("touchend",nJ),FH++,()=>{FH--,!(FH>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Fhe):document.removeEventListener("touchend",nJ))}}function xie(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:s}=t,[a,o]=h.useState(!1),l=h.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;h.useEffect(DJe,[]);let{hoverProps:c,triggerHoverEnd:u}=h.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=>{YM&&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&&!YM&&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 h.useEffect(()=>{s&&u({currentTarget:l.target},l.pointerType)},[s]),{hoverProps:c,isHovered:a}}function gie(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,s=h.useRef({isFocused:!1,isFocusVisible:e||o7e()}),[a,o]=h.useState(!1),[l,c]=h.useState(()=>s.current.isFocused&&s.current.isFocusVisible),u=h.useCallback(()=>c(s.current.isFocused&&s.current.isFocusVisible),[]),d=h.useCallback(g=>{s.current.isFocused=g,o(g),u()},[u]);LJe(g=>{s.current.isFocusVisible=g,u()},[],{isTextInput:n});let{focusProps:f}=TJe({isDisabled:r,onFocusChange:d}),{focusWithinProps:x}=RJe({isDisabled:!r,onFocusWithinChange:d});return{isFocused:a,isFocusVisible:l,focusProps:r?x:f}}var BJe=Object.defineProperty,$Je=(t,e,n)=>e in t?BJe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,OH=(t,e,n)=>($Je(t,typeof e!="symbol"?e+"":e,n),n);let UJe=class{constructor(){OH(this,"current",this.detect()),OH(this,"handoffState","pending"),OH(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"}},f3=new UJe;function C2(t){return f3.isServer?null:t instanceof Node?t.ownerDocument:t!=null&&t.hasOwnProperty("current")&&t.current instanceof Node?t.current.ownerDocument:document}function MB(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function vx(){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 MB(()=>{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=vx();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 N2(){let[t]=h.useState(vx);return h.useEffect(()=>()=>t.dispose(),[t]),t}let so=(t,e)=>{f3.isServer?h.useEffect(t,e):h.useLayoutEffect(t,e)};function _5(t){let e=h.useRef(t);return so(()=>{e.current=t},[t]),e}let Ks=function(t){let e=_5(t);return ke.useCallback((...n)=>e.current(...n),[e])};function zJe(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 HJe(t,e){return!(!t||!e||t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom)}function bie({disabled:t=!1}={}){let e=h.useRef(null),[n,r]=h.useState(!1),s=N2(),a=Ks(()=>{e.current=null,r(!1),s.dispose()}),o=Ks(l=>{if(s.dispose(),e.current===null){e.current=l.currentTarget,r(!0);{let c=C2(l.currentTarget);s.addEventListener(c,"pointerup",a,!1),s.addEventListener(c,"pointermove",u=>{if(e.current){let d=zJe(u);r(HJe(d,e.current.getBoundingClientRect()))}},!1),s.addEventListener(c,"pointercancel",a,!1)}}});return{pressed:n,pressProps:t?{}:{onPointerDown:o,onPointerUp:a,onClick:a}}}let VJe=h.createContext(void 0);function yie(){return h.useContext(VJe)}function rJ(...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 Ky=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(Ky||{}),_y=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(_y||{});function To(){let t=qJe();return h.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??GJe;let c=l7e(e,t);if(a)return yI(c,n,r,o,l);let u=s??0;if(u&2){let{static:d=!1,...f}=c;if(d)return yI(f,n,r,o,l)}if(u&1){let{unmount:d=!0,...f}=c;return rh(d?0:1,{0(){return null},1(){return yI({...f,hidden:!0,style:{display:"none"}},n,r,o,l)}})}return yI(c,n,r,o,l)}function yI(t,e={},n,r,s){let{as:a=n,children:o,refName:l="ref",...c}=MH(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===h.Fragment&&(Object.keys(qb(c)).length>0||Object.keys(qb(f)).length>0))if(!h.isValidElement(d)||Array.isArray(d)&&d.length>1){if(Object.keys(qb(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(qb(c)).concat(Object.keys(qb(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"?(...S)=>rJ(g(...S),c.className):rJ(g,c.className),v=y?{className:y}:{},C=l7e(d.props,qb(MH(c,["ref"])));for(let S in f)S in C&&delete f[S];return h.cloneElement(d,Object.assign({},C,f,u,{ref:s(KJe(d),u.ref)},v))}return h.createElement(a,Object.assign({},MH(c,["ref"]),a!==h.Fragment&&u,a!==h.Fragment&&f),d)}function qJe(){let t=h.useRef([]),e=h.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 GJe(...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 l7e(...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 f9(...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 wo(t){var e;return Object.assign(h.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function qb(t){let e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function MH(t,e=[]){let n=Object.assign({},t);for(let r of e)r in n&&delete n[r];return n}function KJe(t){return ke.version.split(".")[0]>="19"?t.props.ref:t.ref}function YJe(t,e,n){let[r,s]=h.useState(n),a=t!==void 0,o=h.useRef(a),l=h.useRef(!1),c=h.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,Ks(u=>(a||s(u),e==null?void 0:e(u)))]}function XJe(t){let[e]=h.useState(t);return e}function c7e(t={},e=null,n=[]){for(let[r,s]of Object.entries(t))d7e(n,u7e(e,r),s);return n}function u7e(t,e){return t?t+"["+e+"]":e}function d7e(t,e,n){if(Array.isArray(n))for(let[r,s]of n.entries())d7e(t,u7e(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,""]):c7e(n,e,t)}function QJe(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 ZJe="span";var JN=(t=>(t[t.None=1]="None",t[t.Focusable=2]="Focusable",t[t.Hidden=4]="Hidden",t))(JN||{});function JJe(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 To()({ourProps:a,theirProps:s,slot:{},defaultTag:ZJe,name:"Hidden"})}let h9=wo(JJe),eet=h.createContext(null);function tet({children:t}){let e=h.useContext(eet);if(!e)return ke.createElement(ke.Fragment,null,t);let{target:n}=e;return n?Ea.createPortal(ke.createElement(ke.Fragment,null,t),n):null}function net({data:t,form:e,disabled:n,onReset:r,overrides:s}){let[a,o]=h.useState(null),l=N2();return h.useEffect(()=>{if(r&&a)return l.addEventListener(a,"reset",r)},[a,e,r]),ke.createElement(tet,null,ke.createElement(ret,{setForm:o,formId:e}),c7e(t).map(([c,u])=>ke.createElement(h9,{features:JN.Hidden,...qb({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:e,disabled:n,name:c,value:u,...s})})))}function ret({setForm:t,formId:e}){return h.useEffect(()=>{if(e){let n=document.getElementById(e);n&&t(n)}},[t,e]),e?null:ke.createElement(h9,{features:JN.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&t(r)}})}let set=h.createContext(void 0);function f7e(){return h.useContext(set)}function vie(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&&iet(n)?!1:r}function iet(t){if(!t)return!1;let e=t.previousElementSibling;for(;e!==null;){if(e instanceof HTMLLegendElement)return!1;e=e.previousElementSibling}return!0}let h7e=Symbol();function p7e(t,e=!0){return Object.assign(t,{[h7e]:e})}function fc(...t){let e=h.useRef(t);h.useEffect(()=>{e.current=t},[t]);let n=Ks(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[h7e]))?void 0:n}let LB=h.createContext(null);LB.displayName="DescriptionContext";function m7e(){let t=h.useContext(LB);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,m7e),e}return t}function aet(){var t,e;return(e=(t=h.useContext(LB))==null?void 0:t.value)!=null?e:void 0}function wie(){let[t,e]=h.useState([]);return[t.length>0?t.join(" "):void 0,h.useMemo(()=>function(n){let r=Ks(a=>(e(o=>[...o,a]),()=>e(o=>{let l=o.slice(),c=l.indexOf(a);return c!==-1&&l.splice(c,1),l}))),s=h.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 ke.createElement(LB.Provider,{value:s},n.children)},[e])]}let oet="p";function cet(t,e){let n=h.useId(),r=yie(),{id:s=`headlessui-description-${n}`,...a}=t,o=m7e(),l=fc(e);so(()=>o.register(s),[s,o.register]);let c=r||!1,u=h.useMemo(()=>({...o.slot,disabled:c}),[o.slot,c]),d={ref:l,...o.props,id:s};return To()({ourProps:d,theirProps:a,slot:u,defaultTag:oet,name:o.name||"Description"})}let uet=wo(cet),x7e=Object.assign(uet,{});var Ao=(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))(Ao||{});let RB=h.createContext(null);RB.displayName="LabelContext";function Cie(){let t=h.useContext(RB);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,Cie),e}return t}function g7e(t){var e,n,r;let s=(n=(e=h.useContext(RB))==null?void 0:e.value)!=null?n:void 0;return((r=void 0)!=null?r:0)>0?[s,...t].filter(Boolean).join(" "):s}function Nie({inherit:t=!1}={}){let e=g7e(),[n,r]=h.useState([]),s=t?[e,...n].filter(Boolean):n;return[s.length>0?s.join(" "):void 0,h.useMemo(()=>function(a){let o=Ks(c=>(r(u=>[...u,c]),()=>r(u=>{let d=u.slice(),f=d.indexOf(c);return f!==-1&&d.splice(f,1),d}))),l=h.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 ke.createElement(RB.Provider,{value:l},a.children)},[r])]}let det="label";function fet(t,e){var n;let r=h.useId(),s=Cie(),a=f7e(),o=yie(),{id:l=`headlessui-label-${r}`,htmlFor:c=a??((n=s.props)==null?void 0:n.htmlFor),passive:u=!1,...d}=t,f=fc(e);so(()=>s.register(l),[l,s.register]);let x=Ks(C=>{let S=C.currentTarget;if(S instanceof HTMLLabelElement&&C.preventDefault(),s.props&&"onClick"in s.props&&typeof s.props.onClick=="function"&&s.props.onClick(C),S instanceof HTMLLabelElement){let T=document.getElementById(S.htmlFor);if(T){let I=T.getAttribute("disabled");if(I==="true"||I==="")return;let L=T.getAttribute("aria-disabled");if(L==="true"||L==="")return;(T instanceof HTMLInputElement&&(T.type==="radio"||T.type==="checkbox")||T.role==="radio"||T.role==="checkbox"||T.role==="switch")&&T.click(),T.focus({preventScroll:!0})}}}),g=o||!1,y=h.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),To()({ourProps:v,theirProps:d,slot:y,defaultTag:c?det:"div",name:s.name||"Label"})}let het=wo(fet),pet=Object.assign(het,{}),met=h.createContext(()=>{});function b7e({value:t,children:e}){return ke.createElement(met.Provider,{value:t},e)}function xet(t){if(t===null)return{width:0,height:0};let{width:e,height:n}=t.getBoundingClientRect();return{width:e,height:n}}function get(t,e=!1){let[n,r]=h.useReducer(()=>({}),{}),s=h.useMemo(()=>xet(t),[t,n]);return so(()=>{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 bet=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 y7e(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 v7e(t){return h.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}let yet=new bet(()=>y7e(()=>[],{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 Oj(t,e){let n=yet.get(e),r=h.useId(),s=v7e(n);if(so(()=>{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 sJ=new Map,S_=new Map;function Ohe(t){var e;let n=(e=S_.get(t))!=null?e:0;return S_.set(t,n+1),n!==0?()=>Mhe(t):(sJ.set(t,{"aria-hidden":t.getAttribute("aria-hidden"),inert:t.inert}),t.setAttribute("aria-hidden","true"),t.inert=!0,()=>Mhe(t))}function Mhe(t){var e;let n=(e=S_.get(t))!=null?e:1;if(n===1?S_.delete(t):S_.set(t,n-1),n!==1)return;let r=sJ.get(t);r&&(r["aria-hidden"]===null?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r["aria-hidden"]),t.inert=r.inert,sJ.delete(t))}function w7e(t,{allowed:e,disallowed:n}={}){let r=Oj(t,"inert-others");so(()=>{var s,a;if(!r)return;let o=vx();for(let c of(s=n==null?void 0:n())!=null?s:[])c&&o.add(Ohe(c));let l=(a=e==null?void 0:e())!=null?a:[];for(let c of l){if(!c)continue;let u=C2(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(Ohe(f));d=d.parentElement}}return o.dispose},[r,e,n])}function C7e(t,e,n){let r=_5(s=>{let a=s.getBoundingClientRect();a.x===0&&a.y===0&&a.width===0&&a.height===0&&n()});h.useEffect(()=>{if(!t)return;let s=e===null?null:e instanceof HTMLElement?e:e.current;if(!s)return;let a=vx();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 XM=["[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(","),vet=["[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||{}),iJ=(t=>(t[t.Error=0]="Error",t[t.Overflow=1]="Overflow",t[t.Success=2]="Success",t[t.Underflow=3]="Underflow",t))(iJ||{}),wet=(t=>(t[t.Previous=-1]="Previous",t[t.Next=1]="Next",t))(wet||{});function N7e(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(XM)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Cet(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(vet)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Sie=(t=>(t[t.Strict=0]="Strict",t[t.Loose=1]="Loose",t))(Sie||{});function jie(t,e=0){var n;return t===((n=C2(t))==null?void 0:n.body)?!1:rh(e,{0(){return t.matches(XM)},1(){let r=t;for(;r!==null;){if(r.matches(XM))return!0;r=r.parentElement}return!1}})}function S7e(t){let e=C2(t);vx().nextFrame(()=>{e&&!jie(e.activeElement,0)&&W0(t)})}var Net=(t=>(t[t.Keyboard=0]="Keyboard",t[t.Mouse=1]="Mouse",t))(Net||{});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 W0(t){t==null||t.focus({preventScroll:!0})}let jet=["textarea","input"].join(",");function Aet(t){var e,n;return(n=(e=t==null?void 0:t.matches)==null?void 0:e.call(t,jet))!=null?n:!1}function j7e(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 _et(t,e){return N4(N7e(),e,{relativeTo:t})}function N4(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?j7e(t):t:e&64?Cet(t):N7e(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&&Aet(x)&&x.select(),2}function A7e(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Eet(){return/Android/gi.test(window.navigator.userAgent)}function ket(){return A7e()||Eet()}function GA(t,e,n,r){let s=_5(n);h.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 _7e(t,e,n,r){let s=_5(n);h.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 Lhe=30;function E7e(t,e,n){let r=Oj(t,"outside-click"),s=_5(n),a=h.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!jie(d,Sie.Loose)&&d.tabIndex!==-1&&c.preventDefault(),s.current(c,d)},[s,e]),o=h.useRef(null);GA(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),GA(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),GA(r,"click",c=>{ket()||o.current&&(a(c,()=>o.current),o.current=null)},!0);let l=h.useRef({x:0,y:0});GA(r,"touchstart",c=>{l.current.x=c.touches[0].clientX,l.current.y=c.touches[0].clientY},!0),GA(r,"touchend",c=>{let u={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(u.x-l.current.x)>=Lhe||Math.abs(u.y-l.current.y)>=Lhe))return a(c,()=>c.target instanceof HTMLElement?c.target:null)},!0),_7e(r,"blur",c=>a(c,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Mj(...t){return h.useMemo(()=>C2(...t),[...t])}function k7e(t,e,n,r){let s=_5(n);h.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 Aie(t,e){return h.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 Tet(){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 Pet(){return A7e()?{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=vx();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 Iet(){return{before({doc:t,d:e}){e.style(t.documentElement,"overflow","hidden")}}}function Fet(t){let e={};for(let n of t)Object.assign(e,n(e));return e}let fw=y7e(()=>new Map,{PUSH(t,e){var n;let r=(n=this.get(t))!=null?n:{doc:t,count:0,d:vx(),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:Fet(n)},s=[Pet(),Tet(),Iet()];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)}});fw.subscribe(()=>{let t=fw.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)&&fw.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&fw.dispatch("TEARDOWN",n)}});function Oet(t,e,n=()=>({containers:[]})){let r=v7e(fw),s=e?r.get(e):void 0,a=s?s.count>0:!1;return so(()=>{if(!(!e||!t))return fw.dispatch("PUSH",e,n),()=>fw.dispatch("POP",e,n)},[t,e]),a}function T7e(t,e,n=()=>[document.body]){let r=Oj(t,"scroll-lock");Oet(r,e,s=>{var a;return{containers:[...(a=s.containers)!=null?a:[],n]}})}function Rhe(t){return[t.screenX,t.screenY]}function Met(){let t=h.useRef([-1,-1]);return{wasMoved(e){let n=Rhe(e);return t.current[0]===n[0]&&t.current[1]===n[1]?!1:(t.current=n,!0)},update(e){t.current=Rhe(e)}}}function Let(t=0){let[e,n]=h.useState(t),r=h.useCallback(c=>n(c),[e]),s=h.useCallback(c=>n(u=>u|c),[e]),a=h.useCallback(c=>(e&c)===c,[e]),o=h.useCallback(c=>n(u=>u&~c),[n]),l=h.useCallback(c=>n(u=>u^c),[n]);return{flags:e,setFlag:r,addFlag:s,hasFlag:a,removeFlag:o,toggleFlag:l}}var Ret={},Dhe,Bhe;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Dhe=process==null?void 0:Ret)==null?void 0:Dhe.NODE_ENV)==="test"&&typeof((Bhe=Element==null?void 0:Element.prototype)==null?void 0:Bhe.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 Det=(t=>(t[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t))(Det||{});function _ie(t){let e={};for(let n in t)t[n]===!0&&(e[`data-${n}`]="");return e}function Eie(t,e,n,r){let[s,a]=h.useState(n),{hasFlag:o,addFlag:l,removeFlag:c}=Let(t&&s?3:0),u=h.useRef(!1),d=h.useRef(!1),f=N2();return so(()=>{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),Bet(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 Bet(t,{prepare:e,run:n,done:r,inFlight:s}){let a=vx();return Uet(t,{prepare:e,inFlight:s}),a.nextFrame(()=>{n(),a.requestAnimationFrame(()=>{a.add($et(t,r))})}),a.dispose}function $et(t,e){var n,r;let s=vx();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 Uet(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 zet(t,{container:e,accept:n,walk:r}){let s=h.useRef(n),a=h.useRef(r);h.useEffect(()=>{s.current=n,a.current=r},[n,r]),so(()=>{if(!e||!t)return;let o=C2(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 kie(t,e){let n=h.useRef([]),r=Ks(t);h.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 DB(){return typeof window<"u"}function Lj(t){return P7e(t)?(t.nodeName||"").toLowerCase():"#document"}function Qf(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function wx(t){var e;return(e=(P7e(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function P7e(t){return DB()?t instanceof Node||t instanceof Qf(t).Node:!1}function ud(t){return DB()?t instanceof Element||t instanceof Qf(t).Element:!1}function sx(t){return DB()?t instanceof HTMLElement||t instanceof Qf(t).HTMLElement:!1}function $he(t){return!DB()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Qf(t).ShadowRoot}function dT(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Sm(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(s)}function Het(t){return["table","td","th"].includes(Lj(t))}function BB(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Tie(t){const e=Pie(),n=ud(t)?Sm(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 Vet(t){let e=Yy(t);for(;sx(e)&&!eS(e);){if(Tie(e))return e;if(BB(e))return null;e=Yy(e)}return null}function Pie(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function eS(t){return["html","body","#document"].includes(Lj(t))}function Sm(t){return Qf(t).getComputedStyle(t)}function $B(t){return ud(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Yy(t){if(Lj(t)==="html")return t;const e=t.assignedSlot||t.parentNode||$he(t)&&t.host||wx(t);return $he(e)?e.host:e}function I7e(t){const e=Yy(t);return eS(e)?t.ownerDocument?t.ownerDocument.body:t.body:sx(e)&&dT(e)?e:I7e(e)}function p9(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=I7e(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=Qf(s);if(a){const l=aJ(o);return e.concat(o,o.visualViewport||[],dT(s)?s:[],l&&n?p9(l):[])}return e.concat(s,p9(s,[],n))}function aJ(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Wet(){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 qet=["top","right","bottom","left"],Xy=Math.min,Tu=Math.max,m9=Math.round,vI=Math.floor,Qy=t=>({x:t,y:t}),Get={left:"right",right:"left",bottom:"top",top:"bottom"},Ket={start:"end",end:"start"};function oJ(t,e,n){return Tu(t,Xy(e,n))}function ix(t,e){return typeof t=="function"?t(e):t}function m1(t){return t.split("-")[0]}function Rj(t){return t.split("-")[1]}function Iie(t){return t==="x"?"y":"x"}function Fie(t){return t==="y"?"height":"width"}function Zy(t){return["top","bottom"].includes(m1(t))?"y":"x"}function Oie(t){return Iie(Zy(t))}function Yet(t,e,n){n===void 0&&(n=!1);const r=Rj(t),s=Oie(t),a=Fie(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=QM(o)),[o,QM(o)]}function Xet(t){const e=QM(t);return[lJ(t),e,lJ(e)]}function lJ(t){return t.replace(/start|end/g,e=>Ket[e])}function Qet(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 Zet(t,e,n,r){const s=Rj(t);let a=Qet(m1(t),n==="start",r);return s&&(a=a.map(o=>o+"-"+s),e&&(a=a.concat(a.map(lJ)))),a}function QM(t){return t.replace(/left|right|bottom|top/g,e=>Get[e])}function Jet(t){return{top:0,right:0,bottom:0,left:0,...t}}function F7e(t){return typeof t!="number"?Jet(t):{top:t,right:t,bottom:t,left:t}}function x9(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 Uhe(t,e,n){let{reference:r,floating:s}=t;const a=Zy(e),o=Oie(e),l=Fie(o),c=m1(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(Rj(e)){case"start":g[o]-=x*(n&&u?-1:1);break;case"end":g[o]+=x*(n&&u?-1:1);break}return g}const ett=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}=Uhe(u,r,c),x=r,g={},y=0;for(let v=0;v<l.length;v++){const{name:C,fn:S}=l[v],{x:T,y:I,data:L,reset:F}=await S({x:d,y:f,initialPlacement:r,placement:x,strategy:s,middlewareData:g,rects:u,platform:o,elements:{reference:t,floating:e}});d=T??d,f=I??f,g={...g,[C]:{...g[C],...L}},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}=Uhe(u,x,c)),v=-1)}return{x:d,y:f,placement:x,strategy:s,middlewareData:g}};async function tS(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}=ix(e,t),y=F7e(g),C=l[x?f==="floating"?"reference":"floating":f],S=x9(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})),T=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,I=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),L=await(a.isElement==null?void 0:a.isElement(I))?await(a.getScale==null?void 0:a.getScale(I))||{x:1,y:1}:{x:1,y:1},F=x9(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:T,offsetParent:I,strategy:c}):T);return{top:(S.top-F.top+y.top)/L.y,bottom:(F.bottom-S.bottom+y.bottom)/L.y,left:(S.left-F.left+y.left)/L.x,right:(F.right-S.right+y.right)/L.x}}const ttt=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}=ix(t,e)||{};if(u==null)return{};const f=F7e(d),x={x:n,y:r},g=Oie(s),y=Fie(g),v=await o.getDimensions(u),C=g==="y",S=C?"top":"left",T=C?"bottom":"right",I=C?"clientHeight":"clientWidth",L=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 O=$?$[I]:0;(!O||!await(o.isElement==null?void 0:o.isElement($)))&&(O=l.floating[I]||a.floating[y]);const U=L/2-F/2,Y=O/2-v[y]/2-1,re=Xy(f[S],Y),Q=Xy(f[T],Y),q=re,te=O-v[y]-Q,fe=O/2-v[y]/2+U,G=oJ(q,fe,te),ie=!c.arrow&&Rj(s)!=null&&fe!==G&&a.reference[y]/2-(fe<q?re:Q)-v[y]/2<0,oe=ie?fe<q?fe-q:fe-te:0;return{[g]:x[g]+oe,data:{[g]:G,centerOffset:fe-G-oe,...ie&&{alignmentOffset:oe}},reset:ie}}}),ntt=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}=ix(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const S=m1(s),T=Zy(l),I=m1(l)===l,L=await(c.isRTL==null?void 0:c.isRTL(u.floating)),F=x||(I||!v?[QM(l)]:Xet(l)),$=y!=="none";!x&&$&&F.push(...Zet(l,v,y,L));const O=[l,...F],U=await tS(e,C),Y=[];let re=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&Y.push(U[S]),f){const fe=Yet(s,o,L);Y.push(U[fe[0]],U[fe[1]])}if(re=[...re,{placement:s,overflows:Y}],!Y.every(fe=>fe<=0)){var Q,q;const fe=(((Q=a.flip)==null?void 0:Q.index)||0)+1,G=O[fe];if(G)return{data:{index:fe,overflows:re},reset:{placement:G}};let ie=(q=re.filter(oe=>oe.overflows[0]<=0).sort((oe,K)=>oe.overflows[1]-K.overflows[1])[0])==null?void 0:q.placement;if(!ie)switch(g){case"bestFit":{var te;const oe=(te=re.filter(K=>{if($){const H=Zy(K.placement);return H===T||H==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(H=>H>0).reduce((H,ee)=>H+ee,0)]).sort((K,H)=>K[1]-H[1])[0])==null?void 0:te[0];oe&&(ie=oe);break}case"initialPlacement":ie=l;break}if(s!==ie)return{reset:{placement:ie}}}return{}}}};function zhe(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Hhe(t){return qet.some(e=>t[e]>=0)}const rtt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...s}=ix(t,e);switch(r){case"referenceHidden":{const a=await tS(e,{...s,elementContext:"reference"}),o=zhe(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Hhe(o)}}}case"escaped":{const a=await tS(e,{...s,altBoundary:!0}),o=zhe(a,n.floating);return{data:{escapedOffsets:o,escaped:Hhe(o)}}}default:return{}}}}};async function stt(t,e){const{placement:n,platform:r,elements:s}=t,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=m1(n),l=Rj(n),c=Zy(n)==="y",u=["left","top"].includes(o)?-1:1,d=a&&c?-1:1,f=ix(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 itt=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 stt(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}}}}},att=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:S,y:T}=C;return{x:S,y:T}}},...c}=ix(t,e),u={x:n,y:r},d=await tS(e,c),f=Zy(m1(s)),x=Iie(f);let g=u[x],y=u[f];if(a){const C=x==="y"?"top":"left",S=x==="y"?"bottom":"right",T=g+d[C],I=g-d[S];g=oJ(T,g,I)}if(o){const C=f==="y"?"top":"left",S=f==="y"?"bottom":"right",T=y+d[C],I=y-d[S];y=oJ(T,y,I)}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}}}}}},ott=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}=ix(t,e),d={x:n,y:r},f=Zy(s),x=Iie(f);let g=d[x],y=d[f];const v=ix(l,e),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const I=x==="y"?"height":"width",L=a.reference[x]-a.floating[I]+C.mainAxis,F=a.reference[x]+a.reference[I]-C.mainAxis;g<L?g=L:g>F&&(g=F)}if(u){var S,T;const I=x==="y"?"width":"height",L=["top","left"].includes(m1(s)),F=a.reference[f]-a.floating[I]+(L&&((S=o.offset)==null?void 0:S[f])||0)+(L?0:C.crossAxis),$=a.reference[f]+a.reference[I]+(L?0:((T=o.offset)==null?void 0:T[f])||0)-(L?C.crossAxis:0);y<F?y=F:y>$&&(y=$)}return{[x]:g,[f]:y}}}},ltt=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}=ix(t,e),d=await tS(e,u),f=m1(s),x=Rj(s),g=Zy(s)==="y",{width:y,height:v}=a.floating;let C,S;f==="top"||f==="bottom"?(C=f,S=x===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(S=f,C=x==="end"?"top":"bottom");const T=v-d.top-d.bottom,I=y-d.left-d.right,L=Xy(v-d[C],T),F=Xy(y-d[S],I),$=!e.middlewareData.shift;let O=L,U=F;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(U=I),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(O=T),$&&!x){const re=Tu(d.left,0),Q=Tu(d.right,0),q=Tu(d.top,0),te=Tu(d.bottom,0);g?U=y-2*(re!==0||Q!==0?re+Q:Tu(d.left,d.right)):O=v-2*(q!==0||te!==0?q+te:Tu(d.top,d.bottom))}await c({...e,availableWidth:U,availableHeight:O});const Y=await o.getDimensions(l.floating);return y!==Y.width||v!==Y.height?{reset:{rects:!0}}:{}}}};function O7e(t){const e=Sm(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=sx(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=m9(n)!==a||m9(r)!==o;return l&&(n=a,r=o),{width:n,height:r,$:l}}function Mie(t){return ud(t)?t:t.contextElement}function S4(t){const e=Mie(t);if(!sx(e))return Qy(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=O7e(e);let o=(a?m9(n.width):n.width)/r,l=(a?m9(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const ctt=Qy(0);function M7e(t){const e=Qf(t);return!Pie()||!e.visualViewport?ctt:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function utt(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Qf(t)?!1:e}function R3(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=Mie(t);let o=Qy(1);e&&(r?ud(r)&&(o=S4(r)):o=S4(t));const l=utt(a,n,r)?M7e(a):Qy(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=aJ(y);for(;v&&r&&g!==y;){const C=S4(v),S=v.getBoundingClientRect(),T=Sm(v),I=S.left+(v.clientLeft+parseFloat(T.paddingLeft))*C.x,L=S.top+(v.clientTop+parseFloat(T.paddingTop))*C.y;c*=C.x,u*=C.y,d*=C.x,f*=C.y,c+=I,u+=L,y=Qf(v),v=aJ(y)}}return x9({width:d,height:f,x:c,y:u})}function dtt(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const a=s==="fixed",o=wx(r),l=e?BB(e.floating):!1;if(r===o||l&&a)return n;let c={scrollLeft:0,scrollTop:0},u=Qy(1);const d=Qy(0),f=sx(r);if((f||!f&&!a)&&((Lj(r)!=="body"||dT(o))&&(c=$B(r)),sx(r))){const x=R3(r);u=S4(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 ftt(t){return Array.from(t.getClientRects())}function cJ(t,e){const n=$B(t).scrollLeft;return e?e.left+n:R3(wx(t)).left+n}function htt(t){const e=wx(t),n=$B(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+cJ(t);const l=-n.scrollTop;return Sm(r).direction==="rtl"&&(o+=Tu(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:l}}function ptt(t,e){const n=Qf(t),r=wx(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=Pie();(!u||u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:a,height:o,x:l,y:c}}function mtt(t,e){const n=R3(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,a=sx(t)?S4(t):Qy(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 Vhe(t,e,n){let r;if(e==="viewport")r=ptt(t,n);else if(e==="document")r=htt(wx(t));else if(ud(e))r=mtt(e,n);else{const s=M7e(t);r={...e,x:e.x-s.x,y:e.y-s.y}}return x9(r)}function L7e(t,e){const n=Yy(t);return n===e||!ud(n)||eS(n)?!1:Sm(n).position==="fixed"||L7e(n,e)}function xtt(t,e){const n=e.get(t);if(n)return n;let r=p9(t,[],!1).filter(l=>ud(l)&&Lj(l)!=="body"),s=null;const a=Sm(t).position==="fixed";let o=a?Yy(t):t;for(;ud(o)&&!eS(o);){const l=Sm(o),c=Tie(o);!c&&l.position==="fixed"&&(s=null),(a?!c&&!s:!c&&l.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||dT(o)&&!c&&L7e(t,o))?r=r.filter(d=>d!==o):s=l,o=Yy(o)}return e.set(t,r),r}function gtt(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?BB(e)?[]:xtt(e,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const f=Vhe(e,d,s);return u.top=Tu(f.top,u.top),u.right=Xy(f.right,u.right),u.bottom=Xy(f.bottom,u.bottom),u.left=Tu(f.left,u.left),u},Vhe(e,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function btt(t){const{width:e,height:n}=O7e(t);return{width:e,height:n}}function ytt(t,e,n){const r=sx(e),s=wx(e),a=n==="fixed",o=R3(t,!0,a,e);let l={scrollLeft:0,scrollTop:0};const c=Qy(0);if(r||!r&&!a)if((Lj(e)!=="body"||dT(s))&&(l=$B(e)),r){const g=R3(e,!0,a,e);c.x=g.x+e.clientLeft,c.y=g.y+e.clientTop}else s&&(c.x=cJ(s));let u=0,d=0;if(s&&!r&&!a){const g=s.getBoundingClientRect();d=g.top+l.scrollTop,u=g.left+l.scrollLeft-cJ(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 LH(t){return Sm(t).position==="static"}function Whe(t,e){if(!sx(t)||Sm(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return wx(t)===n&&(n=n.ownerDocument.body),n}function R7e(t,e){const n=Qf(t);if(BB(t))return n;if(!sx(t)){let s=Yy(t);for(;s&&!eS(s);){if(ud(s)&&!LH(s))return s;s=Yy(s)}return n}let r=Whe(t,e);for(;r&&Het(r)&&LH(r);)r=Whe(r,e);return r&&eS(r)&&LH(r)&&!Tie(r)?n:r||Vet(t)||n}const vtt=async function(t){const e=this.getOffsetParent||R7e,n=this.getDimensions,r=await n(t.floating);return{reference:ytt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wtt(t){return Sm(t).direction==="rtl"}const Ctt={convertOffsetParentRelativeRectToViewportRelativeRect:dtt,getDocumentElement:wx,getClippingRect:gtt,getOffsetParent:R7e,getElementRects:vtt,getClientRects:ftt,getDimensions:btt,getScale:S4,isElement:ud,isRTL:wtt};function Ntt(t,e){let n=null,r;const s=wx(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=vI(d),y=vI(s.clientWidth-(u+f)),v=vI(s.clientHeight-(d+x)),C=vI(u),T={rootMargin:-g+"px "+-y+"px "+-v+"px "+-C+"px",threshold:Tu(0,Xy(1,c))||1};let I=!0;function L(F){const $=F[0].intersectionRatio;if($!==c){if(!I)return o();$?o(!1,$):r=setTimeout(()=>{o(!1,1e-7)},1e3)}I=!1}try{n=new IntersectionObserver(L,{...T,root:s.ownerDocument})}catch{n=new IntersectionObserver(L,T)}n.observe(t)}return o(!0),a}function D7e(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=Mie(t),d=s||a?[...u?p9(u):[],...p9(e)]:[];d.forEach(S=>{s&&S.addEventListener("scroll",n,{passive:!0}),a&&S.addEventListener("resize",n)});const f=u&&l?Ntt(u,n):null;let x=-1,g=null;o&&(g=new ResizeObserver(S=>{let[T]=S;T&&T.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var I;(I=g)==null||I.observe(e)})),n()}),u&&!c&&g.observe(u),g.observe(e));let y,v=c?R3(t):null;c&&C();function C(){const S=R3(t);v&&(S.x!==v.x||S.y!==v.y||S.width!==v.width||S.height!==v.height)&&n(),v=S,y=requestAnimationFrame(C)}return n(),()=>{var S;d.forEach(T=>{s&&T.removeEventListener("scroll",n),a&&T.removeEventListener("resize",n)}),f==null||f(),(S=g)==null||S.disconnect(),g=null,c&&cancelAnimationFrame(y)}}const RH=tS,B7e=itt,$7e=att,U7e=ntt,z7e=ltt,Stt=rtt,qhe=ttt,jtt=ott,H7e=(t,e,n)=>{const r=new Map,s={platform:Ctt,...n},a={...s.platform,_c:r};return ett(t,e,{...s,platform:a})};var LO=typeof document<"u"?h.useLayoutEffect:h.useEffect;function ZM(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(!ZM(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)&&!ZM(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function V7e(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Ghe(t,e){const n=V7e(t);return Math.round(e*n)/n}function DH(t){const e=h.useRef(t);return LO(()=>{e.current=t}),e}function Att(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]=h.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,g]=h.useState(r);ZM(x,r)||g(r);const[y,v]=h.useState(null),[C,S]=h.useState(null),T=h.useCallback(K=>{K!==$.current&&($.current=K,v(K))},[]),I=h.useCallback(K=>{K!==O.current&&(O.current=K,S(K))},[]),L=a||y,F=o||C,$=h.useRef(null),O=h.useRef(null),U=h.useRef(d),Y=c!=null,re=DH(c),Q=DH(s),q=DH(u),te=h.useCallback(()=>{if(!$.current||!O.current)return;const K={placement:e,strategy:n,middleware:x};Q.current&&(K.platform=Q.current),H7e($.current,O.current,K).then(H=>{const ee={...H,isPositioned:q.current!==!1};fe.current&&!ZM(U.current,ee)&&(U.current=ee,Ea.flushSync(()=>{f(ee)}))})},[x,e,n,Q,q]);LO(()=>{u===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,f(K=>({...K,isPositioned:!1})))},[u]);const fe=h.useRef(!1);LO(()=>(fe.current=!0,()=>{fe.current=!1}),[]),LO(()=>{if(L&&($.current=L),F&&(O.current=F),L&&F){if(re.current)return re.current(L,F,te);te()}},[L,F,te,re,Y]);const G=h.useMemo(()=>({reference:$,floating:O,setReference:T,setFloating:I}),[T,I]),ie=h.useMemo(()=>({reference:L,floating:F}),[L,F]),oe=h.useMemo(()=>{const K={position:n,left:0,top:0};if(!ie.floating)return K;const H=Ghe(ie.floating,d.x),ee=Ghe(ie.floating,d.y);return l?{...K,transform:"translate("+H+"px, "+ee+"px)",...V7e(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:ee}},[n,l,ie.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:te,refs:G,elements:ie,floatingStyles:oe}),[d,te,G,ie,oe])}const W7e=(t,e)=>({...B7e(t),options:[t,e]}),_tt=(t,e)=>({...$7e(t),options:[t,e]}),Ett=(t,e)=>({...U7e(t),options:[t,e]}),ktt=(t,e)=>({...z7e(t),options:[t,e]}),q7e={...Gy},Ttt=q7e.useInsertionEffect,Ptt=Ttt||(t=>t());function G7e(t){const e=h.useRef(()=>{});return Ptt(()=>{e.current=t}),h.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 uJ=typeof document<"u"?h.useLayoutEffect:h.useEffect;let Khe=!1,Itt=0;const Yhe=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Itt++;function Ftt(){const[t,e]=h.useState(()=>Khe?Yhe():void 0);return uJ(()=>{t==null&&e(Yhe())},[]),h.useEffect(()=>{Khe=!0},[]),t}const Ott=q7e.useId,Mtt=Ott||Ftt;function Ltt(){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 Rtt=h.createContext(null),Dtt=h.createContext(null),Btt=()=>{var t;return((t=h.useContext(Rtt))==null?void 0:t.id)||null},$tt=()=>h.useContext(Dtt),Utt="data-floating-ui-focusable";function ztt(t){const{open:e=!1,onOpenChange:n,elements:r}=t,s=Mtt(),a=h.useRef({}),[o]=h.useState(()=>Ltt()),l=Btt()!=null,[c,u]=h.useState(r.reference),d=G7e((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=h.useMemo(()=>({setPositionReference:u}),[]),x=h.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return h.useMemo(()=>({dataRef:a,open:e,onOpenChange:d,elements:x,events:o,floatingId:s,refs:f}),[e,d,x,o,s,f])}function Htt(t){t===void 0&&(t={});const{nodeId:e}=t,n=ztt({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,s=r.elements,[a,o]=h.useState(null),[l,c]=h.useState(null),d=(s==null?void 0:s.reference)||a,f=h.useRef(null),x=$tt();uJ(()=>{d&&(f.current=d)},[d]);const g=Att({...t,elements:{...s,...l&&{reference:l}}}),y=h.useCallback(I=>{const L=ud(I)?{getBoundingClientRect:()=>I.getBoundingClientRect(),contextElement:I}:I;c(L),g.refs.setReference(L)},[g.refs]),v=h.useCallback(I=>{(ud(I)||I===null)&&(f.current=I,o(I)),(ud(g.refs.reference.current)||g.refs.reference.current===null||I!==null&&!ud(I))&&g.refs.setReference(I)},[g.refs]),C=h.useMemo(()=>({...g.refs,setReference:v,setPositionReference:y,domReference:f}),[g.refs,v,y]),S=h.useMemo(()=>({...g.elements,domReference:d}),[g.elements,d]),T=h.useMemo(()=>({...g,...r,refs:C,elements:S,nodeId:e}),[g,C,S,e,r]);return uJ(()=>{r.dataRef.current.floatingContext=T;const I=x==null?void 0:x.nodesRef.current.find(L=>L.id===e);I&&(I.context=T)}),h.useMemo(()=>({...g,context:T,refs:C,elements:S}),[g,C,S,T])}const Xhe="active",Qhe="selected";function BH(t,e,n){const r=new Map,s=n==="item";let a=t;if(s&&t){const{[Xhe]:o,[Qhe]:l,...c}=t;a=c}return{...n==="floating"&&{tabIndex:-1,[Utt]:""},...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&&[Xhe,Qhe].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=h.useCallback(l=>BH(l,t,"reference"),e),a=h.useCallback(l=>BH(l,t,"floating"),n),o=h.useCallback(l=>BH(l,t,"item"),r);return h.useMemo(()=>({getReferenceProps:s,getFloatingProps:a,getItemProps:o}),[s,a,o])}function Zhe(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}=ix(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,S=y.clientTop!==0,T=x===y;if(!g)return{};const I={...e,...await W7e(-g.offsetTop-x.clientTop-f.reference.height/2-g.offsetHeight/2-a).fn(e)},L=await RH(Zhe(I,y.scrollHeight+v+x.clientTop),d),F=await RH(I,{...d,elementContext:"reference"}),$=Tu(0,L.top),O=I.y+$,U=y.scrollHeight>y.clientHeight,re=(U?Q=>Q:m9)(Tu(0,y.scrollHeight+(C&&T||S?v*2:0)-$-Tu(0,L.bottom)));if(y.style.maxHeight=re+"px",y.scrollTop=$,s){const Q=U&&y.offsetHeight<g.offsetHeight*l-1||F.top>=-c||F.bottom>=-c;Ea.flushSync(()=>s(Q))}return r&&(r.current=await RH(Zhe({...I,y:O},y.offsetHeight+v+x.clientTop),d)),{y:O}}});function qtt(t,e){const{open:n,elements:r}=t,{enabled:s=!0,overflowRef:a,scrollRef:o,onChange:l}=e,c=G7e(l),u=h.useRef(!1),d=h.useRef(null),f=h.useRef(null);h.useEffect(()=>{if(!s)return;function g(v){if(v.ctrlKey||!y||a.current==null)return;const C=v.deltaY,S=a.current.top>=-.5,T=a.current.bottom>=-.5,I=y.scrollHeight-y.clientHeight,L=C<0?-1:1,F=C<0?"max":"min";y.scrollHeight<=y.clientHeight||(!S&&C>0||!T&&C<0?(v.preventDefault(),Ea.flushSync(()=>{c($=>$+Math[F](C,I*L))})):/firefox/i.test(Wet())&&(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=h.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)&&Ea.flushSync(()=>c(v=>v+y))}requestAnimationFrame(()=>{d.current=g.scrollTop})}}}),[r.floating,c,a,o]);return h.useMemo(()=>s?{floating:x}:{},[s,x])}let Dj=h.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Dj.displayName="FloatingContext";let Lie=h.createContext(null);Lie.displayName="PlacementContext";function Gtt(t){return h.useMemo(()=>t?typeof t=="string"?{to:t}:t:null,[t])}function Ktt(){return h.useContext(Dj).setReference}function Ytt(){return h.useContext(Dj).getReferenceProps}function Xtt(){let{getFloatingProps:t,slot:e}=h.useContext(Dj);return h.useCallback((...n)=>Object.assign({},t(...n),{"data-anchor":e.anchor}),[t,e])}function Qtt(t=null){t===!1&&(t=null),typeof t=="string"&&(t={to:t});let e=h.useContext(Lie),n=h.useMemo(()=>t,[JSON.stringify(t,(s,a)=>{var o;return(o=a==null?void 0:a.outerHTML)!=null?o:a})]);so(()=>{e==null||e(n??null)},[e,n]);let r=h.useContext(Dj);return h.useMemo(()=>[r.setFloating,t?r.styles:{}],[r.setFloating,t,r.styles])}let Jhe=4;function Ztt({children:t,enabled:e=!0}){let[n,r]=h.useState(null),[s,a]=h.useState(0),o=h.useRef(null),[l,c]=h.useState(null);Jtt(l);let u=e&&n!==null&&l!==null,{to:d="bottom",gap:f=0,offset:x=0,padding:g=0,inner:y}=ent(n,l),[v,C="center"]=d.split(" ");so(()=>{u&&a(0)},[u]);let{refs:S,floatingStyles:T,context:I}=Htt({open:u,placement:v==="selection"?C==="center"?"bottom":`bottom-${C}`:C==="center"?`${v}`:`${v}-${C}`,strategy:"absolute",transform:!1,middleware:[W7e({mainAxis:v==="selection"?0:f,crossAxis:x}),_tt({padding:g}),v!=="selection"&&Ett({padding:g}),v==="selection"&&y?Wtt({...y,padding:g,overflowRef:o,offset:s,minItemsVisible:Jhe,referenceOverflowThreshold:g,onFallbackChange(Q){var q,te;if(!Q)return;let fe=I.elements.floating;if(!fe)return;let G=parseFloat(getComputedStyle(fe).scrollPaddingBottom)||0,ie=Math.min(Jhe,fe.childElementCount),oe=0,K=0;for(let H of(te=(q=I.elements.floating)==null?void 0:q.childNodes)!=null?te:[])if(H instanceof HTMLElement){let ee=H.offsetTop,se=ee+H.clientHeight+G,pe=fe.scrollTop,Se=pe+fe.clientHeight;if(ee>=pe&&se<=Se)ie--;else{K=Math.max(0,Math.min(se,Se)-Math.max(ee,pe)),oe=H.clientHeight;break}}ie>=1&&a(H=>{let ee=oe*ie-K+G;return H>=ee?H:ee})}}):null,ktt({padding:g,apply({availableWidth:Q,availableHeight:q,elements:te}){Object.assign(te.floating.style,{overflow:"auto",maxWidth:`${Q}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${q}px)`})}})].filter(Boolean),whileElementsMounted:D7e}),[L=v,F=C]=I.placement.split("-");v==="selection"&&(L="selection");let $=h.useMemo(()=>({anchor:[L,F].filter(Boolean).join(" ")}),[L,F]),O=qtt(I,{overflowRef:o,onChange:a}),{getReferenceProps:U,getFloatingProps:Y}=Vtt([O]),re=Ks(Q=>{c(Q),S.setFloating(Q)});return h.createElement(Lie.Provider,{value:r},h.createElement(Dj.Provider,{value:{setFloating:re,setReference:S.setReference,styles:T,getReferenceProps:U,getFloatingProps:Y,slot:$}},t))}function Jtt(t){so(()=>{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 ent(t,e){var n,r,s;let a=$H((n=t==null?void 0:t.gap)!=null?n:"var(--anchor-gap, 0)",e),o=$H((r=t==null?void 0:t.offset)!=null?r:"var(--anchor-offset, 0)",e),l=$H((s=t==null?void 0:t.padding)!=null?s:"var(--anchor-padding, 0)",e);return{...t,gap:a,offset:o,padding:l}}function $H(t,e,n=void 0){let r=N2(),s=Ks((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=epe(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[S,T]of x.entries()){let I=window.getComputedStyle(u).getPropertyValue(T);if(g[S]!==I){g[S]=I,v=!0;break}}if(!v)return;let C=epe(c,u);d!==C&&(f(C),d=C)})}return r.dispose}]}return[n,null]}),a=h.useMemo(()=>s(t,e)[0],[t,e]),[o=a,l]=h.useState();return so(()=>{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 epe(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 UB=h.createContext(null);UB.displayName="OpenClosedContext";var oc=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(oc||{});function Bj(){return h.useContext(UB)}function Rie({value:t,children:e}){return ke.createElement(UB.Provider,{value:t},e)}function Y7e({children:t}){return ke.createElement(UB.Provider,{value:null},t)}function tnt(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let Yb=[];tnt(()=>{function t(e){if(!(e.target instanceof HTMLElement)||e.target===document.body||Yb[0]===e.target)return;let n=e.target;n=n.closest(XM),Yb.unshift(n??e.target),Yb=Yb.filter(r=>r!=null&&r.isConnected),Yb.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 nnt(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 UH(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:nnt(t)}}function X7e(t){let e=Ks(t),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,MB(()=>{n.current&&e()})}),[e])}function rnt(){let t=typeof document>"u";return"useSyncExternalStore"in Gy?(e=>e.useSyncExternalStore)(Gy)(()=>()=>{},()=>!1,()=>!t):!1}function fT(){let t=rnt(),[e,n]=h.useState(f3.isHandoffComplete);return e&&f3.isHandoffComplete===!1&&n(!1),h.useEffect(()=>{e!==!0&&n(!0)},[e]),h.useEffect(()=>f3.handoff(),[]),t?!1:e}let Q7e=h.createContext(!1);function snt(){return h.useContext(Q7e)}function tpe(t){return ke.createElement(Q7e.Provider,{value:t.force},t.children)}function int(t){let e=snt(),n=h.useContext(J7e),r=Mj(t),[s,a]=h.useState(()=>{var o;if(!e&&n!==null)return(o=n.current)!=null?o:null;if(f3.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 h.useEffect(()=>{s!==null&&(r!=null&&r.body.contains(s)||r==null||r.body.appendChild(s))},[s,r]),h.useEffect(()=>{e||n!==null&&a(n.current)},[n,a,e]),s}let Z7e=h.Fragment,ant=wo(function(t,e){let n=t,r=h.useRef(null),s=fc(p7e(f=>{r.current=f}),e),a=Mj(r),o=int(r),[l]=h.useState(()=>{var f;return f3.isServer?null:(f=a==null?void 0:a.createElement("div"))!=null?f:null}),c=h.useContext(dJ),u=fT();so(()=>{!o||!l||o.contains(l)||(l.setAttribute("data-headlessui-portal",""),o.appendChild(l))},[o,l]),so(()=>{if(l&&c)return c.register(l)},[c,l]),X7e(()=>{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=To();return u?!o||!l?null:Ea.createPortal(d({ourProps:{ref:s},theirProps:n,slot:{},defaultTag:Z7e,name:"Portal"}),l):null});function ont(t,e){let n=fc(e),{enabled:r=!0,...s}=t,a=To();return r?ke.createElement(ant,{...s,ref:n}):a({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Z7e,name:"Portal"})}let lnt=h.Fragment,J7e=h.createContext(null);function cnt(t,e){let{target:n,...r}=t,s={ref:fc(e)},a=To();return ke.createElement(J7e.Provider,{value:n},a({ourProps:s,theirProps:r,defaultTag:lnt,name:"Popover.Group"}))}let dJ=h.createContext(null);function unt(){let t=h.useContext(dJ),e=h.useRef([]),n=Ks(a=>(e.current.push(a),t&&t.register(a),()=>r(a))),r=Ks(a=>{let o=e.current.indexOf(a);o!==-1&&e.current.splice(o,1),t&&t.unregister(a)}),s=h.useMemo(()=>({register:n,unregister:r,portals:e}),[n,r,e]);return[e,h.useMemo(()=>function({children:a}){return ke.createElement(dJ.Provider,{value:s},a)},[s])]}let dnt=wo(ont),e_e=wo(cnt),t_e=Object.assign(dnt,{Group:e_e});function fnt(t,e=typeof document<"u"?document.defaultView:null,n){let r=Oj(t,"escape");k7e(e,"keydown",s=>{r&&(s.defaultPrevented||s.key===Ao.Escape&&n(s))})}function hnt(){var t;let[e]=h.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,r]=h.useState((t=e==null?void 0:e.matches)!=null?t:!1);return so(()=>{if(!e)return;function s(a){r(a.matches)}return e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[e]),n}function pnt({defaultContainers:t=[],portals:e,mainTreeNode:n}={}){let r=Mj(n),s=Ks(()=>{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:Ks(a=>s().some(o=>o.contains(a)))}}let n_e=h.createContext(null);function npe({children:t,node:e}){let[n,r]=h.useState(null),s=r_e(e??n);return ke.createElement(n_e.Provider,{value:s},t,s===null&&ke.createElement(h9,{features:JN.Hidden,ref:a=>{var o,l;if(a){for(let c of(l=(o=C2(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 r_e(t=null){var e;return(e=h.useContext(n_e))!=null?e:t}function Die(){let t=h.useRef(!1);return so(()=>(t.current=!0,()=>{t.current=!1}),[]),t}var q7=(t=>(t[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t))(q7||{});function mnt(){let t=h.useRef(0);return _7e(!0,"keydown",e=>{e.key==="Tab"&&(t.current=e.shiftKey?1:0)},!0),t}function s_e(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 xnt="div";var rw=(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))(rw||{});function gnt(t,e){let n=h.useRef(null),r=fc(n,e),{initialFocus:s,initialFocusFallback:a,containers:o,features:l=15,...c}=t;fT()||(l=0);let u=Mj(n);wnt(l,{ownerDocument:u});let d=Cnt(l,{ownerDocument:u,container:n,initialFocus:s,initialFocusFallback:a});Nnt(l,{ownerDocument:u,container:n,containers:o,previousActiveElement:d});let f=mnt(),x=Ks(T=>{let I=n.current;I&&(L=>L())(()=>{rh(f.current,{[q7.Forwards]:()=>{N4(I,um.First,{skipElements:[T.relatedTarget,a]})},[q7.Backwards]:()=>{N4(I,um.Last,{skipElements:[T.relatedTarget,a]})}})})}),g=Oj(!!(l&2),"focus-trap#tab-lock"),y=N2(),v=h.useRef(!1),C={ref:r,onKeyDown(T){T.key=="Tab"&&(v.current=!0,y.requestAnimationFrame(()=>{v.current=!1}))},onBlur(T){if(!(l&4))return;let I=s_e(o);n.current instanceof HTMLElement&&I.add(n.current);let L=T.relatedTarget;L instanceof HTMLElement&&L.dataset.headlessuiFocusGuard!=="true"&&(i_e(I,L)||(v.current?N4(n.current,rh(f.current,{[q7.Forwards]:()=>um.Next,[q7.Backwards]:()=>um.Previous})|um.WrapAround,{relativeTo:T.target}):T.target instanceof HTMLElement&&W0(T.target)))}},S=To();return ke.createElement(ke.Fragment,null,g&&ke.createElement(h9,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:JN.Focusable}),S({ourProps:C,theirProps:c,defaultTag:xnt,name:"FocusTrap"}),g&&ke.createElement(h9,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:JN.Focusable}))}let bnt=wo(gnt),ynt=Object.assign(bnt,{features:rw});function vnt(t=!0){let e=h.useRef(Yb.slice());return kie(([n],[r])=>{r===!0&&n===!1&&MB(()=>{e.current.splice(0)}),r===!1&&n===!0&&(e.current=Yb.slice())},[t,Yb,e]),Ks(()=>{var n;return(n=e.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function wnt(t,{ownerDocument:e}){let n=!!(t&8),r=vnt(n);kie(()=>{n||(e==null?void 0:e.activeElement)===(e==null?void 0:e.body)&&W0(r())},[n]),X7e(()=>{n&&W0(r())})}function Cnt(t,{ownerDocument:e,container:n,initialFocus:r,initialFocusFallback:s}){let a=h.useRef(null),o=Oj(!!(t&1),"focus-trap#initial-focus"),l=Die();return kie(()=>{if(t===0)return;if(!o){s!=null&&s.current&&W0(s.current);return}let c=n.current;c&&MB(()=>{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)W0(r.current);else{if(t&16){if(N4(c,um.First|um.AutoFocus)!==iJ.Error)return}else if(N4(c,um.First)!==iJ.Error)return;if(s!=null&&s.current&&(W0(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 Nnt(t,{ownerDocument:e,container:n,containers:r,previousActiveElement:s}){let a=Die(),o=!!(t&4);k7e(e==null?void 0:e.defaultView,"focus",l=>{if(!o||!a.current)return;let c=s_e(r);n.current instanceof HTMLElement&&c.add(n.current);let u=s.current;if(!u)return;let d=l.target;d&&d instanceof HTMLElement?i_e(c,d)?(s.current=d,W0(d)):(l.preventDefault(),l.stopPropagation(),W0(u)):W0(s.current)},!0)}function i_e(t,e){for(let n of t)if(n.contains(e))return!0;return!1}function a_e(t){var e;return!!(t.enter||t.enterFrom||t.enterTo||t.leave||t.leaveFrom||t.leaveTo)||((e=t.as)!=null?e:l_e)!==h.Fragment||ke.Children.count(t.children)===1}let zB=h.createContext(null);zB.displayName="TransitionContext";var Snt=(t=>(t.Visible="visible",t.Hidden="hidden",t))(Snt||{});function jnt(){let t=h.useContext(zB);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function Ant(){let t=h.useContext(HB);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let HB=h.createContext(null);HB.displayName="NestingContext";function VB(t){return"children"in t?VB(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function o_e(t,e){let n=_5(t),r=h.useRef([]),s=Die(),a=N2(),o=Ks((g,y=_y.Hidden)=>{let v=r.current.findIndex(({el:C})=>C===g);v!==-1&&(rh(y,{[_y.Unmount](){r.current.splice(v,1)},[_y.Hidden](){r.current[v].state="hidden"}}),a.microTask(()=>{var C;!VB(r)&&s.current&&((C=n.current)==null||C.call(n))}))}),l=Ks(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,_y.Unmount)}),c=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[]}),f=Ks((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(([S,T])=>T)).then(()=>C())})]),y==="enter"?u.current=u.current.then(()=>e==null?void 0:e.wait.current).then(()=>v(y)):v(y)}),x=Ks((g,y,v)=>{Promise.all(d.current[y].splice(0).map(([C,S])=>S)).then(()=>{var C;(C=c.current.shift())==null||C()}).then(()=>v(y))});return h.useMemo(()=>({children:r,register:l,unregister:o,onStart:f,onStop:x,wait:u,chains:d}),[l,o,r,f,x,d,u])}let l_e=h.Fragment,c_e=Ky.RenderStrategy;function _nt(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,[S,T]=h.useState(null),I=h.useRef(null),L=a_e(t),F=fc(...L?[I,e,T]:e===null?[]:[e]),$=(n=C.unmount)==null||n?_y.Unmount:_y.Hidden,{show:O,appear:U,initial:Y}=jnt(),[re,Q]=h.useState(O?"visible":"hidden"),q=Ant(),{register:te,unregister:fe}=q;so(()=>te(I),[te,I]),so(()=>{if($===_y.Hidden&&I.current){if(O&&re!=="visible"){Q("visible");return}return rh(re,{hidden:()=>fe(I),visible:()=>te(I)})}},[re,I,te,fe,O,$]);let G=fT();so(()=>{if(L&&G&&re==="visible"&&I.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,re,G,L]);let ie=Y&&!U,oe=U&&O&&Y,K=h.useRef(!1),H=o_e(()=>{K.current||(Q("hidden"),fe(I))},q),ee=Ks(we=>{K.current=!0;let je=we?"enter":"leave";H.onStart(I,je,Fe=>{Fe==="enter"?a==null||a():Fe==="leave"&&(l==null||l())})}),se=Ks(we=>{let je=we?"enter":"leave";K.current=!1,H.onStop(I,je,Fe=>{Fe==="enter"?o==null||o():Fe==="leave"&&(c==null||c())}),je==="leave"&&!VB(H)&&(Q("hidden"),fe(I))});h.useEffect(()=>{L&&s||(ee(O),se(O))},[O,L,s]);let pe=!(!s||!L||!G||ie),[,Se]=Eie(pe,S,O,{start:ee,end:se}),ge=qb({ref:F,className:((r=rJ(C.className,oe&&u,oe&&d,Se.enter&&u,Se.enter&&Se.closed&&d,Se.enter&&!Se.closed&&f,Se.leave&&g,Se.leave&&!Se.closed&&y,Se.leave&&Se.closed&&v,!Se.transition&&O&&x))==null?void 0:r.trim())||void 0,..._ie(Se)}),ve=0;re==="visible"&&(ve|=oc.Open),re==="hidden"&&(ve|=oc.Closed),Se.enter&&(ve|=oc.Opening),Se.leave&&(ve|=oc.Closing);let be=To();return ke.createElement(HB.Provider,{value:H},ke.createElement(Rie,{value:ve},be({ourProps:ge,theirProps:C,defaultTag:l_e,features:c_e,visible:re==="visible",name:"Transition.Child"})))}function Ent(t,e){let{show:n,appear:r=!1,unmount:s=!0,...a}=t,o=h.useRef(null),l=a_e(t),c=fc(...l?[o,e]:e===null?[]:[e]);fT();let u=Bj();if(n===void 0&&u!==null&&(n=(u&oc.Open)===oc.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[d,f]=h.useState(n?"visible":"hidden"),x=o_e(()=>{n||f("hidden")}),[g,y]=h.useState(!0),v=h.useRef([n]);so(()=>{g!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),y(!1))},[v,n]);let C=h.useMemo(()=>({show:n,appear:r,initial:g}),[n,r,g]);so(()=>{n?f("visible"):!VB(x)&&o.current!==null&&f("hidden")},[n,x]);let S={unmount:s},T=Ks(()=>{var F;g&&y(!1),(F=t.beforeEnter)==null||F.call(t)}),I=Ks(()=>{var F;g&&y(!1),(F=t.beforeLeave)==null||F.call(t)}),L=To();return ke.createElement(HB.Provider,{value:x},ke.createElement(zB.Provider,{value:C},L({ourProps:{...S,as:h.Fragment,children:ke.createElement(u_e,{ref:c,...S,...a,beforeEnter:T,beforeLeave:I})},theirProps:{},defaultTag:h.Fragment,features:c_e,visible:d==="visible",name:"Transition"})))}function knt(t,e){let n=h.useContext(zB)!==null,r=Bj()!==null;return ke.createElement(ke.Fragment,null,!n&&r?ke.createElement(fJ,{ref:e,...t}):ke.createElement(u_e,{ref:e,...t}))}let fJ=wo(Ent),u_e=wo(_nt),Bie=wo(knt),d_e=Object.assign(fJ,{Child:Bie,Root:fJ});var Tnt=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(Tnt||{}),Pnt=(t=>(t[t.SetTitleId=0]="SetTitleId",t))(Pnt||{});let Int={0(t,e){return t.titleId===e.id?t:{...t,titleId:e.id}}},$ie=h.createContext(null);$ie.displayName="DialogContext";function WB(t){let e=h.useContext($ie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,WB),n}return e}function Fnt(t,e){return rh(e.type,Int,t,e)}let rpe=wo(function(t,e){let n=h.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=h.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=Bj();s===void 0&&g!==null&&(s=(g&oc.Open)===oc.Open);let y=h.useRef(null),v=fc(y,e),C=Mj(y),S=s?0:1,[T,I]=h.useReducer(Fnt,{titleId:null,descriptionId:null,panelRef:h.createRef()}),L=Ks(()=>a(!1)),F=Ks(se=>I({type:0,id:se})),$=fT()?S===0:!1,[O,U]=unt(),Y={get current(){var se;return(se=T.panelRef.current)!=null?se:y.current}},re=r_e(),{resolveContainers:Q}=pnt({mainTreeNode:re,portals:O,defaultContainers:[Y]}),q=g!==null?(g&oc.Closing)===oc.Closing:!1;w7e(u||q?!1:$,{allowed:Ks(()=>{var se,pe;return[(pe=(se=y.current)==null?void 0:se.closest("[data-headlessui-portal]"))!=null?pe:null]}),disallowed:Ks(()=>{var se;return[(se=re==null?void 0:re.closest("body > *:not(#headlessui-portal-root)"))!=null?se:null]})}),E7e($,Q,se=>{se.preventDefault(),L()}),fnt($,C==null?void 0:C.defaultView,se=>{se.preventDefault(),se.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),L()}),T7e(u||q?!1:$,C,Q),C7e($,y,L);let[te,fe]=wie(),G=h.useMemo(()=>[{dialogState:S,close:L,setTitleId:F,unmount:d},T],[S,T,L,F,d]),ie=h.useMemo(()=>({open:S===0}),[S]),oe={ref:v,id:r,role:l,tabIndex:-1,"aria-modal":u?void 0:S===0?!0:void 0,"aria-labelledby":T.titleId,"aria-describedby":te,unmount:d},K=!hnt(),H=rw.None;$&&!u&&(H|=rw.RestoreFocus,H|=rw.TabLock,c&&(H|=rw.AutoFocus),K&&(H|=rw.InitialFocus));let ee=To();return ke.createElement(Y7e,null,ke.createElement(tpe,{force:!0},ke.createElement(t_e,null,ke.createElement($ie.Provider,{value:G},ke.createElement(e_e,{target:y},ke.createElement(tpe,{force:!1},ke.createElement(fe,{slot:ie},ke.createElement(U,null,ke.createElement(ynt,{initialFocus:o,initialFocusFallback:y,containers:Q,features:H},ke.createElement(b7e,{value:L},ee({ourProps:oe,theirProps:f,slot:ie,defaultTag:Ont,features:Mnt,visible:S===0,name:"Dialog"})))))))))))}),Ont="div",Mnt=Ky.RenderStrategy|Ky.Static;function Lnt(t,e){let{transition:n=!1,open:r,...s}=t,a=Bj(),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?ke.createElement(npe,null,ke.createElement(d_e,{show:r,transition:n,unmount:s.unmount},ke.createElement(rpe,{ref:e,...s}))):ke.createElement(npe,null,ke.createElement(rpe,{ref:e,open:r,...s}))}let Rnt="div";function Dnt(t,e){let n=h.useId(),{id:r=`headlessui-dialog-panel-${n}`,transition:s=!1,...a}=t,[{dialogState:o,unmount:l},c]=WB("Dialog.Panel"),u=fc(e,c.panelRef),d=h.useMemo(()=>({open:o===0}),[o]),f=Ks(C=>{C.stopPropagation()}),x={ref:u,id:r,onClick:f},g=s?Bie:h.Fragment,y=s?{unmount:l}:{},v=To();return ke.createElement(g,{...y},v({ourProps:x,theirProps:a,slot:d,defaultTag:Rnt,name:"Dialog.Panel"}))}let Bnt="div";function $nt(t,e){let{transition:n=!1,...r}=t,[{dialogState:s,unmount:a}]=WB("Dialog.Backdrop"),o=h.useMemo(()=>({open:s===0}),[s]),l={ref:e,"aria-hidden":!0},c=n?Bie:h.Fragment,u=n?{unmount:a}:{},d=To();return ke.createElement(c,{...u},d({ourProps:l,theirProps:r,slot:o,defaultTag:Bnt,name:"Dialog.Backdrop"}))}let Unt="h2";function znt(t,e){let n=h.useId(),{id:r=`headlessui-dialog-title-${n}`,...s}=t,[{dialogState:a,setTitleId:o}]=WB("Dialog.Title"),l=fc(e);h.useEffect(()=>(o(r),()=>o(null)),[r,o]);let c=h.useMemo(()=>({open:a===0}),[a]),u={ref:l,id:r};return To()({ourProps:u,theirProps:s,slot:c,defaultTag:Unt,name:"Dialog.Title"})}let Hnt=wo(Lnt),Ji=wo(Dnt),fa=wo($nt),Vnt=wo(znt),ha=Object.assign(Hnt,{Panel:Ji,Title:Vnt,Description:x7e});var spe;let Wnt=(spe=ke.startTransition)!=null?spe:function(t){t()};var qnt=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(qnt||{}),Gnt=(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))(Gnt||{});let Knt={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}}},Uie=h.createContext(null);Uie.displayName="DisclosureContext";function zie(t){let e=h.useContext(Uie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,zie),n}return e}let Hie=h.createContext(null);Hie.displayName="DisclosureAPIContext";function f_e(t){let e=h.useContext(Hie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,f_e),n}return e}let Vie=h.createContext(null);Vie.displayName="DisclosurePanelContext";function Ynt(){return h.useContext(Vie)}function Xnt(t,e){return rh(e.type,Knt,t,e)}let Qnt=h.Fragment;function Znt(t,e){let{defaultOpen:n=!1,...r}=t,s=h.useRef(null),a=fc(e,p7e(v=>{s.current=v},t.as===void 0||t.as===h.Fragment)),o=h.useReducer(Xnt,{disclosureState:n?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:c},u]=o,d=Ks(v=>{u({type:1});let C=C2(s);if(!C||!c)return;let S=v?v instanceof HTMLElement?v:v.current instanceof HTMLElement?v.current:C.getElementById(c):C.getElementById(c);S==null||S.focus()}),f=h.useMemo(()=>({close:d}),[d]),x=h.useMemo(()=>({open:l===0,close:d}),[l,d]),g={ref:a},y=To();return ke.createElement(Uie.Provider,{value:o},ke.createElement(Hie.Provider,{value:f},ke.createElement(b7e,{value:d},ke.createElement(Rie,{value:rh(l,{0:oc.Open,1:oc.Closed})},y({ourProps:g,theirProps:r,slot:x,defaultTag:Qnt,name:"Disclosure"})))))}let Jnt="button";function ert(t,e){let n=h.useId(),{id:r=`headlessui-disclosure-button-${n}`,disabled:s=!1,autoFocus:a=!1,...o}=t,[l,c]=zie("Disclosure.Button"),u=Ynt(),d=u===null?!1:u===l.panelId,f=h.useRef(null),x=fc(f,e,Ks(Y=>{if(!d)return c({type:4,element:Y})}));h.useEffect(()=>{if(!d)return c({type:2,buttonId:r}),()=>{c({type:2,buttonId:null})}},[r,c,d]);let g=Ks(Y=>{var re;if(d){if(l.disclosureState===1)return;switch(Y.key){case Ao.Space:case Ao.Enter:Y.preventDefault(),Y.stopPropagation(),c({type:0}),(re=l.buttonElement)==null||re.focus();break}}else switch(Y.key){case Ao.Space:case Ao.Enter:Y.preventDefault(),Y.stopPropagation(),c({type:0});break}}),y=Ks(Y=>{switch(Y.key){case Ao.Space:Y.preventDefault();break}}),v=Ks(Y=>{var re;vie(Y.currentTarget)||s||(d?(c({type:0}),(re=l.buttonElement)==null||re.focus()):c({type:0}))}),{isFocusVisible:C,focusProps:S}=gie({autoFocus:a}),{isHovered:T,hoverProps:I}=xie({isDisabled:s}),{pressed:L,pressProps:F}=bie({disabled:s}),$=h.useMemo(()=>({open:l.disclosureState===0,hover:T,active:L,disabled:s,focus:C,autofocus:a}),[l,T,L,C,s,a]),O=Aie(t,l.buttonElement),U=f9(d?{ref:x,type:O,disabled:s||void 0,autoFocus:a,onKeyDown:g,onClick:v}:{ref:x,id:r,type:O,"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},S,I,F);return To()({ourProps:U,theirProps:o,slot:$,defaultTag:Jnt,name:"Disclosure.Button"})}let trt="div",nrt=Ky.RenderStrategy|Ky.Static;function rrt(t,e){let n=h.useId(),{id:r=`headlessui-disclosure-panel-${n}`,transition:s=!1,...a}=t,[o,l]=zie("Disclosure.Panel"),{close:c}=f_e("Disclosure.Panel"),[u,d]=h.useState(null),f=fc(e,Ks(T=>{Wnt(()=>l({type:5,element:T}))}),d);h.useEffect(()=>(l({type:3,panelId:r}),()=>{l({type:3,panelId:null})}),[r,l]);let x=Bj(),[g,y]=Eie(s,u,x!==null?(x&oc.Open)===oc.Open:o.disclosureState===0),v=h.useMemo(()=>({open:o.disclosureState===0,close:c}),[o.disclosureState,c]),C={ref:f,id:r,..._ie(y)},S=To();return ke.createElement(Y7e,null,ke.createElement(Vie.Provider,{value:o.panelId},S({ourProps:C,theirProps:a,slot:v,defaultTag:trt,features:nrt,visible:g,name:"Disclosure.Panel"})))}let srt=wo(Znt),Wie=wo(ert),qie=wo(rrt),h_e=Object.assign(srt,{Button:Wie,Panel:qie});function irt(t,e){let n=h.useRef({left:0,top:0});if(so(()=>{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 ipe=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ape(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 ipe.test(o)&&(o=o.replace(ipe,"")),o}function art(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():ape(a).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ape(t).trim()}function ort(t){let e=h.useRef(""),n=h.useRef("");return Ks(()=>{let r=t.current;if(!r)return"";let s=r.innerText;if(e.current===s)return n.current;let a=art(r).trim().toLowerCase();return e.current=s,n.current=a,a})}var lrt=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(lrt||{}),crt=(t=>(t[t.Pointer=0]="Pointer",t[t.Other=1]="Other",t))(crt||{}),urt=(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))(urt||{});function zH(t,e=n=>n){let n=t.activeItemIndex!==null?t.items[t.activeItemIndex]:null,r=j7e(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 drt={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=UH(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=UH(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=zH(t),u=UH(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=zH(t,r=>[...r,{id:e.id,dataRef:e.dataRef}]);return{...t,...n}},6:(t,e)=>{let n=zH(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}},Gie=h.createContext(null);Gie.displayName="MenuContext";function qB(t){let e=h.useContext(Gie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,qB),n}return e}function frt(t,e){return rh(e.type,drt,t,e)}let hrt=h.Fragment;function prt(t,e){let{__demoMode:n=!1,...r}=t,s=h.useReducer(frt,{__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=fc(e);E7e(a===0,[l,o],(y,v)=>{c({type:1}),jie(v,Sie.Loose)||(y.preventDefault(),l==null||l.focus())});let d=Ks(()=>{c({type:1})}),f=h.useMemo(()=>({open:a===0,close:d}),[a,d]),x={ref:u},g=To();return ke.createElement(Ztt,null,ke.createElement(Gie.Provider,{value:s},ke.createElement(Rie,{value:rh(a,{0:oc.Open,1:oc.Closed})},g({ourProps:x,theirProps:r,slot:f,defaultTag:hrt,name:"Menu"}))))}let mrt="button";function xrt(t,e){var n;let r=h.useId(),{id:s=`headlessui-menu-button-${r}`,disabled:a=!1,autoFocus:o=!1,...l}=t,[c,u]=qB("Menu.Button"),d=Ytt(),f=fc(e,Ktt(),Ks(O=>u({type:7,element:O}))),x=Ks(O=>{switch(O.key){case Ao.Space:case Ao.Enter:case Ao.ArrowDown:O.preventDefault(),O.stopPropagation(),Ea.flushSync(()=>u({type:0})),u({type:2,focus:Ou.First});break;case Ao.ArrowUp:O.preventDefault(),O.stopPropagation(),Ea.flushSync(()=>u({type:0})),u({type:2,focus:Ou.Last});break}}),g=Ks(O=>{switch(O.key){case Ao.Space:O.preventDefault();break}}),y=Ks(O=>{var U;if(vie(O.currentTarget))return O.preventDefault();a||(c.menuState===0?(Ea.flushSync(()=>u({type:1})),(U=c.buttonElement)==null||U.focus({preventScroll:!0})):(O.preventDefault(),u({type:0})))}),{isFocusVisible:v,focusProps:C}=gie({autoFocus:o}),{isHovered:S,hoverProps:T}=xie({isDisabled:a}),{pressed:I,pressProps:L}=bie({disabled:a}),F=h.useMemo(()=>({open:c.menuState===0,active:I||c.menuState===0,disabled:a,hover:S,focus:v,autofocus:o}),[c,S,v,I,a,o]),$=f9(d(),{ref:f,id:s,type:Aie(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,T,L);return To()({ourProps:$,theirProps:l,slot:F,defaultTag:mrt,name:"Menu.Button"})}let grt="div",brt=Ky.RenderStrategy|Ky.Static;function yrt(t,e){var n,r;let s=h.useId(),{id:a=`headlessui-menu-items-${s}`,anchor:o,portal:l=!1,modal:c=!0,transition:u=!1,...d}=t,f=Gtt(o),[x,g]=qB("Menu.Items"),[y,v]=Qtt(f),C=Xtt(),[S,T]=h.useState(null),I=fc(e,f?y:null,Ks(K=>g({type:8,element:K})),T),L=Mj(x.itemsElement);f&&(l=!0);let F=Bj(),[$,O]=Eie(u,S,F!==null?(F&oc.Open)===oc.Open:x.menuState===0);C7e($,x.buttonElement,()=>{g({type:1})});let U=x.__demoMode?!1:c&&x.menuState===0;T7e(U,L);let Y=x.__demoMode?!1:c&&x.menuState===0;w7e(Y,{allowed:h.useCallback(()=>[x.buttonElement,x.itemsElement],[x.buttonElement,x.itemsElement])});let re=x.menuState!==0,Q=irt(re,x.buttonElement)?!1:$;h.useEffect(()=>{let K=x.itemsElement;K&&x.menuState===0&&K!==(L==null?void 0:L.activeElement)&&K.focus({preventScroll:!0})},[x.menuState,x.itemsElement,L]),zet(x.menuState===0,{container:x.itemsElement,accept(K){return K.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:K.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(K){K.setAttribute("role","none")}});let q=N2(),te=Ks(K=>{var H,ee,se;switch(q.dispose(),K.key){case Ao.Space:if(x.searchQuery!=="")return K.preventDefault(),K.stopPropagation(),g({type:3,value:K.key});case Ao.Enter:if(K.preventDefault(),K.stopPropagation(),g({type:1}),x.activeItemIndex!==null){let{dataRef:pe}=x.items[x.activeItemIndex];(ee=(H=pe.current)==null?void 0:H.domRef.current)==null||ee.click()}S7e(x.buttonElement);break;case Ao.ArrowDown:return K.preventDefault(),K.stopPropagation(),g({type:2,focus:Ou.Next});case Ao.ArrowUp:return K.preventDefault(),K.stopPropagation(),g({type:2,focus:Ou.Previous});case Ao.Home:case Ao.PageUp:return K.preventDefault(),K.stopPropagation(),g({type:2,focus:Ou.First});case Ao.End:case Ao.PageDown:return K.preventDefault(),K.stopPropagation(),g({type:2,focus:Ou.Last});case Ao.Escape:K.preventDefault(),K.stopPropagation(),Ea.flushSync(()=>g({type:1})),(se=x.buttonElement)==null||se.focus({preventScroll:!0});break;case Ao.Tab:K.preventDefault(),K.stopPropagation(),Ea.flushSync(()=>g({type:1})),_et(x.buttonElement,K.shiftKey?um.Previous:um.Next);break;default:K.key.length===1&&(g({type:3,value:K.key}),q.setTimeout(()=>g({type:4}),350));break}}),fe=Ks(K=>{switch(K.key){case Ao.Space:K.preventDefault();break}}),G=h.useMemo(()=>({open:x.menuState===0}),[x.menuState]),ie=f9(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:I,style:{...d.style,...v,"--button-width":get(x.buttonElement,!0).width},..._ie(O)}),oe=To();return ke.createElement(t_e,{enabled:l?t.static||$:!1},oe({ourProps:ie,theirProps:d,slot:G,defaultTag:grt,features:brt,visible:Q,name:"Menu.Items"}))}let vrt=h.Fragment;function wrt(t,e){let n=h.useId(),{id:r=`headlessui-menu-item-${n}`,disabled:s=!1,...a}=t,[o,l]=qB("Menu.Item"),c=o.activeItemIndex!==null?o.items[o.activeItemIndex].id===r:!1,u=h.useRef(null),d=fc(e,u);so(()=>{if(!o.__demoMode&&o.menuState===0&&c&&o.activationTrigger!==0)return vx().requestAnimationFrame(()=>{var Q,q;(q=(Q=u.current)==null?void 0:Q.scrollIntoView)==null||q.call(Q,{block:"nearest"})})},[o.__demoMode,u,c,o.menuState,o.activationTrigger,o.activeItemIndex]);let f=ort(u),x=h.useRef({disabled:s,domRef:u,get textValue(){return f()}});so(()=>{x.current.disabled=s},[x,s]),so(()=>(l({type:5,id:r,dataRef:x}),()=>l({type:6,id:r})),[x,r]);let g=Ks(()=>{l({type:1})}),y=Ks(Q=>{if(s)return Q.preventDefault();l({type:1}),S7e(o.buttonElement)}),v=Ks(()=>{if(s)return l({type:2,focus:Ou.Nothing});l({type:2,focus:Ou.Specific,id:r})}),C=Met(),S=Ks(Q=>{C.update(Q),!s&&(c||l({type:2,focus:Ou.Specific,id:r,trigger:0}))}),T=Ks(Q=>{C.wasMoved(Q)&&(s||c||l({type:2,focus:Ou.Specific,id:r,trigger:0}))}),I=Ks(Q=>{C.wasMoved(Q)&&(s||c&&l({type:2,focus:Ou.Nothing}))}),[L,F]=Nie(),[$,O]=wie(),U=h.useMemo(()=>({active:c,focus:c,disabled:s,close:g}),[c,s,g]),Y={id:r,ref:d,role:"menuitem",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-labelledby":L,"aria-describedby":$,disabled:void 0,onClick:y,onFocus:v,onPointerEnter:S,onMouseEnter:S,onPointerMove:T,onMouseMove:T,onPointerLeave:I,onMouseLeave:I},re=To();return ke.createElement(F,null,ke.createElement(O,null,re({ourProps:Y,theirProps:a,slot:U,defaultTag:vrt,name:"Menu.Item"})))}let Crt="div";function Nrt(t,e){let[n,r]=Nie(),s=t,a={ref:e,"aria-labelledby":n,role:"group"},o=To();return ke.createElement(r,null,o({ourProps:a,theirProps:s,slot:{},defaultTag:Crt,name:"Menu.Section"}))}let Srt="header";function jrt(t,e){let n=h.useId(),{id:r=`headlessui-menu-heading-${n}`,...s}=t,a=Cie();so(()=>a.register(r),[r,a.register]);let o={id:r,ref:e,role:"presentation",...a.props};return To()({ourProps:o,theirProps:s,slot:{},defaultTag:Srt,name:"Menu.Heading"})}let Art="div";function _rt(t,e){let n=t,r={ref:e,role:"separator"};return To()({ourProps:r,theirProps:n,slot:{},defaultTag:Art,name:"Menu.Separator"})}let Ert=wo(prt),GB=wo(xrt),KB=wo(yrt),t4=wo(wrt),krt=wo(Nrt),Trt=wo(jrt),Prt=wo(_rt),YB=Object.assign(Ert,{Button:GB,Items:KB,Item:t4,Section:krt,Heading:Trt,Separator:Prt}),Kie=h.createContext(null);Kie.displayName="GroupContext";let Irt=h.Fragment;function Frt(t){var e;let[n,r]=h.useState(null),[s,a]=Nie(),[o,l]=wie(),c=h.useMemo(()=>({switch:n,setSwitch:r}),[n,r]),u={},d=t,f=To();return ke.createElement(l,{name:"Switch.Description",value:o},ke.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}))}}},ke.createElement(Kie.Provider,{value:c},f({ourProps:u,theirProps:d,slot:{},defaultTag:Irt,name:"Switch.Group"}))))}let Ort="button";function Mrt(t,e){var n;let r=h.useId(),s=f7e(),a=yie(),{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=h.useContext(Kie),[S,T]=h.useState(null),I=h.useRef(null),L=fc(I,e,C===null?null:C.setSwitch,T),F=XJe(u),[$,O]=YJe(c,d,F??!1),U=N2(),[Y,re]=h.useState(!1),Q=Ks(()=>{re(!0),O==null||O(!$),U.nextFrame(()=>{re(!1)})}),q=Ks(we=>{if(vie(we.currentTarget))return we.preventDefault();we.preventDefault(),Q()}),te=Ks(we=>{we.key===Ao.Space?(we.preventDefault(),Q()):we.key===Ao.Enter&&QJe(we.currentTarget)}),fe=Ks(we=>we.preventDefault()),G=g7e(),ie=aet(),{isFocusVisible:oe,focusProps:K}=gie({autoFocus:y}),{isHovered:H,hoverProps:ee}=xie({isDisabled:l}),{pressed:se,pressProps:pe}=bie({disabled:l}),Se=h.useMemo(()=>({checked:$,disabled:l,hover:H,focus:oe,active:se,autofocus:y,changing:Y}),[$,H,oe,se,l,Y,y]),ge=f9({id:o,ref:L,role:"switch",type:Aie(t,S),tabIndex:t.tabIndex===-1?0:(n=t.tabIndex)!=null?n:0,"aria-checked":$,"aria-labelledby":G,"aria-describedby":ie,disabled:l||void 0,autoFocus:y,onClick:q,onKeyUp:te,onKeyPress:fe},K,ee,pe),ve=h.useCallback(()=>{if(F!==void 0)return O==null?void 0:O(F)},[O,F]),be=To();return ke.createElement(ke.Fragment,null,f!=null&&ke.createElement(net,{disabled:l,data:{[f]:x||"on"},overrides:{type:"checkbox",checked:$},form:g,onReset:ve}),be({ourProps:ge,theirProps:v,slot:Se,defaultTag:Ort,name:"Switch"}))}let Lrt=wo(Mrt),Rrt=Frt,Drt=pet,Brt=x7e,Oo=Object.assign(Lrt,{Group:Rrt,Label:Drt,Description:Brt});function $rt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 Vl=h.forwardRef($rt);function Urt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 t1=h.forwardRef(Urt);function zrt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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"}),h.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 Hrt=h.forwardRef(zrt);function Vrt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 Yie=h.forwardRef(Vrt);function Wrt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 qrt=h.forwardRef(Wrt);function Grt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 p_e=h.forwardRef(Grt);function Krt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 g9=h.forwardRef(Krt);function Yrt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 Xie=h.forwardRef(Yrt);function Xrt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 E5=h.forwardRef(Xrt);function Qrt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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"}),h.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 Zrt=h.forwardRef(Qrt);function Jrt({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.createElement("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"}),h.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 est=h.forwardRef(Jrt);function tst({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 m_e=h.forwardRef(tst);function nst({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 rst=h.forwardRef(nst);function sst({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 x_e=h.forwardRef(sst),g_e=h.createContext({});function ist(t){const e=h.useRef(null);return e.current===null&&(e.current=t()),e.current}const Qie=typeof window<"u",ast=Qie?h.useLayoutEffect:h.useEffect,Zie=h.createContext(null);function hT(t,e){t.indexOf(e)===-1&&t.push(e)}function pT(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Dc=(t,e,n)=>n>e?e:n<t?t:n;let nS=()=>{};const Bc={},XB=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function QB(t){return typeof t=="object"&&t!==null}const ZB=t=>/^0[^.\s]+$/u.test(t);function $j(t){let e;return()=>(e===void 0&&(e=t()),e)}const fl=t=>t,ost=(t,e)=>n=>e(t(n)),Cx=(...t)=>t.reduce(ost),ax=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class Uj{constructor(){this.subscriptions=[]}add(e){return hT(this.subscriptions,e),()=>pT(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 Gl=t=>t*1e3,cl=t=>t/1e3;function JB(t,e){return e?t*(1e3/e):0}const b_e=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,lst=1e-7,cst=12;function ust(t,e,n,r,s){let a,o,l=0;do o=e+(n-e)/2,a=b_e(o,r,s)-t,a>0?n=o:e=o;while(Math.abs(a)>lst&&++l<cst);return o}function mT(t,e,n,r){if(t===e&&n===r)return fl;const s=a=>ust(a,0,1,t,n);return a=>a===0||a===1?a:b_e(s(a),e,r)}const y_e=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,v_e=t=>e=>1-t(1-e),w_e=mT(.33,1.53,.69,.99),Jie=v_e(w_e),eae=y_e(Jie),tae=t=>(t*=2)<1?.5*Jie(t):.5*(2-Math.pow(2,-10*(t-1))),nae=t=>1-Math.sin(Math.acos(t)),rae=v_e(nae),sae=y_e(nae),dst=mT(.42,0,1,1),fst=mT(0,0,.58,1),iae=mT(.42,0,.58,1),C_e=t=>Array.isArray(t)&&typeof t[0]!="number",aae=t=>Array.isArray(t)&&typeof t[0]=="number",ope={linear:fl,easeIn:dst,easeInOut:iae,easeOut:fst,circIn:nae,circInOut:sae,circOut:rae,backIn:Jie,backInOut:eae,backOut:w_e,anticipate:tae},hst=t=>typeof t=="string",JM=t=>{if(aae(t)){nS(t.length===4);const[e,n,r,s]=t;return mT(e,n,r,s)}else if(hst(t))return nS(ope[t]!==void 0),ope[t];return t},wI=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function pst(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 mst=40;function N_e(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=wI.reduce((I,L)=>(I[L]=pst(a),I),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:x,render:g,postRender:y}=o,v=()=>{const I=Bc.useManualTiming?s.timestamp:performance.now();n=!1,Bc.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(I-s.timestamp,mst),1)),s.timestamp=I,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:wI.reduce((I,L)=>{const F=o[L];return I[L]=($,O=!1,U=!1)=>(n||C(),F.schedule($,O,U)),I},{}),cancel:I=>{for(let L=0;L<wI.length;L++)o[wI[L]].cancel(I)},state:s,steps:o}}const{schedule:Bo,cancel:Jy,state:eu,steps:HH}=N_e(typeof requestAnimationFrame<"u"?requestAnimationFrame:fl,!0);let RO;function xst(){RO=void 0}const sf={now:()=>(RO===void 0&&sf.set(eu.isProcessing||Bc.useManualTiming?eu.timestamp:performance.now()),RO),set:t=>{RO=t,queueMicrotask(xst)}},S_e=t=>e=>typeof e=="string"&&e.startsWith(t),oae=S_e("--"),gst=S_e("var(--"),lae=t=>gst(t)?bst.test(t.split("/*")[0].trim()):!1,bst=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,zj={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},b9={...zj,transform:t=>Dc(0,1,t)},CI={...zj,default:1},j_=t=>Math.round(t*1e5)/1e5,cae=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function yst(t){return t==null}const vst=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,uae=(t,e)=>n=>!!(typeof n=="string"&&vst.test(n)&&n.startsWith(t)||e&&!yst(n)&&Object.prototype.hasOwnProperty.call(n,e)),j_e=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,a,o,l]=r.match(cae);return{[t]:parseFloat(s),[e]:parseFloat(a),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},wst=t=>Dc(0,255,t),VH={...zj,transform:t=>Math.round(wst(t))},hw={test:uae("rgb","red"),parse:j_e("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+VH.transform(t)+", "+VH.transform(e)+", "+VH.transform(n)+", "+j_(b9.transform(r))+")"};function Cst(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 hJ={test:uae("#"),parse:Cst,transform:hw.transform},xT=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Bb=xT("deg"),q0=xT("%"),di=xT("px"),Nst=xT("vh"),Sst=xT("vw"),lpe={...q0,parse:t=>q0.parse(t)/100,transform:t=>q0.transform(t*100)},n4={test:uae("hsl","hue"),parse:j_e("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+q0.transform(j_(e))+", "+q0.transform(j_(n))+", "+j_(b9.transform(r))+")"},zl={test:t=>hw.test(t)||hJ.test(t)||n4.test(t),parse:t=>hw.test(t)?hw.parse(t):n4.test(t)?n4.parse(t):hJ.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?hw.transform(t):n4.transform(t),getAnimatableNone:t=>{const e=zl.parse(t);return e.alpha=0,zl.transform(e)}},jst=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Ast(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(cae))==null?void 0:e.length)||0)+(((n=t.match(jst))==null?void 0:n.length)||0)>0}const A_e="number",__e="color",_st="var",Est="var(",cpe="${}",kst=/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 y9(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let a=0;const l=e.replace(kst,c=>(zl.test(c)?(r.color.push(a),s.push(__e),n.push(zl.parse(c))):c.startsWith(Est)?(r.var.push(a),s.push(_st),n.push(c)):(r.number.push(a),s.push(A_e),n.push(parseFloat(c))),++a,cpe)).split(cpe);return{values:n,split:l,indexes:r,types:s}}function E_e(t){return y9(t).values}function k_e(t){const{split:e,types:n}=y9(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===A_e?a+=j_(s[o]):l===__e?a+=zl.transform(s[o]):a+=s[o]}return a}}const Tst=t=>typeof t=="number"?0:zl.test(t)?zl.getAnimatableNone(t):t;function Pst(t){const e=E_e(t);return k_e(t)(e.map(Tst))}const e2={test:Ast,parse:E_e,createTransformer:k_e,getAnimatableNone:Pst};function WH(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 Ist({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=WH(c,l,t+1/3),a=WH(c,l,t),o=WH(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function eL(t,e){return n=>n>0?e:t}const Go=(t,e,n)=>t+(e-t)*n,qH=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},Fst=[hJ,hw,n4],Ost=t=>Fst.find(e=>e.test(t));function upe(t){const e=Ost(t);if(!e)return!1;let n=e.parse(t);return e===n4&&(n=Ist(n)),n}const dpe=(t,e)=>{const n=upe(t),r=upe(e);if(!n||!r)return eL(t,e);const s={...n};return a=>(s.red=qH(n.red,r.red,a),s.green=qH(n.green,r.green,a),s.blue=qH(n.blue,r.blue,a),s.alpha=Go(n.alpha,r.alpha,a),hw.transform(s))},pJ=new Set(["none","hidden"]);function Mst(t,e){return pJ.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function Lst(t,e){return n=>Go(t,e,n)}function dae(t){return typeof t=="number"?Lst:typeof t=="string"?lae(t)?eL:zl.test(t)?dpe:Bst:Array.isArray(t)?T_e:typeof t=="object"?zl.test(t)?dpe:Rst:eL}function T_e(t,e){const n=[...t],r=n.length,s=t.map((a,o)=>dae(a)(a,e[o]));return a=>{for(let o=0;o<r;o++)n[o]=s[o](a);return n}}function Rst(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=dae(t[s])(t[s],e[s]));return s=>{for(const a in r)n[a]=r[a](s);return n}}function Dst(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 Bst=(t,e)=>{const n=e2.createTransformer(e),r=y9(t),s=y9(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?pJ.has(t)&&!s.values.length||pJ.has(e)&&!r.values.length?Mst(t,e):Cx(T_e(Dst(r,s),s.values),n):eL(t,e)};function P_e(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Go(t,e,n):dae(t)(t,e)}const $st=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Bo.update(e,n),stop:()=>Jy(e),now:()=>eu.isProcessing?eu.timestamp:sf.now()}},I_e=(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)})`},tL=2e4;function fae(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<tL;)e+=n,r=t.next(e);return e>=tL?1/0:e}function Ust(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(fae(r),tL);return{type:"keyframes",ease:a=>r.next(s*a).value/e,duration:cl(s)}}const zst=5;function F_e(t,e,n){const r=Math.max(e-zst,0);return JB(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},fpe=.001;function Hst({duration:t=il.duration,bounce:e=il.bounce,velocity:n=il.velocity,mass:r=il.mass}){let s,a,o=1-e;o=Dc(il.minDamping,il.maxDamping,o),t=Dc(il.minDuration,il.maxDuration,cl(t)),o<1?(s=u=>{const d=u*o,f=d*t,x=d-n,g=mJ(u,o),y=Math.exp(-f);return fpe-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=mJ(Math.pow(u,2),o);return(-s(u)+fpe>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=Gl(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 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 mJ(t,e){return t*Math.sqrt(1-e*e)}const qst=["duration","bounce"],Gst=["stiffness","damping","mass"];function hpe(t,e){return e.some(n=>t[n]!==void 0)}function Kst(t){let e={velocity:il.velocity,stiffness:il.stiffness,damping:il.damping,mass:il.mass,isResolvedFromDuration:!1,...t};if(!hpe(t,Gst)&&hpe(t,qst))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,a=2*Dc(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:il.mass,stiffness:s,damping:a}}else{const n=Hst(t);e={...e,...n,mass:il.mass},e.isResolvedFromDuration=!0}return e}function nL(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}=Kst({...n,velocity:-cl(n.velocity||0)}),y=x||0,v=u/(2*Math.sqrt(c*d)),C=o-a,S=cl(Math.sqrt(c/d)),T=Math.abs(C)<5;r||(r=T?il.restSpeed.granular:il.restSpeed.default),s||(s=T?il.restDelta.granular:il.restDelta.default);let I;if(v<1){const F=mJ(S,v);I=$=>{const O=Math.exp(-v*S*$);return o-O*((y+v*S*C)/F*Math.sin(F*$)+C*Math.cos(F*$))}}else if(v===1)I=F=>o-Math.exp(-S*F)*(C+(y+S*C)*F);else{const F=S*Math.sqrt(v*v-1);I=$=>{const O=Math.exp(-v*S*$),U=Math.min(F*$,300);return o-O*((y+v*S*C)*Math.sinh(U)+F*C*Math.cosh(U))/F}}const L={calculatedDuration:g&&f||null,next:F=>{const $=I(F);if(g)l.done=F>=f;else{let O=F===0?y:0;v<1&&(O=F===0?Gl(y):F_e(I,F,$));const U=Math.abs(O)<=r,Y=Math.abs(o-$)<=s;l.done=U&&Y}return l.value=l.done?o:$,l},toString:()=>{const F=Math.min(fae(L),tL),$=I_e(O=>L.next(F*O).value,F,30);return F+"ms "+$},toTransition:()=>{}};return L}nL.applyToOptions=t=>{const e=Ust(t,100,nL);return t.ease=e.ease,t.duration=Gl(e.duration),t.type="keyframes",t};function xJ({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=U=>l!==void 0&&U<l||c!==void 0&&U>c,y=U=>l===void 0?c:c===void 0||Math.abs(l-U)<Math.abs(c-U)?l:c;let v=n*e;const C=f+v,S=o===void 0?C:o(C);S!==C&&(v=S-f);const T=U=>-v*Math.exp(-U/r),I=U=>S+T(U),L=U=>{const Y=T(U),re=I(U);x.done=Math.abs(Y)<=u,x.value=x.done?S:re};let F,$;const O=U=>{g(x.value)&&(F=U,$=nL({keyframes:[x.value,y(x.value)],velocity:F_e(I,U,x.value),damping:s,stiffness:a,restDelta:u,restSpeed:d}))};return O(0),{calculatedDuration:null,next:U=>{let Y=!1;return!$&&F===void 0&&(Y=!0,L(U),O(U)),F!==void 0&&U>=F?$.next(U-F):(!Y&&L(U),x)}}}function Yst(t,e,n){const r=[],s=n||Bc.mix||P_e,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]||fl:e;l=Cx(c,l)}r.push(l)}return r}function Xst(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const a=t.length;if(nS(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=Yst(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=ax(t[f],t[f+1],d);return l[f](x)};return n?d=>u(Dc(t[0],t[a-1],d)):u}function Qst(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=ax(0,e,r);t.push(Go(n,1,s))}}function Zst(t){const e=[0];return Qst(e,t.length-1),e}function Jst(t,e){return t.map(n=>n*e)}function eit(t,e){return t.map(()=>e||iae).splice(0,t.length-1)}function A_({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=C_e(r)?r.map(JM):JM(r),a={done:!1,value:e[0]},o=Jst(n&&n.length===e.length?n:Zst(e),t),l=Xst(o,e,{ease:Array.isArray(s)?s:eit(e,s)});return{calculatedDuration:t,next:c=>(a.value=l(c),a.done=c>=t,a)}}const tit=t=>t!==null;function hae(t,{repeat:e,repeatType:n="loop"},r,s=1){const a=t.filter(tit),l=s<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!l||r===void 0?a[l]:r}const nit={decay:xJ,inertia:xJ,tween:A_,keyframes:A_,spring:nL};function O_e(t){typeof t.type=="string"&&(t.type=nit[t.type])}let pae=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 rit=t=>t/100;let mae=class extends pae{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!==sf.now()&&this.tick(sf.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;O_e(e);const{type:n=A_,repeat:r=0,repeatDelay:s=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const c=n||A_;c!==A_&&typeof l[0]!="number"&&(this.mixKeyframes=Cx(rit,P_e(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=fae(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 S=this.currentTime-u*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?S<0:S>s;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let I=this.currentTime,L=r;if(f){const U=Math.min(this.currentTime,s)/l;let Y=Math.floor(U),re=U%1;!re&&U>=1&&(re=1),re===1&&Y--,Y=Math.min(Y,f+1),!!(Y%2)&&(x==="reverse"?(re=1-re,g&&(re-=g/l)):x==="mirror"&&(L=o)),I=Dc(0,1,re)*l}const F=T?{done:!1,value:d[0]}:L.next(I);a&&(F.value=a(F.value));let{done:$}=F;!T&&c!==null&&($=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return O&&y!==xJ&&(F.value=hae(d,this.options,C,this.speed)),v&&v(F.value),O&&this.finish(),F}then(e,n){return this.finished.then(e,n)}get duration(){return cl(this.calculatedDuration)}get time(){return cl(this.currentTime)}set time(e){var n;e=Gl(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(sf.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=cl(this.currentTime))}play(){var s,a;if(this.isStopped)return;const{driver:e=$st,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(sf.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 sit(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const pw=t=>t*180/Math.PI,gJ=t=>{const e=pw(Math.atan2(t[1],t[0]));return bJ(e)},iit={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:gJ,rotateZ:gJ,skewX:t=>pw(Math.atan(t[1])),skewY:t=>pw(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},bJ=t=>(t=t%360,t<0&&(t+=360),t),ppe=gJ,mpe=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),xpe=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),ait={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:mpe,scaleY:xpe,scale:t=>(mpe(t)+xpe(t))/2,rotateX:t=>bJ(pw(Math.atan2(t[6],t[5]))),rotateY:t=>bJ(pw(Math.atan2(-t[2],t[0]))),rotateZ:ppe,rotate:ppe,skewX:t=>pw(Math.atan(t[4])),skewY:t=>pw(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function yJ(t){return t.includes("scale")?1:0}function vJ(t,e){if(!t||t==="none")return yJ(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=ait,s=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=iit,s=l}if(!s)return yJ(e);const a=r[e],o=s[1].split(",").map(lit);return typeof a=="function"?a(o):o[a]}const oit=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return vJ(n,e)};function lit(t){return parseFloat(t.trim())}const Hj=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vj=new Set(Hj),gpe=t=>t===zj||t===di,cit=new Set(["x","y","z"]),uit=Hj.filter(t=>!cit.has(t));function dit(t){const e=[];return uit.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const h3={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})=>vJ(e,"x"),y:(t,{transform:e})=>vJ(e,"y")};h3.translateX=h3.x;h3.translateY=h3.y;const p3=new Set;let wJ=!1,CJ=!1,NJ=!1;function M_e(){if(CJ){const t=Array.from(p3).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=dit(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)})}CJ=!1,wJ=!1,p3.forEach(t=>t.complete(NJ)),p3.clear()}function L_e(){p3.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(CJ=!0)})}function fit(){NJ=!0,L_e(),M_e(),NJ=!1}let xae=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?(p3.add(this),wJ||(wJ=!0,Bo.read(L_e),Bo.resolveKeyframes(M_e))):(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])}sit(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),p3.delete(this)}cancel(){this.state==="scheduled"&&(p3.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}};const hit=t=>t.startsWith("--");function pit(t,e,n){hit(e)?t.style.setProperty(e,n):t.style[e]=n}const mit=$j(()=>window.ScrollTimeline!==void 0),xit={};function git(t,e){const n=$j(t);return()=>xit[e]??n()}const R_e=git(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),G7=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,bpe={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:G7([0,.65,.55,1]),circOut:G7([.55,0,1,.45]),backIn:G7([.31,.01,.66,-.59]),backOut:G7([.33,1.53,.69,.99])};function D_e(t,e){if(t)return typeof t=="function"?R_e()?I_e(t,e):"ease-out":aae(t)?G7(t):Array.isArray(t)?t.map(n=>D_e(n,e)||bpe.easeOut):bpe[t]}function bit(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=D_e(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 B_e(t){return typeof t=="function"&&"applyToOptions"in t}function yit({type:t,...e}){return B_e(t)&&R_e()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}let vit=class extends pae{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,nS(typeof e.type!="string");const u=yit(e);this.animation=bit(n,r,s,u,a),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const d=hae(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):pit(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 cl(Number(e))}get time(){return cl(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Gl(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&&mit()?(this.animation.timeline=e,fl):n(this)}};const $_e={anticipate:tae,backInOut:eae,circInOut:sae};function wit(t){return t in $_e}function Cit(t){typeof t.ease=="string"&&wit(t.ease)&&(t.ease=$_e[t.ease])}const ype=10;let Nit=class extends vit{constructor(e){Cit(e),O_e(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 mae({...o,autoplay:!1}),c=Gl(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-ype).value,l.sample(c).value,ype),l.stop()}};const vpe=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(e2.test(t)||t==="0")&&!t.startsWith("url("));function Sit(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 jit(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=vpe(s,e),l=vpe(a,e);return!o||!l?!1:Sit(t)||(n==="spring"||B_e(n))&&r}function SJ(t){t.duration=0,t.type}const Ait=new Set(["opacity","clipPath","filter","transform"]),_it=$j(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Eit(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 _it()&&n&&Ait.has(n)&&(n!=="transform"||!u)&&!c&&!r&&s!=="mirror"&&a!==0&&o!=="inertia"}const kit=40;let Tit=class extends pae{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=sf.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)||xae;this.keyframeResolver=new g(l,(v,C,S)=>this.onKeyframesResolved(v,C,x,!S),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=sf.now(),jit(e,a,o,l)||((Bc.instantAnimations||!c)&&(d==null||d(hae(e,r,n))),e[0]=e[e.length-1],SJ(r),r.repeat=0);const x={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>kit?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},g=!u&&Eit(x)?new Nit({...x,element:x.motionValue.owner.current}):new mae(x);g.finished.then(()=>this.notifyFinished()).catch(fl),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(),fit()),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 Pit=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Iit(t){const e=Pit.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function U_e(t,e,n=1){const[r,s]=Iit(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const o=a.trim();return XB(o)?parseFloat(o):o}return lae(s)?U_e(s,e,n+1):s}function gae(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const z_e=new Set(["width","height","top","left","right","bottom",...Hj]),Fit={test:t=>t==="auto",parse:t=>t},H_e=t=>e=>e.test(t),V_e=[zj,di,q0,Bb,Sst,Nst,Fit],wpe=t=>V_e.find(H_e(t));function Oit(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||ZB(t):!0}const Mit=new Set(["brightness","contrast","saturate","opacity"]);function Lit(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(cae)||[];if(!r)return t;const s=n.replace(r,"");let a=Mit.has(e)?1:0;return r!==n&&(a*=100),e+"("+a+s+")"}const Rit=/\b([a-z-]*)\(.*?\)/gu,jJ={...e2,getAnimatableNone:t=>{const e=t.match(Rit);return e?e.map(Lit).join(" "):t}},Cpe={...zj,transform:Math.round},Dit={rotate:Bb,rotateX:Bb,rotateY:Bb,rotateZ:Bb,scale:CI,scaleX:CI,scaleY:CI,scaleZ:CI,skew:Bb,skewX:Bb,skewY:Bb,distance:di,translateX:di,translateY:di,translateZ:di,x:di,y:di,z:di,perspective:di,transformPerspective:di,opacity:b9,originX:lpe,originY:lpe,originZ:di},bae={borderWidth:di,borderTopWidth:di,borderRightWidth:di,borderBottomWidth:di,borderLeftWidth:di,borderRadius:di,radius:di,borderTopLeftRadius:di,borderTopRightRadius:di,borderBottomRightRadius:di,borderBottomLeftRadius:di,width:di,maxWidth:di,height:di,maxHeight:di,top:di,right:di,bottom:di,left:di,padding:di,paddingTop:di,paddingRight:di,paddingBottom:di,paddingLeft:di,margin:di,marginTop:di,marginRight:di,marginBottom:di,marginLeft:di,backgroundPositionX:di,backgroundPositionY:di,...Dit,zIndex:Cpe,fillOpacity:b9,strokeOpacity:b9,numOctaves:Cpe},Bit={...bae,color:zl,backgroundColor:zl,outlineColor:zl,fill:zl,stroke:zl,borderColor:zl,borderTopColor:zl,borderRightColor:zl,borderBottomColor:zl,borderLeftColor:zl,filter:jJ,WebkitFilter:jJ},W_e=t=>Bit[t];function q_e(t,e){let n=W_e(t);return n!==jJ&&(n=e2),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const $it=new Set(["auto","none","0"]);function Uit(t,e,n){let r=0,s;for(;r<t.length&&!s;){const a=t[r];typeof a=="string"&&!$it.has(a)&&y9(a).values.length&&(s=t[r]),r++}if(s&&n)for(const a of e)t[a]=q_e(n,s)}let zit=class extends xae{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(),lae(u))){const d=U_e(u,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!z_e.has(r)||e.length!==2)return;const[s,a]=e,o=wpe(s),l=wpe(a);if(o!==l)if(gpe(o)&&gpe(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else h3[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||Oit(e[s]))&&r.push(s);r.length&&Uit(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=h3[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]=h3[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 Hit(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 G_e=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Vit(t){return QB(t)&&"offsetHeight"in t}const Npe=30,Wit=t=>!isNaN(parseFloat(t));let qit=class{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var a;const s=sf.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=sf.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 Uj);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=sf.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Npe)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Npe);return JB(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 rS(t,e){return new qit(t,e)}const{schedule:yae,cancel:i4n}=N_e(queueMicrotask,!1),Hp={x:!1,y:!1};function K_e(){return Hp.x||Hp.y}function Git(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 Y_e(t,e){const n=Hit(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function Spe(t){return!(t.pointerType==="touch"||K_e())}function Kit(t,e,n={}){const[r,s,a]=Y_e(t,n),o=l=>{if(!Spe(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=f=>{Spe(f)&&(u(f),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),a}const X_e=(t,e)=>e?t===e?!0:X_e(t,e.parentElement):!1,vae=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Yit=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Xit(t){return Yit.has(t.tagName)||t.tabIndex!==-1}const DO=new WeakSet;function jpe(t){return e=>{e.key==="Enter"&&t(e)}}function GH(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Qit=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=jpe(()=>{if(DO.has(n))return;GH(n,"down");const s=jpe(()=>{GH(n,"up")}),a=()=>GH(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 Ape(t){return vae(t)&&!K_e()}function Zit(t,e,n={}){const[r,s,a]=Y_e(t,n),o=l=>{const c=l.currentTarget;if(!Ape(l))return;DO.add(c);const u=e(c,l),d=(g,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",x),DO.has(c)&&DO.delete(c),Ape(g)&&typeof u=="function"&&u(g,{success:y})},f=g=>{d(g,c===window||c===document||n.useGlobalTarget||X_e(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=>Qit(u,s)),!Xit(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),a}function Q_e(t){return QB(t)&&"ownerSVGElement"in t}function Jit(t){return Q_e(t)&&t.tagName==="svg"}const Ru=t=>!!(t&&t.getVelocity),eat=[...V_e,zl,e2],tat=t=>eat.find(H_e(t)),Z_e=h.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function nat(t=!0){const e=h.useContext(Zie);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,a=h.useId();h.useEffect(()=>{if(t)return s(a)},[t]);const o=h.useCallback(()=>t&&r&&r(a),[a,r,t]);return!n&&r?[!1,o]:[!0]}const J_e=h.createContext({strict:!1}),_pe={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"]},sS={};for(const t in _pe)sS[t]={isEnabled:e=>_pe[t].some(n=>!!e[n])};function rat(t){for(const e in t)sS[e]={...sS[e],...t[e]}}const sat=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 rL(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||sat.has(t)}let e9e=t=>!rL(t);function iat(t){typeof t=="function"&&(e9e=e=>e.startsWith("on")?!rL(e):t(e))}try{iat(require("@emotion/is-prop-valid").default)}catch{}function aat(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(e9e(s)||n===!0&&rL(s)||!e&&!rL(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const e$=h.createContext({});function t$(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function v9(t){return typeof t=="string"||Array.isArray(t)}const wae=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Cae=["initial",...wae];function n$(t){return t$(t.animate)||Cae.some(e=>v9(t[e]))}function t9e(t){return!!(n$(t)||t.variants)}function oat(t,e){if(n$(t)){const{initial:n,animate:r}=t;return{initial:n===!1||v9(n)?n:void 0,animate:v9(r)?r:void 0}}return t.inherit!==!1?e:{}}function lat(t){const{initial:e,animate:n}=oat(t,h.useContext(e$));return h.useMemo(()=>({initial:e,animate:n}),[Epe(e),Epe(n)])}function Epe(t){return Array.isArray(t)?t.join(" "):t}const w9={};function cat(t){for(const e in t)w9[e]=t[e],oae(e)&&(w9[e].isCSSVariable=!0)}function n9e(t,{layout:e,layoutId:n}){return Vj.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!w9[t]||t==="opacity")}const uat={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},dat=Hj.length;function fat(t,e,n){let r="",s=!0;for(let a=0;a<dat;a++){const o=Hj[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=G_e(l,bae[o]);if(!c){s=!1;const d=uat[o]||o;r+=`${d}(${u}) `}n&&(e[o]=u)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function Nae(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(Vj.has(c)){o=!0;continue}else if(oae(c)){s[c]=u;continue}else{const d=G_e(u,bae[c]);c.startsWith("origin")?(l=!0,a[c]=d):r[c]=d}}if(e.transform||(o||n?r.transform=fat(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 Sae=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function r9e(t,e,n){for(const r in e)!Ru(e[r])&&!n9e(r,n)&&(t[r]=e[r])}function hat({transformTemplate:t},e){return h.useMemo(()=>{const n=Sae();return Nae(n,e,t),Object.assign({},n.vars,n.style)},[e])}function pat(t,e){const n=t.style||{},r={};return r9e(r,n,t),Object.assign(r,hat(t,e)),r}function mat(t,e){const n={},r=pat(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 xat={offset:"stroke-dashoffset",array:"stroke-dasharray"},gat={offset:"strokeDashoffset",array:"strokeDasharray"};function bat(t,e,n=1,r=0,s=!0){t.pathLength=1;const a=s?xat:gat;t[a.offset]=di.transform(-r);const o=di.transform(e),l=di.transform(n);t[a.array]=`${o} ${l}`}function s9e(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:a=1,pathOffset:o=0,...l},c,u,d){if(Nae(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&&bat(f,s,a,o,!1)}const i9e=()=>({...Sae(),attrs:{}}),a9e=t=>typeof t=="string"&&t.toLowerCase()==="svg";function yat(t,e,n,r){const s=h.useMemo(()=>{const a=i9e();return s9e(a,e,a9e(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};r9e(a,t.style,t),s.style={...a,...s.style}}return s}const vat=["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 jae(t){return typeof t!="string"||t.includes("-")?!1:!!(vat.indexOf(t)>-1||/[A-Z]/u.test(t))}function wat(t,e,n,{latestValues:r},s,a=!1){const l=(jae(t)?yat:mat)(e,r,s,t),c=aat(e,typeof t=="string",a),u=t!==h.Fragment?{...c,...l,ref:n}:{},{children:d}=e,f=h.useMemo(()=>Ru(d)?d.get():d,[d]);return h.createElement(t,{...u,children:f})}function kpe(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Aae(t,e,n,r){if(typeof e=="function"){const[s,a]=kpe(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]=kpe(r);e=e(n!==void 0?n:t.custom,s,a)}return e}function BO(t){return Ru(t)?t.get():t}function Cat({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:Nat(n,r,s,t),renderState:e()}}function Nat(t,e,n,r){const s={},a=r(t,{});for(const x in a)s[x]=BO(a[x]);let{initial:o,animate:l}=t;const c=n$(t),u=t9e(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"&&!t$(f)){const x=Array.isArray(f)?f:[f];for(let g=0;g<x.length;g++){const y=Aae(t,x[g]);if(y){const{transitionEnd:v,transition:C,...S}=y;for(const T in S){let I=S[T];if(Array.isArray(I)){const L=d?I.length-1:0;I=I[L]}I!==null&&(s[T]=I)}for(const T in v)s[T]=v[T]}}}return s}const o9e=t=>(e,n)=>{const r=h.useContext(e$),s=h.useContext(Zie),a=()=>Cat(t,e,r,s);return n?a():ist(a)};function _ae(t,e,n){var a;const{style:r}=t,s={};for(const o in r)(Ru(r[o])||e.style&&Ru(e.style[o])||n9e(o,t)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(s[o]=r[o]);return s}const Sat=o9e({scrapeMotionValuesFromProps:_ae,createRenderState:Sae});function l9e(t,e,n){const r=_ae(t,e,n);for(const s in t)if(Ru(t[s])||Ru(e[s])){const a=Hj.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[a]=t[s]}return r}const jat=o9e({scrapeMotionValuesFromProps:l9e,createRenderState:i9e}),Aat=Symbol.for("motionComponentSymbol");function r4(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function _at(t,e,n){return h.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):r4(n)&&(n.current=r))},[e])}const Eae=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Eat="framerAppearId",c9e="data-"+Eae(Eat),u9e=h.createContext({});function kat(t,e,n,r,s){var v,C;const{visualElement:a}=h.useContext(e$),o=h.useContext(J_e),l=h.useContext(Zie),c=h.useContext(Z_e).reducedMotion,u=h.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=h.useContext(u9e);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&Tat(u.current,n,s,f);const x=h.useRef(!1);h.useInsertionEffect(()=>{d&&x.current&&d.update(n,l)});const g=n[c9e],y=h.useRef(!!g&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,g))&&((C=window.MotionHasOptimisedAnimation)==null?void 0:C.call(window,g)));return ast(()=>{d&&(x.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),y.current&&d.animationState&&d.animationState.animateChanges())}),h.useEffect(()=>{d&&(!y.current&&d.animationState&&d.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var S;(S=window.MotionHandoffMarkAsComplete)==null||S.call(window,g)}),y.current=!1),d.enteringChildren=void 0)}),d}function Tat(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:d9e(t.parent)),t.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!o||l&&r4(l),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:u})}function d9e(t){if(t)return t.options.allowProjection!==!1?t.projection:d9e(t.parent)}function KH(t,{forwardMotionProps:e=!1}={},n,r){n&&rat(n);const s=jae(t)?jat:Sat;function a(l,c){let u;const d={...h.useContext(Z_e),...l,layoutId:Pat(l)},{isStatic:f}=d,x=lat(l),g=s(l,f);if(!f&&Qie){Iat();const y=Fat(d);u=y.MeasureLayout,x.visualElement=kat(t,g,d,r,y.ProjectionNode)}return i.jsxs(e$.Provider,{value:x,children:[u&&x.visualElement?i.jsx(u,{visualElement:x.visualElement,...d}):null,wat(t,l,_at(g,x.visualElement,c),g,f,e)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=h.forwardRef(a);return o[Aat]=t,o}function Pat({layoutId:t}){const e=h.useContext(g_e).id;return e&&t!==void 0?e+"-"+t:t}function Iat(t,e){h.useContext(J_e).strict}function Fat(t){const{drag:e,layout:n}=sS;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 Oat(t,e){if(typeof Proxy>"u")return KH;const n=new Map,r=(a,o)=>KH(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,KH(o,void 0,t,e)),n.get(o))})}function f9e({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Mat({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Lat(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 YH(t){return t===void 0||t===1}function AJ({scale:t,scaleX:e,scaleY:n}){return!YH(t)||!YH(e)||!YH(n)}function qv(t){return AJ(t)||h9e(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function h9e(t){return Tpe(t.x)||Tpe(t.y)}function Tpe(t){return t&&t!=="0%"}function sL(t,e,n){const r=t-n,s=e*r;return n+s}function Ppe(t,e,n,r,s){return s!==void 0&&(t=sL(t,s,r)),sL(t,n,r)+e}function _J(t,e=0,n=1,r,s){t.min=Ppe(t.min,e,n,r,s),t.max=Ppe(t.max,e,n,r,s)}function p9e(t,{x:e,y:n}){_J(t.x,e.translate,e.scale,e.originPoint),_J(t.y,n.translate,n.scale,n.originPoint)}const Ipe=.999999999999,Fpe=1.0000000000001;function Rat(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&&i4(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,p9e(t,o)),r&&qv(a.latestValues)&&i4(t,a.latestValues))}e.x<Fpe&&e.x>Ipe&&(e.x=1),e.y<Fpe&&e.y>Ipe&&(e.y=1)}function s4(t,e){t.min=t.min+e,t.max=t.max+e}function Ope(t,e,n,r,s=.5){const a=Go(t.min,t.max,s);_J(t,e,n,a,r)}function i4(t,e){Ope(t.x,e.x,e.scaleX,e.scale,e.originX),Ope(t.y,e.y,e.scaleY,e.scale,e.originY)}function m9e(t,e){return f9e(Lat(t.getBoundingClientRect(),e))}function Dat(t,e,n){const r=m9e(t,n),{scroll:s}=e;return s&&(s4(r.x,s.offset.x),s4(r.y,s.offset.y)),r}const Mpe=()=>({translate:0,scale:1,origin:0,originPoint:0}),a4=()=>({x:Mpe(),y:Mpe()}),Lpe=()=>({min:0,max:0}),vl=()=>({x:Lpe(),y:Lpe()}),EJ={current:null},x9e={current:!1};function Bat(){if(x9e.current=!0,!!Qie)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>EJ.current=t.matches;t.addEventListener("change",e),e()}else EJ.current=!1}const $at=new WeakMap;function Uat(t,e,n){for(const r in e){const s=e[r],a=n[r];if(Ru(s))t.addValue(r,s);else if(Ru(a))t.addValue(r,rS(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,rS(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Rpe=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let zat=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=xae,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=sf.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=n$(n),this.isVariantNode=t9e(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&&Ru(g)&&g.set(c[x])}}mount(e){var n;this.current=e,$at.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)),x9e.current||Bat(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:EJ.current,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),Jy(this.notifyUpdate),Jy(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=Vj.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 sS){const n=sS[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):vl()}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<Rpe.length;r++){const s=Rpe[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=Uat(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=rS(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"&&(XB(r)||ZB(r))?r=parseFloat(r):!tat(r)&&e2.test(n)&&(r=q_e(e,n)),this.setBaseTarget(e,Ru(r)?r.get():r)),Ru(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=Aae(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&&!Ru(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 Uj),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){yae.render(this.render)}},g9e=class extends zat{constructor(){super(...arguments),this.KeyframeResolver=zit}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;Ru(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}};function b9e(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 Hat(t){return window.getComputedStyle(t)}let Vat=class extends g9e{constructor(){super(...arguments),this.type="html",this.renderInstance=b9e}readValueFromInstance(e,n){var r;if(Vj.has(n))return(r=this.projection)!=null&&r.isProjecting?yJ(n):oit(e,n);{const s=Hat(e),a=(oae(n)?s.getPropertyValue(n):s[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:n}){return m9e(e,n)}build(e,n,r){Nae(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return _ae(e,n,r)}};const y9e=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){b9e(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(y9e.has(s)?s:Eae(s),e.attrs[s])}let qat=class extends g9e{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=vl}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Vj.has(n)){const r=W_e(n);return r&&r.default||0}return n=y9e.has(n)?n:Eae(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return l9e(e,n,r)}build(e,n,r){s9e(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){Wat(e,n,r,s)}mount(e){this.isSVGTag=a9e(e.tagName),super.mount(e)}};const Gat=(t,e)=>jae(t)?new qat(e):new Vat(e,{allowProjection:t!==h.Fragment});function j4(t,e,n){const r=t.getProps();return Aae(r,e,n!==void 0?n:r.custom,t)}const kJ=t=>Array.isArray(t);function Kat(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,rS(n))}function Yat(t){return kJ(t)?t[t.length-1]||0:t}function Xat(t,e){const n=j4(t,e);let{transitionEnd:r={},transition:s={},...a}=n||{};a={...a,...r};for(const o in a){const l=Yat(a[o]);Kat(t,o,l)}}function Qat(t){return!!(Ru(t)&&t.add)}function TJ(t,e){const n=t.getValue("willChange");if(Qat(n))return n.add(e);if(!n&&Bc.WillChange){const r=new Bc.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function v9e(t){return t.props[c9e]}const Zat=t=>t!==null;function Jat(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(Zat),a=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[a]}const eot={type:"spring",stiffness:500,damping:25,restSpeed:10},tot=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),not={type:"keyframes",duration:.8},rot={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},sot=(t,{keyframes:e})=>e.length>2?not:Vj.has(t)?t.startsWith("scale")?tot(e[1]):eot:rot;function iot({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 kae=(t,e,n,r={},s,a)=>o=>{const l=gae(r,t)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Gl(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};iot(l)||Object.assign(d,sot(t,d)),d.duration&&(d.duration=Gl(d.duration)),d.repeatDelay&&(d.repeatDelay=Gl(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(SJ(d),d.delay===0&&(f=!0)),(Bc.instantAnimations||Bc.skipAnimations)&&(f=!0,SJ(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!a&&e.get()!==void 0){const x=Jat(d.keyframes,l);if(x!==void 0){Bo.update(()=>{d.onUpdate(x),d.onComplete()});return}}return l.isSync?new mae(d):new Tit(d)};function aot({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function w9e(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&&aot(u,d))continue;const g={delay:n,...gae(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 S=v9e(t);if(S){const T=window.MotionHandoffAnimation(S,d,Bo);T!==null&&(g.startTime=T,v=!0)}}TJ(t,d),f.start(kae(d,f,x,t.shouldReduceMotion&&z_e.has(d)?{type:!1}:g,t,v));const C=f.animation;C&&c.push(C)}return o&&Promise.all(c).then(()=>{Bo.update(()=>{o&&Xat(t,o)})}),c}function C9e(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 PJ(t,e,n={}){var c;const r=j4(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(w9e(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:x}=s;return oot(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 oot(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(PJ(c,e,{...o,delay:n+(typeof r=="function"?0:r)+C9e(t.variantChildren,c,r,s,a)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function lot(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(a=>PJ(t,a,n));r=Promise.all(s)}else if(typeof e=="string")r=PJ(t,e,n);else{const s=typeof e=="function"?j4(t,e,n.custom):e;r=Promise.all(w9e(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function N9e(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 cot=Cae.length;function S9e(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?S9e(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<cot;n++){const r=Cae[n],s=t.props[r];(v9(s)||s===!1)&&(e[r]=s)}return e}const uot=[...wae].reverse(),dot=wae.length;function fot(t){return e=>Promise.all(e.map(({animation:n,options:r})=>lot(t,n,r)))}function hot(t){let e=fot(t),n=Dpe(),r=!0;const s=c=>(u,d)=>{var x;const f=j4(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=S9e(t.parent)||{},f=[],x=new Set;let g={},y=1/0;for(let C=0;C<dot;C++){const S=uot[C],T=n[S],I=u[S]!==void 0?u[S]:d[S],L=v9(I),F=S===c?T.isActive:null;F===!1&&(y=C);let $=I===d[S]&&I!==u[S]&&L;if($&&r&&t.manuallyAnimateOnMount&&($=!1),T.protectedKeys={...g},!T.isActive&&F===null||!I&&!T.prevProp||t$(I)||typeof I=="boolean")continue;const O=pot(T.prevProp,I);let U=O||S===c&&T.isActive&&!$&&L||C>y&&L,Y=!1;const re=Array.isArray(I)?I:[I];let Q=re.reduce(s(S),{});F===!1&&(Q={});const{prevResolvedValues:q={}}=T,te={...q,...Q},fe=oe=>{U=!0,x.has(oe)&&(Y=!0,x.delete(oe)),T.needsAnimating[oe]=!0;const K=t.getValue(oe);K&&(K.liveStyle=!1)};for(const oe in te){const K=Q[oe],H=q[oe];if(g.hasOwnProperty(oe))continue;let ee=!1;kJ(K)&&kJ(H)?ee=!N9e(K,H):ee=K!==H,ee?K!=null?fe(oe):x.add(oe):K!==void 0&&x.has(oe)?fe(oe):T.protectedKeys[oe]=!0}T.prevProp=I,T.prevResolvedValues=Q,T.isActive&&(g={...g,...Q}),r&&t.blockInitialAnimation&&(U=!1);const G=$&&O;U&&(!G||Y)&&f.push(...re.map(oe=>{const K={type:S};if(typeof oe=="string"&&r&&!G&&t.manuallyAnimateOnMount&&t.parent){const{parent:H}=t,ee=j4(H,oe);if(H.enteringChildren&&ee){const{delayChildren:se}=ee.transition||{};K.delay=C9e(H.enteringChildren,t,se)}}return{animation:oe,options:K}}))}if(x.size){const C={};if(typeof u.initial!="boolean"){const S=j4(t,Array.isArray(u.initial)?u.initial[0]:u.initial);S&&S.transition&&(C.transition=S.transition)}x.forEach(S=>{const T=t.getBaseTarget(S),I=t.getValue(S);I&&(I.liveStyle=!0),C[S]=T??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=Dpe(),r=!0}}}function pot(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!N9e(e,t):!1}function Ev(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Dpe(){return{animate:Ev(!0),whileInView:Ev(),whileHover:Ev(),whileTap:Ev(),whileDrag:Ev(),whileFocus:Ev(),exit:Ev()}}let S2=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},mot=class extends S2{constructor(e){super(e),e.animationState||(e.animationState=hot(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();t$(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)}},xot=0,got=class extends S2{constructor(){super(...arguments),this.id=xot++}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 bot={animation:{Feature:mot},exit:{Feature:got}};function C9(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function gT(t){return{point:{x:t.pageX,y:t.pageY}}}const yot=t=>e=>vae(e)&&t(e,gT(e));function __(t,e,n,r){return C9(t,e,yot(n),r)}const j9e=1e-4,vot=1-j9e,wot=1+j9e,A9e=.01,Cot=0-A9e,Not=0+A9e;function dd(t){return t.max-t.min}function Sot(t,e,n){return Math.abs(t-e)<=n}function Bpe(t,e,n,r=.5){t.origin=r,t.originPoint=Go(e.min,e.max,t.origin),t.scale=dd(n)/dd(e),t.translate=Go(n.min,n.max,t.origin)-t.originPoint,(t.scale>=vot&&t.scale<=wot||isNaN(t.scale))&&(t.scale=1),(t.translate>=Cot&&t.translate<=Not||isNaN(t.translate))&&(t.translate=0)}function E_(t,e,n,r){Bpe(t.x,e.x,n.x,r?r.originX:void 0),Bpe(t.y,e.y,n.y,r?r.originY:void 0)}function $pe(t,e,n){t.min=n.min+e.min,t.max=t.min+dd(e)}function jot(t,e,n){$pe(t.x,e.x,n.x),$pe(t.y,e.y,n.y)}function Upe(t,e,n){t.min=e.min-n.min,t.max=t.min+dd(e)}function k_(t,e,n){Upe(t.x,e.x,n.x),Upe(t.y,e.y,n.y)}function Bh(t){return[t("x"),t("y")]}const _9e=({current:t})=>t?t.ownerDocument.defaultView:null,zpe=(t,e)=>Math.abs(t-e);function Aot(t,e){const n=zpe(t.x,e.x),r=zpe(t.y,e.y);return Math.sqrt(n**2+r**2)}let E9e=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=QH(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,y=Aot(x.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!y)return;const{point:v}=x,{timestamp:C}=eu;this.history.push({...v,timestamp:C});const{onStart:S,onMove:T}=this.handlers;g||(S&&S(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,x)},this.handlePointerMove=(x,g)=>{this.lastMoveEvent=x,this.lastMoveEventInfo=XH(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 S=QH(x.type==="pointercancel"?this.lastMoveEventInfo:XH(g,this.transformPagePoint),this.history);this.startEvent&&y&&y(x,S),v&&v(x,S)},!vae(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=gT(e),c=XH(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=eu;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(e,QH(c,this.history)),this.removeListeners=Cx(__(this.contextWindow,"pointermove",this.handlePointerMove),__(this.contextWindow,"pointerup",this.handlePointerUp),__(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Jy(this.updatePoint)}};function XH(t,e){return e?{point:e(t.point)}:t}function Hpe(t,e){return{x:t.x-e.x,y:t.y-e.y}}function QH({point:t},e){return{point:t,delta:Hpe(t,k9e(e)),offset:Hpe(t,_ot(e)),velocity:Eot(e,.1)}}function _ot(t){return t[0]}function k9e(t){return t[t.length-1]}function Eot(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=k9e(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Gl(e)));)n--;if(!r)return{x:0,y:0};const a=cl(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 kot(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 Vpe(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 Tot(t,{top:e,left:n,bottom:r,right:s}){return{x:Vpe(t.x,n,s),y:Vpe(t.y,e,r)}}function Wpe(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 Pot(t,e){return{x:Wpe(t.x,e.x),y:Wpe(t.y,e.y)}}function Iot(t,e){let n=.5;const r=dd(t),s=dd(e);return s>r?n=ax(e.min,e.max-r,t.min):r>s&&(n=ax(t.min,t.max-s,e.min)),Dc(0,1,n)}function Fot(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 IJ=.35;function Oot(t=IJ){return t===!1?t=0:t===!0&&(t=IJ),{x:qpe(t,"left","right"),y:qpe(t,"top","bottom")}}function qpe(t,e,n){return{min:Gpe(t,e),max:Gpe(t,n)}}function Gpe(t,e){return typeof t=="number"?t:t[e]||0}const Mot=new WeakMap;let Lot=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=vl(),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(gT(f).point)},o=(f,x)=>{const{drag:g,dragPropagation:y,onDragStart:v}=this.getProps();if(g&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Git(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(S=>{let T=this.getAxisMotionValue(S).get()||0;if(q0.test(T)){const{projection:I}=this.visualElement;if(I&&I.layout){const L=I.layout.layoutBox[S];L&&(T=dd(L)*(parseFloat(T)/100))}}this.originPoint[S]=T}),v&&Bo.postRender(()=>v(f,x)),TJ(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:S}=x;if(y&&this.currentDirection===null){this.currentDirection=Rot(S),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",x.point,S),this.updateAxis("y",x.point,S),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 E9e(e,{onSessionStart:a,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:_9e(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||!NI(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=kot(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&&r4(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Tot(r.layoutBox,e):this.constraints=!1,this.elastic=Oot(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Bh(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Fot(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!r4(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=Dat(r,s.root,this.visualElement.getTransformPagePoint());let o=Pot(s.layout.layoutBox,a);if(n){const l=n(Mat(o));this.hasMutatedConstraints=!!l,l&&(o=f9e(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(!NI(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 TJ(this.visualElement,e),r.start(kae(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(!NI(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(!r4(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]=Iot({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(!NI(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;Mot.set(this.visualElement,this);const e=this.visualElement.current,n=__(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();r4(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=C9(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=IJ,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:a,dragElastic:o,dragMomentum:l}}};function NI(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Rot(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}let Dot=class extends S2{constructor(e){super(e),this.removeGroupControls=fl,this.removeListeners=fl,this.controls=new Lot(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||fl}unmount(){this.removeGroupControls(),this.removeListeners()}};const Kpe=t=>(e,n)=>{t&&Bo.postRender(()=>t(e,n))};let Bot=class extends S2{constructor(){super(...arguments),this.removePointerDownListener=fl}onPointerDown(e){this.session=new E9e(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:_9e(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Kpe(e),onStart:Kpe(n),onMove:r,onEnd:(a,o)=>{delete this.session,s&&Bo.postRender(()=>s(a,o))}}}mount(){this.removePointerDownListener=__(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 $O={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Ype(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const KA={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(di.test(t))t=parseFloat(t);else return t;const n=Ype(t,e.target.x),r=Ype(t,e.target.y);return`${n}% ${r}%`}},$ot={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=e2.parse(t);if(s.length>5)return r;const a=e2.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 ZH=!1,Uot=class extends h.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:a}=e;cat(zot),a&&(n.group&&n.group.add(a),r&&r.register&&s&&r.register(a),ZH&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),$O.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,ZH=!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(),yae.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;ZH=!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 T9e(t){const[e,n]=nat(),r=h.useContext(g_e);return i.jsx(Uot,{...t,layoutGroup:r,switchLayoutGroup:h.useContext(u9e),isPresent:e,safeToRemove:n})}const zot={borderRadius:{...KA,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:KA,borderTopRightRadius:KA,borderBottomLeftRadius:KA,borderBottomRightRadius:KA,boxShadow:$ot};function Hot(t,e,n){const r=Ru(t)?t:rS(t);return r.start(kae("",r,e,n)),r.animation}const Vot=(t,e)=>t.depth-e.depth;let Wot=class{constructor(){this.children=[],this.isDirty=!1}add(e){hT(this.children,e),this.isDirty=!0}remove(e){pT(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Vot),this.isDirty=!1,this.children.forEach(e)}};function qot(t,e){const n=sf.now(),r=({timestamp:s})=>{const a=s-n;a>=e&&(Jy(r),t(a-e))};return Bo.setup(r,!0),()=>Jy(r)}const P9e=["TopLeft","TopRight","BottomLeft","BottomRight"],Got=P9e.length,Xpe=t=>typeof t=="string"?parseFloat(t):t,Qpe=t=>typeof t=="number"||di.test(t);function Kot(t,e,n,r,s,a){s?(t.opacity=Go(0,n.opacity??1,Yot(r)),t.opacityExit=Go(e.opacity??1,0,Xot(r))):a&&(t.opacity=Go(e.opacity??1,n.opacity??1,r));for(let o=0;o<Got;o++){const l=`border${P9e[o]}Radius`;let c=Zpe(e,l),u=Zpe(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||Qpe(c)===Qpe(u)?(t[l]=Math.max(Go(Xpe(c),Xpe(u),r),0),(q0.test(u)||q0.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||n.rotate)&&(t.rotate=Go(e.rotate||0,n.rotate||0,r))}function Zpe(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Yot=I9e(0,.5,rae),Xot=I9e(.5,.95,fl);function I9e(t,e,n){return r=>r<t?0:r>e?1:n(ax(t,e,r))}function Jpe(t,e){t.min=e.min,t.max=e.max}function Sh(t,e){Jpe(t.x,e.x),Jpe(t.y,e.y)}function eme(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function tme(t,e,n,r,s){return t-=e,t=sL(t,1/n,r),s!==void 0&&(t=sL(t,1/s,r)),t}function Qot(t,e=0,n=1,r=.5,s,a=t,o=t){if(q0.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=tme(t.min,e,n,l,s),t.max=tme(t.max,e,n,l,s)}function nme(t,e,[n,r,s],a,o){Qot(t,e[n],e[r],e[s],e.scale,a,o)}const Zot=["x","scaleX","originX"],Jot=["y","scaleY","originY"];function rme(t,e,n,r){nme(t.x,e,Zot,n?n.x:void 0,r?r.x:void 0),nme(t.y,e,Jot,n?n.y:void 0,r?r.y:void 0)}function sme(t){return t.translate===0&&t.scale===1}function F9e(t){return sme(t.x)&&sme(t.y)}function ime(t,e){return t.min===e.min&&t.max===e.max}function elt(t,e){return ime(t.x,e.x)&&ime(t.y,e.y)}function ame(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function O9e(t,e){return ame(t.x,e.x)&&ame(t.y,e.y)}function ome(t){return dd(t.x)/dd(t.y)}function lme(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}let tlt=class{constructor(){this.members=[]}add(e){hT(this.members,e),e.scheduleRender()}remove(e){if(pT(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 nlt(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 JH=["","X","Y","Z"],rlt=1e3;let slt=0;function eV(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function M9e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=v9e(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&&M9e(r)}function L9e({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=slt++,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(olt),this.nodes.forEach(dlt),this.nodes.forEach(flt),this.nodes.forEach(llt)},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 Uj),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=Q_e(o)&&!Jit(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=qot(x,250),$O.hasAnimatedSinceResize&&($O.hasAnimatedSinceResize=!1,this.nodes.forEach(dme)))})}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()||glt,{onLayoutAnimationStart:v,onLayoutAnimationComplete:C}=u.getProps(),S=!this.targetLayout||!O9e(this.targetLayout,g),T=!f&&x;if(this.options.layoutRoot||this.resumeFrom||T||f&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const I={...gae(y,"layout"),onPlay:v,onComplete:C};(u.shouldReduceMotion||this.options.layoutRoot)&&(I.delay=0,I.type=!1),this.startAnimation(I),this.setAnimationOrigin(d,T)}else f||dme(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(),Jy(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(hlt),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&&M9e(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(cme);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(ume);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ult),this.nodes.forEach(ilt),this.nodes.forEach(alt)):this.nodes.forEach(ume),this.clearAllSnapshots();const l=sf.now();eu.delta=Dc(0,1e3/60,l-eu.timestamp),eu.timestamp=l,eu.isProcessing=!0,HH.update.process(eu),HH.preRender.process(eu),HH.render.process(eu),eu.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,yae.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(clt),this.sharedNodes.forEach(plt)}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&&!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=vl(),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&&!F9e(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||qv(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)),blt(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return vl();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(ylt))){const{scroll:d}=this.root;d&&(s4(l.x,d.offset.x),s4(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=vl();if(Sh(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&&Sh(l,o),s4(l.x,f.offset.x),s4(l.y,f.offset.y))}return l}applyTransform(o,l=!1){const c=vl();Sh(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&&i4(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),qv(d.latestValues)&&i4(c,d.latestValues)}return qv(this.latestValues)&&i4(c,this.latestValues),c}removeTransform(o){const l=vl();Sh(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!qv(u.latestValues))continue;AJ(u.latestValues)&&u.updateSnapshot();const d=vl(),f=u.measurePageBox();Sh(d,f),rme(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return qv(this.latestValues)&&rme(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!==eu.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=eu.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=vl(),this.relativeTargetOrigin=vl(),k_(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Sh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=vl(),this.targetWithTransforms=vl()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),jot(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Sh(this.target,this.layout.layoutBox),p9e(this.target,this.targetDelta)):Sh(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=vl(),this.relativeTargetOrigin=vl(),k_(this.relativeTargetOrigin,this.target,g.target),Sh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||AJ(this.parent.latestValues)||h9e(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===eu.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;Sh(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,x=this.treeScale.y;Rat(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=vl());const{target:g}=o;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(eme(this.prevProjectionDelta.x,this.projectionDelta.x),eme(this.prevProjectionDelta.y,this.projectionDelta.y)),E_(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==x||!lme(this.projectionDelta.x,this.prevProjectionDelta.x)||!lme(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=a4(),this.projectionDelta=a4(),this.projectionDeltaWithTransform=a4()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=a4();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const x=vl(),g=c?c.source:void 0,y=this.layout?this.layout.source:void 0,v=g!==y,C=this.getStack(),S=!C||C.members.length<=1,T=!!(v&&!S&&this.options.crossfade===!0&&!this.path.some(xlt));this.animationProgress=0;let I;this.mixTargetDelta=L=>{const F=L/1e3;fme(f.x,o.x,F),fme(f.y,o.y,F),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(k_(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mlt(this.relativeTarget,this.relativeTargetOrigin,x,F),I&&elt(this.relativeTarget,I)&&(this.isProjectionDirty=!1),I||(I=vl()),Sh(I,this.relativeTarget)),v&&(this.animationValues=d,Kot(d,u,this.latestValues,F,T,S)),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&&(Jy(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Bo.update(()=>{$O.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=rS(0)),this.currentAnimation=Hot(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(rlt),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&&R9e(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||vl();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}Sh(l,c),i4(l,d),E_(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new tlt),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&&eV("z",o,u,this.animationValues);for(let d=0;d<JH.length;d++)eV(`rotate${JH[d]}`,o,u,this.animationValues),eV(`skew${JH[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=BO(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=BO(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!qv(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=nlt(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 w9){if(d[y]===void 0)continue;const{correct:v,applyTo:C,isCSSVariable:S}=w9[y],T=f==="none"?d[y]:v(d[y],u);if(C){const I=C.length;for(let L=0;L<I;L++)o[C[L]]=T}else S?this.options.visualElement.renderState.vars[y]=T:o[y]=T}this.options.layoutId&&(o.pointerEvents=u===this?BO(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(cme),this.root.sharedNodes.clear()}}}function ilt(t){t.updateLayout()}function alt(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}):R9e(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=a4();E_(l,r,e.layoutBox);const c=a4();o?E_(c,t.applyTransform(s,!0),e.measuredBox):E_(c,r,e.layoutBox);const u=!F9e(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=vl();k_(y,e.layoutBox,x.layoutBox);const v=vl();k_(v,r,g.layoutBox),O9e(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 olt(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 llt(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function clt(t){t.clearSnapshot()}function cme(t){t.clearMeasurements()}function ume(t){t.isLayoutDirty=!1}function ult(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function dme(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function dlt(t){t.resolveTargetDelta()}function flt(t){t.calcProjection()}function hlt(t){t.resetSkewAndRotation()}function plt(t){t.removeLeadSnapshot()}function fme(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 hme(t,e,n,r){t.min=Go(e.min,n.min,r),t.max=Go(e.max,n.max,r)}function mlt(t,e,n,r){hme(t.x,e.x,n.x,r),hme(t.y,e.y,n.y,r)}function xlt(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const glt={duration:.45,ease:[.4,0,.1,1]},pme=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),mme=pme("applewebkit/")&&!pme("chrome/")?Math.round:fl;function xme(t){t.min=mme(t.min),t.max=mme(t.max)}function blt(t){xme(t.x),xme(t.y)}function R9e(t,e,n){return t==="position"||t==="preserve-aspect"&&!Sot(ome(e),ome(n),.2)}function ylt(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const vlt=L9e({attachResizeListener:(t,e)=>C9(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),tV={current:void 0},D9e=L9e({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!tV.current){const t=new vlt({});t.mount(window),t.setOptions({layoutScroll:!0}),tV.current=t}return tV.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),wlt={pan:{Feature:Bot},drag:{Feature:Dot,ProjectionNode:D9e,MeasureLayout:T9e}};function gme(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,gT(e)))}let Clt=class extends S2{mount(){const{current:e}=this.node;e&&(this.unmount=Kit(e,(n,r)=>(gme(this.node,r,"Start"),s=>gme(this.node,s,"End"))))}unmount(){}},Nlt=class extends S2{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=Cx(C9(this.node.current,"focus",()=>this.onFocus()),C9(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function bme(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,gT(e)))}let Slt=class extends S2{mount(){const{current:e}=this.node;e&&(this.unmount=Zit(e,(n,r)=>(bme(this.node,r,"Start"),(s,{success:a})=>bme(this.node,s,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}};const FJ=new WeakMap,nV=new WeakMap,jlt=t=>{const e=FJ.get(t.target);e&&e(t)},Alt=t=>{t.forEach(jlt)};function _lt({root:t,...e}){const n=t||document;nV.has(n)||nV.set(n,{});const r=nV.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(Alt,{root:t,...e})),r[s]}function Elt(t,e,n){const r=_lt(e);return FJ.set(t,n),r.observe(t),()=>{FJ.delete(t),r.unobserve(t)}}const klt={some:0,all:1};let Tlt=class extends S2{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:klt[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 Elt(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(Plt(e,n))&&this.startObserver()}unmount(){}};function Plt({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const Ilt={inView:{Feature:Tlt},tap:{Feature:Slt},focus:{Feature:Nlt},hover:{Feature:Clt}},Flt={layout:{ProjectionNode:D9e,MeasureLayout:T9e}},Olt={...bot,...Ilt,...wlt,...Flt},pm=Oat(Olt,Gat),yme={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 T0({label:t="NEW",tone:e="yellow"}){const n=yme[e]??yme.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 Mlt({label:t,items:e=[],activePaths:n=[],badgeLabel:r,badgeTone:s="yellow",align:a="left",border_color:o=""}){var f,x;const{pathname:l}=Pl(),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(ke.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(YB,{as:"div",className:"relative hidden sm:inline-block text-left",children:[i.jsxs(GB,{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(T0,{label:r,tone:s}):null,i.jsx(g9,{"aria-hidden":"true",className:"-mr-1 size-5 text-gray-400"})]}),i.jsx(KB,{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(t4,{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(g9,{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,S)=>C.to?i.jsx(khe,{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-${S}`):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(T0,{tone:"emerald",label:C.badge})]},`sub-btn-${S}`))})})]},`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(T0,{tone:"emerald",label:g.badge})]})});return g.to?i.jsx(t4,{children:i.jsx(khe,{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(t4,{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(t4,{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 Wj=({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"})]})]})]}),L0=({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"})]}),Llt="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",Hi="/assets/dextrabotIcon-B5aLRkPC.png",Rlt="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",Dlt="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",Ha="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",Na="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",io="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",Blt="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",O1="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",B9e="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",$lt="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",Ult="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",Yl="/assets/noDataNewIcon-D33nv6-9.svg",qj="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",k5="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",zlt="/assets/referralBgIcon-C-Csekzm.svg",j2="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",jm="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",iL="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",Hlt="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",qlt="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",aL="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",oL="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",Gj="/assets/sharePnlGreenIcon-CwGFUwvO.svg",Kj="/assets/sharePnlRedIcon-NsgQBTQF.svg",Yj="/assets/dextrabotShareIcon-DbUzC8hq.png",Glt="/assets/buttonHyperrIcon-BEIlirim.png",vme="/assets/mushroomRed-DlifwotO.svg",wme="/assets/mushroomBlue-DU8qWKKQ.svg",Ec="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",Klt="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",Ylt="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",Wo="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",Tae="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",Xlt="/assets/copyTradeBanner-Bzh6f0rX.svg",Qlt="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",Cme="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",Pae="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",Zlt="/assets/introductionModalIcon-C3qCLVbZ.svg",Jlt="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",ect="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",tct="/assets/dextrabot-copy-trade-hyperliquid-BgdeQSj5.png",nct="/assets/dextrabot-position-copy-Ph5ntD17.png",rct="/assets/dextrabot-referral-rewards-CvRzGBKC.png",sct="/assets/hyperliquid-discover-wallets-CgeXGTl5.svg",ict="/assets/dextrabot-telegram-alerts-CJHcZn29.png",act="/assets/hyperliquid-wallet-analysis-DwEnicpm.png",oct="/assets/dextrabot-discover-wallets-filters-BSnYa19g.svg",lct="/assets/hyperliquid-trading-metrics-Cwsy4rqz.svg",cct="/assets/dextrabot-risk-parameters-DzTb7mB0.svg",uct="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",rV="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",dct="/assets/dextrabotNewLogoIcon-V6eDxoac.png",Iae="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",fct="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",hct="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",pct="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",mct="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",$9e="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",xct="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",U9e="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",gct="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",bct="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",yct="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",vct="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",z9e="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=",wct="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",Cct="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",Nct="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",Nme="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",OJ="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",MJ="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",Sct="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",jct="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",Xj="/assets/dextrabotIcon64x64-CGBWeHNW.png",Act="/assets/telegramfilterIcon-D3R-nSo1.svg",_ct="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",N9="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",S9="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",Ect="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",Fae="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",kct="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",Tct="/assets/telegramModalIcon-CwWiyADO.png",H9e="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",V9e="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",Sme="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",W9e="/assets/basedLogoSvgIcon-C71QETXb.png",bT="/assets/variationalIcon-VFI-7A--.png",Oae="/assets/apexIcon-pUC7_jPm.png",yT="/assets/paradexIcon-gNYlng5D.jpg",Pct="/assets/basedAppIcon-xn9d9rQz.jpg",Ict="/assets/pacificaErrorImage-BKGQKjSV.jpeg",Fct="/assets/polyBgImage-xAYohOZ-.png",lL="/assets/polymarketIcon-CZ05BwyS.jpg",Oct="/assets/polyDcaBgImage-C9s3-bzA.png",Mct=[{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","/standx-mm"],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?market=extended",icon:"https://app.extended.exchange/assets/logo/extended.svg"},{label:"Hyperliquid DCA Bot",to:"/dca-bot?market=hyperliquid",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",badge:"NEW"},{label:"Lighter Grid Bot",to:"/terminal/lighter/BTC#gridbot",icon:L0},{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"},{label:"StandX Market Maker",to:"/standx-mm",icon:"https://standx.com/logo_white.png",badge:"BETA"}]},{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:bT},{label:"Paradex",action:"openParadex",description:"",icon:yT},{label:"Lighter",action:"openLighter",description:"Delta Neutral vs Variational",icon:L0},{label:"Pacifica",action:"openPacifica",description:"",icon:"https://app.pacifica.fi/imgs/icon.svg"},{label:"Apex",action:"openApex",description:"",icon:Oae},{label:"Aster",action:"openAster",description:"",icon:Wj}]},{type:"dropdown",label:"Polymarket",activePaths:["/polymarket","/polymarket-dca"],badgeLabel:"NEW",badgeTone:"emerald",border_color:"blue",items:[{label:"Polymarket",to:"/polymarket",icon:lL,badge:"NEW"},{label:"Polymarket DCA Bot",to:"/polymarket-dca",icon:lL,badge:"NEW"}]}];function D3(t){"@babel/helpers - typeof";return D3=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},D3(t)}function Lct(t,e){if(D3(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(D3(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function q9e(t){var e=Lct(t,"string");return D3(e)=="symbol"?e:e+""}function K7(t,e,n){return(e=q9e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jme(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 ei(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jme(Object(n),!0).forEach(function(r){K7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jme(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Rct(t){if(Array.isArray(t))return t}function Dct(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 LJ(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 G9e(t,e){if(t){if(typeof t=="string")return LJ(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)?LJ(t,e):void 0}}function Bct(){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 n1(t,e){return Rct(t)||Dct(t,e)||G9e(t,e)||Bct()}function $ct(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 M1(t,e){if(t==null)return{};var n,r,s=$ct(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 Uct=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function zct(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=M1(t,Uct),v=h.useState(l!==void 0?l:n),C=n1(v,2),S=C[0],T=C[1],I=h.useState(c!==void 0?c:s),L=n1(I,2),F=L[0],$=L[1],O=h.useState(g!==void 0?g:o),U=n1(O,2),Y=U[0],re=U[1],Q=h.useCallback(function(K,H){typeof u=="function"&&u(K,H),re(K)},[u]),q=h.useCallback(function(K,H){var ee;typeof d=="function"&&(ee=d(K,H)),T(ee!==void 0?ee:K)},[d]),te=h.useCallback(function(){typeof x=="function"&&x(),$(!0)},[x]),fe=h.useCallback(function(){typeof f=="function"&&f(),$(!1)},[f]),G=l!==void 0?l:S,ie=c!==void 0?c:F,oe=g!==void 0?g:Y;return ei(ei({},y),{},{inputValue:G,menuIsOpen:ie,onChange:Q,onInputChange:q,onMenuClose:fe,onMenuOpen:te,value:oe})}function ai(){return ai=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},ai.apply(null,arguments)}function Hct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ame(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,q9e(r.key),r)}}function Vct(t,e,n){return Ame(t.prototype,e),Ame(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function RJ(t,e){return RJ=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},RJ(t,e)}function Wct(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&&RJ(t,e)}function cL(t){return cL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},cL(t)}function K9e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(K9e=function(){return!!t})()}function qct(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Gct(t,e){if(e&&(D3(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qct(t)}function Kct(t){var e=K9e();return function(){var n,r=cL(t);if(e){var s=cL(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return Gct(this,n)}}function Yct(t){if(Array.isArray(t))return LJ(t)}function Xct(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Qct(){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 Mae(t){return Yct(t)||Xct(t)||G9e(t)||Qct()}function Zct(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 Jct(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 eut=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(Jct(this));var s=this.tags[this.tags.length-1];if(this.isSpeedy){var a=Zct(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-",uL="-moz-",ja="-webkit-",Y9e="comm",Lae="rule",Rae="decl",tut="@import",X9e="@keyframes",nut="@layer",rut=Math.abs,r$=String.fromCharCode,sut=Object.assign;function iut(t,e){return nu(t,0)^45?(((e<<2^nu(t,0))<<2^nu(t,1))<<2^nu(t,2))<<2^nu(t,3):0}function Q9e(t){return t.trim()}function aut(t,e){return(t=e.exec(t))?t[0]:t}function Aa(t,e,n){return t.replace(e,n)}function DJ(t,e){return t.indexOf(e)}function nu(t,e){return t.charCodeAt(e)|0}function j9(t,e,n){return t.slice(e,n)}function A0(t){return t.length}function Dae(t){return t.length}function SI(t,e){return e.push(t),t}function out(t,e){return t.map(e).join("")}var s$=1,iS=1,Z9e=0,xf=0,Wl=0,Qj="";function i$(t,e,n,r,s,a,o){return{value:t,root:e,parent:n,type:r,props:s,children:a,line:s$,column:iS,length:o,return:""}}function YA(t,e){return sut(i$("",null,null,"",null,null,0),t,{length:-t.length},e)}function lut(){return Wl}function cut(){return Wl=xf>0?nu(Qj,--xf):0,iS--,Wl===10&&(iS=1,s$--),Wl}function Zf(){return Wl=xf<Z9e?nu(Qj,xf++):0,iS++,Wl===10&&(iS=1,s$++),Wl}function G0(){return nu(Qj,xf)}function UO(){return xf}function vT(t,e){return j9(Qj,t,e)}function A9(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 J9e(t){return s$=iS=1,Z9e=A0(Qj=t),xf=0,[]}function eEe(t){return Qj="",t}function zO(t){return Q9e(vT(xf-1,BJ(t===91?t+2:t===40?t+1:t)))}function uut(t){for(;(Wl=G0())&&Wl<33;)Zf();return A9(t)>2||A9(Wl)>3?"":" "}function dut(t,e){for(;--e&&Zf()&&!(Wl<48||Wl>102||Wl>57&&Wl<65||Wl>70&&Wl<97););return vT(t,UO()+(e<6&&G0()==32&&Zf()==32))}function BJ(t){for(;Zf();)switch(Wl){case t:return xf;case 34:case 39:t!==34&&t!==39&&BJ(Wl);break;case 40:t===41&&BJ(t);break;case 92:Zf();break}return xf}function fut(t,e){for(;Zf()&&t+Wl!==57;)if(t+Wl===84&&G0()===47)break;return"/*"+vT(e,xf-1)+"*"+r$(t===47?t:Zf())}function hut(t){for(;!A9(G0());)Zf();return vT(t,xf)}function put(t){return eEe(HO("",null,null,null,[""],t=J9e(t),0,[0],t))}function HO(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,S=1,T=0,I="",L=s,F=a,$=r,O=I;C;)switch(y=T,T=Zf()){case 40:if(y!=108&&nu(O,f-1)==58){DJ(O+=Aa(zO(T),"&","&\f"),"&\f")!=-1&&(S=-1);break}case 34:case 39:case 91:O+=zO(T);break;case 9:case 10:case 13:case 32:O+=uut(y);break;case 92:O+=dut(UO()-1,7);continue;case 47:switch(G0()){case 42:case 47:SI(mut(fut(Zf(),UO()),e,n),c);break;default:O+="/"}break;case 123*v:l[u++]=A0(O)*S;case 125*v:case 59:case 0:switch(T){case 0:case 125:C=0;case 59+d:S==-1&&(O=Aa(O,/\f/g,"")),g>0&&A0(O)-f&&SI(g>32?Eme(O+";",r,n,f-1):Eme(Aa(O," ","")+";",r,n,f-2),c);break;case 59:O+=";";default:if(SI($=_me(O,e,n,u,d,s,l,I,L=[],F=[],f),a),T===123)if(d===0)HO(O,e,$,$,L,a,f,l,F);else switch(x===99&&nu(O,3)===110?100:x){case 100:case 108:case 109:case 115:HO(t,$,$,r&&SI(_me(t,$,$,0,0,s,l,I,s,L=[],f),F),s,F,f,l,r?L:F);break;default:HO(O,$,$,$,[""],F,0,l,F)}}u=d=g=0,v=S=1,I=O="",f=o;break;case 58:f=1+A0(O),g=y;default:if(v<1){if(T==123)--v;else if(T==125&&v++==0&&cut()==125)continue}switch(O+=r$(T),T*v){case 38:S=d>0?1:(O+="\f",-1);break;case 44:l[u++]=(A0(O)-1)*S,S=1;break;case 64:G0()===45&&(O+=zO(Zf())),x=G0(),d=f=A0(I=O+=hut(UO())),T++;break;case 45:y===45&&A0(O)==2&&(v=0)}}return a}function _me(t,e,n,r,s,a,o,l,c,u,d){for(var f=s-1,x=s===0?a:[""],g=Dae(x),y=0,v=0,C=0;y<r;++y)for(var S=0,T=j9(t,f+1,f=rut(v=o[y])),I=t;S<g;++S)(I=Q9e(v>0?x[S]+" "+T:Aa(T,/&\f/g,x[S])))&&(c[C++]=I);return i$(t,e,n,s===0?Lae:l,c,u,d)}function mut(t,e,n){return i$(t,e,n,Y9e,r$(lut()),j9(t,2,-2),0)}function Eme(t,e,n,r){return i$(t,e,n,Rae,j9(t,0,r),j9(t,r+1,-1),r)}function A4(t,e){for(var n="",r=Dae(t),s=0;s<r;s++)n+=e(t[s],s,t,e)||"";return n}function xut(t,e,n,r){switch(t.type){case nut:if(t.children.length)break;case tut:case Rae:return t.return=t.return||t.value;case Y9e:return"";case X9e:return t.return=t.value+"{"+A4(t.children,r)+"}";case Lae:t.value=t.props.join(",")}return A0(n=A4(t.children,r))?t.return=t.value+"{"+n+"}":""}function gut(t){var e=Dae(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 but(t){return function(e){e.root||(e=e.return)&&t(e)}}function yut(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var vut=function(e,n,r){for(var s=0,a=0;s=a,a=G0(),s===38&&a===12&&(n[r]=1),!A9(a);)Zf();return vT(e,xf)},wut=function(e,n){var r=-1,s=44;do switch(A9(s)){case 0:s===38&&G0()===12&&(n[r]=1),e[r]+=vut(xf-1,n,r);break;case 2:e[r]+=zO(s);break;case 4:if(s===44){e[++r]=G0()===58?"&\f":"",n[r]=e[r].length;break}default:e[r]+=r$(s)}while(s=Zf());return e},Cut=function(e,n){return eEe(wut(J9e(e),n))},kme=new WeakMap,Nut=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&&!kme.get(r))&&!s){kme.set(e,!0);for(var a=[],o=Cut(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]}}},Sut=function(e){if(e.type==="decl"){var n=e.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(e.return="",e.value="")}};function tEe(t,e){switch(iut(t,e)){case 5103:return ja+"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 ja+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return ja+t+uL+t+vu+t+t;case 6828:case 4268:return ja+t+vu+t+t;case 6165:return ja+t+vu+"flex-"+t+t;case 5187:return ja+t+Aa(t,/(\w+).+(:[^]+)/,ja+"box-$1$2"+vu+"flex-$1$2")+t;case 5443:return ja+t+vu+"flex-item-"+Aa(t,/flex-|-self/,"")+t;case 4675:return ja+t+vu+"flex-line-pack"+Aa(t,/align-content|flex-|-self/,"")+t;case 5548:return ja+t+vu+Aa(t,"shrink","negative")+t;case 5292:return ja+t+vu+Aa(t,"basis","preferred-size")+t;case 6060:return ja+"box-"+Aa(t,"-grow","")+ja+t+vu+Aa(t,"grow","positive")+t;case 4554:return ja+Aa(t,/([^-])(transform)/g,"$1"+ja+"$2")+t;case 6187:return Aa(Aa(Aa(t,/(zoom-|grab)/,ja+"$1"),/(image-set)/,ja+"$1"),t,"")+t;case 5495:case 3959:return Aa(t,/(image-set\([^]*)/,ja+"$1$`$1");case 4968:return Aa(Aa(t,/(.+:)(flex-)?(.*)/,ja+"box-pack:$3"+vu+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ja+t+t;case 4095:case 3583:case 4068:case 2532:return Aa(t,/(.+)-inline(.+)/,ja+"$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(A0(t)-1-e>6)switch(nu(t,e+1)){case 109:if(nu(t,e+4)!==45)break;case 102:return Aa(t,/(.+:)(.+)-([^]+)/,"$1"+ja+"$2-$3$1"+uL+(nu(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~DJ(t,"stretch")?tEe(Aa(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(nu(t,e+1)!==115)break;case 6444:switch(nu(t,A0(t)-3-(~DJ(t,"!important")&&10))){case 107:return Aa(t,":",":"+ja)+t;case 101:return Aa(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ja+(nu(t,14)===45?"inline-":"")+"box$3$1"+ja+"$2$3$1"+vu+"$2box$3")+t}break;case 5936:switch(nu(t,e+11)){case 114:return ja+t+vu+Aa(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return ja+t+vu+Aa(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return ja+t+vu+Aa(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return ja+t+vu+t+t}return t}var jut=function(e,n,r,s){if(e.length>-1&&!e.return)switch(e.type){case Rae:e.return=tEe(e.value,e.length);break;case X9e:return A4([YA(e,{value:Aa(e.value,"@","@"+ja)})],s);case Lae:if(e.length)return out(e.props,function(a){switch(aut(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return A4([YA(e,{props:[Aa(a,/:(read-\w+)/,":"+uL+"$1")]})],s);case"::placeholder":return A4([YA(e,{props:[Aa(a,/:(plac\w+)/,":"+ja+"input-$1")]}),YA(e,{props:[Aa(a,/:(plac\w+)/,":"+uL+"$1")]}),YA(e,{props:[Aa(a,/:(plac\w+)/,vu+"input-$1")]})],s)}return""})}},Aut=[jut],_ut=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||Aut,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(" "),S=1;S<C.length;S++)a[C[S]]=!0;l.push(v)});var c,u=[Nut,Sut];{var d,f=[xut,but(function(v){d.insert(v)})],x=gut(u.concat(s,f)),g=function(C){return A4(put(C),x)};c=function(C,S,T,I){d=T,g(C?C+"{"+S.styles+"}":S.styles),I&&(y.inserted[S.name]=!0)}}var y={key:n,sheet:new eut({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},sV={exports:{}},Oa={};/** @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 Tme;function Eut(){if(Tme)return Oa;Tme=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,S=t?Symbol.for("react.responder"):60118,T=t?Symbol.for("react.scope"):60119;function I(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 L(F){return I(F)===u}return Oa.AsyncMode=c,Oa.ConcurrentMode=u,Oa.ContextConsumer=l,Oa.ContextProvider=o,Oa.Element=e,Oa.ForwardRef=d,Oa.Fragment=r,Oa.Lazy=y,Oa.Memo=g,Oa.Portal=n,Oa.Profiler=a,Oa.StrictMode=s,Oa.Suspense=f,Oa.isAsyncMode=function(F){return L(F)||I(F)===c},Oa.isConcurrentMode=L,Oa.isContextConsumer=function(F){return I(F)===l},Oa.isContextProvider=function(F){return I(F)===o},Oa.isElement=function(F){return typeof F=="object"&&F!==null&&F.$$typeof===e},Oa.isForwardRef=function(F){return I(F)===d},Oa.isFragment=function(F){return I(F)===r},Oa.isLazy=function(F){return I(F)===y},Oa.isMemo=function(F){return I(F)===g},Oa.isPortal=function(F){return I(F)===n},Oa.isProfiler=function(F){return I(F)===a},Oa.isStrictMode=function(F){return I(F)===s},Oa.isSuspense=function(F){return I(F)===f},Oa.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===S||F.$$typeof===T||F.$$typeof===v)},Oa.typeOf=I,Oa}var Pme;function kut(){return Pme||(Pme=1,sV.exports=Eut()),sV.exports}var iV,Ime;function Tut(){if(Ime)return iV;Ime=1;var t=kut(),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 S=f(v);S&&S!==x&&g(y,S,C)}var T=c(v);u&&(T=T.concat(u(v)));for(var I=o(y),L=o(v),F=0;F<T.length;++F){var $=T[F];if(!n[$]&&!(C&&C[$])&&!(L&&L[$])&&!(I&&I[$])){var O=d(v,$);try{l(y,$,O)}catch{}}}}return y}return iV=g,iV}Tut();var Put=!0;function Iut(t,e,n){var r="";return n.split(" ").forEach(function(s){t[s]!==void 0?e.push(t[s]+";"):s&&(r+=s+" ")}),r}var nEe=function(e,n,r){var s=e.key+"-"+n.name;(r===!1||Put===!1)&&e.registered[s]===void 0&&(e.registered[s]=n.styles)},Fut=function(e,n,r){nEe(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 Out(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 Mut={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},Lut=/[A-Z]|^ms/g,Rut=/_EMO_([^_]+?)_([^]*?)_EMO_/g,rEe=function(e){return e.charCodeAt(1)===45},Fme=function(e){return e!=null&&typeof e!="boolean"},aV=yut(function(t){return rEe(t)?t:t.replace(Lut,"-$&").toLowerCase()}),Ome=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(Rut,function(r,s,a){return _0={name:s,styles:a,next:_0},s})}return Mut[e]!==1&&!rEe(e)&&typeof n=="number"&&n!==0?n+"px":n};function _9(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 _0={name:s.name,styles:s.styles,next:_0},s.name;var a=n;if(a.styles!==void 0){var o=a.next;if(o!==void 0)for(;o!==void 0;)_0={name:o.name,styles:o.styles,next:_0},o=o.next;var l=a.styles+";";return l}return Dut(t,e,n)}case"function":{if(t!==void 0){var c=_0,u=n(t);return _0=c,_9(t,e,u)}break}}var d=n;return d}function Dut(t,e,n){var r="";if(Array.isArray(n))for(var s=0;s<n.length;s++)r+=_9(t,e,n[s])+";";else for(var a in n){var o=n[a];if(typeof o!="object"){var l=o;Fme(l)&&(r+=aV(a)+":"+Ome(a,l)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&e==null)for(var c=0;c<o.length;c++)Fme(o[c])&&(r+=aV(a)+":"+Ome(a,o[c])+";");else{var u=_9(t,e,o);switch(a){case"animation":case"animationName":{r+=aV(a)+":"+u+";";break}default:r+=a+"{"+u+"}"}}}return r}var Mme=/label:\s*([^\s;{]+)\s*(;|$)/g,_0;function sEe(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="";_0=void 0;var a=t[0];if(a==null||a.raw===void 0)r=!1,s+=_9(n,e,a);else{var o=a;s+=o[0]}for(var l=1;l<t.length;l++)if(s+=_9(n,e,t[l]),r){var c=a;s+=c[l]}Mme.lastIndex=0;for(var u="",d;(d=Mme.exec(s))!==null;)u+="-"+d[1];var f=Out(s)+u;return{name:f,styles:s,next:_0}}var But=function(e){return e()},$ut=Gy.useInsertionEffect?Gy.useInsertionEffect:!1,Uut=$ut||But,iEe=h.createContext(typeof HTMLElement<"u"?_ut({key:"css"}):null);iEe.Provider;var zut=function(e){return h.forwardRef(function(n,r){var s=h.useContext(iEe);return e(n,s,r)})},Hut=h.createContext({}),Bae={}.hasOwnProperty,$J="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Vut=function(e,n){var r={};for(var s in n)Bae.call(n,s)&&(r[s]=n[s]);return r[$J]=e,r},Wut=function(e){var n=e.cache,r=e.serialized,s=e.isStringTag;return nEe(n,r,s),Uut(function(){return Fut(n,r,s)}),null},qut=zut(function(t,e,n){var r=t.css;typeof r=="string"&&e.registered[r]!==void 0&&(r=e.registered[r]);var s=t[$J],a=[r],o="";typeof t.className=="string"?o=Iut(e.registered,a,t.className):t.className!=null&&(o=t.className+" ");var l=sEe(a,void 0,h.useContext(Hut));o+=e.key+"-"+l.name;var c={};for(var u in t)Bae.call(t,u)&&u!=="css"&&u!==$J&&(c[u]=t[u]);return c.className=o,n&&(c.ref=n),h.createElement(h.Fragment,null,h.createElement(Wut,{cache:e,serialized:l,isStringTag:typeof s=="string"}),h.createElement(s,c))}),Gut=qut,Qs=function(e,n){var r=arguments;if(n==null||!Bae.call(n,"css"))return h.createElement.apply(void 0,r);var s=r.length,a=new Array(s);a[0]=Gut,a[1]=Vut(e,n);for(var o=2;o<s;o++)a[o]=r[o];return h.createElement.apply(null,a)};(function(t){var e;e||(e=t.JSX||(t.JSX={}))})(Qs);function $ae(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return sEe(e)}function Kut(){var t=$ae.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 Yut(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}const Xut=Math.min,Qut=Math.max,dL=Math.round,jI=Math.floor,fL=t=>({x:t,y:t});function a$(){return typeof window<"u"}function aEe(t){return lEe(t)?(t.nodeName||"").toLowerCase():"#document"}function x1(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function oEe(t){var e;return(e=(lEe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function lEe(t){return a$()?t instanceof Node||t instanceof x1(t).Node:!1}function Zut(t){return a$()?t instanceof Element||t instanceof x1(t).Element:!1}function Uae(t){return a$()?t instanceof HTMLElement||t instanceof x1(t).HTMLElement:!1}function Lme(t){return!a$()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof x1(t).ShadowRoot}function cEe(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=zae(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(s)}function Jut(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function edt(t){return["html","body","#document"].includes(aEe(t))}function zae(t){return x1(t).getComputedStyle(t)}function tdt(t){if(aEe(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lme(t)&&t.host||oEe(t);return Lme(e)?e.host:e}function uEe(t){const e=tdt(t);return edt(e)?t.ownerDocument?t.ownerDocument.body:t.body:Uae(e)&&cEe(e)?e:uEe(e)}function hL(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=uEe(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=x1(s);if(a){const l=UJ(o);return e.concat(o,o.visualViewport||[],cEe(s)?s:[],l&&n?hL(l):[])}return e.concat(s,hL(s,[],n))}function UJ(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ndt(t){const e=zae(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Uae(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=dL(n)!==a||dL(r)!==o;return l&&(n=a,r=o),{width:n,height:r,$:l}}function Hae(t){return Zut(t)?t:t.contextElement}function Rme(t){const e=Hae(t);if(!Uae(e))return fL(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=ndt(e);let o=(a?dL(n.width):n.width)/r,l=(a?dL(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const rdt=fL(0);function sdt(t){const e=x1(t);return!Jut()||!e.visualViewport?rdt:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function idt(t,e,n){return!1}function Dme(t,e,n,r){e===void 0&&(e=!1);const s=t.getBoundingClientRect(),a=Hae(t);let o=fL(1);e&&(o=Rme(t));const l=idt()?sdt(a):fL(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=x1(a),g=r;let y=x,v=UJ(y);for(;v&&r&&g!==y;){const C=Rme(v),S=v.getBoundingClientRect(),T=zae(v),I=S.left+(v.clientLeft+parseFloat(T.paddingLeft))*C.x,L=S.top+(v.clientTop+parseFloat(T.paddingTop))*C.y;c*=C.x,u*=C.y,d*=C.x,f*=C.y,c+=I,u+=L,y=x1(v),v=UJ(y)}}return x9({width:d,height:f,x:c,y:u})}function dEe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function adt(t,e){let n=null,r;const s=oEe(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=jI(f),v=jI(s.clientWidth-(d+x)),C=jI(s.clientHeight-(f+g)),S=jI(d),I={rootMargin:-y+"px "+-v+"px "+-C+"px "+-S+"px",threshold:Qut(0,Xut(1,c))||1};let L=!0;function F($){const O=$[0].intersectionRatio;if(O!==c){if(!L)return o();O?o(!1,O):r=setTimeout(()=>{o(!1,1e-7)},1e3)}O===1&&!dEe(u,t.getBoundingClientRect())&&o(),L=!1}try{n=new IntersectionObserver(F,{...I,root:s.ownerDocument})}catch{n=new IntersectionObserver(F,I)}n.observe(t)}return o(!0),a}function odt(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=Hae(t),d=s||a?[...u?hL(u):[],...hL(e)]:[];d.forEach(S=>{s&&S.addEventListener("scroll",n,{passive:!0}),a&&S.addEventListener("resize",n)});const f=u&&l?adt(u,n):null;let x=-1,g=null;o&&(g=new ResizeObserver(S=>{let[T]=S;T&&T.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var I;(I=g)==null||I.observe(e)})),n()}),u&&!c&&g.observe(u),g.observe(e));let y,v=c?Dme(t):null;c&&C();function C(){const S=Dme(t);v&&!dEe(v,S)&&n(),v=S,y=requestAnimationFrame(C)}return n(),()=>{var S;d.forEach(T=>{s&&T.removeEventListener("scroll",n),a&&T.removeEventListener("resize",n)}),f==null||f(),(S=g)==null||S.disconnect(),g=null,c&&cancelAnimationFrame(y)}}var zJ=h.useLayoutEffect,ldt=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],pL=function(){};function cdt(t,e){return e?e[0]==="-"?t+e:t+"__"+e:t}function udt(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(cdt(t,o)));return a.filter(function(l){return l}).map(function(l){return String(l).trim()}).join(" ")}var Bme=function(e){return ydt(e)?e.filter(Boolean):D3(e)==="object"&&e!==null?[e]:[]},fEe=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=M1(e,ldt);return ei({},n)},hl=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 o$(t){return[document.documentElement,document.body,window].indexOf(t)>-1}function ddt(t){return o$(t)?window.innerHeight:t.clientHeight}function hEe(t){return o$(t)?window.pageYOffset:t.scrollTop}function mL(t,e){if(o$(t)){window.scrollTo(0,e);return}t.scrollTop=e}function fdt(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 hdt(t,e,n,r){return n*((t=t/r-1)*t*t+1)+e}function AI(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:pL,s=hEe(t),a=e-s,o=10,l=0;function c(){l+=o;var u=hdt(l,s,a,n);mL(t,u),l<n?window.requestAnimationFrame(c):r(t)}c()}function $me(t,e){var n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=e.offsetHeight/3;r.bottom+s>n.bottom?mL(t,Math.min(e.offsetTop+e.clientHeight-t.offsetHeight+s,t.scrollHeight)):r.top-s<n.top&&mL(t,Math.max(e.offsetTop-s,0))}function pdt(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 Ume(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function mdt(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var pEe=!1,xdt={get passive(){return pEe=!0}},_I=typeof window<"u"?window:{};_I.addEventListener&&_I.removeEventListener&&(_I.addEventListener("p",pL,xdt),_I.removeEventListener("p",pL,!1));var gdt=pEe;function bdt(t){return t!=null}function ydt(t){return Array.isArray(t)}function EI(t,e,n){return t?e:n}var vdt=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=n1(o,1),c=l[0];return!r.includes(c)});return a.reduce(function(o,l){var c=n1(l,2),u=c[0],d=c[1];return o[u]=d,o},{})},wdt=["children","innerProps"],Cdt=["children","innerProps"];function Ndt(t){var e=t.maxHeight,n=t.menuEl,r=t.minHeight,s=t.placement,a=t.shouldScroll,o=t.isFixedPosition,l=t.controlHeight,c=fdt(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(),S=C.top,T=o?window.innerHeight:ddt(c),I=hEe(c),L=parseInt(getComputedStyle(n).marginBottom,10),F=parseInt(getComputedStyle(n).marginTop,10),$=S-F,O=T-v,U=$+I,Y=f-I-v,re=g-T+I+L,Q=I+v-F,q=160;switch(s){case"auto":case"bottom":if(O>=y)return{placement:"bottom",maxHeight:e};if(Y>=y&&!o)return a&&AI(c,re,q),{placement:"bottom",maxHeight:e};if(!o&&Y>=r||o&&O>=r){a&&AI(c,re,q);var te=o?O-L:Y-L;return{placement:"bottom",maxHeight:te}}if(s==="auto"||o){var fe=e,G=o?$:U;return G>=r&&(fe=Math.min(G-L-l,e)),{placement:"top",maxHeight:fe}}if(s==="bottom")return a&&mL(c,re),{placement:"bottom",maxHeight:e};break;case"top":if($>=y)return{placement:"top",maxHeight:e};if(U>=y&&!o)return a&&AI(c,Q,q),{placement:"top",maxHeight:e};if(!o&&U>=r||o&&$>=r){var ie=e;return(!o&&U>=r||o&&$>=r)&&(ie=o?$-F:U-F),a&&AI(c,Q,q),{placement:"top",maxHeight:ie}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(s,'".'))}return u}function Sdt(t){var e={bottom:"top",top:"bottom"};return t?e[t]:"bottom"}var mEe=function(e){return e==="auto"?"bottom":e},jdt=function(e,n){var r,s=e.placement,a=e.theme,o=a.borderRadius,l=a.spacing,c=a.colors;return ei((r={label:"menu"},K7(r,Sdt(s),"100%"),K7(r,"position","absolute"),K7(r,"width","100%"),K7(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})},xEe=h.createContext(null),Adt=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=h.useContext(xEe)||{},d=u.setPortalPlacement,f=h.useRef(null),x=h.useState(s),g=n1(x,2),y=g[0],v=g[1],C=h.useState(null),S=n1(C,2),T=S[0],I=S[1],L=c.spacing.controlHeight;return zJ(function(){var F=f.current;if(F){var $=o==="fixed",O=l&&!$,U=Ndt({maxHeight:s,menuEl:F,minHeight:r,placement:a,shouldScroll:O,isFixedPosition:$,controlHeight:L});v(U.maxHeight),I(U.placement),d==null||d(U.placement)}},[s,a,o,l,r,d,L]),n({ref:f,placerProps:ei(ei({},e),{},{placement:T||mEe(a),maxHeight:y})})},_dt=function(e){var n=e.children,r=e.innerRef,s=e.innerProps;return Qs("div",ai({},hl(e,"menu",{menu:!0}),{ref:r},s),n)},Edt=_dt,kdt=function(e,n){var r=e.maxHeight,s=e.theme.spacing.baseUnit;return ei({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},Tdt=function(e){var n=e.children,r=e.innerProps,s=e.innerRef,a=e.isMulti;return Qs("div",ai({},hl(e,"menuList",{"menu-list":!0,"menu-list--is-multi":a}),{ref:s},r),n)},gEe=function(e,n){var r=e.theme,s=r.spacing.baseUnit,a=r.colors;return ei({textAlign:"center"},n?{}:{color:a.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},Pdt=gEe,Idt=gEe,Fdt=function(e){var n=e.children,r=n===void 0?"No options":n,s=e.innerProps,a=M1(e,wdt);return Qs("div",ai({},hl(ei(ei({},a),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},Odt=function(e){var n=e.children,r=n===void 0?"Loading...":n,s=e.innerProps,a=M1(e,Cdt);return Qs("div",ai({},hl(ei(ei({},a),{},{children:r,innerProps:s}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),s),r)},Mdt=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}},Ldt=function(e){var n=e.appendTo,r=e.children,s=e.controlElement,a=e.innerProps,o=e.menuPlacement,l=e.menuPosition,c=h.useRef(null),u=h.useRef(null),d=h.useState(mEe(o)),f=n1(d,2),x=f[0],g=f[1],y=h.useMemo(function(){return{setPortalPlacement:g}},[]),v=h.useState(null),C=n1(v,2),S=C[0],T=C[1],I=h.useCallback(function(){if(s){var O=pdt(s),U=l==="fixed"?0:window.pageYOffset,Y=O[x]+U;(Y!==(S==null?void 0:S.offset)||O.left!==(S==null?void 0:S.rect.left)||O.width!==(S==null?void 0:S.rect.width))&&T({offset:Y,rect:O})}},[s,l,x,S==null?void 0:S.offset,S==null?void 0:S.rect.left,S==null?void 0:S.rect.width]);zJ(function(){I()},[I]);var L=h.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),s&&c.current&&(u.current=odt(s,c.current,I,{elementResize:"ResizeObserver"in window}))},[s,I]);zJ(function(){L()},[L]);var F=h.useCallback(function(O){c.current=O,L()},[L]);if(!n&&l!=="fixed"||!S)return null;var $=Qs("div",ai({ref:F},hl(ei(ei({},e),{},{offset:S.offset,position:l,rect:S.rect}),"menuPortal",{"menu-portal":!0}),a),r);return Qs(xEe.Provider,{value:y},n?Ea.createPortal($,n):$)},Rdt=function(e){var n=e.isDisabled,r=e.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},Ddt=function(e){var n=e.children,r=e.innerProps,s=e.isDisabled,a=e.isRtl;return Qs("div",ai({},hl(e,"container",{"--is-disabled":s,"--is-rtl":a}),r),n)},Bdt=function(e,n){var r=e.theme.spacing,s=e.isMulti,a=e.hasValue,o=e.selectProps.controlShouldRenderValue;return ei({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")})},$dt=function(e){var n=e.children,r=e.innerProps,s=e.isMulti,a=e.hasValue;return Qs("div",ai({},hl(e,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":a}),r),n)},Udt=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},zdt=function(e){var n=e.children,r=e.innerProps;return Qs("div",ai({},hl(e,"indicatorsContainer",{indicators:!0}),r),n)},zme,Hdt=["size"],Vdt=["innerProps","isRtl","size"],Wdt={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},bEe=function(e){var n=e.size,r=M1(e,Hdt);return Qs("svg",ai({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:Wdt},r))},Vae=function(e){return Qs(bEe,ai({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"}))},yEe=function(e){return Qs(bEe,ai({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"}))},vEe=function(e,n){var r=e.isFocused,s=e.theme,a=s.spacing.baseUnit,o=s.colors;return ei({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?o.neutral60:o.neutral20,padding:a*2,":hover":{color:r?o.neutral80:o.neutral40}})},qdt=vEe,Gdt=function(e){var n=e.children,r=e.innerProps;return Qs("div",ai({},hl(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||Qs(yEe,null))},Kdt=vEe,Ydt=function(e){var n=e.children,r=e.innerProps;return Qs("div",ai({},hl(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||Qs(Vae,null))},Xdt=function(e,n){var r=e.isDisabled,s=e.theme,a=s.spacing.baseUnit,o=s.colors;return ei({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?o.neutral10:o.neutral20,marginBottom:a*2,marginTop:a*2})},Qdt=function(e){var n=e.innerProps;return Qs("span",ai({},n,hl(e,"indicatorSeparator",{"indicator-separator":!0})))},Zdt=Kut(zme||(zme=Yut([`
0%, 80%, 100% { opacity: 0; }
40% { opacity: 1; }
`]))),Jdt=function(e,n){var r=e.isFocused,s=e.size,a=e.theme,o=a.colors,l=a.spacing.baseUnit;return ei({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})},oV=function(e){var n=e.delay,r=e.offset;return Qs("span",{css:$ae({animation:"".concat(Zdt," 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"},"","")})},eft=function(e){var n=e.innerProps,r=e.isRtl,s=e.size,a=s===void 0?4:s,o=M1(e,Vdt);return Qs("div",ai({},hl(ei(ei({},o),{},{innerProps:n,isRtl:r,size:a}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),Qs(oV,{delay:0,offset:r}),Qs(oV,{delay:160,offset:!0}),Qs(oV,{delay:320,offset:!r}))},tft=function(e,n){var r=e.isDisabled,s=e.isFocused,a=e.theme,o=a.colors,l=a.borderRadius,c=a.spacing;return ei({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}})},nft=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,a=e.innerRef,o=e.innerProps,l=e.menuIsOpen;return Qs("div",ai({ref:a},hl(e,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":l}),o,{"aria-disabled":r||void 0}),n)},rft=nft,sft=["data"],ift=function(e,n){var r=e.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},aft=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",ai({},hl(e,"group",{group:!0}),c),Qs(o,ai({},l,{selectProps:f,theme:d,getStyles:s,getClassNames:a,cx:r}),u),Qs("div",null,n))},oft=function(e,n){var r=e.theme,s=r.colors,a=r.spacing;return ei({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"})},lft=function(e){var n=fEe(e);n.data;var r=M1(n,sft);return Qs("div",ai({},hl(e,"groupHeading",{"group-heading":!0}),r))},cft=aft,uft=["innerRef","isDisabled","isHidden","inputClassName"],dft=function(e,n){var r=e.isDisabled,s=e.value,a=e.theme,o=a.spacing,l=a.colors;return ei(ei({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},fft),n?{}:{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,color:l.neutral80})},wEe={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},fft={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":ei({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},wEe)},hft=function(e){return ei({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},wEe)},pft=function(e){var n=e.cx,r=e.value,s=fEe(e),a=s.innerRef,o=s.isDisabled,l=s.isHidden,c=s.inputClassName,u=M1(s,uft);return Qs("div",ai({},hl(e,"input",{"input-container":!0}),{"data-value":r||""}),Qs("input",ai({className:n({input:!0},c),ref:a,style:hft(l),disabled:o},u)))},mft=pft,xft=function(e,n){var r=e.theme,s=r.spacing,a=r.borderRadius,o=r.colors;return ei({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:o.neutral10,borderRadius:a/2,margin:s.baseUnit/2})},gft=function(e,n){var r=e.theme,s=r.borderRadius,a=r.colors,o=e.cropWithEllipsis;return ei({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})},bft=function(e,n){var r=e.theme,s=r.spacing,a=r.borderRadius,o=r.colors,l=e.isFocused;return ei({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}})},CEe=function(e){var n=e.children,r=e.innerProps;return Qs("div",r,n)},yft=CEe,vft=CEe;function wft(t){var e=t.children,n=t.innerProps;return Qs("div",ai({role:"button"},n),e||Qs(Vae,{size:14}))}var Cft=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:ei(ei({},hl(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":o})),a),selectProps:c},Qs(d,{data:s,innerProps:ei({},hl(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:c},n),Qs(f,{data:s,innerProps:ei(ei({},hl(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},l),selectProps:c}))},Nft=Cft,Sft=function(e,n){var r=e.isDisabled,s=e.isFocused,a=e.isSelected,o=e.theme,l=o.spacing,c=o.colors;return ei({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}})},jft=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,a=e.isSelected,o=e.innerRef,l=e.innerProps;return Qs("div",ai({},hl(e,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":a}),{ref:o,"aria-disabled":r},l),n)},Aft=jft,_ft=function(e,n){var r=e.theme,s=r.spacing,a=r.colors;return ei({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:a.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},Eft=function(e){var n=e.children,r=e.innerProps;return Qs("div",ai({},hl(e,"placeholder",{placeholder:!0}),r),n)},kft=Eft,Tft=function(e,n){var r=e.isDisabled,s=e.theme,a=s.spacing,o=s.colors;return ei({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})},Pft=function(e){var n=e.children,r=e.isDisabled,s=e.innerProps;return Qs("div",ai({},hl(e,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},Ift=Pft,ba={ClearIndicator:Ydt,Control:rft,DropdownIndicator:Gdt,DownChevron:yEe,CrossIcon:Vae,Group:cft,GroupHeading:lft,IndicatorsContainer:zdt,IndicatorSeparator:Qdt,Input:mft,LoadingIndicator:eft,Menu:Edt,MenuList:Tdt,MenuPortal:Ldt,LoadingMessage:Odt,NoOptionsMessage:Fdt,MultiValue:Nft,MultiValueContainer:yft,MultiValueLabel:vft,MultiValueRemove:wft,Option:Aft,Placeholder:kft,SelectContainer:Ddt,SingleValue:Ift,ValueContainer:$dt},Fft=function(e){return ei(ei({},ba),e.components)},Hme=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Oft(t,e){return!!(t===e||Hme(t)&&Hme(e))}function Mft(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!Oft(t[n],e[n]))return!1;return!0}function Lft(t,e){e===void 0&&(e=Mft);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 Rft={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"},Dft=function(e){return Qs("span",ai({css:Rft},e))},Vme=Dft,Bft={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:"",".")}},$ft=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,S=c.menuIsOpen,T=c.options,I=c.screenReaderStatus,L=c.tabSelectsValue,F=c.isLoading,$=c["aria-label"],O=c["aria-live"],U=h.useMemo(function(){return ei(ei({},Bft),f||{})},[f]),Y=h.useMemo(function(){var G="";if(n&&U.onChange){var ie=n.option,oe=n.options,K=n.removedValue,H=n.removedValues,ee=n.value,se=function(je){return Array.isArray(je)?null:je},pe=K||ie||se(ee),Se=pe?x(pe):"",ge=oe||H||void 0,ve=ge?ge.map(x):[],be=ei({isDisabled:pe&&v(pe,l),label:Se,labels:ve},n);G=U.onChange(be)}return G},[n,U,v,l,x]),re=h.useMemo(function(){var G="",ie=r||s,oe=!!(r&&l&&l.includes(r));if(ie&&U.onFocus){var K={focused:ie,label:x(ie),isDisabled:v(ie,l),isSelected:oe,options:a,context:ie===r?"menu":"value",selectValue:l,isAppleDevice:d};G=U.onFocus(K)}return G},[r,s,x,v,U,a,l,d]),Q=h.useMemo(function(){var G="";if(S&&T.length&&!F&&U.onFilter){var ie=I({count:a.length});G=U.onFilter({inputValue:g,resultsMessage:ie})}return G},[a,g,S,U,T,I,F]),q=(n==null?void 0:n.action)==="initial-input-focus",te=h.useMemo(function(){var G="";if(U.guidance){var ie=s?"value":S?"menu":"input";G=U.guidance({"aria-label":$,context:ie,isDisabled:r&&v(r,l),isMulti:y,isSearchable:C,tabSelectsValue:L,isInitialFocus:q})}return G},[$,r,s,y,v,C,S,U,l,L,q]),fe=Qs(h.Fragment,null,Qs("span",{id:"aria-selection"},Y),Qs("span",{id:"aria-focused"},re),Qs("span",{id:"aria-results"},Q),Qs("span",{id:"aria-guidance"},te));return Qs(h.Fragment,null,Qs(Vme,{id:u},q&&fe),Qs(Vme,{"aria-live":O,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},o&&!q&&fe))},Uft=$ft,HJ=[{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źẑżžẓẕƶȥɀⱬꝣ"}],zft=new RegExp("["+HJ.map(function(t){return t.letters}).join("")+"]","g"),NEe={};for(var lV=0;lV<HJ.length;lV++)for(var cV=HJ[lV],uV=0;uV<cV.letters.length;uV++)NEe[cV.letters[uV]]=cV.base;var SEe=function(e){return e.replace(zft,function(n){return NEe[n]})},Hft=Lft(SEe),Wme=function(e){return e.replace(/^\s+|\s+$/g,"")},Vft=function(e){return"".concat(e.label," ").concat(e.value)},Wft=function(e){return function(n,r){if(n.data.__isNew__)return!0;var s=ei({ignoreCase:!0,ignoreAccents:!0,stringify:Vft,trim:!0,matchFrom:"any"},e),a=s.ignoreCase,o=s.ignoreAccents,l=s.stringify,c=s.trim,u=s.matchFrom,d=c?Wme(r):r,f=c?Wme(l(n)):l(n);return a&&(d=d.toLowerCase(),f=f.toLowerCase()),o&&(d=Hft(d),f=SEe(f)),u==="start"?f.substr(0,d.length)===d:f.indexOf(d)>-1}},qft=["innerRef"];function Gft(t){var e=t.innerRef,n=M1(t,qft),r=vdt(n,"onExited","in","enter","exit","appear");return Qs("input",ai({ref:e},r,{css:$ae({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 Kft=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function Yft(t){var e=t.isEnabled,n=t.onBottomArrive,r=t.onBottomLeave,s=t.onTopArrive,a=t.onTopLeave,o=h.useRef(!1),l=h.useRef(!1),c=h.useRef(0),u=h.useRef(null),d=h.useCallback(function(C,S){if(u.current!==null){var T=u.current,I=T.scrollTop,L=T.scrollHeight,F=T.clientHeight,$=u.current,O=S>0,U=L-F-I,Y=!1;U>S&&o.current&&(r&&r(C),o.current=!1),O&&l.current&&(a&&a(C),l.current=!1),O&&S>U?(n&&!o.current&&n(C),$.scrollTop=L,Y=!0,o.current=!0):!O&&-S>I&&(s&&!l.current&&s(C),$.scrollTop=0,Y=!0,l.current=!0),Y&&Kft(C)}},[n,r,s,a]),f=h.useCallback(function(C){d(C,C.deltaY)},[d]),x=h.useCallback(function(C){c.current=C.changedTouches[0].clientY},[]),g=h.useCallback(function(C){var S=c.current-C.changedTouches[0].clientY;d(C,S)},[d]),y=h.useCallback(function(C){if(C){var S=gdt?{passive:!1}:!1;C.addEventListener("wheel",f,S),C.addEventListener("touchstart",x,S),C.addEventListener("touchmove",g,S)}},[g,x,f]),v=h.useCallback(function(C){C&&(C.removeEventListener("wheel",f,!1),C.removeEventListener("touchstart",x,!1),C.removeEventListener("touchmove",g,!1))},[g,x,f]);return h.useEffect(function(){if(e){var C=u.current;return y(C),function(){v(C)}}},[e,y,v]),function(C){u.current=C}}var qme=["boxSizing","height","overflow","paddingRight","position"],Gme={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Kme(t){t.cancelable&&t.preventDefault()}function Yme(t){t.stopPropagation()}function Xme(){var t=this.scrollTop,e=this.scrollHeight,n=t+this.offsetHeight;t===0?this.scrollTop=1:n===e&&(this.scrollTop=t-1)}function Qme(){return"ontouchstart"in window||navigator.maxTouchPoints}var Zme=!!(typeof window<"u"&&window.document&&window.document.createElement),XA=0,aC={capture:!1,passive:!1};function Xft(t){var e=t.isEnabled,n=t.accountForScrollbars,r=n===void 0?!0:n,s=h.useRef({}),a=h.useRef(null),o=h.useCallback(function(c){if(Zme){var u=document.body,d=u&&u.style;if(r&&qme.forEach(function(y){var v=d&&d[y];s.current[y]=v}),r&&XA<1){var f=parseInt(s.current.paddingRight,10)||0,x=document.body?document.body.clientWidth:0,g=window.innerWidth-x+f||0;Object.keys(Gme).forEach(function(y){var v=Gme[y];d&&(d[y]=v)}),d&&(d.paddingRight="".concat(g,"px"))}u&&Qme()&&(u.addEventListener("touchmove",Kme,aC),c&&(c.addEventListener("touchstart",Xme,aC),c.addEventListener("touchmove",Yme,aC))),XA+=1}},[r]),l=h.useCallback(function(c){if(Zme){var u=document.body,d=u&&u.style;XA=Math.max(XA-1,0),r&&XA<1&&qme.forEach(function(f){var x=s.current[f];d&&(d[f]=x)}),u&&Qme()&&(u.removeEventListener("touchmove",Kme,aC),c&&(c.removeEventListener("touchstart",Xme,aC),c.removeEventListener("touchmove",Yme,aC)))}},[r]);return h.useEffect(function(){if(e){var c=a.current;return o(c),function(){l(c)}}},[e,o,l]),function(c){a.current=c}}var Qft=function(e){var n=e.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},Zft={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Jft(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=Yft({isEnabled:s,onBottomArrive:a,onBottomLeave:o,onTopArrive:l,onTopLeave:c}),d=Xft({isEnabled:n}),f=function(g){u(g),d(g)};return Qs(h.Fragment,null,n&&Qs("div",{onClick:Qft,css:Zft}),e(f))}var eht={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},tht=function(e){var n=e.name,r=e.onFocus;return Qs("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:eht,value:"",onChange:function(){}})},nht=tht;function Wae(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 rht(){return Wae(/^iPhone/i)}function jEe(){return Wae(/^Mac/i)}function sht(){return Wae(/^iPad/i)||jEe()&&navigator.maxTouchPoints>1}function iht(){return rht()||sht()}function aht(){return jEe()||iht()}var oht=function(e){return e.label},lht=function(e){return e.label},cht=function(e){return e.value},uht=function(e){return!!e.isDisabled},dht={clearIndicator:Kdt,container:Rdt,control:tft,dropdownIndicator:qdt,group:ift,groupHeading:oft,indicatorsContainer:Udt,indicatorSeparator:Xdt,input:dft,loadingIndicator:Jdt,loadingMessage:Idt,menu:jdt,menuList:kdt,menuPortal:Mdt,multiValue:xft,multiValueLabel:gft,multiValueRemove:bft,noOptionsMessage:Pdt,option:Sft,placeholder:_ft,singleValue:Tft,valueContainer:Bdt},fht={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%)"},hht=4,AEe=4,pht=38,mht=AEe*2,xht={baseUnit:AEe,controlHeight:pht,menuGutter:mht},dV={borderRadius:hht,colors:fht,spacing:xht},ght={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Ume(),captureMenuScroll:!Ume(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:Wft(),formatGroupLabel:oht,getOptionLabel:lht,getOptionValue:cht,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:uht,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!mdt(),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 Jme(t,e,n,r){var s=kEe(t,e,n),a=TEe(t,e,n),o=EEe(t,e),l=xL(t,e);return{type:"option",data:e,isDisabled:s,isSelected:a,label:o,value:l,index:r}}function VO(t,e){return t.options.map(function(n,r){if("options"in n){var s=n.options.map(function(o,l){return Jme(t,o,e,l)}).filter(function(o){return t0e(t,o)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var a=Jme(t,n,e,r);return t0e(t,a)?a:void 0}).filter(bdt)}function _Ee(t){return t.reduce(function(e,n){return n.type==="group"?e.push.apply(e,Mae(n.options.map(function(r){return r.data}))):e.push(n.data),e},[])}function e0e(t,e){return t.reduce(function(n,r){return r.type==="group"?n.push.apply(n,Mae(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 bht(t,e){return _Ee(VO(t,e))}function t0e(t,e){var n=t.inputValue,r=n===void 0?"":n,s=e.data,a=e.isSelected,o=e.label,l=e.value;return(!IEe(t)||!a)&&PEe(t,{label:o,value:l,data:s},r)}function yht(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 vht(t,e){var n=t.focusedOption;return n&&e.indexOf(n)>-1?n:e[0]}var fV=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},EEe=function(e,n){return e.getOptionLabel(n)},xL=function(e,n){return e.getOptionValue(n)};function kEe(t,e,n){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,n):!1}function TEe(t,e,n){if(n.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,n);var r=xL(t,e);return n.some(function(s){return xL(t,s)===r})}function PEe(t,e,n){return t.filterOption?t.filterOption(e,n):!0}var IEe=function(e){var n=e.hideSelectedOptions,r=e.isMulti;return n===void 0?r:n},wht=1,FEe=function(t){Wct(n,t);var e=Kct(n);function n(r){var s;if(Hct(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=aht(),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(S){return s.getOptionValue(S)!==C}),"deselect-option",c)}else if(!v)f?s.setValue([].concat(Mae(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=EI(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(EI(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=EI(c,f,f[0]||null);d&&s.onChange(x,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(c){return fV(s.state.focusableOptionsWithIds,c)},s.getFocusableOptionsWithIds=function(){return e0e(VO(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 udt.apply(void 0,[s.props.classNamePrefix].concat(u))},s.getOptionLabel=function(c){return EEe(s.props,c)},s.getOptionValue=function(c){return xL(s.props,c)},s.getStyles=function(c,u){var d=s.props.unstyled,f=dht[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 Fft(s.props)},s.buildCategorizedOptions=function(){return VO(s.props,s.state.selectValue)},s.getCategorizedOptions=function(){return s.props.menuIsOpen?s.buildCategorizedOptions():[]},s.buildFocusableOptions=function(){return _Ee(s.buildCategorizedOptions())},s.getFocusableOptions=function(){return s.props.menuIsOpen?s.buildFocusableOptions():[]},s.ariaOnChange=function(c,u){s.setState({ariaSelection:ei({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&&o$(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 IEe(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,S=u.onKeyDown,T=u.tabSelectsValue,I=u.openMenuOnFocus,L=s.state,F=L.focusedOption,$=L.focusedValue,O=L.selectValue;if(!v&&!(typeof S=="function"&&(S(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||!T||!F||I&&s.isOptionSelected(F,O))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||++wht),s.state.selectValue=Bme(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=fV(a,o[l])}return s}return Vct(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&&$me(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&&($me(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(dV):ei(ei({},dV),this.props.theme):dV}},{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 kEe(this.props,s,a)}},{key:"isOptionSelected",value:function(s,a){return TEe(this.props,s,a)}},{key:"filterOption",value:function(s,a){return PEe(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,S=v.ariaSelection,T=this.commonProps,I=l||this.getElementId("input"),L=ei(ei(ei({"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()?(S==null?void 0:S.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return o?h.createElement(y,ai({},T,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:I,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},L)):h.createElement(Gft,ai({id:I,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:pL,onFocus:this.onInputFocus,disabled:a,tabIndex:u,inputMode:"none",form:d,value:""},L))}},{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,S=g.inputValue,T=g.placeholder,I=this.state,L=I.selectValue,F=I.focusedValue,$=I.isFocused;if(!this.hasValue()||!y)return S?null:h.createElement(f,ai({},x,{key:"placeholder",isDisabled:v,isFocused:$,innerProps:{id:this.getElementId("placeholder")}}),T);if(C)return L.map(function(U,Y){var re=U===F,Q="".concat(s.getOptionLabel(U),"-").concat(s.getOptionValue(U));return h.createElement(o,ai({},x,{components:{Container:l,Label:c,Remove:u},isFocused:re,isDisabled:v,key:Q,index:Y,removeProps:{onClick:function(){return s.removeValue(U)},onTouchEnd:function(){return s.removeValue(U)},onMouseDown:function(te){te.preventDefault()}},data:U}),s.formatOptionLabel(U,"value"))});if(S)return null;var O=L[0];return h.createElement(d,ai({},x,{data:O,isDisabled:v}),this.formatOptionLabel(O,"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 h.createElement(a,ai({},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 h.createElement(a,ai({},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 h.createElement(o,ai({},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 h.createElement(a,ai({},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,S=C.captureMenuScroll,T=C.inputValue,I=C.isLoading,L=C.loadingMessage,F=C.minMenuHeight,$=C.maxMenuHeight,O=C.menuIsOpen,U=C.menuPlacement,Y=C.menuPosition,re=C.menuPortalTarget,Q=C.menuShouldBlockScroll,q=C.menuShouldScrollIntoView,te=C.noOptionsMessage,fe=C.onMenuScrollToTop,G=C.onMenuScrollToBottom;if(!O)return null;var ie=function(Se,ge){var ve=Se.type,be=Se.data,we=Se.isDisabled,je=Se.isSelected,Fe=Se.label,Re=Se.value,Qe=v===be,Ye=we?void 0:function(){return s.onOptionHover(be)},dt=we?void 0:function(){return s.selectOption(be)},st="".concat(s.getElementId("option"),"-").concat(ge),at={id:st,onClick:dt,onMouseMove:Ye,onMouseOver:Ye,tabIndex:-1,role:"option","aria-selected":s.isAppleDevice?void 0:je};return h.createElement(g,ai({},y,{innerProps:at,data:be,isDisabled:we,isSelected:je,key:st,label:Fe,type:ve,value:Re,isFocused:Qe,innerRef:Qe?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(Se.data,"menu"))},oe;if(this.hasOptions())oe=this.getCategorizedOptions().map(function(pe){if(pe.type==="group"){var Se=pe.data,ge=pe.options,ve=pe.index,be="".concat(s.getElementId("group"),"-").concat(ve),we="".concat(be,"-heading");return h.createElement(o,ai({},y,{key:be,data:Se,options:ge,Heading:l,headingProps:{id:we,data:pe.data},label:s.formatGroupLabel(pe.data)}),pe.options.map(function(je){return ie(je,"".concat(ve,"-").concat(je.index))}))}else if(pe.type==="option")return ie(pe,"".concat(pe.index))});else if(I){var K=L({inputValue:T});if(K===null)return null;oe=h.createElement(f,y,K)}else{var H=te({inputValue:T});if(H===null)return null;oe=h.createElement(x,y,H)}var ee={minMenuHeight:F,maxMenuHeight:$,menuPlacement:U,menuPosition:Y,menuShouldScrollIntoView:q},se=h.createElement(Adt,ai({},y,ee),function(pe){var Se=pe.ref,ge=pe.placerProps,ve=ge.placement,be=ge.maxHeight;return h.createElement(c,ai({},y,ee,{innerRef:Se,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:I,placement:ve}),h.createElement(Jft,{captureEnabled:S,onTopArrive:fe,onBottomArrive:G,lockEnabled:Q},function(we){return h.createElement(u,ai({},y,{innerRef:function(Fe){s.getMenuListRef(Fe),we(Fe)},innerProps:{role:"listbox","aria-multiselectable":y.isMulti,id:s.getElementId("listbox")},isLoading:I,maxHeight:be,focusedOption:v}),oe)}))});return re||Y==="fixed"?h.createElement(d,ai({},y,{appendTo:re,controlElement:this.controlRef,menuPlacement:U,menuPosition:Y}),se):se}},{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 h.createElement(nht,{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 h.createElement("input",{name:u,type:"hidden",value:x})}else{var g=f.length>0?f.map(function(v,C){return h.createElement("input",{key:"i-".concat(C),name:u,type:"hidden",value:s.getOptionValue(v)})}):h.createElement("input",{name:u,type:"hidden",value:""});return h.createElement("div",null,g)}else{var y=f[0]?this.getOptionValue(f[0]):"";return h.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 h.createElement(Uft,ai({},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 h.createElement(l,ai({},v,{className:d,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:x,isFocused:y}),this.renderLiveRegion(),h.createElement(a,ai({},v,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:x,isFocused:y,menuIsOpen:g}),h.createElement(c,ai({},v,{isDisabled:x}),this.renderPlaceholderOrValue(),this.renderInput()),h.createElement(o,ai({},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,S=s.isMulti,T=Bme(y),I={};if(o&&(y!==o.value||g!==o.options||v!==o.menuIsOpen||C!==o.inputValue)){var L=v?bht(s,T):[],F=v?e0e(VO(s,T),"".concat(x,"-option")):[],$=l?yht(a,T):null,O=vht(a,L),U=fV(F,O);I={selectValue:T,focusedOption:O,focusedOptionId:U,focusableOptionsWithIds:F,focusedValue:$,clearFocusValueOnUpdate:!1}}var Y=c!=null&&s!==o?{inputIsHidden:c,inputIsHiddenAfterUpdate:void 0}:{},re=u,Q=d&&f;return d&&!Q&&(re={value:EI(S,T,T[0]||null),options:T,action:"initial-input-focus"},Q=!f),(u==null?void 0:u.action)==="initial-input-focus"&&(re=null),ei(ei(ei({},I),Y),{},{prevProps:s,ariaSelection:re,prevWasFocused:Q})}}]),n}(h.Component);FEe.defaultProps=ght;var Cht=h.forwardRef(function(t,e){var n=zct(t);return h.createElement(FEe,ai({ref:e},n))}),pl=Cht;function $c(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 Nht(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"),l=String(e.getSeconds()).padStart(2,"0"),c=e.getHours()>=12?" PM":" AM";return`${n} ${r}, ${s}, ${a}:${o}:${l} ${c}`}function B3(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 vo(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 Sht(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 kI(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 jht(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 zs(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 Aht(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 Ir(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 Y7(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 mo(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 Ey(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 Gv(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 l$=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 m3(t){if(isNaN(t))return;const e=t.toString().replace(".",",");return Number(e.replace(",",".")).toLocaleString("en-US",{maximumFractionDigits:20})}const OEe="2.28.0";let QA={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:n})=>e?`${t??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:`viem@${OEe}`},Hr=class VJ extends Error{constructor(e,n={}){var l;const r=(()=>{var c;return n.cause instanceof VJ?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof VJ&&n.cause.docsPath||n.docsPath,a=(l=QA.getDocsUrl)==null?void 0:l.call(QA,{...n,docsPath:s}),o=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...QA.version?[`Version: ${QA.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=OEe}walk(e){return MEe(this,e)}};function MEe(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?MEe(t.cause,e):e?null:t}let LEe=class extends Hr{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 _ht extends Hr{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 Eht extends Hr{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let kht=class extends Hr{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}},REe=class extends Hr{constructor({offset:e,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},DEe=class extends Hr{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 n0e extends Hr{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 Zj(t,{dir:e,size:n=32}={}){return typeof t=="string"?Dy(t,{dir:e,size:n}):Tht(t,{dir:e,size:n})}function Dy(t,{dir:e,size:n=32}={}){if(n===null)return t;const r=t.replace("0x","");if(r.length>n*2)throw new DEe({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function Tht(t,{dir:e,size:n=32}={}){if(n===null)return t;if(t.length>n)throw new DEe({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 ox(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function ul(t){return ox(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 Pht=new TextEncoder;function Jj(t,e={}){return typeof t=="number"||typeof t=="bigint"?Fht(t,e):typeof t=="boolean"?Iht(t,e):ox(t)?hp(t,e):x3(t,e)}function Iht(t,e={}){const n=new Uint8Array(1);return n[0]=Number(t),typeof e.size=="number"?(Cp(n,{size:e.size}),Zj(n,{size:e.size})):n}const Kx={zero:48,nine:57,A:65,F:70,a:97,f:102};function r0e(t){if(t>=Kx.zero&&t<=Kx.nine)return t-Kx.zero;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 hp(t,e={}){let n=t;e.size&&(Cp(n,{size:e.size}),n=Zj(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=r0e(r.charCodeAt(l++)),u=r0e(r.charCodeAt(l++));if(c===void 0||u===void 0)throw new Hr(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);a[o]=c*16+u}return a}function Fht(t,e){const n=Gs(t,e);return hp(n)}function x3(t,e={}){const n=Pht.encode(t);return typeof e.size=="number"?(Cp(n,{size:e.size}),Zj(n,{dir:"right",size:e.size})):n}function Cp(t,{size:e}){if(ul(t)>e)throw new kht({givenSize:ul(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 Oht(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 Eht(n)}function lx(t,e={}){return Number(cd(t,e))}function Mht(t,e={}){let n=hp(t);return e.size&&(Cp(n,{size:e.size}),n=Jf(n,{dir:"right"})),new TextDecoder().decode(n)}const Lht=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function pi(t,e={}){return typeof t=="number"||typeof t=="bigint"?Gs(t,e):typeof t=="string"?aS(t,e):typeof t=="boolean"?BEe(t,e):Xl(t,e)}function BEe(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(Cp(n,{size:e.size}),Zj(n,{size:e.size})):n}function Xl(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=Lht[t[s]];const r=`0x${n}`;return typeof e.size=="number"?(Cp(r,{size:e.size}),Zj(r,{dir:"right",size:e.size})):r}function Gs(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 LEe({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?Zj(l,{size:r}):l}const Rht=new TextEncoder;function aS(t,e={}){const n=Rht.encode(t);return Xl(n,e)}function Am(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new Xht(t.type);return`${t.name}(${c$(t.inputs,{includeName:e})})`}function c$(t,{includeName:e=!1}={}){return t?t.map(n=>Dht(n,{includeName:e})).join(e?", ":","):""}function Dht(t,{includeName:e}){return t.type.startsWith("tuple")?`(${c$(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}class Bht extends Hr{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 s0e extends Hr{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 $Ee extends Hr{constructor({data:e,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
`),{metaMessages:[`Params: (${c$(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 wT extends Hr{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class $ht extends Hr{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 Uht extends Hr{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${ul(n)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class zht extends Hr{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${n}`].join(`
`),{name:"AbiEncodingLengthMismatchError"})}}class Hht extends Hr{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 i0e extends Hr{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 UEe extends Hr{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 Vht extends Hr{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e,name:"AbiEventSignatureEmptyTopicsError"})}}class zEe extends Hr{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 a0e extends Hr{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 oS extends Hr{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 HEe extends Hr{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 Wht extends Hr{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 qht extends Hr{constructor(e,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Am(e.abiItem)}\`, and`,`\`${n.type}\` in \`${Am(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let Ght=class extends Hr{constructor({expectedSize:e,givenSize:n}){super(`Expected bytes${e}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class E9 extends Hr{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: (${c$(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 u$ extends Hr{constructor({abiItem:e,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Am(e,{includeName:!0})}".`].join(`
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class Kht extends Hr{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 Yht extends Hr{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 VEe=class extends Hr{constructor(e){super([`Value "${e}" is not a valid array.`].join(`
`),{name:"InvalidArrayError"})}};class Xht extends Hr{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
`),{name:"InvalidDefinitionTypeError"})}}function g1(t){return typeof t[0]=="string"?Im(t):Qht(t)}function Qht(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 Nd=class extends Hr{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"})}},d$=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 gL(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Zht(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function CT(t,...e){if(!Zht(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 Jht(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");gL(t.outputLen),gL(t.blockLen)}function lS(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 WEe(t,e){CT(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const TI=BigInt(2**32-1),o0e=BigInt(32);function ept(t,e=!1){return e?{h:Number(t&TI),l:Number(t>>o0e&TI)}:{h:Number(t>>o0e&TI)|0,l:Number(t&TI)|0}}function tpt(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}=ept(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const npt=(t,e,n)=>t<<n|e>>>32-n,rpt=(t,e,n)=>e<<n|t>>>32-n,spt=(t,e,n)=>e<<n-32|t>>>64-n,ipt=(t,e,n)=>t<<n-32|e>>>64-n,oC=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function apt(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function hV(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function n0(t,e){return t<<32-e|t>>>e}const l0e=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function opt(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function c0e(t){for(let e=0;e<t.length;e++)t[e]=opt(t[e])}typeof Uint8Array.from([]).toHex=="function"&&Uint8Array.fromHex;function lpt(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function f$(t){return typeof t=="string"&&(t=lpt(t)),CT(t),t}function cpt(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];CT(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 qae=class{clone(){return this._cloneInto()}};function qEe(t){const e=r=>t().update(f$(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function upt(t=32){if(oC&&typeof oC.getRandomValues=="function")return oC.getRandomValues(new Uint8Array(t));if(oC&&typeof oC.randomBytes=="function")return Uint8Array.from(oC.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const GEe=[],KEe=[],YEe=[],dpt=BigInt(0),ZA=BigInt(1),fpt=BigInt(2),hpt=BigInt(7),ppt=BigInt(256),mpt=BigInt(113);for(let t=0,e=ZA,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],GEe.push(2*(5*r+n)),KEe.push((t+1)*(t+2)/2%64);let s=dpt;for(let a=0;a<7;a++)e=(e<<ZA^(e>>hpt)*mpt)%ppt,e&fpt&&(s^=ZA<<(ZA<<BigInt(a))-ZA);YEe.push(s)}const[xpt,gpt]=tpt(YEe,!0),u0e=(t,e,n)=>n>32?spt(t,e,n):npt(t,e,n),d0e=(t,e,n)=>n>32?ipt(t,e,n):rpt(t,e,n);function bpt(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=u0e(u,d,1)^n[l],x=d0e(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=KEe[o],c=u0e(s,a,l),u=d0e(s,a,l),d=GEe[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]^=xpt[r],t[1]^=gpt[r]}n.fill(0)}let ypt=class XEe extends qae{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,gL(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=apt(this.state)}keccak(){l0e||c0e(this.state32),bpt(this.state32,this.rounds),l0e||c0e(this.state32),this.posOut=0,this.pos=0}update(e){lS(this);const{blockLen:n,state:r}=this;e=f$(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){lS(this,!1),CT(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 gL(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(WEe(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 XEe(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 vpt=(t,e,n)=>qEe(()=>new ypt(e,t,n)),wpt=vpt(1,136,256/8);function au(t,e){const n=e||"hex",r=wpt(ox(t,{strict:!1})?Jj(t):t);return n==="bytes"?r:pi(r)}const pV=new d$(8192);function h$(t,e){if(pV.has(`${t}.${e}`))return pV.get(`${t}.${e}`);const n=e?`${e}${t.toLowerCase()}`:t.substring(2).toLowerCase(),r=au(x3(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 pV.set(`${t}.${e}`,a),a}function Pc(t,e){if(!dc(t,{strict:!1}))throw new Nd({address:t});return h$(t,e)}const Cpt=/^0x[a-fA-F0-9]{40}$/,mV=new d$(8192);function dc(t,e){const{strict:n=!0}=e??{},r=`${t}.${n}`;if(mV.has(r))return mV.get(r);const s=Cpt.test(t)?t.toLowerCase()===t?!0:n?h$(t)===t:!0:!1;return mV.set(r,s),s}function $3(t,e,n,{strict:r}={}){return ox(t,{strict:!1})?eke(t,e,n,{strict:r}):JEe(t,e,n,{strict:r})}function QEe(t,e){if(typeof e=="number"&&e>0&&e>ul(t)-1)throw new REe({offset:e,position:"start",size:ul(t)})}function ZEe(t,e,n){if(typeof e=="number"&&typeof n=="number"&&ul(t)!==n-e)throw new REe({offset:n,position:"end",size:ul(t)})}function JEe(t,e,n,{strict:r}={}){QEe(t,e);const s=t.slice(e,n);return r&&ZEe(s,e,n),s}function eke(t,e,n,{strict:r}={}){QEe(t,e);const s=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return r&&ZEe(s,e,n),s}const Npt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tke=/^(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 A2(t,e){if(t.length!==e.length)throw new zht({expectedLength:t.length,givenLength:e.length});const n=Spt({params:t,values:e}),r=Kae(n);return r.length===0?"0x":r}function Spt({params:t,values:e}){const n=[];for(let r=0;r<t.length;r++)n.push(Gae({param:t[r],value:e[r]}));return n}function Gae({param:t,value:e}){const n=Yae(t.type);if(n){const[r,s]=n;return Apt(e,{length:r,param:{...t,type:s}})}if(t.type==="tuple")return Ppt(e,{param:t});if(t.type==="address")return jpt(e);if(t.type==="bool")return Ept(e);if(t.type.startsWith("uint")||t.type.startsWith("int")){const r=t.type.startsWith("int"),[,,s="256"]=tke.exec(t.type)??[];return kpt(e,{signed:r,size:Number(s)})}if(t.type.startsWith("bytes"))return _pt(e,{param:t});if(t.type==="string")return Tpt(e);throw new Kht(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Kae(t){let e=0;for(let a=0;a<t.length;a++){const{dynamic:o,encoded:l}=t[a];o?e+=32:e+=ul(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(Gs(e+s,{size:32})),r.push(l),s+=ul(l)):n.push(l)}return g1([...n,...r])}function jpt(t){if(!dc(t))throw new Nd({address:t});return{dynamic:!1,encoded:Dy(t.toLowerCase())}}function Apt(t,{length:e,param:n}){const r=e===null;if(!Array.isArray(t))throw new VEe(t);if(!r&&t.length!==e)throw new $ht({expectedLength:e,givenLength:t.length,type:`${n.type}[${e}]`});let s=!1;const a=[];for(let o=0;o<t.length;o++){const l=Gae({param:n,value:t[o]});l.dynamic&&(s=!0),a.push(l)}if(r||s){const o=Kae(a);if(r){const l=Gs(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?g1([l,o]):l}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:g1(a.map(({encoded:o})=>o))}}function _pt(t,{param:e}){const[,n]=e.type.split("bytes"),r=ul(t);if(!n){let s=t;return r%32!==0&&(s=Dy(s,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:g1([Dy(Gs(r,{size:32})),s])}}if(r!==Number.parseInt(n))throw new Uht({expectedSize:Number.parseInt(n),value:t});return{dynamic:!1,encoded:Dy(t,{dir:"right"})}}function Ept(t){if(typeof t!="boolean")throw new Hr(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Dy(BEe(t))}}function kpt(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 LEe({max:r.toString(),min:s.toString(),signed:e,size:n/8,value:t.toString()})}return{dynamic:!1,encoded:Gs(t,{size:32,signed:e})}}function Tpt(t){const e=aS(t),n=Math.ceil(ul(e)/32),r=[];for(let s=0;s<n;s++)r.push(Dy($3(e,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:g1([Dy(Gs(ul(e),{size:32})),...r])}}function Ppt(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=Gae({param:a,value:t[o]});r.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Kae(r):g1(r.map(({encoded:s})=>s))}}function Yae(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const xV="/docs/contract/encodeDeployData";function Xae(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 Bht({docsPath:xV});if(!("inputs"in s))throw new s0e({docsPath:xV});if(!s.inputs||s.inputs.length===0)throw new s0e({docsPath:xV});const a=A2(s.inputs,n);return Im([r,a])}function Vu(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}class p$ extends Hr{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 gV extends Hr{constructor({docsPath:e,metaMessages:n,type:r}){super(`Account type "${r}" is not supported.`,{docsPath:e,metaMessages:n,name:"AccountTypeNotSupportedError"})}}function Ipt(t){const e=au(`0x${t.substring(4)}`).substring(26);return h$(`0x${e}`)}const Fpt="modulepreload",Opt=function(t){return"/"+t},f0e={},ps=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=Opt(c),c in f0e)return;f0e[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":Fpt,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 Mpt({hash:t,signature:e}){const n=ox(t)?t:pi(t),{secp256k1:r}=await ps(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>gbt);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=h0e(g);return new r.Signature(cd(u),cd(d)).addRecoveryBit(y)}const o=ox(e)?e:pi(e),l=lx(`0x${o.slice(130)}`),c=h0e(l);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function h0e(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 nke({hash:t,signature:e}){return Ipt(await Mpt({hash:t,signature:e}))}class p0e extends Hr{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class rke extends Hr{constructor({length:e,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class Lpt extends Hr{constructor({count:e,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const Rpt={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 Lpt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new rke({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new p0e({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 p0e({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 Qae(t,{recursiveReadLimit:e=8192}={}){const n=Object.create(Rpt);return n.bytes=t,n.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=e,n}function t2(t,e="hex"){const n=ske(t),r=Qae(new Uint8Array(n.length));return n.encode(r),e==="hex"?Xl(r.bytes):r.bytes}function ske(t){return Array.isArray(t)?Dpt(t.map(e=>ske(e))):Bpt(t)}function Dpt(t){const e=t.reduce((s,a)=>s+a.length,0),n=ike(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 Bpt(t){const e=typeof t=="string"?hp(t):t,n=ike(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 ike(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 Hr("Length is too large.")}function $pt(t){const{chainId:e,nonce:n,to:r}=t,s=t.contractAddress??t.address,a=au(Im(["0x05",t2([e?Gs(e):"0x",s,n?Gs(n):"0x"])]));return r==="bytes"?hp(a):a}async function ake(t){const{authorization:e,signature:n}=t;return nke({hash:$pt(e),signature:n??e})}class WJ extends Hr{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 Upt=class extends Hr{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 zpt extends Hr{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 oke extends Hr{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class m$ extends Hr{constructor({chainId:e}){super(typeof e=="number"?`Chain ID "${e}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}function Hpt({chain:t,currentChainId:e}){if(!t)throw new zpt;if(e!==t.id)throw new Upt({chain:t,currentChainId:e})}const Vpt={gwei:9,wei:18},Wpt={ether:-9,wei:9},qpt={ether:-18,gwei:-9};function NT(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 uf(t,e="wei"){return NT(t,Wpt[e])}class o4 extends Hr{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(o4,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(o4,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class U3 extends Hr{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${uf(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(U3,"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 qJ extends Hr{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${uf(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(qJ,"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 GJ extends Hr{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(GJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class KJ extends Hr{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(KJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class YJ extends Hr{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(YJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class XJ extends Hr{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(XJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class QJ extends Hr{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(QJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class ZJ extends Hr{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(ZJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class JJ extends Hr{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(JJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class k9 extends Hr{constructor({cause:e,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${uf(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${uf(r)} gwei`:""}).`].join(`
`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(k9,"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 ST extends Hr{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Zae(t,e="wei"){return NT(t,Vpt[e])}function jT(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 Gpt extends Hr{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 Kpt extends Hr{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class Ypt extends Hr{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",jT(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 Xpt extends Hr{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 Qpt extends Hr{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=jT({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"&&`${Zae(x)} ${((y=s==null?void 0:s.nativeCurrency)==null?void 0:y.symbol)||"ETH"}`,data:a,gas:o,gasPrice:typeof l<"u"&&`${uf(l)} gwei`,maxFeePerGas:typeof c<"u"&&`${uf(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${uf(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 lke extends Hr{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 cke extends Hr{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 Zpt extends Hr{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Lc=(t,e,n)=>JSON.stringify(t,(r,s)=>typeof s=="bigint"?s.toString():s,n),Jpt=t=>t,Jae=t=>t;class T_ extends Hr{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: ${Jae(o)}`,e&&`Request body: ${Lc(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 eoe extends Hr{constructor({body:e,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Jae(r)}`,`Request body: ${Lc(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 m0e extends Hr{constructor({body:e,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Jae(n)}`,`Request body: ${Lc(e)}`],name:"TimeoutError"})}}const emt=-1;let wf=class extends Hr{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 eoe?e.code:n??emt}};class oh extends wf{constructor(e,n){super(e,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class T9 extends wf{constructor(e){super(e,{code:T9.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(T9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class P9 extends wf{constructor(e){super(e,{code:P9.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(P9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class I9 extends wf{constructor(e,{method:n}={}){super(e,{code:I9.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(I9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class F9 extends wf{constructor(e){super(e,{code:F9.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(F9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class z3 extends wf{constructor(e){super(e,{code:z3.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(z3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class H3 extends wf{constructor(e){super(e,{code:H3.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(H3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class O9 extends wf{constructor(e){super(e,{code:O9.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(O9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class By extends wf{constructor(e){super(e,{code:By.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(By,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class M9 extends wf{constructor(e){super(e,{code:M9.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(M9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class mw extends wf{constructor(e,{method:n}={}){super(e,{code:mw.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(mw,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class cS extends wf{constructor(e){super(e,{code:cS.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(cS,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class L9 extends wf{constructor(e){super(e,{code:L9.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(L9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Eo extends oh{constructor(e){super(e,{code:Eo.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class R9 extends oh{constructor(e){super(e,{code:R9.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(R9,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class D9 extends oh{constructor(e,{method:n}={}){super(e,{code:D9.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(D9,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class B9 extends oh{constructor(e){super(e,{code:B9.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(B9,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class $9 extends oh{constructor(e){super(e,{code:$9.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty($9,"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 U9 extends oh{constructor(e){super(e,{code:U9.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(U9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class z9 extends oh{constructor(e){super(e,{code:z9.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(z9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class H9 extends oh{constructor(e){super(e,{code:H9.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(H9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class V9 extends oh{constructor(e){super(e,{code:V9.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(V9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class W9 extends oh{constructor(e){super(e,{code:W9.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(W9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class q9 extends oh{constructor(e){super(e,{code:q9.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(q9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class G9 extends oh{constructor(e){super(e,{code:G9.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(G9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class tmt extends wf{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function x$(t,e){const n=(t.details||"").toLowerCase(),r=t instanceof Hr?t.walk(s=>(s==null?void 0:s.code)===o4.code):t;return r instanceof Hr?new o4({cause:t,message:r.details}):o4.nodeMessage.test(n)?new o4({cause:t,message:t.details}):U3.nodeMessage.test(n)?new U3({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):qJ.nodeMessage.test(n)?new qJ({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):GJ.nodeMessage.test(n)?new GJ({cause:t,nonce:e==null?void 0:e.nonce}):KJ.nodeMessage.test(n)?new KJ({cause:t,nonce:e==null?void 0:e.nonce}):YJ.nodeMessage.test(n)?new YJ({cause:t,nonce:e==null?void 0:e.nonce}):XJ.nodeMessage.test(n)?new XJ({cause:t}):QJ.nodeMessage.test(n)?new QJ({cause:t,gas:e==null?void 0:e.gas}):ZJ.nodeMessage.test(n)?new ZJ({cause:t,gas:e==null?void 0:e.gas}):JJ.nodeMessage.test(n)?new JJ({cause:t}):k9.nodeMessage.test(n)?new k9({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new ST({cause:t})}function nmt(t,{docsPath:e,...n}){const r=(()=>{const s=x$(t,n);return s instanceof ST?t:s})();return new Qpt(r,{docsPath:e,...n})}function g$(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 toe(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 rmt={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function AT(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=smt(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=>Xl(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=Gs(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Gs(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Gs(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Gs(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Gs(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Gs(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=rmt[t.type]),typeof t.value<"u"&&(e.value=Gs(t.value)),e}function smt(t){return t.map(e=>({address:e.address,r:e.r?Gs(BigInt(e.r)):e.r,s:e.s?Gs(BigInt(e.s)):e.s,chainId:Gs(e.chainId),nonce:Gs(e.nonce),...typeof e.yParity<"u"?{yParity:Gs(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Gs(e.v)}:{}}))}function ci(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 b$=2n**256n-1n;function e8(t){const{account:e,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:s,to:a}=t,o=e?Vu(e):void 0;if(o&&!dc(o.address))throw new Nd({address:o.address});if(a&&!dc(a))throw new Nd({address:a});if(typeof n<"u"&&(typeof r<"u"||typeof s<"u"))throw new Gpt;if(r&&r>b$)throw new U3({maxFeePerGas:r});if(s&&r&&s>r)throw new k9({maxFeePerGas:r,maxPriorityFeePerGas:s})}async function noe(t){const e=await t.request({method:"eth_chainId"},{dedupe:!0});return lx(e)}class imt extends Hr{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class roe extends Hr{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class amt extends Hr{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${uf(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class uke extends Hr{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 dke={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function y$(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?lx(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?lx(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?dke[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=lmt(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 omt=toe("transaction",y$);function lmt(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 soe(t){const e=(t.transactions??[]).map(n=>typeof n=="string"?n:y$(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 cmt=toe("block",soe);async function D0(t,{blockHash:e,blockNumber:n,blockTag:r,includeTransactions:s}={}){var d,f,x;const a=r??"latest",o=s??!1,l=n!==void 0?Gs(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 uke({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)||soe)(c)}async function ioe(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function umt(t,e){return fke(t,e)}async function fke(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 ci(t,D0,"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):ci(t,D0,"getBlock")({}),ci(t,ioe,"getGasPrice")({})]);if(typeof l.baseFeePerGas!="bigint")throw new roe;const u=c-l.baseFeePerGas;return u<0n?0n:u}}async function dmt(t,e){return eee(t,e)}async function eee(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 imt;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 ci(t,D0,"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 roe;const y=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await fke(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 ci(t,ioe,"getGasPrice")({}))}}class fmt extends Hr{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=jT({from:n==null?void 0:n.address,to:f,value:typeof x<"u"&&`${Zae(x)} ${((y=s==null?void 0:s.nativeCurrency)==null?void 0:y.symbol)||"ETH"}`,data:a,gas:o,gasPrice:typeof l<"u"&&`${uf(l)} gwei`,maxFeePerGas:typeof c<"u"&&`${uf(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${uf(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 hmt(t,{docsPath:e,...n}){const r=(()=>{const s=x$(t,n);return s instanceof ST?t:s})();return new fmt(r,{docsPath:e,...n})}class pmt extends Hr{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class mmt extends Hr{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function x0e(t){return t.reduce((e,{slot:n,value:r})=>`${e} ${n}: ${r}
`,"")}function xmt(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+=x0e(r.state)),r.stateDiff&&(s+=` stateDiff:
`,s+=x0e(r.stateDiff)),s},` State Override:
`).slice(0,-1)}function g0e(t){if(!(!t||t.length===0))return t.reduce((e,{slot:n,value:r})=>{if(n.length!==66)throw new n0e({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new n0e({size:r.length,targetSize:66,type:"hex"});return e[n]=r,e},{})}function gmt(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=Gs(e)),n!==void 0&&(o.nonce=Gs(n)),r!==void 0&&(o.state=g0e(r)),s!==void 0){if(o.state)throw new mmt;o.stateDiff=g0e(s)}return o}function aoe(t){if(!t)return;const e={};for(const{address:n,...r}of t){if(!dc(n,{strict:!1}))throw new Nd({address:n});if(e[n])throw new pmt({address:n});e[n]=gmt(r)}return e}async function ooe(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n?Gs(n):void 0,a=await t.request({method:"eth_getBalance",params:[e,s||r]});return BigInt(a)}async function loe(t,e){var s,a,o;const{account:n=t.account}=e,r=n?Vu(n):void 0;try{let fe=function(ie){const{block:oe,request:K,rpcStateOverride:H}=ie;return t.request({method:"eth_estimateGas",params:H?[K,oe??"latest",H]:oe?[K,oe]:[K]})};const{accessList:l,authorizationList:c,blobs:u,blobVersionedHashes:d,blockNumber:f,blockTag:x,data:g,gas:y,gasPrice:v,maxFeePerBlobGas:C,maxFeePerGas:S,maxPriorityFeePerGas:T,nonce:I,value:L,stateOverride:F,...$}=await foe(t,{...e,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),U=(f?Gs(f):void 0)||x,Y=aoe(F),re=await(async()=>{if($.to)return $.to;if(c&&c.length>0)return await ake({authorization:c[0]}).catch(()=>{throw new Hr("`to` is required. Could not infer from `authorizationList`")})})();e8(e);const Q=(o=(a=(s=t.chain)==null?void 0:s.formatters)==null?void 0:a.transactionRequest)==null?void 0:o.format,te=(Q||AT)({...g$($,{format:Q}),from:r==null?void 0:r.address,accessList:l,authorizationList:c,blobs:u,blobVersionedHashes:d,data:g,gas:y,gasPrice:v,maxFeePerBlobGas:C,maxFeePerGas:S,maxPriorityFeePerGas:T,nonce:I,to:re,value:L});let G=BigInt(await fe({block:U,request:te,rpcStateOverride:Y}));if(c){const ie=await ooe(t,{address:te.from}),oe=await Promise.all(c.map(async K=>{const{address:H}=K,ee=await fe({block:U,request:{authorizationList:void 0,data:g,from:r==null?void 0:r.address,to:H,value:Gs(ie)},rpcStateOverride:Y}).catch(()=>100000n);return 2n*BigInt(ee)}));G+=oe.reduce((K,H)=>K+H,0n)}return G}catch(l){throw hmt(l,{...e,account:r,chain:t.chain})}}async function hke(t,{address:e,blockTag:n="latest",blockNumber:r}){const s=await t.request({method:"eth_getTransactionCount",params:[e,r?Gs(r):n]},{dedupe:!!r});return lx(s)}function coe(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=>Xl(a))}function uoe(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=>Xl(o))}function bmt(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 ymt(t,e,n){return t&e^~t&n}function vmt(t,e,n){return t&e^t&n^e&n}let wmt=class extends qae{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=hV(this.buffer)}update(e){lS(this);const{view:n,buffer:r,blockLen:s}=this;e=f$(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=hV(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){lS(this),WEe(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;bmt(r,s-8,BigInt(this.length*8),a),this.process(r,0);const l=hV(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 Cmt=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 Nmt=class extends wmt{constructor(e=32){super(64,e,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=n0(x,7)^n0(x,18)^x>>>3,v=n0(g,17)^n0(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=n0(l,6)^n0(l,11)^n0(l,25),g=d+x+ymt(l,c,u)+Cmt[f]+wb[f]|0,v=(n0(r,2)^n0(r,13)^n0(r,22))+vmt(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 pke=qEe(()=>new Nmt);function Smt(t,e){return pke(ox(t,{strict:!1})?Jj(t):t)}function jmt(t){const{commitment:e,version:n=1}=t,r=t.to??(typeof e=="string"?"hex":"bytes"),s=Smt(e);return s.set([n],0),r==="bytes"?s:Xl(s)}function mke(t){const{commitments:e,version:n}=t,r=t.to??(typeof e[0]=="string"?"hex":"bytes"),s=[];for(const a of e)s.push(jmt({commitment:a,to:r,version:n}));return s}const b0e=6,xke=32,doe=4096,gke=xke*doe,y0e=gke*b0e-1-1*doe*b0e,bke=1;class Amt extends Hr{constructor({maxSize:e,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class yke extends Hr{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class _mt extends Hr{constructor({hash:e,size:n}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class Emt extends Hr{constructor({hash:e,version:n}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${bke}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function kmt(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),n=typeof t.data=="string"?hp(t.data):t.data,r=ul(n);if(!r)throw new yke;if(r>y0e)throw new Amt({maxSize:y0e,size:r});const s=[];let a=!0,o=0;for(;a;){const l=Qae(new Uint8Array(gke));let c=0;for(;c<doe;){const u=n.slice(o,o+(xke-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=>Xl(l.bytes))}function vke(t){const{data:e,kzg:n,to:r}=t,s=t.blobs??kmt({data:e,to:r}),a=t.commitments??coe({blobs:s,kzg:n,to:r}),o=t.proofs??uoe({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 wke(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 Ypt({transaction:t})}const Cke=["blobVersionedHashes","chainId","fees","gas","nonce","type"],v0e=new Map;async function foe(t,e){const{account:n=t.account,blobs:r,chain:s,gas:a,kzg:o,nonce:l,nonceManager:c,parameters:u=Cke,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 ci(t,D0,"getBlock")({blockTag:"latest"}),g)}let v;async function C(){return v||(s?s.id:typeof e.chainId<"u"?e.chainId:(v=await ci(t,noe,"getChainId")({}),v))}if(u.includes("nonce")&&typeof l>"u"&&f)if(c){const S=await C();x.nonce=await c.consume({address:f.address,chainId:S,client:t})}else x.nonce=await ci(t,hke,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&o){const S=coe({blobs:r,kzg:o});if(u.includes("blobVersionedHashes")){const T=mke({commitments:S,to:"hex"});x.blobVersionedHashes=T}if(u.includes("sidecars")){const T=uoe({blobs:r,commitments:S,kzg:o}),I=vke({blobs:r,commitments:S,proofs:T,to:"hex"});x.sidecars=I}}if(u.includes("chainId")&&(x.chainId=await C()),(u.includes("fees")||u.includes("type"))&&typeof d>"u")try{x.type=wke(x)}catch{let S=v0e.get(t.uid);if(typeof S>"u"){const T=await y();S=typeof(T==null?void 0:T.baseFeePerGas)=="bigint",v0e.set(t.uid,S)}x.type=S?"eip1559":"legacy"}if(u.includes("fees"))if(x.type!=="legacy"&&x.type!=="eip2930"){if(typeof x.maxFeePerGas>"u"||typeof x.maxPriorityFeePerGas>"u"){const S=await y(),{maxFeePerGas:T,maxPriorityFeePerGas:I}=await eee(t,{block:S,chain:s,request:x});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas<I)throw new amt({maxPriorityFeePerGas:I});x.maxPriorityFeePerGas=I,x.maxFeePerGas=T}}else{if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")throw new roe;if(typeof e.gasPrice>"u"){const S=await y(),{gasPrice:T}=await eee(t,{block:S,chain:s,request:x,type:"legacy"});x.gasPrice=T}}return u.includes("gas")&&typeof a>"u"&&(x.gas=await ci(t,loe,"estimateGas")({...x,account:f&&{address:f.address,type:"json-rpc"}})),e8(x),delete x.parameters,x}async function Nke(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const bV=new d$(128);async function Tmt(t,e){var S,T,I,L;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 p$({docsPath:"/docs/actions/wallet/sendTransaction"});const C=n?Vu(n):null;try{e8(e);const F=await(async()=>{if(e.to)return e.to;if(e.to!==null&&a&&a.length>0)return await ake({authorization:a[0]}).catch(()=>{throw new Hr("`to` is required. Could not infer from `authorizationList`.")})})();if((C==null?void 0:C.type)==="json-rpc"||C===null){let $;r!==null&&($=await ci(t,noe,"getChainId")({}),Hpt({currentChainId:$,chain:r}));const O=(I=(T=(S=t.chain)==null?void 0:S.formatters)==null?void 0:T.transactionRequest)==null?void 0:I.format,Y=(O||AT)({...g$(v,{format:O}),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}),re=bV.get(t.uid),Q=re?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:Q,params:[Y]},{retryCount:0})}catch(q){if(re===!1)throw q;const te=q;if(te.name==="InvalidInputRpcError"||te.name==="InvalidParamsRpcError"||te.name==="MethodNotFoundRpcError"||te.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[Y]},{retryCount:0}).then(fe=>(bV.set(t.uid,!0),fe)).catch(fe=>{const G=fe;throw G.name==="MethodNotFoundRpcError"||G.name==="MethodNotSupportedRpcError"?(bV.set(t.uid,!1),te):G});throw te}}if((C==null?void 0:C.type)==="local"){const $=await ci(t,foe,"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:[...Cke,"sidecars"],value:y,...v,to:F}),O=(L=r==null?void 0:r.serializers)==null?void 0:L.transaction,U=await C.signTransaction($,{serializer:O});return await ci(t,Nke,"sendRawTransaction")({serializedTransaction:U})}throw(C==null?void 0:C.type)==="smart"?new gV({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new gV({docsPath:"/docs/actions/wallet/sendTransaction",type:C==null?void 0:C.type})}catch(F){throw F instanceof gV?F:nmt(F,{...e,account:C,chain:e.chain||void 0})}}const tee=[{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"}],nee=[{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"}]}],Ske=[{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"}],jke=[...Ske,{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"}]}],Pmt=[...Ske,{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"}]}],w0e=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],C0e=[{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"}]}],N0e=[{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 Imt(t,e={}){typeof e.size<"u"&&Cp(t,{size:e.size});const n=Xl(t,e);return cd(n,e)}function Fmt(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 _ht(n);return!!n[0]}function r1(t,e={}){typeof e.size<"u"&&Cp(t,{size:e.size});const n=Xl(t,e);return lx(n,e)}function Omt(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 _T(t,e){const n=typeof e=="string"?hp(e):e,r=Qae(n);if(ul(n)===0&&t.length>0)throw new wT;if(ul(e)&&ul(e)<32)throw new $Ee({data:typeof e=="string"?e:Xl(e),params:t,size:ul(e)});let s=0;const a=[];for(let o=0;o<t.length;++o){const l=t[o];r.setPosition(s);const[c,u]=_4(r,l,{staticPosition:0});s+=u,a.push(c)}return a}function _4(t,e,{staticPosition:n}){const r=Yae(e.type);if(r){const[s,a]=r;return Lmt(t,{...e,type:a},{length:s,staticPosition:n})}if(e.type==="tuple")return $mt(t,e,{staticPosition:n});if(e.type==="address")return Mmt(t);if(e.type==="bool")return Rmt(t);if(e.type.startsWith("bytes"))return Dmt(t,e,{staticPosition:n});if(e.type.startsWith("uint")||e.type.startsWith("int"))return Bmt(t,e);if(e.type==="string")return Umt(t,{staticPosition:n});throw new Yht(e.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const S0e=32,ree=32;function Mmt(t){const e=t.readBytes(32);return[h$(Xl(JEe(e,-20))),32]}function Lmt(t,e,{length:n,staticPosition:r}){if(!n){const o=r1(t.readBytes(ree)),l=r+o,c=l+S0e;t.setPosition(l);const u=r1(t.readBytes(S0e)),d=K9(e);let f=0;const x=[];for(let g=0;g<u;++g){t.setPosition(c+(d?g*32:f));const[y,v]=_4(t,e,{staticPosition:c});f+=v,x.push(y)}return t.setPosition(r+32),[x,32]}if(K9(e)){const o=r1(t.readBytes(ree)),l=r+o,c=[];for(let u=0;u<n;++u){t.setPosition(l+u*32);const[d]=_4(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]=_4(t,e,{staticPosition:r+s});s+=c,a.push(l)}return[a,s]}function Rmt(t){return[Fmt(t.readBytes(32),{size:32}),32]}function Dmt(t,e,{staticPosition:n}){const[r,s]=e.type.split("bytes");if(!s){const o=r1(t.readBytes(32));t.setPosition(n+o);const l=r1(t.readBytes(32));if(l===0)return t.setPosition(n+32),["0x",32];const c=t.readBytes(l);return t.setPosition(n+32),[Xl(c),32]}return[Xl(t.readBytes(Number.parseInt(s),32)),32]}function Bmt(t,e){const n=e.type.startsWith("int"),r=Number.parseInt(e.type.split("int")[1]||"256"),s=t.readBytes(32);return[r>48?Imt(s,{signed:n}):r1(s,{signed:n}),32]}function $mt(t,e,{staticPosition:n}){const r=e.components.length===0||e.components.some(({name:o})=>!o),s=r?[]:{};let a=0;if(K9(e)){const o=r1(t.readBytes(ree)),l=n+o;for(let c=0;c<e.components.length;++c){const u=e.components[c];t.setPosition(l+a);const[d,f]=_4(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]=_4(t,l,{staticPosition:n});s[r?o:l==null?void 0:l.name]=c,a+=u}return[s,a]}function Umt(t,{staticPosition:e}){const n=r1(t.readBytes(32)),r=e+n;t.setPosition(r);const s=r1(t.readBytes(32));if(s===0)return t.setPosition(e+32),["",32];const a=t.readBytes(s,32),o=Omt(Jf(a));return t.setPosition(e+32),[o,32]}function K9(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(K9);const n=Yae(t.type);return!!(n&&K9({...t,type:n[1]}))}const zmt=t=>au(Jj(t));function Hmt(t){return zmt(t)}const Vmt="1.0.8";let lh=class see extends Error{constructor(e,n={}){var o;const r=n.cause instanceof see?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof see&&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@${Vmt}`].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 L1(t,e){const n=t.exec(e);return n==null?void 0:n.groups}const Ake=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,_ke=/^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)?$/,Eke=/^\(.+?\).*?$/,j0e=/^tuple(?<array>(\[(\d*)\])*)$/;function iee(t){let e=t.type;if(j0e.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+=iee(a),s<n-1&&(e+=", ")}const r=L1(j0e,t.type);return e+=`)${(r==null?void 0:r.array)??""}`,iee({...t,type:e})}return"indexed"in t&&t.indexed&&(e=`${e} indexed`),t.name?`${e} ${t.name}`:e}function JA(t){let e="";const n=t.length;for(let r=0;r<n;r++){const s=t[r];e+=iee(s),r!==n-1&&(e+=", ")}return e}function bL(t){var e;return t.type==="function"?`function ${t.name}(${JA(t.inputs)})${t.stateMutability&&t.stateMutability!=="nonpayable"?` ${t.stateMutability}`:""}${(e=t.outputs)!=null&&e.length?` returns (${JA(t.outputs)})`:""}`:t.type==="event"?`event ${t.name}(${JA(t.inputs)})`:t.type==="error"?`error ${t.name}(${JA(t.inputs)})`:t.type==="constructor"?`constructor(${JA(t.inputs)})${t.stateMutability==="payable"?" payable":""}`:t.type==="fallback"?`fallback() external${t.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const kke=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Wmt(t){return kke.test(t)}function qmt(t){return L1(kke,t)}const Tke=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Gmt(t){return Tke.test(t)}function Kmt(t){return L1(Tke,t)}const Pke=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Ymt(t){return Pke.test(t)}function Xmt(t){return L1(Pke,t)}const Ike=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function hoe(t){return Ike.test(t)}function Qmt(t){return L1(Ike,t)}const Fke=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Zmt(t){return Fke.test(t)}function Jmt(t){return L1(Fke,t)}const Oke=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function e0t(t){return Oke.test(t)}function t0t(t){return L1(Oke,t)}const n0t=/^receive\(\) external payable$/;function r0t(t){return n0t.test(t)}const s0t=new Set(["indexed"]),aee=new Set(["calldata","memory","storage"]);class i0t 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 a0t 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 o0t 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 l0t extends lh{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class c0t 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 u0t 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 d0t 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 f0t 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 t8=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 h0t extends lh{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class p0t 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 m0t 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 x0t 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 g0t(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 yV=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 oee(t,e={}){if(Ymt(t))return b0t(t,e);if(Gmt(t))return y0t(t,e);if(Wmt(t))return v0t(t,e);if(Zmt(t))return w0t(t,e);if(e0t(t))return C0t(t);if(r0t(t))return{type:"receive",stateMutability:"payable"};throw new h0t({signature:t})}function b0t(t,e={}){const n=Xmt(t);if(!n)throw new t8({signature:t,type:"function"});const r=dm(n.parameters),s=[],a=r.length;for(let l=0;l<a;l++)s.push(V3(r[l],{modifiers:aee,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(V3(l[u],{modifiers:aee,structs:e,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function y0t(t,e={}){const n=Kmt(t);if(!n)throw new t8({signature:t,type:"event"});const r=dm(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(V3(r[o],{modifiers:s0t,structs:e,type:"event"}));return{name:n.name,type:"event",inputs:s}}function v0t(t,e={}){const n=qmt(t);if(!n)throw new t8({signature:t,type:"error"});const r=dm(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(V3(r[o],{structs:e,type:"error"}));return{name:n.name,type:"error",inputs:s}}function w0t(t,e={}){const n=Jmt(t);if(!n)throw new t8({signature:t,type:"constructor"});const r=dm(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(V3(r[o],{structs:e,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function C0t(t){const e=t0t(t);if(!e)throw new t8({signature:t,type:"fallback"});return{type:"fallback",stateMutability:e.stateMutability??"nonpayable"}}const N0t=/^(?<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$_]*))?$/,S0t=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,j0t=/^u?int$/;function V3(t,e){var f,x;const n=g0t(t,e==null?void 0:e.type,e==null?void 0:e.structs);if(yV.has(n))return yV.get(n);const r=Eke.test(t),s=L1(r?S0t:N0t,t);if(!s)throw new l0t({param:t});if(s.name&&_0t(s.name))throw new c0t({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(V3(g[C],{structs:l}));u={components:y}}else if(s.type in l)c="tuple",u={components:l[s.type]};else if(j0t.test(s.type))c=`${s.type}256`;else if(c=s.type,(e==null?void 0:e.type)!=="struct"&&!Mke(c))throw new o0t({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 u0t({param:t,type:e==null?void 0:e.type,modifier:s.modifier});if(aee.has(s.modifier)&&!E0t(c,!!s.array))throw new d0t({param:t,type:e==null?void 0:e.type,modifier:s.modifier})}const d={type:`${c}${s.array??""}`,...a,...o,...u};return yV.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 x0t({current:n,depth:r});return e.push(n.trim()),e}function Mke(t){return t==="address"||t==="bool"||t==="function"||t==="string"||Ake.test(t)||_ke.test(t)}const A0t=/^(?: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 _0t(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||Ake.test(t)||_ke.test(t)||A0t.test(t)}function E0t(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function Lke(t){const e={},n=t.length;for(let o=0;o<n;o++){const l=t[o];if(!hoe(l))continue;const c=Qmt(l);if(!c)throw new t8({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=V3(y,{type:"struct"});d.push(v)}if(!d.length)throw new p0t({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]=Rke(c,e)}return r}const k0t=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Rke(t,e,n=new Set){const r=[],s=t.length;for(let a=0;a<s;a++){const o=t[a];if(Eke.test(o.type))r.push(o);else{const c=L1(k0t,o.type);if(!(c!=null&&c.type))throw new f0t({abiParameter:o});const{array:u,type:d}=c;if(d in e){if(n.has(d))throw new m0t({type:d});r.push({...o,type:`tuple${u??""}`,components:Rke(e[d]??[],e,new Set([...n,d]))})}else if(Mke(d))r.push(o);else throw new a0t({type:d})}}return r}function Dke(t){const e=Lke(t),n=[],r=t.length;for(let s=0;s<r;s++){const a=t[s];hoe(a)||n.push(oee(a,e))}return n}function A0e(t){let e;if(typeof t=="string")e=oee(t);else{const n=Lke(t),r=t.length;for(let s=0;s<r;s++){const a=t[s];if(!hoe(a)){e=oee(a,n);break}}}if(!e)throw new i0t({signature:t});return e}function T0t(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 Hr("Unable to normalize signature.");return s}const P0t=t=>{const e=typeof t=="string"?t:bL(t);return T0t(e)};function Bke(t){return Hmt(P0t(t))}const v$=Bke,ET=t=>$3(Bke(t),0,4);function T5(t){const{abi:e,args:n=[],name:r}=t,s=ox(r,{strict:!1}),a=e.filter(l=>s?l.type==="function"?ET(l)===r:l.type==="event"?v$(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?lee(u,f):!1})){if(o&&"inputs"in o&&o.inputs){const u=$ke(l.inputs,o.inputs,n);if(u)throw new qht({abiItem:l,type:u[0]},{abiItem:o,type:u[1]})}o=l}}return o||a[0]}function lee(t,e){const n=typeof t,r=e.type;switch(r){case"address":return dc(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)=>lee(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=>lee(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function $ke(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 $ke(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")?dc(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?dc(n[r],{strict:!1}):!1)return o}}const vV="/docs/contract/decodeFunctionResult";function P5(t){const{abi:e,args:n,functionName:r,data:s}=t;let a=e[0];if(r){const l=T5({abi:e,args:n,name:r});if(!l)throw new oS(r,{docsPath:vV});a=l}if(a.type!=="function")throw new oS(void 0,{docsPath:vV});if(!a.outputs)throw new HEe(a.name,{docsPath:vV});const o=_T(a.outputs,s);if(o.length>1)return o;if(o.length===1)return o[0]}const _0e="/docs/contract/encodeFunctionData";function I0t(t){const{abi:e,args:n,functionName:r}=t;let s=e[0];if(r){const a=T5({abi:e,args:n,name:r});if(!a)throw new oS(r,{docsPath:_0e});s=a}if(s.type!=="function")throw new oS(void 0,{docsPath:_0e});return{abi:[s],functionName:ET(Am(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:I0t(t)})(),s=n[0],a=r,o="inputs"in s&&s.inputs?A2(s.inputs,e??[]):void 0;return Im([a,o??"0x"])}function n8({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 WJ({chain:e,contract:{name:n}});if(t&&r.blockCreated&&r.blockCreated>t)throw new WJ({blockNumber:t,chain:e,contract:{name:n,blockCreated:r.blockCreated}});return r.address}const Uke={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."},zke={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},F0t={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function O0t(t){const{abi:e,data:n}=t,r=$3(n,0,4);if(r==="0x")throw new wT;const a=[...e||[],zke,F0t].find(o=>o.type==="error"&&r===ET(Am(o)));if(!a)throw new UEe(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:a,args:"inputs"in a&&a.inputs&&a.inputs.length>0?_T(a.inputs,$3(n,4)):void 0,errorName:a.name}}function Hke({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"?Lc(e[a]):e[a]}`).join(", ")})`}class Vke extends Hr{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=jT({from:y==null?void 0:y.address,to:f,value:typeof x<"u"&&`${Zae(x)} ${((C=s==null?void 0:s.nativeCurrency)==null?void 0:C.symbol)||"ETH"}`,data:a,gas:o,gasPrice:typeof l<"u"&&`${uf(l)} gwei`,maxFeePerGas:typeof c<"u"&&`${uf(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${uf(u)} gwei`,nonce:d});g&&(v+=`
${xmt(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 Wke extends Hr{constructor(e,{abi:n,args:r,contractAddress:s,docsPath:a,functionName:o,sender:l}){const c=T5({abi:n,args:r,name:o}),u=c?Hke({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=c?Am(c,{includeName:!0}):void 0,f=jT({address:s&&Jpt(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 cee extends Hr{constructor({abi:e,data:n,functionName:r,message:s}){let a,o,l,c;if(n&&n!=="0x")try{o=O0t({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=Uke[g]}else{const g=d?Am(d,{includeName:!0}):void 0,y=d&&x?Hke({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 UEe&&(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 M0t extends Hr{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 L0t extends Hr{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 w$ extends Hr{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 poe(t,e){var r,s,a,o,l,c;if(!(t instanceof Hr))return!1;const n=t.walk(u=>u instanceof cee);return n instanceof cee?!!(((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===Uke[50]):!1}function R0t(t){const{abi:e,data:n}=t,r=$3(n,0,4),s=e.find(a=>a.type==="function"&&r===ET(Am(a)));if(!s)throw new Wht(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?_T(s.inputs,$3(n,4)):void 0}}const wV="/docs/contract/encodeErrorResult";function E0e(t){const{abi:e,errorName:n,args:r}=t;let s=e[0];if(n){const c=T5({abi:e,args:r,name:n});if(!c)throw new i0e(n,{docsPath:wV});s=c}if(s.type!=="error")throw new i0e(void 0,{docsPath:wV});const a=Am(s),o=ET(a);let l="0x";if(r&&r.length>0){if(!s.inputs)throw new Hht(s.name,{docsPath:wV});l=A2(s.inputs,r)}return Im([o,l])}const CV="/docs/contract/encodeFunctionResult";function D0t(t){const{abi:e,functionName:n,result:r}=t;let s=e[0];if(n){const o=T5({abi:e,name:n});if(!o)throw new oS(n,{docsPath:CV});s=o}if(s.type!=="function")throw new oS(void 0,{docsPath:CV});if(!s.outputs)throw new HEe(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 VEe(r)})();return A2(s.outputs,a)}const qke="x-batch-gateway:true";async function B4n(t){const{data:e,ccipRequest:n}=t,{args:[r]}=R0t({abi:nee,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]=B0t(c)}})),D0t({abi:nee,functionName:"query",result:[s,a]})}function B0t(t){return t.name==="HttpRequestError"&&t.status?E0e({abi:nee,errorName:"HttpError",args:[t.status,t.shortMessage]}):E0e({abi:[zke],errorName:"Error",args:["shortMessage"in t?t.shortMessage:t.message]})}function Gke(t){if(t.length!==66||t.indexOf("[")!==0||t.indexOf("]")!==65)return null;const e=`0x${t.slice(1,65)}`;return ox(e)?e:null}function WO(t){let e=new Uint8Array(32).fill(0);if(!t)return Xl(e);const n=t.split(".");for(let r=n.length-1;r>=0;r-=1){const s=Gke(n[r]),a=s?Jj(s):au(x3(n[r]),"bytes");e=au(g1([e,a]),"bytes")}return Xl(e)}function $0t(t){return`[${t.slice(2)}]`}function U0t(t){const e=new Uint8Array(32).fill(0);return t?Gke(t)||au(x3(t)):Xl(e)}function C$(t){const e=t.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const n=new Uint8Array(x3(e).byteLength+2);let r=0;const s=e.split(".");for(let a=0;a<s.length;a++){let o=x3(s[a]);o.byteLength>255&&(o=x3($0t(U0t(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 z0t=3;function W3(t,{abi:e,address:n,args:r,docsPath:s,functionName:a,sender:o}){const l=t instanceof w$?t:t instanceof Hr?t.walk(y=>"data"in y)||t.walk():{},{code:c,data:u,details:d,message:f,shortMessage:x}=l,g=t instanceof wT?new M0t({functionName:a}):[z0t,z3.code].includes(c)&&(u||d||f||x)?new cee({abi:e,data:typeof u=="object"?u.data:u,functionName:a,message:l instanceof eoe?d:x??f}):t;return new Wke(g,{abi:e,args:r,contractAddress:n,docsPath:s,functionName:a,sender:o})}const H0t="0x82ad56cb",Kke="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",V0t="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",W0t="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";function Yke(t,{docsPath:e,...n}){const r=(()=>{const s=x$(t,n);return s instanceof ST?t:s})();return new Vke(r,{docsPath:e,...n})}function Xke(){let t=()=>{},e=()=>{};return{promise:new Promise((r,s)=>{t=r,e=s}),resolve:t,reject:e}}const NV=new Map;function Qke({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=()=>NV.delete(e),l=()=>c().map(({args:d})=>d),c=()=>NV.get(e)||[],u=d=>NV.set(e,[...c(),d]);return{flush:o,async schedule(d){const{promise:f,resolve:x,reject:g}=Xke();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 N$(t,e){var Q,q,te,fe;const{account:n=t.account,batch:r=!!((Q=t.batch)!=null&&Q.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:S,to:T,value:I,stateOverride:L,...F}=e,$=n?Vu(n):void 0;if(c&&(d||f))throw new Hr("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(c&&T)throw new Hr("Cannot provide both `code` & `to` as parameters.");const O=c&&u,U=d&&f&&T&&u,Y=O||U,re=O?K0t({code:c,data:u}):U?Y0t({data:u,factory:d,factoryData:f,to:T}):u;try{e8(e);const ie=(s?Gs(s):void 0)||a,oe=aoe(L),K=(fe=(te=(q=t.chain)==null?void 0:q.formatters)==null?void 0:te.transactionRequest)==null?void 0:fe.format,ee=(K||AT)({...g$(F,{format:K}),from:$==null?void 0:$.address,accessList:o,blobs:l,data:re,gas:x,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:v,maxPriorityFeePerGas:C,nonce:S,to:Y?void 0:T,value:I});if(r&&q0t({request:ee})&&!oe)try{return await G0t(t,{...ee,blockNumber:s,blockTag:a})}catch(pe){if(!(pe instanceof oke)&&!(pe instanceof WJ))throw pe}const se=await t.request({method:"eth_call",params:oe?[ee,ie,oe]:[ee,ie]});return se==="0x"?{data:void 0}:{data:se}}catch(G){const ie=X0t(G),{offchainLookup:oe,offchainLookupSignature:K}=await ps(async()=>{const{offchainLookup:H,offchainLookupSignature:ee}=await import("./ccip-B7Cal6dF.js");return{offchainLookup:H,offchainLookupSignature:ee}},[]);if(t.ccipRead!==!1&&(ie==null?void 0:ie.slice(0,10))===K&&T)return{data:await oe(t,{data:ie,to:T})};throw Y&&(ie==null?void 0:ie.slice(0,10))==="0x101bb98d"?new L0t({factory:d}):Yke(G,{...e,account:$,chain:t.chain})}}function q0t({request:t}){const{data:e,to:n,...r}=t;return!(!e||e.startsWith(H0t)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function G0t(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 oke;u=n8({blockNumber:s,chain:t.chain,contract:"multicall3"})}const f=(s?Gs(s):void 0)||a,{schedule:x}=Qke({id:`${t.uid}.${f}`,wait:r,shouldSplitBatch(C){return C.reduce((T,{data:I})=>T+(I.length-2),0)>n*2},fn:async C=>{const S=C.map(L=>({allowFailure:!0,callData:L.data,target:L.to})),T=Fm({abi:tee,args:[S],functionName:"aggregate3"}),I=await t.request({method:"eth_call",params:[{data:T,to:u},f]});return P5({abi:tee,args:[S],functionName:"aggregate3",data:I||"0x"})}}),[{returnData:g,success:y}]=await x({data:o,to:c});if(!y)throw new w$({data:g});return g==="0x"?{data:void 0}:{data:g}}function K0t(t){const{code:e,data:n}=t;return Xae({abi:Dke(["constructor(bytes, bytes)"]),bytecode:Kke,args:[e,n]})}function Y0t(t){const{data:e,factory:n,factoryData:r,to:s}=t;return Xae({abi:Dke(["constructor(address, bytes, address, bytes)"]),bytecode:V0t,args:[s,e,n,r]})}function X0t(t){var n;if(!(t instanceof Hr))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 cx(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 ci(t,N$,"call")({...o,data:l,to:r});return P5({abi:n,args:s,functionName:a,data:c||"0x"})}catch(c){throw W3(c,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:a})}}async function Q0t(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 n8({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:C0e,functionName:"addr",...s!=null?{args:[WO(a),BigInt(s)]}:{args:[WO(a)]}}),x={address:u,abi:jke,functionName:"resolve",args:[pi(C$(a)),f,o??[qke]],blockNumber:n,blockTag:r},y=await ci(t,cx,"readContract")(x);if(y[0]==="0x")return null;const v=P5({abi:C0e,args:s!=null?[WO(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(poe(f,"resolve"))return null;throw f}}class Z0t extends Hr{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 e7 extends Hr{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`,{name:"EnsAvatarInvalidNftUriError"})}}class moe extends Hr{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 J0t extends Hr{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const ext=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,txt=/^(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>\/.*)?$/,nxt=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,rxt=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function sxt(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 k0e(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function Zke({uri:t,gatewayUrls:e}){const n=nxt.test(t);if(n)return{uri:t,isOnChain:!0,isEncoded:n};const r=k0e(e==null?void 0:e.ipfs,"https://ipfs.io"),s=k0e(e==null?void 0:e.arweave,"https://arweave.net"),a=t.match(ext),{protocol:o,subpath:l,target:c,subtarget:u=""}=(a==null?void 0:a.groups)||{},d=o==="ipns:/"||l==="ipns/",f=o==="ipfs:/"||l==="ipfs/"||txt.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(rxt,"");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 moe({uri:t})}function Jke(t){if(typeof t!="object"||!("image"in t)&&!("image_url"in t)&&!("image_data"in t))throw new Z0t({data:t});return t.image||t.image_url||t.image_data}async function ixt({gatewayUrls:t,uri:e}){try{const n=await fetch(e).then(s=>s.json());return await xoe({gatewayUrls:t,uri:Jke(n)})}catch{throw new moe({uri:e})}}async function xoe({gatewayUrls:t,uri:e}){const{uri:n,isOnChain:r}=Zke({uri:e,gatewayUrls:t});if(r||await sxt(n))return n;throw new moe({uri:e})}function axt(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 e7({reason:"Only EIP-155 supported"});if(!o)throw new e7({reason:"Chain ID not found"});if(!c)throw new e7({reason:"Contract address not found"});if(!s)throw new e7({reason:"Token ID not found"});if(!l)throw new e7({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o),namespace:l.toLowerCase(),contractAddress:c,tokenID:s}}async function oxt(t,{nft:e}){if(e.namespace==="erc721")return cx(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 cx(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 J0t({namespace:e.namespace})}async function lxt(t,{gatewayUrls:e,record:n}){return/eip155:/i.test(n)?cxt(t,{gatewayUrls:e,record:n}):xoe({uri:n,gatewayUrls:e})}async function cxt(t,{gatewayUrls:e,record:n}){const r=axt(n),s=await oxt(t,{nft:r}),{uri:a,isOnChain:o,isEncoded:l}=Zke({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 xoe({uri:Jke(d),gatewayUrls:e})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),ixt({gatewayUrls:e,uri:a.replace(/(?:0x)?{id}/,c)})}async function eTe(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 n8({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:jke,functionName:"resolve",args:[pi(C$(a)),Fm({abi:w0e,functionName:"text",args:[WO(a),s]}),o??[qke]],blockNumber:n,blockTag:r},g=await ci(t,cx,"readContract")(f);if(g[0]==="0x")return null;const y=P5({abi:w0e,functionName:"text",data:g[0]});return y===""?null:y}catch(f){if(l)throw f;if(poe(f,"resolve"))return null;throw f}}async function tTe(t,{blockNumber:e,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:a,strict:o,universalResolverAddress:l}){const c=await ci(t,eTe,"getEnsText")({blockNumber:e,blockTag:n,key:"avatar",name:s,universalResolverAddress:l,gatewayUrls:a,strict:o});if(!c)return null;try{return await lxt(t,{record:c,gatewayUrls:r})}catch{return null}}async function nTe(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=n8({blockNumber:n,chain:t.chain,contract:"ensUniversalResolver"})}const c=`${e.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:l,abi:Pmt,functionName:"reverse",args:[pi(C$(c))],blockNumber:n,blockTag:r},d=ci(t,cx,"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(poe(u,"reverse"))return null;throw u}}async function uxt(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 n8({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 ci(t,cx,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[pi(C$(s))],blockNumber:n,blockTag:r});return c}async function rTe(t,e){var C,S,T;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{e8(e);const L=(r?Gs(r):void 0)||s,F=(T=(S=(C=t.chain)==null?void 0:C.formatters)==null?void 0:S.transactionRequest)==null?void 0:T.format,O=(F||AT)({...g$(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}),U=await t.request({method:"eth_createAccessList",params:[O,L]});return{accessList:U.accessList,gasUsed:BigInt(U.gasUsed)}}catch(I){throw Yke(I,{...e,account:v,chain:t.chain})}}function S$(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 dxt(t){const e=S$(t,{method:"eth_newBlockFilter"}),n=await t.request({method:"eth_newBlockFilter"});return{id:n,request:e(n),type:"block"}}class fxt extends Hr{constructor(e){super(`Filter type "${e}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}const T0e="/docs/contract/encodeEventTopics";function kT(t){var c;const{abi:e,eventName:n,args:r}=t;let s=e[0];if(n){const u=T5({abi:e,name:n});if(!u)throw new a0e(n,{docsPath:T0e});s=u}if(s.type!=="event")throw new a0e(void 0,{docsPath:T0e});const a=Am(s),o=v$(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)=>P0e({param:f,value:d[x][y]})):typeof d[x]<"u"&&d[x]!==null?P0e({param:f,value:d[x]}):null))??[])}return[o,...l]}function P0e({param:t,value:e}){if(t.type==="string"||t.type==="bytes")return au(Jj(e));if(t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/))throw new fxt(t.type);return A2([t],[e])}async function sTe(t,e){const{address:n,abi:r,args:s,eventName:a,fromBlock:o,strict:l,toBlock:c}=e,u=S$(t,{method:"eth_newFilter"}),d=a?kT({abi:r,args:s,eventName:a}):void 0,f=await t.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof o=="bigint"?Gs(o):o,toBlock:typeof c=="bigint"?Gs(c):c,topics:d}]});return{abi:r,args:s,eventName:a,id:f,request:u(f),strict:!!l,type:"event"}}async function iTe(t,{address:e,args:n,event:r,events:s,fromBlock:a,strict:o,toBlock:l}={}){const c=s??(r?[r]:void 0),u=S$(t,{method:"eth_newFilter"});let d=[];c&&(d=[c.flatMap(g=>kT({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"?Gs(a):a,toBlock:typeof l=="bigint"?Gs(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 aTe(t){const e=S$(t,{method:"eth_newPendingTransactionFilter"}),n=await t.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:e(n),type:"transaction"}}async function hxt(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 ci(t,loe,"estimateGas")({data:`${c}${o?o.replace("0x",""):""}`,to:r,...l})}catch(u){const d=l.account?Vu(l.account):void 0;throw W3(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:a,sender:d==null?void 0:d.address})}}async function pxt(t){const e=await t.request({method:"eth_blobBaseFee"});return BigInt(e)}const mxt=new Map,xxt=new Map;function gxt(t){const e=(s,a)=>({clear:()=>a.delete(s),get:()=>a.get(s),set:o=>a.set(s,o)}),n=e(t,mxt),r=e(t,xxt);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function bxt(t,{cacheKey:e,cacheTime:n=Number.POSITIVE_INFINITY}){const r=gxt(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 yxt=t=>`blockNumber.${t}`;async function TT(t,{cacheTime:e=t.cacheTime}={}){const n=await bxt(()=>t.request({method:"eth_blockNumber"}),{cacheKey:yxt(t.uid),cacheTime:e});return BigInt(n)}async function vxt(t,{blockHash:e,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?Gs(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}),lx(a)}async function I0e(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?Gs(n):void 0,a=await t.request({method:"eth_getCode",params:[e,s||r]},{dedupe:!!s});if(a!=="0x")return a}function goe(t,e){if(!dc(t,{strict:!1}))throw new Nd({address:t});if(!dc(e,{strict:!1}))throw new Nd({address:e});return t.toLowerCase()===e.toLowerCase()}const F0e="/docs/contract/decodeEventLog";function boe(t){const{abi:e,data:n,strict:r,topics:s}=t,a=r??!0,[o,...l]=s;if(!o)throw new Vht({docsPath:F0e});const c=e.length===1?e[0]:e.find(v=>v.type==="event"&&o===v$(Am(v)));if(!(c&&"name"in c)||c.type!=="event")throw new zEe(o,{docsPath:F0e});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],S=l[v];if(!S)throw new u$({abiItem:c,param:C});x[f?v:C.name||v]=wxt({param:C,value:S})}const y=d.filter(v=>!("indexed"in v&&v.indexed));if(y.length>0){if(n&&n!=="0x")try{const v=_T(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 $Ee||v instanceof rke?new E9({abiItem:c,data:n,params:y,size:ul(n)}):v}else if(a)throw new E9({abiItem:c,data:"0x",params:y,size:0})}return{eventName:u,args:Object.values(x).length>0?x:void 0}}function wxt({param:t,value:e}){return t.type==="string"||t.type==="bytes"||t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/)?e:_T([t],e)[0]}function yoe(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]===v$(d));if(!c)return null;const u=boe({...o,abi:[c],strict:s});return a&&!a.includes(u.eventName)||!Cxt({args:u.args,inputs:c.inputs,matchArgs:n})?null:{...u,...o}}catch(c){let u,d;if(c instanceof zEe)return null;if(c instanceof E9||c instanceof u$){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 Cxt(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"?goe(o,l):a.type==="string"||a.type==="bytes"?au(Jj(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 b1(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 voe(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=>kT({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"?Gs(r):r,toBlock:typeof s=="bigint"?Gs(s):s}]});const g=x.map(y=>b1(y));return d?yoe({abi:d,args:l,logs:g,strict:u}):g}async function oTe(t,e){const{abi:n,address:r,args:s,blockHash:a,eventName:o,fromBlock:l,toBlock:c,strict:u}=e,d=o?T5({abi:n,name:o}):void 0,f=d?void 0:n.filter(x=>x.type==="event");return ci(t,voe,"getLogs")({address:r,args:s,blockHash:a,event:d,events:f,fromBlock:l,toBlock:c,strict:u})}class Nxt extends Hr{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 Sxt(t,e){const{address:n,factory:r,factoryData:s}=e;try{const[a,o,l,c,u,d,f]=await ci(t,cx,"readContract")({abi:jxt,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 Nxt({address:n}):o}}const jxt=[{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 Axt(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 _xt(t,{blockCount:e,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const a=n?Gs(n):void 0,o=await t.request({method:"eth_feeHistory",params:[Gs(e),a||r,s]},{dedupe:!!a});return Axt(o)}async function j$(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=>b1(a));return!("abi"in e)||!e.abi?s:yoe({abi:e.abi,logs:s,strict:n})}async function Ext(t,{filter:e}){const n=e.strict??!1,s=(await e.request({method:"eth_getFilterLogs",params:[e.id]})).map(a=>b1(a));return e.abi?yoe({abi:e.abi,logs:s,strict:n}):s}async function kxt(t,{address:e,blockNumber:n,blockTag:r="latest",slot:s}){const a=n!==void 0?Gs(n):void 0;return await t.request({method:"eth_getStorageAt",params:[e,s,a||r]})}async function woe(t,{blockHash:e,blockNumber:n,blockTag:r,hash:s,index:a}){var d,f,x;const o=r||"latest",l=n!==void 0?Gs(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,Gs(a)]},{dedupe:!0}):(l||o)&&(c=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||o,Gs(a)]},{dedupe:!!l})),!c)throw new lke({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)||y$)(c)}async function Txt(t,{hash:e,transactionReceipt:n}){const[r,s]=await Promise.all([ci(t,TT,"getBlockNumber")({}),e?ci(t,woe,"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 Pxt={"0x0":"reverted","0x1":"success"};function lTe(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=>b1(n)):null,to:t.to?t.to:null,transactionIndex:t.transactionIndex?lx(t.transactionIndex):null,status:t.status?Pxt[t.status]:null,type:t.type?dke[t.type]||t.type:null};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),e}const Ixt=toe("transactionReceipt",lTe);async function uee(t,{hash:e}){var s,a,o;const n=await t.request({method:"eth_getTransactionReceipt",params:[e]},{dedupe:!0});if(!n)throw new cke({hash:e});return(((o=(a=(s=t.chain)==null?void 0:s.formatters)==null?void 0:a.transactionReceipt)==null?void 0:o.format)||lTe)(n)}async function cTe(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=n8({blockNumber:s,chain:t.chain,contract:"multicall3"})}const f=[[]];let x=0,g=0;for(let S=0;S<c.length;S++){const{abi:T,address:I,args:L,functionName:F}=c[S];try{const $=Fm({abi:T,args:L,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:I}]}catch($){const O=W3($,{abi:T,address:I,args:L,docsPath:"/docs/contract/multicall",functionName:F});if(!n)throw O;f[x]=[...f[x],{allowFailure:!0,callData:"0x",target:I}]}}const y=await Promise.allSettled(f.map(S=>ci(t,cx,"readContract")({abi:tee,address:d,args:[S],blockNumber:s,blockTag:a,functionName:"aggregate3",stateOverride:l}))),v=[];for(let S=0;S<y.length;S++){const T=y[S];if(T.status==="rejected"){if(!n)throw T.reason;for(let L=0;L<f[S].length;L++)v.push({status:"failure",error:T.reason,result:void 0});continue}const I=T.value;for(let L=0;L<I.length;L++){const{returnData:F,success:$}=I[L],{callData:O}=f[S][L],{abi:U,address:Y,functionName:re,args:Q}=c[v.length];try{if(O==="0x")throw new wT;if(!$)throw new w$({data:F});const q=P5({abi:U,args:Q,data:F,functionName:re});v.push(n?{result:q,status:"success"}:q)}catch(q){const te=W3(q,{abi:U,address:Y,args:Q,docsPath:"/docs/contract/multicall",functionName:re});if(!n)throw te;v.push({error:te,result:void 0,status:"failure"})}}}if(v.length!==c.length)throw new Hr("multicall results mismatch");return v}const Fxt="0.1.1";function Oxt(){return Fxt}let Il=class dee extends Error{constructor(e,n={}){const r=(()=>{var c;if(n.cause instanceof dee){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 dee&&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@${Oxt()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=s,this.shortMessage=e}walk(e){return uTe(this,e)}};function uTe(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause?uTe(t.cause,e):e?null:t}const Mxt="#__bigint";function Lxt(t,e,n){return JSON.stringify(t,(r,s)=>typeof s=="bigint"?s.toString()+Mxt:s,n)}function Rxt(t,e){if(M0e(t)>e)throw new Gxt({givenSize:M0e(t),maxSize:e})}const Yx={zero:48,nine:57,A:65,F:70,a:97,f:102};function O0e(t){if(t>=Yx.zero&&t<=Yx.nine)return t-Yx.zero;if(t>=Yx.A&&t<=Yx.F)return t-(Yx.A-10);if(t>=Yx.a&&t<=Yx.f)return t-(Yx.a-10)}function Dxt(t,e={}){const{dir:n,size:r=32}=e;if(r===0)return t;if(t.length>r)throw new Kxt({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 Coe(t,e){if(mp(t)>e)throw new Jxt({givenSize:mp(t),maxSize:e})}function Bxt(t,e){if(typeof e=="number"&&e>0&&e>mp(t)-1)throw new mTe({offset:e,position:"start",size:mp(t)})}function $xt(t,e,n){if(typeof e=="number"&&typeof n=="number"&&mp(t)!==n-e)throw new mTe({offset:n,position:"end",size:mp(t)})}function dTe(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 egt({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Uxt=new TextEncoder;function zxt(t){return t instanceof Uint8Array?t:typeof t=="string"?Vxt(t):Hxt(t)}function Hxt(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function Vxt(t,e={}){const{size:n}=e;let r=t;n&&(Coe(t,n),r=G3(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=O0e(s.charCodeAt(c++)),d=O0e(s.charCodeAt(c++));if(u===void 0||d===void 0)throw new Il(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[l]=u*16+d}return o}function Wxt(t,e={}){const{size:n}=e,r=Uxt.encode(t);return typeof n=="number"?(Rxt(r,n),qxt(r,n)):r}function qxt(t,e){return Dxt(t,{dir:"right",size:e})}function M0e(t){return t.length}let Gxt=class extends Il{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"})}},Kxt=class extends Il{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 Yxt=new TextEncoder,Xxt=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Qxt(t,e={}){const{strict:n=!1}=e;if(!t)throw new L0e(t);if(typeof t!="string")throw new L0e(t);if(n&&!/^0x[0-9a-fA-F]*$/.test(t))throw new R0e(t);if(!t.startsWith("0x"))throw new R0e(t)}function ux(...t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}function fTe(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(Coe(n,e.size),q3(n,e.size)):n}function hTe(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=Xxt[t[s]];const r=`0x${n}`;return typeof e.size=="number"?(Coe(r,e.size),G3(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 pTe({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?q3(c,r):c}function Noe(t,e={}){return hTe(Yxt.encode(t),e)}function q3(t,e){return dTe(t,{dir:"left",size:e})}function G3(t,e){return dTe(t,{dir:"right",size:e})}function Soe(t,e,n,r={}){const{strict:s}=r;Bxt(t,e);const a=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return s&&$xt(a,e,n),a}function mp(t){return Math.ceil((t.length-2)/2)}function Zxt(t,e={}){const{strict:n=!1}=e;try{return Qxt(t,{strict:n}),!0}catch{return!1}}class pTe extends Il{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 L0e extends Il{constructor(e){super(`Value \`${typeof e=="object"?Lxt(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 R0e extends Il{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 Jxt extends Il{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 mTe extends Il{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 egt extends Il{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 tgt(t){return{address:t.address,amount:od(t.amount),index:od(t.index),validatorIndex:od(t.validatorIndex)}}function ngt(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(tgt)}}}async function fee(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?ngt(x.blockOverrides):void 0,y=x.calls.map(C=>{const S=C,T=S.account?Vu(S.account):void 0,I={...S,data:S.abi?Fm(S):S.data,from:S.from??(T==null?void 0:T.address)};return e8(I),AT(I)}),v=x.stateOverrides?aoe(x.stateOverrides):void 0;c.push({blockOverrides:g,calls:y,stateOverrides:v})}const d=(n?Gs(n):void 0)||r;return(await t.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:a,traceTransfers:o,validation:l},d]})).map((x,g)=>({...soe(x),calls:x.calls.map((y,v)=>{var re,Q;const{abi:C,args:S,functionName:T,to:I}=s[g].calls[v],L=((re=y.error)==null?void 0:re.data)??y.returnData,F=BigInt(y.gasUsed),$=(Q=y.logs)==null?void 0:Q.map(q=>b1(q)),O=y.status==="0x1"?"success":"failure",U=C&&O==="success"&&L!=="0x"?P5({abi:C,data:L,functionName:T}):null,Y=(()=>{var te;if(O==="success")return;let q;if(((te=y.error)==null?void 0:te.data)==="0x"?q=new wT:y.error&&(q=new w$(y.error)),!!q)return W3(q,{abi:C??[],address:I,args:S,functionName:T??"<unknown>"})})();return{data:L,gasUsed:F,logs:$,status:O,...O==="success"?{result:U}:{error:Y}}})}))}catch(c){const u=c,d=x$(u,{});throw d instanceof ST?u:d}}function D0e(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function rgt(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function joe(t,...e){if(!rgt(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 B0e(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 sgt(t,e){joe(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 igt=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),$0e=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,agt=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function U0e(t){for(let e=0;e<t.length;e++)t[e]=agt(t[e])}function ogt(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function xTe(t){return typeof t=="string"&&(t=ogt(t)),joe(t),t}let lgt=class{clone(){return this._cloneInto()}};function cgt(t){const e=r=>t().update(xTe(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}const PI=BigInt(2**32-1),z0e=BigInt(32);function ugt(t,e=!1){return e?{h:Number(t&PI),l:Number(t>>z0e&PI)}:{h:Number(t>>z0e&PI)|0,l:Number(t&PI)|0}}function dgt(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}=ugt(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const fgt=(t,e,n)=>t<<n|e>>>32-n,hgt=(t,e,n)=>e<<n|t>>>32-n,pgt=(t,e,n)=>e<<n-32|t>>>64-n,mgt=(t,e,n)=>t<<n-32|e>>>64-n,gTe=[],bTe=[],yTe=[],xgt=BigInt(0),t7=BigInt(1),ggt=BigInt(2),bgt=BigInt(7),ygt=BigInt(256),vgt=BigInt(113);for(let t=0,e=t7,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],gTe.push(2*(5*r+n)),bTe.push((t+1)*(t+2)/2%64);let s=xgt;for(let a=0;a<7;a++)e=(e<<t7^(e>>bgt)*vgt)%ygt,e&ggt&&(s^=t7<<(t7<<BigInt(a))-t7);yTe.push(s)}const[wgt,Cgt]=dgt(yTe,!0),H0e=(t,e,n)=>n>32?pgt(t,e,n):fgt(t,e,n),V0e=(t,e,n)=>n>32?mgt(t,e,n):hgt(t,e,n);function Ngt(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=H0e(u,d,1)^n[l],x=V0e(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=bTe[o],c=H0e(s,a,l),u=V0e(s,a,l),d=gTe[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]^=wgt[r],t[1]^=Cgt[r]}n.fill(0)}let Sgt=class vTe extends lgt{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,D0e(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=igt(this.state)}keccak(){$0e||U0e(this.state32),Ngt(this.state32,this.rounds),$0e||U0e(this.state32),this.posOut=0,this.pos=0}update(e){B0e(this);const{blockLen:n,state:r}=this;e=xTe(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){B0e(this,!1),joe(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 D0e(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sgt(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 vTe(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 jgt=(t,e,n)=>cgt(()=>new Sgt(e,t,n)),Agt=jgt(1,136,256/8);function wTe(t,e={}){const{as:n=typeof t=="string"?"Hex":"Bytes"}=e,r=Agt(zxt(t));return n==="Bytes"?r:hTe(r)}class _gt 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 Egt={checksum:new _gt(8192)},SV=Egt.checksum,kgt=/^0x[a-fA-F0-9]{40}$/;function A$(t,e={}){const{strict:n=!0}=e;if(!kgt.test(t))throw new W0e({address:t,cause:new Pgt});if(n){if(t.toLowerCase()===t)return;if(Tgt(t)!==t)throw new W0e({address:t,cause:new Igt})}}function Tgt(t){if(SV.has(t))return SV.get(t);A$(t,{strict:!1});const e=t.substring(2).toLowerCase(),n=wTe(Wxt(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 SV.set(t,s),s}function hee(t,e={}){const{strict:n=!0}=e??{};try{return A$(t,{strict:n}),!0}catch{return!1}}let W0e=class extends Il{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"})}},Pgt=class extends Il{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 Igt extends Il{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function pee(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 Il("Unable to normalize signature.");return s}function mee(t,e){const n=typeof t,r=e.type;switch(r){case"address":return hee(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)=>mee(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=>mee(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function CTe(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 CTe(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")?hee(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?hee(n[r],{strict:!1}):!1)return o}}function NTe(t,e={}){const{prepare:n=!0}=e,r=Array.isArray(t)||typeof t=="string"?A0e(t):t;return{...r,...n?{hash:l4(r)}:{}}}function Fgt(t,e,n){const{args:r=[],prepare:s=!0}=n,a=Zxt(e,{strict:!1}),o=t.filter(u=>a?u.type==="function"||u.type==="error"?STe(u)===Soe(e,0,4):u.type==="event"?l4(u)===e:!1:"name"in u&&u.name===e);if(o.length===0)throw new xee({name:e});if(o.length===1)return{...o[0],...s?{hash:l4(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:l4(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?mee(f,g):!1})){if(l&&"inputs"in l&&l.inputs){const f=CTe(u.inputs,l.inputs,r);if(f)throw new Mgt({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 xee({name:e});return{...c,...s?{hash:l4(c)}:{}}}function STe(t){return Soe(l4(t),0,4)}function Ogt(t){const e=typeof t=="string"?t:bL(t);return pee(e)}function l4(t){return typeof t!="string"&&"hash"in t&&t.hash?t.hash:wTe(Noe(Ogt(t)))}class Mgt extends Il{constructor(e,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${e.type}\` in \`${pee(bL(e.abiItem))}\`, and`,`\`${n.type}\` in \`${pee(bL(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 xee extends Il{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 Lgt=/^(.*)\[([0-9]*)\]$/,Rgt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,jTe=/^(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 Dgt({checksumAddress:t,parameters:e,values:n}){const r=[];for(let s=0;s<e.length;s++)r.push(Aoe({checksumAddress:t,parameter:e[s],value:n[s]}));return r}function Aoe({checksumAddress:t=!1,parameter:e,value:n}){const r=e,s=qgt(r.type);if(s){const[a,o]=s;return $gt(n,{checksumAddress:t,length:a,parameter:{...r,type:o}})}if(r.type==="tuple")return Wgt(n,{checksumAddress:t,parameter:r});if(r.type==="address")return Bgt(n,{checksum:t});if(r.type==="bool")return zgt(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const a=r.type.startsWith("int"),[,,o="256"]=jTe.exec(r.type)??[];return Hgt(n,{signed:a,size:Number(o)})}if(r.type.startsWith("bytes"))return Ugt(n,{type:r.type});if(r.type==="string")return Vgt(n);throw new TTe(r.type)}function _oe(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 ux(...n,...r)}function Bgt(t,e){const{checksum:n=!1}=e;return A$(t,{strict:n}),{dynamic:!1,encoded:q3(t.toLowerCase())}}function $gt(t,e){const{checksumAddress:n,length:r,parameter:s}=e,a=r===null;if(!Array.isArray(t))throw new Kgt(t);if(!a&&t.length!==r)throw new Ggt({expectedLength:r,givenLength:t.length,type:`${s.type}[${r}]`});let o=!1;const l=[];for(let c=0;c<t.length;c++){const u=Aoe({checksumAddress:n,parameter:s,value:t[c]});u.dynamic&&(o=!0),l.push(u)}if(a||o){const c=_oe(l);if(a){const u=od(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?ux(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:ux(...l.map(({encoded:c})=>c))}}function Ugt(t,{type:e}){const[,n]=e.split("bytes"),r=mp(t);if(!n){let s=t;return r%32!==0&&(s=G3(s,Math.ceil((t.length-2)/2/32)*32)),{dynamic:!0,encoded:ux(q3(od(r,{size:32})),s)}}if(r!==Number.parseInt(n))throw new ETe({expectedSize:Number.parseInt(n),value:t});return{dynamic:!1,encoded:G3(t)}}function zgt(t){if(typeof t!="boolean")throw new Il(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q3(fTe(t))}}function Hgt(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 pTe({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 Vgt(t){const e=Noe(t),n=Math.ceil(mp(e)/32),r=[];for(let s=0;s<n;s++)r.push(G3(Soe(e,s*32,(s+1)*32)));return{dynamic:!0,encoded:ux(G3(od(mp(e),{size:32})),...r)}}function Wgt(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=Aoe({checksumAddress:n,parameter:l,value:t[c]});a.push(u),u.dynamic&&(s=!0)}return{dynamic:s,encoded:s?_oe(a):ux(...a.map(({encoded:o})=>o))}}function qgt(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}function ATe(t,e,n){const{checksumAddress:r=!1}={};if(t.length!==e.length)throw new kTe({expectedLength:t.length,givenLength:e.length});const s=Dgt({checksumAddress:r,parameters:t,values:e}),a=_oe(s);return a.length===0?"0x":a}function _Te(t,e){if(t.length!==e.length)throw new kTe({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(_Te.encode(s,a))}return ux(...n)}(function(t){function e(n,r,s=!1){if(n==="address"){const c=r;return A$(c),q3(c.toLowerCase(),s?32:0)}if(n==="string")return Noe(r);if(n==="bytes")return r;if(n==="bool")return q3(fTe(r),s?32:1);const a=n.match(jTe);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(Rgt);if(o){const[c,u]=o;if(Number.parseInt(u)!==(r.length-2)/2)throw new ETe({expectedSize:Number.parseInt(u),value:r});return G3(r,s?32:0)}const l=n.match(Lgt);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":ux(...d)}throw new TTe(n)}t.encode=e})(_Te);class Ggt extends Il{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 ETe extends Il{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 kTe extends Il{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 Kgt extends Il{constructor(e){super(`Value \`${e}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class TTe extends Il{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 Ygt(t,e){var s;const{bytecode:n,args:r}=e;return ux(n,(s=t.inputs)!=null&&s.length&&(r!=null&&r.length)?ATe(t.inputs,r):"0x")}function Xgt(t){return NTe(t)}function Qgt(t,...e){const{overloads:n}=t,r=n?Zgt([t,...n],t.name,{args:e[0]}):t,s=Jgt(r),a=e.length>0?ATe(r.inputs,e[0]):void 0;return a?ux(s,a):s}function lC(t,e={}){return NTe(t,e)}function Zgt(t,e,n){const r=Fgt(t,e,n);if(r.type!=="function")throw new xee({name:e,type:"function"});return r}function Jgt(t){return STe(t)}const e1t="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",r0="0x0000000000000000000000000000000000000000",II=new d$(8192);function t1t(t,{enabled:e=!0,id:n}){if(!e||!n)return t();if(II.get(n))return II.get(n);const r=t().finally(()=>II.delete(n));return II.set(n,r),r}async function gee(t){return new Promise(e=>setTimeout(e,t))}function yL(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 gee(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 n1t(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 mw(new Error("method not supported"),{method:u});if(a!=null&&a.include&&!a.include.includes(u))throw new mw(new Error("method not supported"),{method:u});const d=s?aS(`${c}.${Lc(n)}`):void 0;return t1t(()=>yL(async()=>{try{return await t(n)}catch(x){const g=x;switch(g.code){case T9.code:throw new T9(g);case P9.code:throw new P9(g);case I9.code:throw new I9(g,{method:n.method});case F9.code:throw new F9(g);case z3.code:throw new z3(g);case H3.code:throw new H3(g);case O9.code:throw new O9(g);case By.code:throw new By(g);case M9.code:throw new M9(g);case mw.code:throw new mw(g,{method:n.method});case cS.code:throw new cS(g);case L9.code:throw new L9(g);case Eo.code:throw new Eo(g);case R9.code:throw new R9(g);case D9.code:throw new D9(g);case B9.code:throw new B9(g);case $9.code:throw new $9(g);case pp.code:throw new pp(g);case U9.code:throw new U9(g);case z9.code:throw new z9(g);case H9.code:throw new H9(g);case V9.code:throw new V9(g);case W9.code:throw new W9(g);case q9.code:throw new q9(g);case G9.code:throw new G9(g);case 5e3:throw new Eo(g);default:throw x instanceof Hr?x:new tmt(g)}}},{delay:({count:x,error:g})=>{var y;if(g&&g instanceof T_){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})=>r1t(x)}),{enabled:s,id:d})}}function r1t(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===cS.code||t.code===z3.code:t instanceof T_&&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 _$(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}function Eoe(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 s1t(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const q0e=s1t();function i1t(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 Eoe(async({signal:y})=>{const v={...l,body:Array.isArray(r)?Lc(r.map(I=>({jsonrpc:"2.0",id:I.id??q0e.take(),...I}))):Lc({jsonrpc:"2.0",id:r.id??q0e.take(),...r}),headers:{"Content-Type":"application/json",...c},method:u||"POST",signal:d||(o>0?y:null)},C=new Request(t,v),S=await(s==null?void 0:s(C,v))??{...v,url:t};return await fetch(S.url??t,S)},{errorInstance:new m0e({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 T_({body:r,details:Lc(g.error)||x.statusText,headers:x.headers,status:x.status,url:t});return g}catch(x){throw x instanceof T_||x instanceof m0e?x:new T_({body:r,cause:x,url:t})}}}}class a1t extends Hr{constructor({domain:e}){super(`Invalid domain "${Lc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class o1t extends Hr{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 l1t extends Hr{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function c1t(t){const{domain:e={},message:n,primaryType:r}=t,s={EIP712Domain:LTe({domain:e}),...t.types};MTe({domain:e,message:n,primaryType:r,types:s});const a=["0x1901"];return e&&a.push(u1t({domain:e,types:s})),r!=="EIP712Domain"&&a.push(PTe({data:n,primaryType:r,types:s})),au(g1(a))}function u1t({domain:t,types:e}){return PTe({data:t,primaryType:"EIP712Domain",types:e})}function PTe({data:t,primaryType:e,types:n}){const r=ITe({data:t,primaryType:e,types:n});return au(r)}function ITe({data:t,primaryType:e,types:n}){const r=[{type:"bytes32"}],s=[d1t({primaryType:e,types:n})];for(const a of n[e]){const[o,l]=OTe({types:n,name:a.name,type:a.type,value:t[a.name]});r.push(o),s.push(l)}return A2(r,s)}function d1t({primaryType:t,types:e}){const n=pi(f1t({primaryType:t,types:e}));return au(n)}function f1t({primaryType:t,types:e}){let n="";const r=FTe({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 FTe({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])FTe({primaryType:a.type,types:e},n);return n}function OTe({types:t,name:e,type:n,value:r}){if(t[n]!==void 0)return[{type:"bytes32"},au(ITe({data:r,primaryType:n,types:t}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},au(r)];if(n==="string")return[{type:"bytes32"},au(pi(r))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),a=r.map(o=>OTe({name:e,type:s,types:t,value:o}));return[{type:"bytes32"},au(A2(a.map(([o])=>o),a.map(([,o])=>o)))]}return[{type:n},r]}function h1t(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 Lc({domain:o,message:l,primaryType:r,types:s})}function MTe(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(tke);if(x&&(typeof f=="number"||typeof f=="bigint")){const[v,C,S]=x;Gs(f,{signed:C==="int",size:Number.parseInt(S)/8})}if(d==="address"&&typeof f=="string"&&!dc(f))throw new Nd({address:f});const g=d.match(Npt);if(g){const[v,C]=g;if(C&&ul(f)!==Number.parseInt(C))throw new Ght({expectedSize:Number.parseInt(C),givenSize:ul(f)})}const y=s[d];y&&(p1t(d),a(y,f))}};if(s.EIP712Domain&&e){if(typeof e!="object")throw new a1t({domain:e});a(s.EIP712Domain,e)}if(r!=="EIP712Domain")if(s[r])a(s[r],n);else throw new o1t({primaryType:r,types:s})}function LTe({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 p1t(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new l1t({type:t})}function m1t(t){const{authorizationList:e}=t;if(e)for(const n of e){const{chainId:r}=n,s=n.address;if(!dc(s))throw new Nd({address:s});if(r<0)throw new m$({chainId:r})}koe(t)}function x1t(t){const{blobVersionedHashes:e}=t;if(e){if(e.length===0)throw new yke;for(const n of e){const r=ul(n),s=lx($3(n,0,1));if(r!==32)throw new _mt({hash:n,size:r});if(s!==bke)throw new Emt({hash:n,version:s})}}koe(t)}function koe(t){const{chainId:e,maxPriorityFeePerGas:n,maxFeePerGas:r,to:s}=t;if(e<=0)throw new m$({chainId:e});if(s&&!dc(s))throw new Nd({address:s});if(r&&r>b$)throw new U3({maxFeePerGas:r});if(n&&r&&n>r)throw new k9({maxFeePerGas:r,maxPriorityFeePerGas:n})}function g1t(t){const{chainId:e,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:s,to:a}=t;if(e<=0)throw new m$({chainId:e});if(a&&!dc(a))throw new Nd({address:a});if(n||s)throw new Hr("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(r&&r>b$)throw new U3({maxFeePerGas:r})}function b1t(t){const{chainId:e,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:s,to:a}=t;if(a&&!dc(a))throw new Nd({address:a});if(typeof e<"u"&&e<=0)throw new m$({chainId:e});if(n||s)throw new Hr("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(r&&r>b$)throw new U3({maxFeePerGas:r})}function E$(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 Xpt({storageKey:s[a]});if(!dc(r,{strict:!1}))throw new Nd({address:r});e.push([r,s])}return e}function y1t(t,e){const n=wke(t);return n==="eip1559"?C1t(t,e):n==="eip2930"?N1t(t,e):n==="eip4844"?w1t(t,e):n==="eip7702"?v1t(t,e):S1t(t,e)}function v1t(t,e){const{authorizationList:n,chainId:r,gas:s,nonce:a,to:o,value:l,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:f}=t;m1t(t);const x=E$(d),g=j1t(n);return Im(["0x04",t2([pi(r),a?pi(a):"0x",u?pi(u):"0x",c?pi(c):"0x",s?pi(s):"0x",o??"0x",l?pi(l):"0x",f??"0x",x,g,...PT(t,e)])])}function w1t(t,e){const{chainId:n,gas:r,nonce:s,to:a,value:o,maxFeePerBlobGas:l,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:f}=t;x1t(t);let x=t.blobVersionedHashes,g=t.sidecars;if(t.blobs&&(typeof x>"u"||typeof g>"u")){const I=typeof t.blobs[0]=="string"?t.blobs:t.blobs.map($=>Xl($)),L=t.kzg,F=coe({blobs:I,kzg:L});if(typeof x>"u"&&(x=mke({commitments:F})),typeof g>"u"){const $=uoe({blobs:I,commitments:F,kzg:L});g=vke({blobs:I,commitments:F,proofs:$})}}const y=E$(d),v=[pi(n),s?pi(s):"0x",u?pi(u):"0x",c?pi(c):"0x",r?pi(r):"0x",a??"0x",o?pi(o):"0x",f??"0x",y,l?pi(l):"0x",x??[],...PT(t,e)],C=[],S=[],T=[];if(g)for(let I=0;I<g.length;I++){const{blob:L,commitment:F,proof:$}=g[I];C.push(L),S.push(F),T.push($)}return Im(["0x03",t2(g?[v,C,S,T]:v)])}function C1t(t,e){const{chainId:n,gas:r,nonce:s,to:a,value:o,maxFeePerGas:l,maxPriorityFeePerGas:c,accessList:u,data:d}=t;koe(t);const f=E$(u),x=[pi(n),s?pi(s):"0x",c?pi(c):"0x",l?pi(l):"0x",r?pi(r):"0x",a??"0x",o?pi(o):"0x",d??"0x",f,...PT(t,e)];return Im(["0x02",t2(x)])}function N1t(t,e){const{chainId:n,gas:r,data:s,nonce:a,to:o,value:l,accessList:c,gasPrice:u}=t;g1t(t);const d=E$(c),f=[pi(n),a?pi(a):"0x",u?pi(u):"0x",r?pi(r):"0x",o??"0x",l?pi(l):"0x",s??"0x",d,...PT(t,e)];return Im(["0x01",t2(f)])}function S1t(t,e){const{chainId:n=0,gas:r,data:s,nonce:a,to:o,value:l,gasPrice:c}=t;b1t(t);let u=[a?pi(a):"0x",c?pi(c):"0x",r?pi(r):"0x",o??"0x",l?pi(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 Kpt({v:e.v});return g})(),f=Jf(e.r),x=Jf(e.s);u=[...u,pi(d),f==="0x00"?"0x":f,x==="0x00"?"0x":x]}else n>0&&(u=[...u,pi(n),"0x","0x"]);return t2(u)}function PT(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?pi(1):"0x":r===0n?"0x":r===1n?pi(1):r===27n?"0x":pi(1),a==="0x00"?"0x":a,o==="0x00"?"0x":o]}function j1t(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?pi(r):"0x",o,s?pi(s):"0x",...PT({},a)])}return e}const A1t=`Ethereum Signed Message:
`;function _1t(t){const e=typeof t=="string"?aS(t):typeof t.raw=="string"?t.raw:Xl(t.raw),n=aS(`${A1t}${ul(e)}`);return g1([n,e])}function RTe(t,e){return au(_1t(t),e)}const DTe="0x6492649264926492649264926492649264926492649264926492649264926492";function E1t(t){return eke(t,-32)===DTe}function k1t(t){const{address:e,data:n,signature:r,to:s="hex"}=t,a=Im([A2([{type:"address"},{type:"bytes"},{type:"bytes"}],[e,n,r]),DTe]);return s==="hex"?a:hp(a)}class T1t extends Hr{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function P1t(t,e){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(t))throw new T1t({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 I1t="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function F1t(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 Hr("`account` is required when `traceAssetChanges` is true");const d=u?Ygt(Xgt("constructor(bytes, bytes)"),{bytecode:Kke,args:[I1t,Qgt(lC("function getBalance(address)"),[u.address])]}):void 0,f=o?await Promise.all(e.calls.map(async H=>{if(!H.data&&!H.abi)return;const{accessList:ee}=await rTe(t,{account:u.address,...H,data:H.abi?Fm(H):H.data});return ee.map(({address:se,storageKeys:pe})=>pe.length>0?se:null)})).then(H=>H.flat().filter(Boolean)):[],x=a==null?void 0:a.map(H=>H.address===(u==null?void 0:u.address)?{...H,nonce:0}:H),g=await fee(t,{blockNumber:n,blockTag:r,blocks:[...o?[{calls:[{data:d}],stateOverrides:a},{calls:f.map((H,ee)=>({abi:[lC("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:H,from:r0,nonce:ee})),stateOverrides:[{address:r0,nonce:0}]}]:[],{calls:[...s,{}].map((H,ee)=>({...H,from:u==null?void 0:u.address,nonce:ee})),stateOverrides:x},...o?[{calls:[{data:d}]},{calls:f.map((H,ee)=>({abi:[lC("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:H,from:r0,nonce:ee})),stateOverrides:[{address:r0,nonce:0}]},{calls:f.map((H,ee)=>({to:H,abi:[lC("function decimals() returns (uint256)")],functionName:"decimals",from:r0,nonce:ee})),stateOverrides:[{address:r0,nonce:0}]},{calls:f.map((H,ee)=>({to:H,abi:[lC("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:r0,nonce:ee})),stateOverrides:[{address:r0,nonce:0}]},{calls:f.map((H,ee)=>({to:H,abi:[lC("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,,S,T,I,L,F]=o?g:[],{calls:$,...O}=y,U=$.slice(0,-1)??[],Y=(v==null?void 0:v.calls)??[],re=(C==null?void 0:C.calls)??[],Q=[...Y,...re].map(H=>H.status==="success"?cd(H.data):null),q=(S==null?void 0:S.calls)??[],te=(T==null?void 0:T.calls)??[],fe=[...q,...te].map(H=>H.status==="success"?cd(H.data):null),G=((I==null?void 0:I.calls)??[]).map(H=>H.status==="success"?H.result:null),ie=((F==null?void 0:F.calls)??[]).map(H=>H.status==="success"?H.result:null),oe=((L==null?void 0:L.calls)??[]).map(H=>H.status==="success"?H.result:null),K=[];for(const[H,ee]of fe.entries()){const se=Q[H];if(typeof ee!="bigint"||typeof se!="bigint")continue;const pe=G[H-1],Se=ie[H-1],ge=oe[H-1],ve=H===0?{address:e1t,decimals:18,symbol:"ETH"}:{address:f[H-1],decimals:ge||pe?Number(pe??1):void 0,symbol:Se??void 0};K.some(be=>be.token.address===ve.address)||K.push({token:ve,value:{pre:se,post:ee,diff:ee-se}})}return{assetChanges:K,block:O,results:U}}const jV=new Map,G0e=new Map;let O1t=0;function n2(t,e,n){const r=++O1t,s=()=>jV.get(t)||[],a=()=>{const d=s();jV.set(t,d.filter(f=>f.id!==r))},o=()=>{const d=s();if(!d.some(x=>x.id===r))return;const f=G0e.get(t);d.length===1&&f&&f(),a()},l=s();if(jV.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"&&G0e.set(t,u),o}function IT(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 gee(c);const u=async()=>{s&&(await t({unpoll:a}),await gee(r),u())};u()})(),a}function M1t(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=Lc(["watchBlocks",t.uid,e,n,r,d,c]);return n2(y,{onBlock:s,onError:a},v=>IT(async()=>{var C;try{const S=await ci(t,D0,"getBlock")({blockTag:e,includeTransactions:d});if(S.number&&(f!=null&&f.number)){if(S.number===f.number)return;if(S.number-f.number>1&&n)for(let T=(f==null?void 0:f.number)+1n;T<S.number;T++){const I=await ci(t,D0,"getBlock")({blockNumber:T,includeTransactions:d});v.onBlock(I,f),f=I}}(!(f!=null&&f.number)||e==="pending"&&!(S!=null&&S.number)||S.number&&S.number>f.number)&&(v.onBlock(S,f),f=S)}catch(S){(C=v.onError)==null||C.call(v,S)}},{emitOnBegin:r,interval:c}))})():(()=>{let y=!0,v=!0,C=()=>y=!1;return(async()=>{try{r&&ci(t,D0,"getBlock")({blockTag:e,includeTransactions:d}).then(I=>{y&&v&&(s(I,void 0),v=!1)});const S=(()=>{if(t.transport.type==="fallback"){const I=t.transport.transports.find(L=>L.config.type==="webSocket");return I?I.value:t.transport}return t.transport})(),{unsubscribe:T}=await S.subscribe({params:["newHeads"],async onData(I){if(!y)return;const L=await ci(t,D0,"getBlock")({blockNumber:I.blockNumber,includeTransactions:d}).catch(()=>{});y&&(s(L,f),v=!1,f=L)},onError(I){a==null||a(I)}});C=T,y||C()}catch(S){a==null||a(S)}})(),()=>C()})()}function BTe(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=Lc(["watchBlockNumber",t.uid,e,n,o]);return n2(f,{onBlockNumber:r,onError:s},x=>IT(async()=>{var g;try{const y=await ci(t,TT,"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=Lc(["watchBlockNumber",t.uid,e,n]);return n2(f,{onBlockNumber:r,onError:s},x=>{let g=!0,y=()=>g=!1;return(async()=>{try{const v=(()=>{if(t.transport.type==="fallback"){const S=t.transport.transports.find(T=>T.config.type==="webSocket");return S?S.value:t.transport}return t.transport})(),{unsubscribe:C}=await v.subscribe({params:["newHeads"],onData(S){var I;if(!g)return;const T=cd((I=S.result)==null?void 0:I.number);x.onBlockNumber(T,c),c=T},onError(S){var T;(T=x.onError)==null||T.call(x,S)}});y=C,g||y()}catch(v){s==null||s(v)}})(),()=>y()})})()}async function k$(t,{filter:e}){return e.request({method:"eth_uninstallFilter",params:[e.id]})}function L1t(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=Lc(["watchEvent",e,n,r,t.uid,s,d,o]);return n2(C,{onLogs:c,onError:l},S=>{let T;o!==void 0&&(T=o-1n);let I,L=!1;const F=IT(async()=>{var $;if(!L){try{I=await ci(t,iTe,"createEventFilter")({address:e,args:n,event:s,events:a,strict:g,fromBlock:o})}catch{}L=!0;return}try{let O;if(I)O=await ci(t,j$,"getFilterChanges")({filter:I});else{const U=await ci(t,TT,"getBlockNumber")({});T&&T!==U?O=await ci(t,voe,"getLogs")({address:e,args:n,event:s,events:a,fromBlock:T+1n,toBlock:U}):O=[],T=U}if(O.length===0)return;if(r)S.onLogs(O);else for(const U of O)S.onLogs([U])}catch(O){I&&O instanceof H3&&(L=!1),($=S.onError)==null||$.call(S,O)}},{emitOnBegin:!0,interval:d});return async()=>{I&&await ci(t,k$,"uninstallFilter")({filter:I}),F()}})})():(()=>{let C=!0,S=()=>C=!1;return(async()=>{try{const T=(()=>{if(t.transport.type==="fallback"){const $=t.transport.transports.find(O=>O.config.type==="webSocket");return $?$.value:t.transport}return t.transport})(),I=a??(s?[s]:void 0);let L=[];I&&(L=[I.flatMap(O=>kT({abi:[O],eventName:O.name,args:n}))],s&&(L=L[0]));const{unsubscribe:F}=await T.subscribe({params:["logs",{address:e,topics:L}],onData($){var U;if(!C)return;const O=$.result;try{const{eventName:Y,args:re}=boe({abi:I??[],data:O.data,topics:O.topics,strict:g}),Q=b1(O,{args:re,eventName:Y});c([Q])}catch(Y){let re,Q;if(Y instanceof E9||Y instanceof u$){if(f)return;re=Y.abiItem.name,Q=(U=Y.abiItem.inputs)==null?void 0:U.some(te=>!("name"in te&&te.name))}const q=b1(O,{args:Q?[]:{},eventName:re});c([q])}},onError($){l==null||l($)}});S=F,C||S()}catch(T){l==null||l(T)}})(),()=>S()})()}function R1t(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=Lc(["watchPendingTransactions",t.uid,e,a]);return n2(u,{onTransactions:r,onError:n},d=>{let f;const x=IT(async()=>{var g;try{if(!f)try{f=await ci(t,aTe,"createPendingTransactionFilter")({});return}catch(v){throw x(),v}const y=await ci(t,j$,"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 ci(t,k$,"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 D1t(t){return t.map(e=>({...e,value:BigInt(e.value)}))}function B1t(t){return{...t,balance:t.balance?BigInt(t.balance):void 0,nonce:t.nonce?lx(t.nonce):void 0,storageProof:t.storageProof?D1t(t.storageProof):void 0}}async function $1t(t,{address:e,blockNumber:n,blockTag:r,storageKeys:s}){const a=r??"latest",o=n!==void 0?Gs(n):void 0,l=await t.request({method:"eth_getProof",params:[e,s,o||a]});return B1t(l)}async function U1t(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=Lc(["waitForTransactionReceipt",t.uid,n]);let u,d,f,x=!1;const{promise:g,resolve:y,reject:v}=Xke(),C=l?setTimeout(()=>v(new Zpt({hash:n})),l):void 0,S=n2(c,{onReplaced:r,resolve:y,reject:v},T=>{const I=ci(t,BTe,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:s,async onBlockNumber(L){const F=O=>{clearTimeout(C),I(),O(),S()};let $=L;if(!x)try{if(f){if(e>1&&(!f.blockNumber||$-f.blockNumber+1n<e))return;F(()=>T.resolve(f));return}if(u||(x=!0,await yL(async()=>{u=await ci(t,woe,"getTransaction")({hash:n}),u.blockNumber&&($=u.blockNumber)},{delay:o,retryCount:a}),x=!1),f=await ci(t,uee,"getTransactionReceipt")({hash:n}),e>1&&(!f.blockNumber||$-f.blockNumber+1n<e))return;F(()=>T.resolve(f))}catch(O){if(O instanceof lke||O instanceof cke){if(!u){x=!1;return}try{d=u,x=!0;const U=await yL(()=>ci(t,D0,"getBlock")({blockNumber:$,includeTransactions:!0}),{delay:o,retryCount:a,shouldRetry:({error:Q})=>Q instanceof uke});x=!1;const Y=U.transactions.find(({from:Q,nonce:q})=>Q===d.from&&q===d.nonce);if(!Y||(f=await ci(t,uee,"getTransactionReceipt")({hash:Y.hash}),e>1&&(!f.blockNumber||$-f.blockNumber+1n<e)))return;let re="replaced";Y.to===d.to&&Y.value===d.value&&Y.input===d.input?re="repriced":Y.from===Y.to&&Y.value===0n&&(re="cancelled"),F(()=>{var Q;(Q=T.onReplaced)==null||Q.call(T,{reason:re,replacedTransaction:d,transaction:Y,transactionReceipt:f}),T.resolve(f)})}catch(U){F(()=>T.reject(U))}}else F(()=>T.reject(O))}}})});return g}async function z1t(t,{account:e=t.account,message:n}){if(!e)throw new p$({docsPath:"/docs/actions/wallet/signMessage"});const r=Vu(e);if(r.signMessage)return r.signMessage({message:n});const s=typeof n=="string"?aS(n):n.raw instanceof Uint8Array?pi(n.raw):n.raw;return t.request({method:"personal_sign",params:[s,r.address]},{retryCount:0})}async function H1t(t,e){const{account:n=t.account,domain:r,message:s,primaryType:a}=e;if(!n)throw new p$({docsPath:"/docs/actions/wallet/signTypedData"});const o=Vu(n),l={EIP712Domain:LTe({domain:r}),...e.types};if(MTe({domain:r,message:s,primaryType:a,types:l}),o.signTypedData)return o.signTypedData({domain:r,message:s,primaryType:a,types:l});const c=h1t({domain:r,message:s,primaryType:a,types:l});return t.request({method:"eth_signTypedData_v4",params:[o.address,c]},{retryCount:0})}async function V1t(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 ci(t,N$,"call")({batch:!1,data:`${u}${a?a.replace("0x",""):""}`,to:r,...l,account:c}),f=P5({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 W3(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:o,sender:c==null?void 0:c.address})}}let $Te=class extends qae{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,Jht(e);const r=f$(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 lS(this),this.iHash.update(e),this}digestInto(e){lS(this),CT(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 UTe=(t,e,n)=>new $Te(t,e).update(n).digest();UTe.create=(t,e)=>new $Te(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Toe=BigInt(0),bee=BigInt(1);function uS(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Poe(t){if(!uS(t))throw new Error("Uint8Array expected")}function Y9(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function FI(t){const e=t.toString(16);return e.length&1?"0"+e:e}function zTe(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?Toe:BigInt("0x"+t)}const HTe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",W1t=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function X9(t){if(Poe(t),HTe)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=W1t[t[n]];return e}const Xx={_0:48,_9:57,A:65,F:70,a:97,f:102};function K0e(t){if(t>=Xx._0&&t<=Xx._9)return t-Xx._0;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 vL(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(HTe)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=K0e(t.charCodeAt(a)),l=K0e(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 g3(t){return zTe(X9(t))}function VTe(t){return Poe(t),zTe(X9(Uint8Array.from(t).reverse()))}function Q9(t,e){return vL(t.toString(16).padStart(e*2,"0"))}function WTe(t,e){return Q9(t,e).reverse()}function Gp(t,e,n){let r;if(typeof e=="string")try{r=vL(e)}catch(a){throw new Error(t+" must be hex string or Uint8Array, cause: "+a)}else if(uS(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 wL(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];Poe(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 AV=t=>typeof t=="bigint"&&Toe<=t;function Ioe(t,e,n){return AV(t)&&AV(e)&&AV(n)&&e<=t&&t<n}function E4(t,e,n,r){if(!Ioe(e,n,r))throw new Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}function q1t(t){let e;for(e=0;t>Toe;t>>=bee,e+=1);return e}const T$=t=>(bee<<BigInt(t))-bee,_V=t=>new Uint8Array(t),Y0e=t=>Uint8Array.from(t);function G1t(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(0))=>{s=l(Y0e([0]),f),r=l(),f.length!==0&&(s=l(Y0e([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 wL(...x)};return(f,x)=>{o(),c(f);let g;for(;!(g=x(u()));)c();return o(),g}}const K1t={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"||uS(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 P$(t,e,n={}){const r=(s,a,o)=>{const l=K1t[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 X0e(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 Ic=BigInt(0),Sl=BigInt(1),sw=BigInt(2),Y1t=BigInt(3),yee=BigInt(4),Q0e=BigInt(5),Z0e=BigInt(8);function Xd(t,e){const n=t%e;return n>=Ic?n:e+n}function X1t(t,e,n){if(e<Ic)throw new Error("invalid exponent, negatives unsupported");if(n<=Ic)throw new Error("invalid modulus");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 vee(t,e){if(t===Ic)throw new Error("invert: expected non-zero number");if(e<=Ic)throw new Error("invert: expected positive modulus, got "+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 Q1t(t){const e=(t-Sl)/sw;let n,r,s;for(n=t-Sl,r=0;n%sw===Ic;n/=sw,r++);for(s=sw;s<t&&X1t(s,e,t)!==t-Sl;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(t+Sl)/yee;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)/sw;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 Z1t(t){if(t%yee===Y1t){const e=(t+Sl)/yee;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%Z0e===Q0e){const e=(t-Q0e)/Z0e;return function(r,s){const a=r.mul(s,sw),o=r.pow(a,e),l=r.mul(s,o),c=r.mul(r.mul(l,sw),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 Q1t(t)}const J1t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ebt(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=J1t.reduce((r,s)=>(r[s]="function",r),e);return P$(t,n)}function tbt(t,e,n){if(n<Ic)throw new Error("invalid exponent, negatives unsupported");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 nbt(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 qTe(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function GTe(t,e,n=!1,r={}){if(t<=Ic)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:a}=qTe(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:T$(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)=>tbt(l,c,u),div:(c,u)=>Xd(c*vee(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>vee(c,t),sqrt:r.sqrt||(c=>(o||(o=Z1t(t)),o(l,c))),invertBatch:c=>nbt(l,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?WTe(c,a):Q9(c,a),fromBytes:c=>{if(c.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+c.length);return n?VTe(c):g3(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 YTe(t){const e=KTe(t);return e+Math.ceil(e/2)}function rbt(t,e,n=!1){const r=t.length,s=KTe(e),a=YTe(e);if(r<16||r<a||r>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+r);const o=n?VTe(t):g3(t),l=Xd(o,e-Sl)+Sl;return n?WTe(l,s):Q9(l,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const J0e=BigInt(0),wee=BigInt(1);function EV(t,e){const n=e.negate();return t?n:e}function XTe(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function kV(t,e){XTe(t,e);const n=Math.ceil(e/t)+1,r=2**(t-1),s=2**t,a=T$(t),o=BigInt(t);return{windows:n,windowSize:r,mask:a,maxNumber:s,shiftBy:o}}function exe(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+=wee);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 sbt(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 ibt(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 TV=new WeakMap,QTe=new WeakMap;function PV(t){return QTe.get(t)||1}function abt(t,e){return{constTimeNegate:EV,hasPrecomputes(n){return PV(n)!==1},unsafeLadder(n,r,s=t.ZERO){let a=n;for(;r>J0e;)r&wee&&(s=s.add(a)),a=a.double(),r>>=wee;return s},precomputeWindow(n,r){const{windows:s,windowSize:a}=kV(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=kV(n,e);for(let c=0;c<l.windows;c++){const{nextN:u,offset:d,isZero:f,isNeg:x,isNegF:g,offsetF:y}=exe(s,c,l);s=u,f?o=o.add(EV(g,r[y])):a=a.add(EV(x,r[d]))}return{p:a,f:o}},wNAFUnsafe(n,r,s,a=t.ZERO){const o=kV(n,e);for(let l=0;l<o.windows&&s!==J0e;l++){const{nextN:c,offset:u,isZero:d,isNeg:f}=exe(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=TV.get(r);return a||(a=this.precomputeWindow(r,n),n!==1&&TV.set(r,s(a))),a},wNAFCached(n,r,s){const a=PV(n);return this.wNAF(a,this.getPrecomputes(a,n,s),r)},wNAFCachedUnsafe(n,r,s,a){const o=PV(n);return o===1?this.unsafeLadder(n,r,a):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,a)},setWindowSize(n,r){XTe(r,e),QTe.set(n,r),TV.delete(n)}}}function obt(t,e,n,r){if(sbt(n,t),ibt(r,e),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,a=q1t(BigInt(n.length)),o=a>12?a-3:a>4?a-2:a?2:1,l=T$(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 ZTe(t){return ebt(t.Fp),P$(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...qTe(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function txe(t){t.lowS!==void 0&&Y9("lowS",t.lowS),t.prehash!==void 0&&Y9("prehash",t.prehash)}function lbt(t){const e=ZTe(t);P$(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 cbt extends Error{constructor(e=""){super(e)}}const wg={Err:cbt,_tlv:{encode:(t,e)=>{const{Err:n}=wg;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=FI(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const a=r>127?FI(s.length/2|128):"";return FI(t)+a+s+e},decode(t,e){const{Err:n}=wg;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}=wg;if(t<Bg)throw new e("integer: negative integers are not allowed");let n=FI(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}=wg;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 g3(t)}},toSig(t){const{Err:e,_int:n,_tlv:r}=wg,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}=wg,r=e.encode(2,n.encode(t.r)),s=e.encode(2,n.encode(t.s)),a=r+s;return e.encode(48,a)}},Bg=BigInt(0),_c=BigInt(1);BigInt(2);const nxe=BigInt(3);BigInt(4);function ubt(t){const e=lbt(t),{Fp:n}=e,r=GTe(e.n,e.nBitLength),s=e.toBytes||((v,C,S)=>{const T=C.toAffine();return wL(Uint8Array.from([4]),n.toBytes(T.x),n.toBytes(T.y))}),a=e.fromBytes||(v=>{const C=v.subarray(1),S=n.fromBytes(C.subarray(0,n.BYTES)),T=n.fromBytes(C.subarray(n.BYTES,2*n.BYTES));return{x:S,y:T}});function o(v){const{a:C,b:S}=e,T=n.sqr(v),I=n.mul(T,v);return n.add(n.add(I,n.mul(v,C)),S)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function l(v){return Ioe(v,_c,e.n)}function c(v){const{allowedPrivateKeyLengths:C,nByteLength:S,wrapPrivateKey:T,n:I}=e;if(C&&typeof v!="bigint"){if(uS(v)&&(v=X9(v)),typeof v!="string"||!C.includes(v.length))throw new Error("invalid private key");v=v.padStart(S*2,"0")}let L;try{L=typeof v=="bigint"?v:g3(Gp("private key",v,S))}catch{throw new Error("invalid private key, expected hex or "+S+" bytes, got "+typeof v)}return T&&(L=Xd(L,I)),E4("private key",L,_c,I),L}function u(v){if(!(v instanceof x))throw new Error("ProjectivePoint expected")}const d=X0e((v,C)=>{const{px:S,py:T,pz:I}=v;if(n.eql(I,n.ONE))return{x:S,y:T};const L=v.is0();C==null&&(C=L?n.ONE:n.inv(I));const F=n.mul(S,C),$=n.mul(T,C),O=n.mul(I,C);if(L)return{x:n.ZERO,y:n.ZERO};if(!n.eql(O,n.ONE))throw new Error("invZ was invalid");return{x:F,y:$}}),f=X0e(v=>{if(v.is0()){if(e.allowInfinityPoint&&!n.is0(v.py))return;throw new Error("bad point: ZERO")}const{x:C,y:S}=v.toAffine();if(!n.isValid(C)||!n.isValid(S))throw new Error("bad point: x or y not FE");const T=n.sqr(S),I=o(C);if(!n.eql(T,I))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,S,T){if(C==null||!n.isValid(C))throw new Error("x required");if(S==null||!n.isValid(S))throw new Error("y required");if(T==null||!n.isValid(T))throw new Error("z required");this.px=C,this.py=S,this.pz=T,Object.freeze(this)}static fromAffine(C){const{x:S,y:T}=C||{};if(!C||!n.isValid(S)||!n.isValid(T))throw new Error("invalid affine point");if(C instanceof x)throw new Error("projective point not allowed");const I=L=>n.eql(L,n.ZERO);return I(S)&&I(T)?x.ZERO:new x(S,T,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(C){const S=n.invertBatch(C.map(T=>T.pz));return C.map((T,I)=>T.toAffine(S[I])).map(x.fromAffine)}static fromHex(C){const S=x.fromAffine(a(Gp("pointHex",C)));return S.assertValidity(),S}static fromPrivateKey(C){return x.BASE.multiply(c(C))}static msm(C,S){return obt(x,r,C,S)}_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:S,py:T,pz:I}=this,{px:L,py:F,pz:$}=C,O=n.eql(n.mul(S,$),n.mul(L,I)),U=n.eql(n.mul(T,$),n.mul(F,I));return O&&U}negate(){return new x(this.px,n.neg(this.py),this.pz)}double(){const{a:C,b:S}=e,T=n.mul(S,nxe),{px:I,py:L,pz:F}=this;let $=n.ZERO,O=n.ZERO,U=n.ZERO,Y=n.mul(I,I),re=n.mul(L,L),Q=n.mul(F,F),q=n.mul(I,L);return q=n.add(q,q),U=n.mul(I,F),U=n.add(U,U),$=n.mul(C,U),O=n.mul(T,Q),O=n.add($,O),$=n.sub(re,O),O=n.add(re,O),O=n.mul($,O),$=n.mul(q,$),U=n.mul(T,U),Q=n.mul(C,Q),q=n.sub(Y,Q),q=n.mul(C,q),q=n.add(q,U),U=n.add(Y,Y),Y=n.add(U,Y),Y=n.add(Y,Q),Y=n.mul(Y,q),O=n.add(O,Y),Q=n.mul(L,F),Q=n.add(Q,Q),Y=n.mul(Q,q),$=n.sub($,Y),U=n.mul(Q,re),U=n.add(U,U),U=n.add(U,U),new x($,O,U)}add(C){u(C);const{px:S,py:T,pz:I}=this,{px:L,py:F,pz:$}=C;let O=n.ZERO,U=n.ZERO,Y=n.ZERO;const re=e.a,Q=n.mul(e.b,nxe);let q=n.mul(S,L),te=n.mul(T,F),fe=n.mul(I,$),G=n.add(S,T),ie=n.add(L,F);G=n.mul(G,ie),ie=n.add(q,te),G=n.sub(G,ie),ie=n.add(S,I);let oe=n.add(L,$);return ie=n.mul(ie,oe),oe=n.add(q,fe),ie=n.sub(ie,oe),oe=n.add(T,I),O=n.add(F,$),oe=n.mul(oe,O),O=n.add(te,fe),oe=n.sub(oe,O),Y=n.mul(re,ie),O=n.mul(Q,fe),Y=n.add(O,Y),O=n.sub(te,Y),Y=n.add(te,Y),U=n.mul(O,Y),te=n.add(q,q),te=n.add(te,q),fe=n.mul(re,fe),ie=n.mul(Q,ie),te=n.add(te,fe),fe=n.sub(q,fe),fe=n.mul(re,fe),ie=n.add(ie,fe),q=n.mul(te,ie),U=n.add(U,q),q=n.mul(oe,ie),O=n.mul(G,O),O=n.sub(O,q),q=n.mul(G,te),Y=n.mul(oe,Y),Y=n.add(Y,q),new x(O,U,Y)}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:S,n:T}=e;E4("scalar",C,Bg,T);const I=x.ZERO;if(C===Bg)return I;if(this.is0()||C===_c)return this;if(!S||y.hasPrecomputes(this))return y.wNAFCachedUnsafe(this,C,x.normalizeZ);let{k1neg:L,k1:F,k2neg:$,k2:O}=S.splitScalar(C),U=I,Y=I,re=this;for(;F>Bg||O>Bg;)F&_c&&(U=U.add(re)),O&_c&&(Y=Y.add(re)),re=re.double(),F>>=_c,O>>=_c;return L&&(U=U.negate()),$&&(Y=Y.negate()),Y=new x(n.mul(Y.px,S.beta),Y.py,Y.pz),U.add(Y)}multiply(C){const{endo:S,n:T}=e;E4("scalar",C,_c,T);let I,L;if(S){const{k1neg:F,k1:$,k2neg:O,k2:U}=S.splitScalar(C);let{p:Y,f:re}=this.wNAF($),{p:Q,f:q}=this.wNAF(U);Y=y.constTimeNegate(F,Y),Q=y.constTimeNegate(O,Q),Q=new x(n.mul(Q.px,S.beta),Q.py,Q.pz),I=Y.add(Q),L=re.add(q)}else{const{p:F,f:$}=this.wNAF(C);I=F,L=$}return x.normalizeZ([I,L])[0]}multiplyAndAddUnsafe(C,S,T){const I=x.BASE,L=($,O)=>O===Bg||O===_c||!$.equals(I)?$.multiplyUnsafe(O):$.multiply(O),F=L(this,S).add(L(C,T));return F.is0()?void 0:F}toAffine(C){return d(this,C)}isTorsionFree(){const{h:C,isTorsionFree:S}=e;if(C===_c)return!0;if(S)return S(x,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:C,clearCofactor:S}=e;return C===_c?this:S?S(x,this):this.multiplyUnsafe(e.h)}toRawBytes(C=!0){return Y9("isCompressed",C),this.assertValidity(),s(x,this,C)}toHex(C=!0){return Y9("isCompressed",C),X9(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=abt(x,e.endo?Math.ceil(g/2):g);return{CURVE:e,ProjectivePoint:x,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:l}}function dbt(t){const e=ZTe(t);return P$(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function fbt(t){const e=dbt(t),{Fp:n,n:r}=e,s=n.BYTES+1,a=2*n.BYTES+1;function o(fe){return Xd(fe,r)}function l(fe){return vee(fe,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:d,isWithinCurveOrder:f}=ubt({...e,toBytes(fe,G,ie){const oe=G.toAffine(),K=n.toBytes(oe.x),H=wL;return Y9("isCompressed",ie),ie?H(Uint8Array.from([G.hasEvenY()?2:3]),K):H(Uint8Array.from([4]),K,n.toBytes(oe.y))},fromBytes(fe){const G=fe.length,ie=fe[0],oe=fe.subarray(1);if(G===s&&(ie===2||ie===3)){const K=g3(oe);if(!Ioe(K,_c,n.ORDER))throw new Error("Point is not on curve");const H=d(K);let ee;try{ee=n.sqrt(H)}catch(Se){const ge=Se instanceof Error?": "+Se.message:"";throw new Error("Point is not on curve"+ge)}const se=(ee&_c)===_c;return(ie&1)===1!==se&&(ee=n.neg(ee)),{x:K,y:ee}}else if(G===a&&ie===4){const K=n.fromBytes(oe.subarray(0,n.BYTES)),H=n.fromBytes(oe.subarray(n.BYTES,2*n.BYTES));return{x:K,y:H}}else{const K=s,H=a;throw new Error("invalid Point, expected length of "+K+", or uncompressed "+H+", got "+G)}}}),x=fe=>X9(Q9(fe,e.nByteLength));function g(fe){const G=r>>_c;return fe>G}function y(fe){return g(fe)?o(-fe):fe}const v=(fe,G,ie)=>g3(fe.slice(G,ie));class C{constructor(G,ie,oe){E4("r",G,_c,r),E4("s",ie,_c,r),this.r=G,this.s=ie,oe!=null&&(this.recovery=oe),Object.freeze(this)}static fromCompact(G){const ie=e.nByteLength;return G=Gp("compactSignature",G,ie*2),new C(v(G,0,ie),v(G,ie,2*ie))}static fromDER(G){const{r:ie,s:oe}=wg.toSig(Gp("DER",G));return new C(ie,oe)}assertValidity(){}addRecoveryBit(G){return new C(this.r,this.s,G)}recoverPublicKey(G){const{r:ie,s:oe,recovery:K}=this,H=$(Gp("msgHash",G));if(K==null||![0,1,2,3].includes(K))throw new Error("recovery id invalid");const ee=K===2||K===3?ie+e.n:ie;if(ee>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const se=K&1?"03":"02",pe=c.fromHex(se+x(ee)),Se=l(ee),ge=o(-H*Se),ve=o(oe*Se),be=c.BASE.multiplyAndAddUnsafe(pe,ge,ve);if(!be)throw new Error("point at infinify");return be.assertValidity(),be}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new C(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return vL(this.toDERHex())}toDERHex(){return wg.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return vL(this.toCompactHex())}toCompactHex(){return x(this.r)+x(this.s)}}const S={isValidPrivateKey(fe){try{return u(fe),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const fe=YTe(e.n);return rbt(e.randomBytes(fe),e.n)},precompute(fe=8,G=c.BASE){return G._setWindowSize(fe),G.multiply(BigInt(3)),G}};function T(fe,G=!0){return c.fromPrivateKey(fe).toRawBytes(G)}function I(fe){const G=uS(fe),ie=typeof fe=="string",oe=(G||ie)&&fe.length;return G?oe===s||oe===a:ie?oe===2*s||oe===2*a:fe instanceof c}function L(fe,G,ie=!0){if(I(fe))throw new Error("first arg must be private key");if(!I(G))throw new Error("second arg must be public key");return c.fromHex(G).multiply(u(fe)).toRawBytes(ie)}const F=e.bits2int||function(fe){if(fe.length>8192)throw new Error("input is too large");const G=g3(fe),ie=fe.length*8-e.nBitLength;return ie>0?G>>BigInt(ie):G},$=e.bits2int_modN||function(fe){return o(F(fe))},O=T$(e.nBitLength);function U(fe){return E4("num < 2^"+e.nBitLength,fe,Bg,O),Q9(fe,e.nByteLength)}function Y(fe,G,ie=re){if(["recovered","canonical"].some(je=>je in ie))throw new Error("sign() legacy options not supported");const{hash:oe,randomBytes:K}=e;let{lowS:H,prehash:ee,extraEntropy:se}=ie;H==null&&(H=!0),fe=Gp("msgHash",fe),txe(ie),ee&&(fe=Gp("prehashed msgHash",oe(fe)));const pe=$(fe),Se=u(G),ge=[U(Se),U(pe)];if(se!=null&&se!==!1){const je=se===!0?K(n.BYTES):se;ge.push(Gp("extraEntropy",je))}const ve=wL(...ge),be=pe;function we(je){const Fe=F(je);if(!f(Fe))return;const Re=l(Fe),Qe=c.BASE.multiply(Fe).toAffine(),Ye=o(Qe.x);if(Ye===Bg)return;const dt=o(Re*o(be+Ye*Se));if(dt===Bg)return;let st=(Qe.x===Ye?0:2)|Number(Qe.y&_c),at=dt;return H&&g(dt)&&(at=y(dt),st^=1),new C(Ye,at,st)}return{seed:ve,k2sig:we}}const re={lowS:e.lowS,prehash:!1},Q={lowS:e.lowS,prehash:!1};function q(fe,G,ie=re){const{seed:oe,k2sig:K}=Y(fe,G,ie),H=e;return G1t(H.hash.outputLen,H.nByteLength,H.hmac)(oe,K)}c.BASE._setWindowSize(8);function te(fe,G,ie,oe=Q){var st;const K=fe;G=Gp("msgHash",G),ie=Gp("publicKey",ie);const{lowS:H,prehash:ee,format:se}=oe;if(txe(oe),"strict"in oe)throw new Error("options.strict was renamed to lowS");if(se!==void 0&&se!=="compact"&&se!=="der")throw new Error("format must be compact or der");const pe=typeof K=="string"||uS(K),Se=!pe&&!se&&typeof K=="object"&&K!==null&&typeof K.r=="bigint"&&typeof K.s=="bigint";if(!pe&&!Se)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let ge,ve;try{if(Se&&(ge=new C(K.r,K.s)),pe){try{se!=="compact"&&(ge=C.fromDER(K))}catch(at){if(!(at instanceof wg.Err))throw at}!ge&&se!=="der"&&(ge=C.fromCompact(K))}ve=c.fromHex(ie)}catch{return!1}if(!ge||H&&ge.hasHighS())return!1;ee&&(G=e.hash(G));const{r:be,s:we}=ge,je=$(G),Fe=l(we),Re=o(je*Fe),Qe=o(be*Fe),Ye=(st=c.BASE.multiplyAndAddUnsafe(ve,Re,Qe))==null?void 0:st.toAffine();return Ye?o(Ye.x)===be:!1}return{CURVE:e,getPublicKey:T,getSharedSecret:L,sign:q,verify:te,ProjectivePoint:c,Signature:C,utils:S}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function hbt(t){return{hash:t,hmac:(e,...n)=>UTe(t,e,cpt(...n)),randomBytes:upt}}function pbt(t,e){const n=r=>fbt({...t,...hbt(r)});return{...n(e),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const JTe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),rxe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),mbt=BigInt(1),Cee=BigInt(2),sxe=(t,e)=>(t+e/Cee)/e;function xbt(t){const e=JTe,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,Cee,e)*u%e,y=jh(g,s,e)*g%e,v=jh(y,a,e)*y%e,C=jh(v,l,e)*v%e,S=jh(C,c,e)*C%e,T=jh(S,l,e)*v%e,I=jh(T,n,e)*d%e,L=jh(I,o,e)*y%e,F=jh(L,r,e)*u%e,$=jh(F,Cee,e);if(!Nee.eql(Nee.sqr($),t))throw new Error("Cannot find square root");return $}const Nee=GTe(JTe,void 0,void 0,{sqrt:xbt}),Foe=pbt({a:BigInt(0),b:BigInt(7),Fp:Nee,n:rxe,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=rxe,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-mbt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,o=BigInt("0x100000000000000000000000000000000"),l=sxe(a*t,e),c=sxe(-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}}}},pke);BigInt(0);Foe.ProjectivePoint;const gbt=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Foe},Symbol.toStringTag,{value:"Module"}));function bbt({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 Foe.Signature(cd(t),cd(e)).toCompactHex()}${a===0?"1b":"1c"}`;return n==="hex"?o:hp(o)}async function Ooe(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=ox(o)?o:typeof o=="object"&&"r"in o&&"s"in o?bbt(o):Xl(o),d=await(async()=>!r&&!s||E1t(u)?u:k1t({address:r,data:s,signature:u}))();try{const y=l?{to:l,data:Fm({abi:N0e,functionName:"isValidSig",args:[n,a,d]}),...c}:{data:Xae({abi:N0e,args:[n,a,d],bytecode:W0t}),...c},{data:v}=await ci(t,N$,"call")(y);return Oht(v??"0x0")}catch(y){try{if(goe(Pc(n),await nke({hash:a,signature:o})))return!0}catch{}if(y instanceof Vke)return!1;throw y}}async function ybt(t,{address:e,message:n,factory:r,factoryData:s,signature:a,...o}){const l=RTe(n);return Ooe(t,{address:e,factory:r,factoryData:s,hash:l,signature:a,...o})}async function vbt(t,e){const{address:n,factory:r,factoryData:s,signature:a,message:o,primaryType:l,types:c,domain:u,...d}=e,f=c1t({message:o,primaryType:l,types:c,domain:u});return Ooe(t,{address:n,factory:r,factoryData:s,hash:f,signature:a,...d})}function wbt(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,S=Lc(["watchContractEvent",r,s,a,t.uid,o,f,C,l]);return n2(S,{onLogs:u,onError:c},T=>{let I;l!==void 0&&(I=l-1n);let L,F=!1;const $=IT(async()=>{var O;if(!F){try{L=await ci(t,sTe,"createContractEventFilter")({abi:n,address:r,args:s,eventName:o,strict:C,fromBlock:l})}catch{}F=!0;return}try{let U;if(L)U=await ci(t,j$,"getFilterChanges")({filter:L});else{const Y=await ci(t,TT,"getBlockNumber")({});I&&I<Y?U=await ci(t,oTe,"getContractEvents")({abi:n,address:r,args:s,eventName:o,fromBlock:I+1n,toBlock:Y,strict:C}):U=[],I=Y}if(U.length===0)return;if(a)T.onLogs(U);else for(const Y of U)T.onLogs([Y])}catch(U){L&&U instanceof H3&&(F=!1),(O=T.onError)==null||O.call(T,U)}},{emitOnBegin:!0,interval:f});return async()=>{L&&await ci(t,k$,"uninstallFilter")({filter:L}),$()}})})():(()=>{const C=x??!1,S=Lc(["watchContractEvent",r,s,a,t.uid,o,f,C]);let T=!0,I=()=>T=!1;return n2(S,{onLogs:u,onError:c},L=>((async()=>{try{const F=(()=>{if(t.transport.type==="fallback"){const U=t.transport.transports.find(Y=>Y.config.type==="webSocket");return U?U.value:t.transport}return t.transport})(),$=o?kT({abi:n,eventName:o,args:s}):[],{unsubscribe:O}=await F.subscribe({params:["logs",{address:r,topics:$}],onData(U){var re;if(!T)return;const Y=U.result;try{const{eventName:Q,args:q}=boe({abi:n,data:Y.data,topics:Y.topics,strict:x}),te=b1(Y,{args:q,eventName:Q});L.onLogs([te])}catch(Q){let q,te;if(Q instanceof E9||Q instanceof u$){if(x)return;q=Q.abiItem.name,te=(re=Q.abiItem.inputs)==null?void 0:re.some(G=>!("name"in G&&G.name))}const fe=b1(Y,{args:te?[]:{},eventName:q});L.onLogs([fe])}},onError(U){var Y;(Y=L.onError)==null||Y.call(L,U)}});I=O,T||I()}catch(F){c==null||c(F)}})(),()=>I()))})()}async function Cbt(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 p$({docsPath:"/docs/contract/writeContract"});const u=r?Vu(r):null,d=Fm({abi:n,args:a,functionName:l});try{return await ci(t,Tmt,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:s,account:u,...c})}catch(f){throw W3(f,{abi:n,address:s,args:a,docsPath:"/docs/contract/writeContract",functionName:l,sender:u==null?void 0:u.address})}}function _2(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 qO="2.16.7",Nbt=()=>`@wagmi/core@${qO}`;var ePe=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)},CL,tPe;let R1=class See extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Nbt()}constructor(e,n={}){var a;super(),CL.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 See?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details,s=n.cause instanceof See&&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 ePe(this,CL,"m",tPe).call(this,this,e)}};CL=new WeakSet,tPe=function t(e,n){return n!=null&&n(e)?e:e.cause?ePe(this,CL,"m",t).call(this,e.cause,n):e};class K3 extends R1{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class Sbt extends R1{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class jbt extends R1{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class Abt extends R1{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 _bt extends R1{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 Ebt extends R1{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 kbt(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 Sbt;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 jee=256;let OI=jee,MI;function nPe(t=11){if(!MI||OI+t>jee*2){MI="",OI=0;for(let e=0;e<jee;e++)MI+=(256+Math.random()*256|0).toString(16).substring(1)}return MI.substring(OI,OI+++t)}function rPe(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:nPe()};function v(C){return S=>{const T=S(C);for(const L in y)delete T[L];const I={...C,...T};return Object.assign(I,{extend:v(I)})}}return Object.assign(y,{extend:v(y)})}function sPe({key:t,methods:e,name:n,request:r,retryCount:s=3,retryDelay:a=150,timeout:o,type:l},c){const u=nPe();return{config:{key:t,methods:e,name:n,request:r,retryCount:s,retryDelay:a,timeout:o,type:l},request:n1t(r,{methods:e,retryCount:s,retryDelay:a,uid:u}),value:c}}function Tbt(t,e={}){const{key:n="custom",methods:r,name:s="Custom Provider",retryDelay:a}=e;return({retryCount:o})=>sPe({key:n,methods:r,name:s,request:t.request.bind(t),retryCount:e.retryCount??o,retryDelay:a,type:"custom"})}class Pbt extends Hr{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 X7(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,S=g??e.timeout??1e4,T=f==null?void 0:f.rpcUrls.default.http[0];if(!T)throw new Pbt;const I=i1t(T,{fetchOptions:r,onRequest:l,onResponse:c,timeout:S});return sPe({key:s,methods:a,name:o,async request({method:L,params:F}){const $={method:L,params:F},{schedule:O}=Qke({id:T,wait:v,shouldSplitBatch(Q){return Q.length>y},fn:Q=>I.request({body:Q}),sort:(Q,q)=>Q.id-q.id}),U=async Q=>n?O(Q):[await I.request({body:Q})],[{error:Y,result:re}]=await U($);if(d)return{error:Y,result:re};if(Y)throw new eoe({body:$,error:Y,url:T});return re},retryCount:C,retryDelay:u,timeout:S,type:"http"},{fetchOptions:r,url:T})}}function Ibt(t){var f,x,g;const{scheme:e,statement:n,...r}=((f=t.match(Fbt))==null?void 0:f.groups)??{},{chainId:s,expirationTime:a,issuedAt:o,notBefore:l,requestId:c,...u}=((x=t.match(Obt))==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 Fbt=/^(?:(?<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)?/,Obt=/(?: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 Mbt(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&&!goe(r.address,e))return!1}catch{return!1}return!0}async function Lbt(t,e){const{address:n,domain:r,message:s,nonce:a,scheme:o,signature:l,time:c=new Date,...u}=e,d=Ibt(s);if(!d.address||!Mbt({address:n,domain:r,message:d,nonce:a,scheme:o,time:c}))return!1;const x=RTe(s);return Ooe(t,{address:d.address,hash:x,signature:l,...u})}function Rbt(t){return{call:e=>N$(t,e),createAccessList:e=>rTe(t,e),createBlockFilter:()=>dxt(t),createContractEventFilter:e=>sTe(t,e),createEventFilter:e=>iTe(t,e),createPendingTransactionFilter:()=>aTe(t),estimateContractGas:e=>hxt(t,e),estimateGas:e=>loe(t,e),getBalance:e=>ooe(t,e),getBlobBaseFee:()=>pxt(t),getBlock:e=>D0(t,e),getBlockNumber:e=>TT(t,e),getBlockTransactionCount:e=>vxt(t,e),getBytecode:e=>I0e(t,e),getChainId:()=>noe(t),getCode:e=>I0e(t,e),getContractEvents:e=>oTe(t,e),getEip712Domain:e=>Sxt(t,e),getEnsAddress:e=>Q0t(t,e),getEnsAvatar:e=>tTe(t,e),getEnsName:e=>nTe(t,e),getEnsResolver:e=>uxt(t,e),getEnsText:e=>eTe(t,e),getFeeHistory:e=>_xt(t,e),estimateFeesPerGas:e=>dmt(t,e),getFilterChanges:e=>j$(t,e),getFilterLogs:e=>Ext(t,e),getGasPrice:()=>ioe(t),getLogs:e=>voe(t,e),getProof:e=>$1t(t,e),estimateMaxPriorityFeePerGas:e=>umt(t,e),getStorageAt:e=>kxt(t,e),getTransaction:e=>woe(t,e),getTransactionConfirmations:e=>Txt(t,e),getTransactionCount:e=>hke(t,e),getTransactionReceipt:e=>uee(t,e),multicall:e=>cTe(t,e),prepareTransactionRequest:e=>foe(t,e),readContract:e=>cx(t,e),sendRawTransaction:e=>Nke(t,e),simulate:e=>fee(t,e),simulateBlocks:e=>fee(t,e),simulateCalls:e=>F1t(t,e),simulateContract:e=>V1t(t,e),verifyMessage:e=>ybt(t,e),verifySiweMessage:e=>Lbt(t,e),verifyTypedData:e=>vbt(t,e),uninstallFilter:e=>k$(t,e),waitForTransactionReceipt:e=>U1t(t,e),watchBlocks:e=>M1t(t,e),watchBlockNumber:e=>BTe(t,e),watchContractEvent:e=>wbt(t,e),watchEvent:e=>L1t(t,e),watchPendingTransactions:e=>R1t(t,e)}}async function Moe(t,e={}){let n;if(e.connector){const{connector:u}=e;if(t.state.status==="reconnecting"&&!u.getAccounts&&!u.getChainId)throw new Ebt({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 jbt;const r=e.chainId??n.chainId,s=await n.connector.getChainId();if(s!==n.chainId)throw new _bt({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=Pc(o.address)),e.account&&!n.accounts.some(u=>u.toLowerCase()===o.address.toLowerCase()))throw new Abt({address:o.address,connector:a});const l=t.chains.find(u=>u.id===r),c=await n.connector.getProvider({chainId:r});return rPe({account:o,chain:l,name:"Connector Client",transport:u=>Tbt(c)({...u,retryCount:0})})}async function Dbt(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 iPe(t){return typeof t=="number"?t:t==="wei"?0:Math.abs(qpt[t])}function aPe(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 Bbt(t,e){const{allowFailure:n=!0,chainId:r,contracts:s,...a}=e,o=t.getClient({chainId:r});return _2(o,cTe,"multicall")({allowFailure:n,contracts:s,...a})}function oPe(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return _2(s,cx,"readContract")(r)}async function $bt(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])=>Bbt(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 Wke)throw c;const u=()=>o.map(d=>oPe(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 Ubt(t,e){const{address:n,blockNumber:r,blockTag:s,chainId:a,token:o,unit:l="ether"}=e;if(o)try{return await ixe(t,{balanceAddress:n,chainId:a,symbolType:"string",tokenAddress:o})}catch(x){if(x.name==="ContractFunctionExecutionError"){const g=await ixe(t,{balanceAddress:n,chainId:a,symbolType:"bytes32",tokenAddress:o}),y=Mht(Jf(g.symbol,{dir:"right"}));return{...g,symbol:y}}throw x}const c=t.getClient({chainId:a}),d=await _2(c,ooe,"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:NT(d,iPe(l)),symbol:f.nativeCurrency.symbol,value:d}}async function ixe(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 $bt(t,{allowFailure:!1,contracts:[{...l,functionName:"balanceOf",args:[n],chainId:r},{...l,functionName:"decimals",chainId:r},{...l,functionName:"symbol",chainId:r}]}),f=NT(c??"0",iPe(o??u));return{decimals:u,formatted:f,symbol:d,value:c}}function axe(t){return t.state.chainId}function r2(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(!r2(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&&!r2(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}let IV=[];function oxe(t){const e=t.chains;return r2(IV,e)?IV:(IV=e,e)}function zbt(t,e={}){let n;try{n=t.getClient(e)}catch{}return n}let LI=[];function Aee(t){const e=[...t.state.connections.values()];return t.state.status==="reconnecting"||r2(LI,e)?LI:(LI=e,e)}let FV=[];function lxe(t){const e=t.connectors;return r2(FV,e)?FV:(FV=e,e)}function Hbt(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return _2(s,tTe,"getEnsAvatar")(r)}function Vbt(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return _2(s,nTe,"getEnsName")(r)}function _ee(t,e={}){const n=zbt(t,e);return n==null?void 0:n.extend(Rbt)}let OV=!1;async function Wbt(t,e={}){var u,d;if(OV)return[];OV=!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"}))),OV=!1,l}async function qbt(t,e){const{account:n,connector:r,...s}=e;let a;return typeof n=="object"&&n.type==="local"?a=t.getClient():a=await Moe(t,{account:n,connector:r}),_2(a,z1t,"signMessage")({...s,...n?{account:n}:{}})}async function Gbt(t,e){const{account:n,connector:r,...s}=e;let a;return typeof n=="object"&&n.type==="local"?a=t.getClient():a=await Moe(t,{account:n,connector:r}),_2(a,H1t,"signTypedData")({...s,...n?{account:n}:{}})}class tp extends R1{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class Kbt extends R1{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 Ybt(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 Kbt({connector:l});return await l.switchChain({addEthereumChainParameter:n,chainId:r})}const a=t.chains.find(l=>l.id===r);if(!a)throw new K3;return t.setState(l=>({...l,chainId:r})),a}function lPe(t,e){const{onChange:n}=e;return t.subscribe(()=>aPe(t),n,{equalityFn(r,s){const{connector:a,...o}=r,{connector:l,...c}=s;return r2(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 Xbt(t,e){const{onChange:n}=e;return t.subscribe(r=>r.chainId,n)}function Qbt(t,e){const{onChange:n}=e;return t.subscribe(()=>Aee(t),n,{equalityFn:r2})}function Zbt(t,e){const{onChange:n}=e;return t._internal.connectors.subscribe((r,s)=>{n(Object.values(r),s)})}function Jbt(t,e){const{onChange:n}=e;return t.subscribe(()=>_ee(t),n,{equalityFn(r,s){return(r==null?void 0:r.uid)===(s==null?void 0:s.uid)}})}async function eyt(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 Moe(t,{account:n??void 0,chainId:r,connector:s}),await _2(o,Cbt,"writeContract")({...a,...n?{account:n}:{},chain:r?{id:r}:null})}I$.type="injected";function I$(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"?{...tyt[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:I$.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,S,T;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(L=>Pc(L)),x.length>0&&(x=await this.getAccounts())}catch(I){const L=I;if(L.code===Eo.code)throw new Eo(L);if(L.code===By.code)throw L}try{!(x!=null&&x.length)&&!d&&(x=(await f.request({method:"eth_requestAccounts"})).map(F=>Pc(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 I=await this.getChainId();if(u&&I!==u){const L=await this.switchChain({chainId:u}).catch(F=>{if(F.code===Eo.code)throw F;return{id:I}});I=(L==null?void 0:L.id)??I}return e&&await((S=c.storage)==null?void 0:S.removeItem(`${this.id}.disconnected`)),t.target||await((T=c.storage)==null?void 0:T.setItem("injected.connected",!0)),{accounts:x,chainId:I}}catch(I){const L=I;throw L.code===Eo.code?new Eo(L):L.code===By.code?new By(L):L}},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 Eoe(()=>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=>Pc(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=GO(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(S=>window.addEventListener("ethereum#initialized",()=>S(y()),{once:!0}))]:[],new Promise(S=>setTimeout(()=>S(y()),v))]))return!0}throw new tp}return!!(await yL(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:u,chainId:d}){var y,v,C,S;const f=await this.getProvider();if(!f)throw new tp;const x=c.chains.find(T=>T.id===d);if(!x)throw new pp(new K3);const g=new Promise(T=>{const I=L=>{"chainId"in L&&L.chainId===d&&(c.emitter.off("change",I),T())};c.emitter.on("change",I)});try{return await Promise.all([f.request({method:"wallet_switchEthereumChain",params:[{chainId:Gs(d)}]}).then(async()=>{await this.getChainId()===d&&c.emitter.emit("change",{chainId:d})}),g]),x}catch(T){const I=T;if(I.code===4902||((v=(y=I==null?void 0:I.data)==null?void 0:y.originalError)==null?void 0:v.code)===4902)try{const{default:L,...F}=x.blockExplorers??{};let $;u!=null&&u.blockExplorerUrls?$=u.blockExplorerUrls:L&&($=[L.url,...Object.values(F).map(Y=>Y.url)]);let O;(C=u==null?void 0:u.rpcUrls)!=null&&C.length?O=u.rpcUrls:O=[((S=x.rpcUrls.default)==null?void 0:S.http[0])??""];const U={blockExplorerUrls:$,chainId:Gs(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:O};return await Promise.all([f.request({method:"wallet_addEthereumChain",params:[U]}).then(async()=>{if(await this.getChainId()===d)c.emitter.emit("change",{chainId:d});else throw new Eo(new Error("User rejected switch after adding network."))}),g]),x}catch(L){throw new Eo(L)}throw I.code===Eo.code?new Eo(I):new pp(I)}},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=>Pc(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 tyt={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t!=null&&t.coinbaseWalletExtension?t.coinbaseWalletExtension:GO(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return GO(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:GO(t,"isPhantom")}}};function GO(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 nyt(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 ryt(){const t=new Set;let e=[];const n=()=>nyt(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 syt=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)},iyt=syt;function ayt(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 Eee=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return Eee(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Eee(r)(n)}}}},oyt=(t,e)=>(n,r,s)=>{let a={storage:ayt(()=>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(T=>{var I;return T((I=r())!=null?I:x)});const S=((C=a.onRehydrateStorage)==null?void 0:C.call(a,(v=r())!=null?v:x))||void 0;return Eee(u.getItem.bind(u))(a.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==a.version){if(a.migrate)return[!0,a.migrate(T.state,T.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var I;const[L,F]=T;if(g=a.merge(F,(I=r())!=null?I:x),n(g,!0),L)return d()}).then(()=>{S==null||S(g,void 0),g=r(),o=!0,c.forEach(T=>T(g))}).catch(T=>{S==null||S(void 0,T)})};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},lyt=oyt,cxe=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},MV=t=>t?cxe(t):cxe;var LV={exports:{}},uxe;function cyt(){return uxe||(uxe=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],S=arguments.length,T,I;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),S){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(I=1,T=new Array(S-1);I<S;I++)T[I-1]=arguments[I];C.fn.apply(C.context,T)}else{var L=C.length,F;for(I=0;I<L;I++)switch(C[I].once&&this.removeListener(u,C[I].fn,void 0,!0),S){case 1:C[I].fn.call(C[I].context);break;case 2:C[I].fn.call(C[I].context,d);break;case 3:C[I].fn.call(C[I].context,d,f);break;case 4:C[I].fn.call(C[I].context,d,f,x);break;default:if(!T)for(F=1,T=new Array(S-1);F<S;F++)T[F-1]=arguments[F];C[I].fn.apply(C[I].context,T)}}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=[],S=y.length;v<S;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}(LV)),LV.exports}var uyt=cyt();const Loe=Pi(uyt);let dyt=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 Loe})}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 fyt(t){return new dyt(t)}function hyt(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 dxe(t,e){return t.slice(0,e).join(".")||"."}function fxe(t,e){const{length:n}=t;for(let r=0;r<n;++r)if(t[r]===e)return r+1;return 0}function pyt(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=fxe(s,this);u===0?s[s.length]=this:(s.splice(u),a.splice(u)),a[a.length]=l;const d=fxe(s,c);if(d!==0)return r?e.call(this,l,c,dxe(a,d)):`[ref=${dxe(a,d)}]`}else s[0]=c,a[0]=l;return n?t.call(this,l,c):c}}function myt(t,e,n,r){return JSON.stringify(t,pyt((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 xyt(t){const{deserialize:e=hyt,key:n="wagmi",serialize:r=myt,storage:s=cPe}=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 cPe={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function gyt(){const t=typeof window<"u"&&window.localStorage?window.localStorage:cPe;return{getItem(e){return t.getItem(e)},removeItem(e){t.removeItem(e)},setItem(e,n){try{t.setItem(e,n)}catch{}}}}const kee=256;let RI=kee,DI;function byt(t=11){if(!DI||RI+t>kee*2){DI="",RI=0;for(let e=0;e<kee;e++)DI+=(256+Math.random()*256|0).toString(16).substring(1)}return DI.substring(RI,RI+++t)}function yyt(t){const{multiInjectedProviderDiscovery:e=!0,storage:n=xyt({storage:gyt()}),syncConnectedChain:r=!0,ssr:s=!1,...a}=t,o=typeof window<"u"&&e?ryt():void 0,l=MV(()=>a.chains),c=MV(()=>{const F=[],$=new Set;for(const O of a.connectors??[]){const U=u(O);if(F.push(U),!s&&U.rdns){const Y=typeof U.rdns=="string"?[U.rdns]:U.rdns;for(const re of Y)$.add(re)}}if(!s&&o){const O=o.getProviders();for(const U of O)$.has(U.info.rdns)||F.push(u(d(U)))}return F});function u(F){var U;const $=fyt(byt()),O={...F({emitter:$,chains:l.getState(),storage:n,transports:a.transports}),emitter:$,uid:$.uid};return $.on("connect",I),(U=O.setup)==null||U.call(O),O}function d(F){const{info:$}=F,O=F.provider;return I$({target:{...$,id:$.rdns,provider:O}})}const f=new Map;function x(F={}){const $=F.chainId??C.getState().chainId,O=l.getState().find(Y=>Y.id===$);if(F.chainId&&!O)throw new K3;{const Y=f.get(C.getState().chainId);if(Y&&!O)return Y;if(!O)throw new K3}{const Y=f.get($);if(Y)return Y}let U;if(a.client)U=a.client({chain:O});else{const Y=O.id,re=l.getState().map(te=>te.id),Q={},q=Object.entries(a);for(const[te,fe]of q)if(!(te==="chains"||te==="client"||te==="connectors"||te==="transports"))if(typeof fe=="object")if(Y in fe)Q[te]=fe[Y];else{if(re.some(ie=>ie in fe))continue;Q[te]=fe}else Q[te]=fe;U=rPe({...Q,chain:O,batch:Q.batch??{multicall:!0},transport:te=>a.transports[Y]({...te,connectors:c})})}return f.set($,U),U}function g(){return{chainId:l.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let y;const v="0.0.0-canary-";qO.startsWith(v)?y=Number.parseInt(qO.replace(v,"")):y=Number.parseInt(qO.split(".")[0]??"0");const C=MV(iyt(n?lyt(g,{migrate(F,$){if($===y)return F;const O=g(),U=S(F,O.chainId);return{...O,chainId:U}},name:"store",partialize(F){return{connections:{__type:"Map",value:Array.from(F.connections.entries()).map(([$,O])=>{const{id:U,name:Y,type:re,uid:Q}=O.connector;return[$,{...O,connector:{id:U,name:Y,type:re,uid:Q}}]})},chainId:F.chainId,current:F.current}},merge(F,$){typeof F=="object"&&F&&"status"in F&&delete F.status;const O=S(F,$.chainId);return{...$,...F,chainId:O}},skipHydration:s,storage:n,version:y}):g));C.setState(g());function S(F,$){return F&&typeof F=="object"&&"chainId"in F&&typeof F.chainId=="number"&&l.getState().some(O=>O.id===F.chainId)?F.chainId:$}r&&C.subscribe(({connections:F,current:$})=>{var O;return $?(O=F.get($))==null?void 0:O.chainId:void 0},F=>{if(l.getState().some(O=>O.id===F))return C.setState(O=>({...O,chainId:F??O.chainId}))}),o==null||o.subscribe(F=>{const $=new Set,O=new Set;for(const Y of c.getState())if($.add(Y.id),Y.rdns){const re=typeof Y.rdns=="string"?[Y.rdns]:Y.rdns;for(const Q of re)O.add(Q)}const U=[];for(const Y of F){if(O.has(Y.info.rdns))continue;const re=u(d(Y));$.has(re.id)||U.push(re)}n&&!C.persist.hasHydrated()||c.setState(Y=>[...Y,...U],!0)});function T(F){C.setState($=>{const O=$.connections.get(F.uid);return O?{...$,connections:new Map($.connections).set(F.uid,{accounts:F.accounts??O.accounts,chainId:F.chainId??O.chainId,connector:O.connector})}:$})}function I(F){C.getState().status==="connecting"||C.getState().status==="reconnecting"||C.setState($=>{const O=c.getState().find(U=>U.uid===F.uid);return O?(O.emitter.listenerCount("connect")&&O.emitter.off("connect",T),O.emitter.listenerCount("change")||O.emitter.on("change",T),O.emitter.listenerCount("disconnect")||O.emitter.on("disconnect",L),{...$,connections:new Map($.connections).set(F.uid,{accounts:F.accounts,chainId:F.chainId,connector:O}),current:F.uid,status:"connected"}):$})}function L(F){C.setState($=>{const O=$.connections.get(F.uid);if(O){const Y=O.connector;Y.emitter.listenerCount("change")&&O.connector.emitter.off("change",T),Y.emitter.listenerCount("disconnect")&&O.connector.emitter.off("disconnect",L),Y.emitter.listenerCount("connect")||O.connector.emitter.on("connect",I)}if($.connections.delete(F.uid),$.connections.size===0)return{...$,connections:new Map,current:null,status:"disconnected"};const U=$.connections.values().next().value;return{...$,connections:new Map($.connections),current:U.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 O=g();typeof $!="object"&&($=O),Object.keys(O).some(Y=>!(Y in $))&&($=O),C.setState($,!0)},subscribe(F,$,O){return C.subscribe(F,$,O?{...O,fireImmediately:O.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:T,connect:I,disconnect:L}}}}function vyt(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?Wbt(t):t.storage&&t.setState(s=>({...s,connections:new Map}))}}}function wyt(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 Cyt(t){const{children:e,config:n,initialState:r,reconnectOnMount:s=!0}=t,{onMount:a}=vyt(n,{initialState:r,reconnectOnMount:s});n._internal.ssr||a();const o=h.useRef(!0);return h.useEffect(()=>{if(o.current&&n._internal.ssr)return a(),()=>{o.current=!1}},[]),e}const uPe=h.createContext(void 0);function Nyt(t){const{children:e,config:n}=t,r={value:n};return h.createElement(Cyt,t,h.createElement(uPe.Provider,r,e))}const Syt="2.14.16",jyt=()=>`wagmi@${Syt}`;let Ayt=class extends R1{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 jyt()}};class _yt extends Ayt{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function Fl(t={}){const e=t.config??h.useContext(uPe);if(!e)throw new _yt;return e}function Eyt(t,e){const{onChange:n}=e;return t._internal.chains.subscribe((r,s)=>{n(r,s)})}var RV={exports:{}},DV={},BV={exports:{}},$V={};/**
* @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 hxe;function kyt(){if(hxe)return $V;hxe=1;var t=bx();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 $V.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,$V}var pxe;function Tyt(){return pxe||(pxe=1,BV.exports=kyt()),BV.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 mxe;function Pyt(){if(mxe)return DV;mxe=1;var t=bx(),e=Tyt();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 DV.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 S($){if(!T){if(T=!0,I=$,$=x($),g!==void 0&&v.hasValue){var O=v.value;if(g(O,$))return L=O}return L=$}if(O=L,r(I,$))return O;var U=x($);return g!==void 0&&g(O,U)?(I=$,O):(I=$,L=U)}var T=!1,I,L,F=f===void 0?null:f;return[function(){return S(d())},F===null?void 0:function(){return S(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},DV}var xxe;function Iyt(){return xxe||(xxe=1,RV.exports=Pyt()),RV.exports}var dPe=Iyt();const UV=t=>typeof t=="object"&&!Array.isArray(t);function Fyt(t,e,n=e,r=r2){const s=h.useRef([]),a=dPe.useSyncExternalStoreWithSelector(t,e,n,o=>o,(o,l)=>{if(UV(o)&&UV(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 h.useMemo(()=>{if(UV(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 ds(t={}){const e=Fl(t);return Fyt(n=>lPe(e,{onChange:n}),()=>aPe(e))}function fPe(t={}){const{onConnect:e,onDisconnect:n}=t,r=Fl(t);h.useEffect(()=>lPe(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 r8=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(){}},Y3=typeof window>"u"||"Deno"in globalThis;function Qh(){}function Oyt(t,e){return typeof t=="function"?t(e):t}function Tee(t){return typeof t=="number"&&t>=0&&t!==1/0}function hPe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function k4(t,e){return typeof t=="function"?t(e):t}function lm(t,e){return typeof t=="function"?t(e):t}function gxe(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:l}=t;if(o){if(r){if(e.queryHash!==Roe(o,e.options))return!1}else if(!Z9(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 bxe(t,e){const{exact:n,status:r,predicate:s,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(n){if(X3(e.options.mutationKey)!==X3(a))return!1}else if(!Z9(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function Roe(t,e){return((e==null?void 0:e.queryKeyHashFn)||X3)(t)}function X3(t){return JSON.stringify(t,(e,n)=>Pee(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Z9(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Z9(t[n],e[n])):!1}function Doe(t,e){if(t===e)return t;const n=yxe(t)&&yxe(e);if(n||Pee(t)&&Pee(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]=Doe(t[d],e[d]),l[d]===t[d]&&t[d]!==void 0&&c++)}return s===o&&c===s?t:l}return e}function NL(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 yxe(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Pee(t){if(!vxe(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!vxe(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function vxe(t){return Object.prototype.toString.call(t)==="[object Object]"}function Myt(t){return new Promise(e=>{setTimeout(e,t)})}function Iee(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Doe(t,e):e}function Lyt(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function Ryt(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Boe=Symbol();function pPe(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Boe?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Mw,Jb,X4,jAe,Dyt=(jAe=class extends r8{constructor(){super();Wn(this,Mw);Wn(this,Jb);Wn(this,X4);tn(this,X4,e=>{if(!Y3&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Je(this,Jb)||this.setEventListener(Je(this,X4))}onUnsubscribe(){var e;this.hasListeners()||((e=Je(this,Jb))==null||e.call(this),tn(this,Jb,void 0))}setEventListener(e){var n;tn(this,X4,e),(n=Je(this,Jb))==null||n.call(this),tn(this,Jb,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){Je(this,Mw)!==e&&(tn(this,Mw,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof Je(this,Mw)=="boolean"?Je(this,Mw):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Mw=new WeakMap,Jb=new WeakMap,X4=new WeakMap,jAe),$oe=new Dyt,Q4,ey,Z4,AAe,Byt=(AAe=class extends r8{constructor(){super();Wn(this,Q4,!0);Wn(this,ey);Wn(this,Z4);tn(this,Z4,e=>{if(!Y3&&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(){Je(this,ey)||this.setEventListener(Je(this,Z4))}onUnsubscribe(){var e;this.hasListeners()||((e=Je(this,ey))==null||e.call(this),tn(this,ey,void 0))}setEventListener(e){var n;tn(this,Z4,e),(n=Je(this,ey))==null||n.call(this),tn(this,ey,e(this.setOnline.bind(this)))}setOnline(e){Je(this,Q4)!==e&&(tn(this,Q4,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return Je(this,Q4)}},Q4=new WeakMap,ey=new WeakMap,Z4=new WeakMap,AAe),SL=new Byt;function Fee(){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 $yt(t){return Math.min(1e3*2**t,3e4)}function mPe(t){return(t??"online")==="online"?SL.isOnline():!0}var xPe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function zV(t){return t instanceof xPe}function gPe(t){let e=!1,n=0,r=!1,s;const a=Fee(),o=v=>{var C;r||(x(new xPe(v)),(C=t.abort)==null||C.call(t))},l=()=>{e=!0},c=()=>{e=!1},u=()=>$oe.isFocused()&&(t.networkMode==="always"||SL.isOnline())&&t.canRun(),d=()=>mPe(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=S=>{(r||u())&&v(S)},(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(S){v=Promise.reject(S)}Promise.resolve(v).then(f).catch(S=>{var $;if(r)return;const T=t.retry??(Y3?0:3),I=t.retryDelay??$yt,L=typeof I=="function"?I(n,S):I,F=T===!0||typeof T=="number"&&n<T||typeof T=="function"&&T(n,S);if(e||!F){x(S);return}n++,($=t.onFail)==null||$.call(t,n,S),Myt(L).then(()=>u()?void 0:g()).then(()=>{e?x(S):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 Uyt=t=>setTimeout(t,0);function zyt(){let t=[],e=0,n=l=>{l()},r=l=>{l()},s=Uyt;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 ac=zyt(),Lw,_Ae,bPe=(_Ae=class{constructor(){Wn(this,Lw)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Tee(this.gcTime)&&tn(this,Lw,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Y3?1/0:5*60*1e3))}clearGcTimeout(){Je(this,Lw)&&(clearTimeout(Je(this,Lw)),tn(this,Lw,void 0))}},Lw=new WeakMap,_Ae),J4,eN,qh,Rw,Nu,zk,Dw,Xp,pg,EAe,Hyt=(EAe=class extends bPe{constructor(e){super();Wn(this,Xp);Wn(this,J4);Wn(this,eN);Wn(this,qh);Wn(this,Rw);Wn(this,Nu);Wn(this,zk);Wn(this,Dw);tn(this,Dw,!1),tn(this,zk,e.defaultOptions),this.setOptions(e.options),this.observers=[],tn(this,Rw,e.client),tn(this,qh,Je(this,Rw).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,tn(this,J4,Vyt(this.options)),this.state=e.state??Je(this,J4),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=Je(this,Nu))==null?void 0:e.promise}setOptions(e){this.options={...Je(this,zk),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Je(this,qh).remove(this)}setData(e,n){const r=Iee(this.state.data,e,this.options);return Er(this,Xp,pg).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Er(this,Xp,pg).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,s;const n=(r=Je(this,Nu))==null?void 0:r.promise;return(s=Je(this,Nu))==null||s.cancel(e),n?n.then(Qh).catch(Qh):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Je(this,J4))}isActive(){return this.observers.some(e=>lm(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Boe||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||!hPe(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=Je(this,Nu))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=Je(this,Nu))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),Je(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||(Je(this,Nu)&&(Je(this,Dw)?Je(this,Nu).cancel({revert:!0}):Je(this,Nu).cancelRetry()),this.scheduleGc()),Je(this,qh).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Er(this,Xp,pg).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(Je(this,Nu))return Je(this,Nu).continueRetry(),Je(this,Nu).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:()=>(tn(this,Dw,!0),r.signal)})},a=()=>{const f=pPe(this.options,n),x={client:Je(this,Rw),queryKey:this.queryKey,meta:this.meta};return s(x),tn(this,Dw,!1),this.options.persister?this.options.persister(f,x,this):f(x)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Je(this,Rw),state:this.state,fetchFn:a};s(o),(c=this.options.behavior)==null||c.onFetch(o,this),tn(this,eN,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&Er(this,Xp,pg).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const l=f=>{var x,g,y,v;zV(f)&&f.silent||Er(this,Xp,pg).call(this,{type:"error",error:f}),zV(f)||((g=(x=Je(this,qh).config).onError)==null||g.call(x,f,this),(v=(y=Je(this,qh).config).onSettled)==null||v.call(y,this.state.data,f,this)),this.scheduleGc()};return tn(this,Nu,gPe({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=Je(this,qh).config).onSuccess)==null||g.call(x,f,this),(v=(y=Je(this,qh).config).onSettled)==null||v.call(y,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,x)=>{Er(this,Xp,pg).call(this,{type:"failed",failureCount:f,error:x})},onPause:()=>{Er(this,Xp,pg).call(this,{type:"pause"})},onContinue:()=>{Er(this,Xp,pg).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),Je(this,Nu).start()}},J4=new WeakMap,eN=new WeakMap,qh=new WeakMap,Rw=new WeakMap,Nu=new WeakMap,zk=new WeakMap,Dw=new WeakMap,Xp=new WeakSet,pg=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,...yPe(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 zV(s)&&s.revert&&Je(this,eN)?{...Je(this,eN),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),ac.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Je(this,qh).notify({query:this,type:"updated",action:e})})},EAe);function yPe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:mPe(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Vyt(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,kAe,Wyt=(kAe=class extends r8{constructor(e={}){super();Wn(this,p0);this.config=e,tn(this,p0,new Map)}build(e,n,r){const s=n.queryKey,a=n.queryHash??Roe(s,n);let o=this.get(a);return o||(o=new Hyt({client:e,queryKey:s,queryHash:a,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){Je(this,p0).has(e.queryHash)||(Je(this,p0).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=Je(this,p0).get(e.queryHash);n&&(e.destroy(),n===e&&Je(this,p0).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ac.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Je(this,p0).get(e)}getAll(){return[...Je(this,p0).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>gxe(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>gxe(e,r)):n}notify(e){ac.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){ac.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ac.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},p0=new WeakMap,kAe),m0,td,Bw,x0,$b,TAe,qyt=(TAe=class extends bPe{constructor(e){super();Wn(this,x0);Wn(this,m0);Wn(this,td);Wn(this,Bw);this.mutationId=e.mutationId,tn(this,td,e.mutationCache),tn(this,m0,[]),this.state=e.state||vPe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){Je(this,m0).includes(e)||(Je(this,m0).push(e),this.clearGcTimeout(),Je(this,td).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){tn(this,m0,Je(this,m0).filter(n=>n!==e)),this.scheduleGc(),Je(this,td).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){Je(this,m0).length||(this.state.status==="pending"?this.scheduleGc():Je(this,td).remove(this))}continue(){var e;return((e=Je(this,Bw))==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,S,T,I,L,F,$,O,U;const n=()=>{Er(this,x0,$b).call(this,{type:"continue"})};tn(this,Bw,gPe({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(Y,re)=>{Er(this,x0,$b).call(this,{type:"failed",failureCount:Y,error:re})},onPause:()=>{Er(this,x0,$b).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Je(this,td).canRun(this)}));const r=this.state.status==="pending",s=!Je(this,Bw).canStart();try{if(r)n();else{Er(this,x0,$b).call(this,{type:"pending",variables:e,isPaused:s}),await((o=(a=Je(this,td).config).onMutate)==null?void 0:o.call(a,e,this));const re=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e));re!==this.state.context&&Er(this,x0,$b).call(this,{type:"pending",context:re,variables:e,isPaused:s})}const Y=await Je(this,Bw).start();return await((d=(u=Je(this,td).config).onSuccess)==null?void 0:d.call(u,Y,e,this.state.context,this)),await((x=(f=this.options).onSuccess)==null?void 0:x.call(f,Y,e,this.state.context)),await((y=(g=Je(this,td).config).onSettled)==null?void 0:y.call(g,Y,null,this.state.variables,this.state.context,this)),await((C=(v=this.options).onSettled)==null?void 0:C.call(v,Y,null,e,this.state.context)),Er(this,x0,$b).call(this,{type:"success",data:Y}),Y}catch(Y){try{throw await((T=(S=Je(this,td).config).onError)==null?void 0:T.call(S,Y,e,this.state.context,this)),await((L=(I=this.options).onError)==null?void 0:L.call(I,Y,e,this.state.context)),await(($=(F=Je(this,td).config).onSettled)==null?void 0:$.call(F,void 0,Y,this.state.variables,this.state.context,this)),await((U=(O=this.options).onSettled)==null?void 0:U.call(O,void 0,Y,e,this.state.context)),Y}finally{Er(this,x0,$b).call(this,{type:"error",error:Y})}}finally{Je(this,td).runNext(this)}}},m0=new WeakMap,td=new WeakMap,Bw=new WeakMap,x0=new WeakSet,$b=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),ac.batch(()=>{Je(this,m0).forEach(r=>{r.onMutationUpdate(e)}),Je(this,td).notify({mutation:this,type:"updated",action:e})})},TAe);function vPe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ag,Qp,Hk,PAe,Gyt=(PAe=class extends r8{constructor(e={}){super();Wn(this,Ag);Wn(this,Qp);Wn(this,Hk);this.config=e,tn(this,Ag,new Set),tn(this,Qp,new Map),tn(this,Hk,0)}build(e,n,r){const s=new qyt({mutationCache:this,mutationId:++yb(this,Hk)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){Je(this,Ag).add(e);const n=BI(e);if(typeof n=="string"){const r=Je(this,Qp).get(n);r?r.push(e):Je(this,Qp).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Je(this,Ag).delete(e)){const n=BI(e);if(typeof n=="string"){const r=Je(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&&Je(this,Qp).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=BI(e);if(typeof n=="string"){const r=Je(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=BI(e);if(typeof n=="string"){const s=(r=Je(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(){ac.batch(()=>{Je(this,Ag).forEach(e=>{this.notify({type:"removed",mutation:e})}),Je(this,Ag).clear(),Je(this,Qp).clear()})}getAll(){return Array.from(Je(this,Ag))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>bxe(n,r))}findAll(e={}){return this.getAll().filter(n=>bxe(e,n))}notify(e){ac.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return ac.batch(()=>Promise.all(e.map(n=>n.continue().catch(Qh))))}},Ag=new WeakMap,Qp=new WeakMap,Hk=new WeakMap,PAe);function BI(t){var e;return(e=t.options.scope)==null?void 0:e.id}function wxe(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=I=>{Object.defineProperty(I,"signal",{enumerable:!0,get:()=>(e.signal.aborted?v=!0:e.signal.addEventListener("abort",()=>{v=!0}),e.signal)})},S=pPe(e.options,e.fetchOptions),T=async(I,L,F)=>{if(v)return Promise.reject();if(L==null&&I.pages.length)return Promise.resolve(I);const $={client:e.client,queryKey:e.queryKey,pageParam:L,direction:F?"backward":"forward",meta:e.options.meta};C($);const O=await S($),{maxPages:U}=e.options,Y=F?Ryt:Lyt;return{pages:Y(I.pages,O,U),pageParams:Y(I.pageParams,L,U)}};if(s&&a.length){const I=s==="backward",L=I?Kyt:Cxe,F={pages:a,pageParams:o},$=L(r,F);l=await T(F,$,I)}else{const I=t??a.length;do{const L=c===0?o[0]??r.initialPageParam:Cxe(r,l);if(c>0&&L==null)break;l=await T(l,L),c++}while(c<I)}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 Cxe(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 Kyt(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 nl,ty,ny,tN,nN,ry,rN,sN,IAe,Yyt=(IAe=class{constructor(t={}){Wn(this,nl);Wn(this,ty);Wn(this,ny);Wn(this,tN);Wn(this,nN);Wn(this,ry);Wn(this,rN);Wn(this,sN);tn(this,nl,t.queryCache||new Wyt),tn(this,ty,t.mutationCache||new Gyt),tn(this,ny,t.defaultOptions||{}),tn(this,tN,new Map),tn(this,nN,new Map),tn(this,ry,0)}mount(){yb(this,ry)._++,Je(this,ry)===1&&(tn(this,rN,$oe.subscribe(async t=>{t&&(await this.resumePausedMutations(),Je(this,nl).onFocus())})),tn(this,sN,SL.subscribe(async t=>{t&&(await this.resumePausedMutations(),Je(this,nl).onOnline())})))}unmount(){var t,e;yb(this,ry)._--,Je(this,ry)===0&&((t=Je(this,rN))==null||t.call(this),tn(this,rN,void 0),(e=Je(this,sN))==null||e.call(this),tn(this,sN,void 0))}isFetching(t){return Je(this,nl).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Je(this,ty).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Je(this,nl).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=Je(this,nl).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(k4(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return Je(this,nl).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=Je(this,nl).get(r.queryHash),a=s==null?void 0:s.state.data,o=Oyt(e,a);if(o!==void 0)return Je(this,nl).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return ac.batch(()=>Je(this,nl).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Je(this,nl).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=Je(this,nl);ac.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=Je(this,nl);return ac.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=ac.batch(()=>Je(this,nl).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(Qh).catch(Qh)}invalidateQueries(t,e={}){return ac.batch(()=>(Je(this,nl).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=ac.batch(()=>Je(this,nl).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=Je(this,nl).build(this,e);return n.isStaleByTime(k4(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=wxe(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Qh).catch(Qh)}ensureInfiniteQueryData(t){return t.behavior=wxe(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return SL.isOnline()?Je(this,ty).resumePausedMutations():Promise.resolve()}getQueryCache(){return Je(this,nl)}getMutationCache(){return Je(this,ty)}getDefaultOptions(){return Je(this,ny)}setDefaultOptions(t){tn(this,ny,t)}setQueryDefaults(t,e){Je(this,tN).set(X3(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Je(this,tN).values()],n={};return e.forEach(r=>{Z9(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){Je(this,nN).set(X3(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Je(this,nN).values()],n={};return e.forEach(r=>{Z9(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Je(this,ny).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Roe(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===Boe&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...Je(this,ny).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Je(this,nl).clear(),Je(this,ty).clear()}},nl=new WeakMap,ty=new WeakMap,ny=new WeakMap,tN=new WeakMap,nN=new WeakMap,ry=new WeakMap,rN=new WeakMap,sN=new WeakMap,IAe),qd,ra,Vk,nd,$w,iN,sy,iy,Wk,aN,oN,Uw,zw,ay,lN,Ba,Q7,Oee,Mee,Lee,Ree,Dee,Bee,$ee,wPe,FAe,Xyt=(FAe=class extends r8{constructor(e,n){super();Wn(this,Ba);Wn(this,qd);Wn(this,ra);Wn(this,Vk);Wn(this,nd);Wn(this,$w);Wn(this,iN);Wn(this,sy);Wn(this,iy);Wn(this,Wk);Wn(this,aN);Wn(this,oN);Wn(this,Uw);Wn(this,zw);Wn(this,ay);Wn(this,lN,new Set);this.options=n,tn(this,qd,e),tn(this,iy,null),tn(this,sy,Fee()),this.options.experimental_prefetchInRender||Je(this,sy).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&&(Je(this,ra).addObserver(this),Nxe(Je(this,ra),this.options)?Er(this,Ba,Q7).call(this):this.updateResult(),Er(this,Ba,Ree).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Uee(Je(this,ra),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Uee(Je(this,ra),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Er(this,Ba,Dee).call(this),Er(this,Ba,Bee).call(this),Je(this,ra).removeObserver(this)}setOptions(e){const n=this.options,r=Je(this,ra);if(this.options=Je(this,qd).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof lm(this.options.enabled,Je(this,ra))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Er(this,Ba,$ee).call(this),Je(this,ra).setOptions(this.options),n._defaulted&&!NL(this.options,n)&&Je(this,qd).getQueryCache().notify({type:"observerOptionsUpdated",query:Je(this,ra),observer:this});const s=this.hasListeners();s&&Sxe(Je(this,ra),r,this.options,n)&&Er(this,Ba,Q7).call(this),this.updateResult(),s&&(Je(this,ra)!==r||lm(this.options.enabled,Je(this,ra))!==lm(n.enabled,Je(this,ra))||k4(this.options.staleTime,Je(this,ra))!==k4(n.staleTime,Je(this,ra)))&&Er(this,Ba,Oee).call(this);const a=Er(this,Ba,Mee).call(this);s&&(Je(this,ra)!==r||lm(this.options.enabled,Je(this,ra))!==lm(n.enabled,Je(this,ra))||a!==Je(this,ay))&&Er(this,Ba,Lee).call(this,a)}getOptimisticResult(e){const n=Je(this,qd).getQueryCache().build(Je(this,qd),e),r=this.createResult(n,e);return Zyt(this,r)&&(tn(this,nd,r),tn(this,iN,this.options),tn(this,$w,Je(this,ra).state)),r}getCurrentResult(){return Je(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){Je(this,lN).add(e)}getCurrentQuery(){return Je(this,ra)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=Je(this,qd).defaultQueryOptions(e),r=Je(this,qd).getQueryCache().build(Je(this,qd),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Er(this,Ba,Q7).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),Je(this,nd)))}createResult(e,n){var Y;const r=Je(this,ra),s=this.options,a=Je(this,nd),o=Je(this,$w),l=Je(this,iN),u=e!==r?e.state:Je(this,Vk),{state:d}=e;let f={...d},x=!1,g;if(n._optimisticResults){const re=this.hasListeners(),Q=!re&&Nxe(e,n),q=re&&Sxe(e,r,n,s);(Q||q)&&(f={...f,...yPe(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:v,status:C}=f;g=f.data;let S=!1;if(n.placeholderData!==void 0&&g===void 0&&C==="pending"){let re;a!=null&&a.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(re=a.data,S=!0):re=typeof n.placeholderData=="function"?n.placeholderData((Y=Je(this,oN))==null?void 0:Y.state.data,Je(this,oN)):n.placeholderData,re!==void 0&&(C="success",g=Iee(a==null?void 0:a.data,re,n),x=!0)}if(n.select&&g!==void 0&&!S)if(a&&g===(o==null?void 0:o.data)&&n.select===Je(this,Wk))g=Je(this,aN);else try{tn(this,Wk,n.select),g=n.select(g),g=Iee(a==null?void 0:a.data,g,n),tn(this,aN,g),tn(this,iy,null)}catch(re){tn(this,iy,re)}Je(this,iy)&&(y=Je(this,iy),g=Je(this,aN),v=Date.now(),C="error");const T=f.fetchStatus==="fetching",I=C==="pending",L=C==="error",F=I&&T,$=g!==void 0,U={status:C,fetchStatus:f.fetchStatus,isPending:I,isSuccess:C==="success",isError:L,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:T,isRefetching:T&&!I,isLoadingError:L&&!$,isPaused:f.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:L&&$,isStale:Uoe(e,n),refetch:this.refetch,promise:Je(this,sy)};if(this.options.experimental_prefetchInRender){const re=te=>{U.status==="error"?te.reject(U.error):U.data!==void 0&&te.resolve(U.data)},Q=()=>{const te=tn(this,sy,U.promise=Fee());re(te)},q=Je(this,sy);switch(q.status){case"pending":e.queryHash===r.queryHash&&re(q);break;case"fulfilled":(U.status==="error"||U.data!==q.value)&&Q();break;case"rejected":(U.status!=="error"||U.error!==q.reason)&&Q();break}}return U}updateResult(){const e=Je(this,nd),n=this.createResult(Je(this,ra),this.options);if(tn(this,$w,Je(this,ra).state),tn(this,iN,this.options),Je(this,$w).data!==void 0&&tn(this,oN,Je(this,ra)),NL(n,e))return;tn(this,nd,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!Je(this,lN).size)return!0;const o=new Set(a??Je(this,lN));return this.options.throwOnError&&o.add("error"),Object.keys(Je(this,nd)).some(l=>{const c=l;return Je(this,nd)[c]!==e[c]&&o.has(c)})};Er(this,Ba,wPe).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Er(this,Ba,Ree).call(this)}},qd=new WeakMap,ra=new WeakMap,Vk=new WeakMap,nd=new WeakMap,$w=new WeakMap,iN=new WeakMap,sy=new WeakMap,iy=new WeakMap,Wk=new WeakMap,aN=new WeakMap,oN=new WeakMap,Uw=new WeakMap,zw=new WeakMap,ay=new WeakMap,lN=new WeakMap,Ba=new WeakSet,Q7=function(e){Er(this,Ba,$ee).call(this);let n=Je(this,ra).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Qh)),n},Oee=function(){Er(this,Ba,Dee).call(this);const e=k4(this.options.staleTime,Je(this,ra));if(Y3||Je(this,nd).isStale||!Tee(e))return;const r=hPe(Je(this,nd).dataUpdatedAt,e)+1;tn(this,Uw,setTimeout(()=>{Je(this,nd).isStale||this.updateResult()},r))},Mee=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Je(this,ra)):this.options.refetchInterval)??!1},Lee=function(e){Er(this,Ba,Bee).call(this),tn(this,ay,e),!(Y3||lm(this.options.enabled,Je(this,ra))===!1||!Tee(Je(this,ay))||Je(this,ay)===0)&&tn(this,zw,setInterval(()=>{(this.options.refetchIntervalInBackground||$oe.isFocused())&&Er(this,Ba,Q7).call(this)},Je(this,ay)))},Ree=function(){Er(this,Ba,Oee).call(this),Er(this,Ba,Lee).call(this,Er(this,Ba,Mee).call(this))},Dee=function(){Je(this,Uw)&&(clearTimeout(Je(this,Uw)),tn(this,Uw,void 0))},Bee=function(){Je(this,zw)&&(clearInterval(Je(this,zw)),tn(this,zw,void 0))},$ee=function(){const e=Je(this,qd).getQueryCache().build(Je(this,qd),this.options);if(e===Je(this,ra))return;const n=Je(this,ra);tn(this,ra,e),tn(this,Vk,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},wPe=function(e){ac.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(Je(this,nd))}),Je(this,qd).getQueryCache().notify({query:Je(this,ra),type:"observerResultsUpdated"})})},FAe);function Qyt(t,e){return lm(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Nxe(t,e){return Qyt(t,e)||t.state.data!==void 0&&Uee(t,e,e.refetchOnMount)}function Uee(t,e,n){if(lm(e.enabled,t)!==!1){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Uoe(t,e)}return!1}function Sxe(t,e,n,r){return(t!==e||lm(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Uoe(t,n)}function Uoe(t,e){return lm(e.enabled,t)!==!1&&t.isStaleByTime(k4(e.staleTime,t))}function Zyt(t,e){return!NL(t.getCurrentResult(),e)}var oy,ly,Gd,_g,h1,KO,zee,OAe,Jyt=(OAe=class extends r8{constructor(n,r){super();Wn(this,h1);Wn(this,oy);Wn(this,ly);Wn(this,Gd);Wn(this,_g);tn(this,oy,n),this.setOptions(r),this.bindMethods(),Er(this,h1,KO).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=Je(this,oy).defaultMutationOptions(n),NL(this.options,r)||Je(this,oy).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Je(this,Gd),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&X3(r.mutationKey)!==X3(this.options.mutationKey)?this.reset():((s=Je(this,Gd))==null?void 0:s.state.status)==="pending"&&Je(this,Gd).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=Je(this,Gd))==null||n.removeObserver(this)}onMutationUpdate(n){Er(this,h1,KO).call(this),Er(this,h1,zee).call(this,n)}getCurrentResult(){return Je(this,ly)}reset(){var n;(n=Je(this,Gd))==null||n.removeObserver(this),tn(this,Gd,void 0),Er(this,h1,KO).call(this),Er(this,h1,zee).call(this)}mutate(n,r){var s;return tn(this,_g,r),(s=Je(this,Gd))==null||s.removeObserver(this),tn(this,Gd,Je(this,oy).getMutationCache().build(Je(this,oy),this.options)),Je(this,Gd).addObserver(this),Je(this,Gd).execute(n)}},oy=new WeakMap,ly=new WeakMap,Gd=new WeakMap,_g=new WeakMap,h1=new WeakSet,KO=function(){var r;const n=((r=Je(this,Gd))==null?void 0:r.state)??vPe();tn(this,ly,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},zee=function(n){ac.batch(()=>{var r,s,a,o,l,c,u,d;if(Je(this,_g)&&this.hasListeners()){const f=Je(this,ly).variables,x=Je(this,ly).context;(n==null?void 0:n.type)==="success"?((s=(r=Je(this,_g)).onSuccess)==null||s.call(r,n.data,f,x),(o=(a=Je(this,_g)).onSettled)==null||o.call(a,n.data,null,f,x)):(n==null?void 0:n.type)==="error"&&((c=(l=Je(this,_g)).onError)==null||c.call(l,n.error,f,x),(d=(u=Je(this,_g)).onSettled)==null||d.call(u,void 0,n.error,f,x))}this.listeners.forEach(f=>{f(Je(this,ly))})})},OAe);function e2t(t,e){return Doe(t,e)}function t2t(t){return JSON.stringify(t,(e,n)=>n2t(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):typeof n=="bigint"?n.toString():n)}function n2t(t){if(!jxe(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const n=e.prototype;return!(!jxe(n)||!n.hasOwnProperty("isPrototypeOf"))}function jxe(t){return Object.prototype.toString.call(t)==="[object Object]"}function F$(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:S,initialPageParam:T,_optimisticResults:I,enabled:L,notifyOnChangeProps:F,placeholderData:$,refetchInterval:O,refetchIntervalInBackground:U,refetchOnMount:Y,refetchOnReconnect:re,refetchOnWindowFocus:Q,retryOnMount:q,select:te,staleTime:fe,suspense:G,throwOnError:ie,config:oe,connector:K,query:H,...ee}=t;return ee}function r2t(t){return{mutationFn(e){return kbt(t,e)},mutationKey:["connect"]}}function s2t(t){return{mutationFn(e){return Dbt(t,e)},mutationKey:["disconnect"]}}function i2t(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 Ubt(t,{...a,address:r})??null},queryKey:a2t(e)}}function a2t(t={}){return["balance",F$(t)]}function o2t(t,e={}){return{async queryFn({queryKey:n}){const{name:r,scopeKey:s,...a}=n[1];if(!r)throw new Error("name is required");return Hbt(t,{...a,name:r})},queryKey:l2t(e)}}function l2t(t={}){return["ensAvatar",F$(t)]}function c2t(t,e={}){return{async queryFn({queryKey:n}){const{address:r,scopeKey:s,...a}=n[1];if(!r)throw new Error("address is required");return Vbt(t,{...a,address:r})},queryKey:u2t(e)}}function u2t(t={}){return["ensName",F$(t)]}function d2t(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 oPe(t,{abi:r,functionName:s,args:o.args,...l,...o})},queryKey:f2t(e)}}function f2t(t={}){const{abi:e,...n}=t;return["readContract",F$(n)]}function h2t(t){return{mutationFn(e){return qbt(t,e)},mutationKey:["signMessage"]}}function p2t(t){return{mutationFn(e){return Gbt(t,e)},mutationKey:["signTypedData"]}}function m2t(t){return{mutationFn(e){return Ybt(t,e)},mutationKey:["switchChain"]}}function x2t(t){return{mutationFn(e){return eyt(t,e)},mutationKey:["writeContract"]}}var CPe=h.createContext(void 0),NPe=t=>{const e=h.useContext(CPe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},g2t=({client:t,children:e})=>(h.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),i.jsx(CPe.Provider,{value:t,children:e})),SPe=h.createContext(!1),b2t=()=>h.useContext(SPe);SPe.Provider;function y2t(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var v2t=h.createContext(y2t()),w2t=()=>h.useContext(v2t);function jPe(t,e){return typeof t=="function"?t(...e):!!t}function Hee(){}var C2t=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},N2t=t=>{h.useEffect(()=>{t.clearReset()},[t])},S2t=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||jPe(n,[t.error,r])),j2t=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)))},A2t=(t,e)=>t.isLoading&&t.isFetching&&!e,_2t=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Axe=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function E2t(t,e,n){var f,x,g,y,v;const r=NPe(),s=b2t(),a=w2t(),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",j2t(o),C2t(o,a),N2t(a);const l=!r.getQueryCache().get(o.queryHash),[c]=h.useState(()=>new e(r,o)),u=c.getOptimisticResult(o),d=!s&&t.subscribed!==!1;if(h.useSyncExternalStore(h.useCallback(C=>{const S=d?c.subscribe(ac.batchCalls(C)):Hee;return c.updateResult(),S},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),h.useEffect(()=>{c.setOptions(o)},[o,c]),_2t(o,u))throw Axe(o,c,a);if(S2t({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&&!Y3&&A2t(u,s)){const C=l?Axe(o,c,a):(v=r.getQueryCache().get(o.queryHash))==null?void 0:v.promise;C==null||C.catch(Hee).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function APe(t,e){return E2t(t,Xyt)}function s8(t,e){const n=NPe(),[r]=h.useState(()=>new Jyt(n,t));h.useEffect(()=>{r.setOptions(t)},[r,t]);const s=h.useSyncExternalStore(h.useCallback(o=>r.subscribe(ac.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=h.useCallback((o,l)=>{r.mutate(o,l).catch(Hee)},[r]);if(s.error&&jPe(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function O$(t){const e=APe({...t,queryKeyHashFn:t2t});return e.queryKey=t.queryKey,e}function i8(t={}){const e=Fl(t);return h.useSyncExternalStore(n=>Xbt(e,{onChange:n}),()=>axe(e),()=>axe(e))}function _Pe(t={}){const{address:e,query:n={}}=t,r=Fl(t),s=i8({config:r}),a=i2t(r,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return O$({...n,...a,enabled:o})}function k2t(t={}){const e=Fl(t);return h.useSyncExternalStore(n=>Eyt(e,{onChange:n}),()=>oxe(e),()=>oxe(e))}function T2t(t={}){const e=Fl(t);return h.useSyncExternalStore(n=>Zbt(e,{onChange:n}),()=>lxe(e),()=>lxe(e))}function P2t(t={}){const{mutation:e}=t,n=Fl(t),r=r2t(n),{mutate:s,mutateAsync:a,...o}=s8({...e,...r});return h.useEffect(()=>n.subscribe(({status:l})=>l,(l,c)=>{c==="connected"&&l==="disconnected"&&o.reset()}),[n,o.reset]),{...o,connect:s,connectAsync:a,connectors:T2t({config:n})}}function I2t(t={}){const e=Fl(t);return h.useSyncExternalStore(n=>Qbt(e,{onChange:n}),()=>Aee(e),()=>Aee(e))}function M$(t={}){const{mutation:e}=t,n=Fl(t),r=s2t(n),{mutate:s,mutateAsync:a,...o}=s8({...e,...r});return{...o,connectors:I2t({config:n}).map(l=>l.connector),disconnect:s,disconnectAsync:a}}function F2t(t={}){const{name:e,query:n={}}=t,r=Fl(t),s=i8({config:r}),a=o2t(r,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return O$({...n,...a,enabled:o})}function O2t(t={}){const{address:e,query:n={}}=t,r=Fl(t),s=i8({config:r}),a=c2t(r,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return O$({...n,...a,enabled:o})}function EPe(t={}){const e=Fl(t);return dPe.useSyncExternalStoreWithSelector(n=>Jbt(e,{onChange:n}),()=>_ee(e,t),()=>_ee(e,t),n=>n,(n,r)=>(n==null?void 0:n.uid)===(r==null?void 0:r.uid))}function _xe(t={}){const{abi:e,address:n,functionName:r,query:s={}}=t,a=t.code,o=Fl(t),l=i8({config:o}),c=d2t(o,{...t,chainId:t.chainId??l}),u=!!((n||a)&&e&&r&&(s.enabled??!0));return O$({...s,...c,enabled:u,structuralSharing:s.structuralSharing??e2t})}function zoe(t={}){const{mutation:e}=t,n=Fl(t),r=h2t(n),{mutate:s,mutateAsync:a,...o}=s8({...e,...r});return{...o,signMessage:s,signMessageAsync:a}}function M2t(t={}){const{mutation:e}=t,n=Fl(t),r=p2t(n),{mutate:s,mutateAsync:a,...o}=s8({...e,...r});return{...o,signTypedData:s,signTypedDataAsync:a}}function Hoe(t={}){const{mutation:e}=t,n=Fl(t),r=m2t(n),{mutate:s,mutateAsync:a,...o}=s8({...e,...r});return{...o,chains:k2t({config:n}),switchChain:s,switchChainAsync:a}}function L2t(t={}){const{mutation:e}=t,n=Fl(t),r=x2t(n),{mutate:s,mutateAsync:a,...o}=s8({...e,...r});return{...o,writeContract:s,writeContractAsync:a}}const dx=Object.create(null);dx.open="0";dx.close="1";dx.ping="2";dx.pong="3";dx.message="4";dx.upgrade="5";dx.noop="6";const YO=Object.create(null);Object.keys(dx).forEach(t=>{YO[dx[t]]=t});const Vee={type:"error",data:"parser error"},kPe=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",TPe=typeof ArrayBuffer=="function",PPe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Voe=({type:t,data:e},n,r)=>kPe&&e instanceof Blob?n?r(e):Exe(e,r):TPe&&(e instanceof ArrayBuffer||PPe(e))?n?r(e):Exe(new Blob([e]),r):r(dx[t]+(e||"")),Exe=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function kxe(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let HV;function R2t(t,e){if(kPe&&t.data instanceof Blob)return t.data.arrayBuffer().then(kxe).then(e);if(TPe&&(t.data instanceof ArrayBuffer||PPe(t.data)))return e(kxe(t.data));Voe(t,!1,n=>{HV||(HV=new TextEncoder),e(HV.encode(n))})}const Txe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Z7=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Txe.length;t++)Z7[Txe.charCodeAt(t)]=t;const D2t=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=Z7[t.charCodeAt(r)],o=Z7[t.charCodeAt(r+1)],l=Z7[t.charCodeAt(r+2)],c=Z7[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},B2t=typeof ArrayBuffer=="function",Woe=(t,e)=>{if(typeof t!="string")return{type:"message",data:IPe(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:$2t(t.substring(1),e)}:YO[n]?t.length>1?{type:YO[n],data:t.substring(1)}:{type:YO[n]}:Vee},$2t=(t,e)=>{if(B2t){const n=D2t(t);return IPe(n,e)}else return{base64:!0,data:t}},IPe=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},FPe="",U2t=(t,e)=>{const n=t.length,r=new Array(n);let s=0;t.forEach((a,o)=>{Voe(a,!1,l=>{r[o]=l,++s===n&&e(r.join(FPe))})})},z2t=(t,e)=>{const n=t.split(FPe),r=[];for(let s=0;s<n.length;s++){const a=Woe(n[s],e);if(r.push(a),a.type==="error")break}return r};function H2t(){return new TransformStream({transform(t,e){R2t(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 VV;function $I(t){return t.reduce((e,n)=>e+n.length,0)}function UI(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 V2t(t,e){VV||(VV=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($I(n)<1)break;const c=UI(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($I(n)<2)break;const c=UI(n,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if($I(n)<8)break;const c=UI(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){l.enqueue(Vee);break}s=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if($I(n)<s)break;const c=UI(n,s);l.enqueue(Woe(a?c:VV.decode(c),e)),r=0}if(s===0||s>t){l.enqueue(Vee);break}}}})}const OPe=4;function ql(t){if(t)return W2t(t)}function W2t(t){for(var e in ql.prototype)t[e]=ql.prototype[e];return t}ql.prototype.on=ql.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};ql.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};ql.prototype.off=ql.prototype.removeListener=ql.prototype.removeAllListeners=ql.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};ql.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};ql.prototype.emitReserved=ql.prototype.emit;ql.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};ql.prototype.hasListeners=function(t){return!!this.listeners(t).length};const L$=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")(),q2t="arraybuffer";function MPe(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const G2t=np.setTimeout,K2t=np.clearTimeout;function R$(t,e){e.useNativeTimers?(t.setTimeoutFn=G2t.bind(np),t.clearTimeoutFn=K2t.bind(np)):(t.setTimeoutFn=np.setTimeout.bind(np),t.clearTimeoutFn=np.clearTimeout.bind(np))}const Y2t=1.33;function X2t(t){return typeof t=="string"?Q2t(t):Math.ceil((t.byteLength||t.size)*Y2t)}function Q2t(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 LPe(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Z2t(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function J2t(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 evt extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}let qoe=class extends ql{constructor(e){super(),this.writable=!1,R$(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 evt(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=Woe(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=Z2t(e);return n.length?"?"+n:""}};class tvt extends qoe{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)};z2t(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,U2t(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]=LPe()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let RPe=!1;try{RPe=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const nvt=RPe;function rvt(){}class svt extends tvt{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 T4=class XO extends ql{constructor(e,n,r){super(),this.createRequest=e,R$(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=MPe(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=XO.requestsCount++,XO.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=rvt,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete XO.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()}};T4.requestsCount=0;T4.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Pxe);else if(typeof addEventListener=="function"){const t="onpagehide"in np?"pagehide":"unload";addEventListener(t,Pxe,!1)}}function Pxe(){for(let t in T4.requests)T4.requests.hasOwnProperty(t)&&T4.requests[t].abort()}const ivt=function(){const t=DPe({xdomain:!1});return t&&t.responseType!==null}();class avt extends svt{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=ivt&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new T4(DPe,this.uri(),e)}}function DPe(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||nvt))return new XMLHttpRequest}catch{}if(!e)try{return new np[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const BPe=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ovt extends qoe{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=BPe?{}:MPe(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;Voe(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}s&&L$(()=>{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]=LPe()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const WV=np.WebSocket||np.MozWebSocket;let lvt=class extends ovt{createSocket(e,n,r){return BPe?new WV(e,n,r):n?new WV(e,n):new WV(e)}doWrite(e,n){this.ws.send(n)}};class cvt extends qoe{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=V2t(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),s=H2t();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&&L$(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const uvt={websocket:lvt,webtransport:cvt,polling:avt},dvt=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,fvt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Wee(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=dvt.exec(t||""),a={},o=14;for(;o--;)a[fvt[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=hvt(a,a.path),a.queryKey=pvt(a,a.query),a}function hvt(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 pvt(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,a){s&&(n[s]=a)}),n}const qee=typeof addEventListener=="function"&&typeof removeEventListener=="function",QO=[];qee&&addEventListener("offline",()=>{QO.forEach(t=>t())},!1);class $y extends ql{constructor(e,n){if(super(),this.binaryType=q2t,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=Wee(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=Wee(n.host).host);R$(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=J2t(this.opts.query)),qee&&(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"})},QO.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=OPe,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&&$y.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",$y.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+=X2t(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,L$(()=>{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($y.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(),qee&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=QO.indexOf(this._offlineEventListener);r!==-1&&QO.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}$y.protocol=OPe;class mvt extends $y{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;$y.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;$y.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 xvt=class extends mvt{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=>uvt[s]).filter(s=>!!s)),super(e,r)}};function gvt(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=Wee(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 bvt=typeof ArrayBuffer=="function",yvt=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,$Pe=Object.prototype.toString,vvt=typeof Blob=="function"||typeof Blob<"u"&&$Pe.call(Blob)==="[object BlobConstructor]",wvt=typeof File=="function"||typeof File<"u"&&$Pe.call(File)==="[object FileConstructor]";function Goe(t){return bvt&&(t instanceof ArrayBuffer||yvt(t))||vvt&&t instanceof Blob||wvt&&t instanceof File}function ZO(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(ZO(t[n]))return!0;return!1}if(Goe(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return ZO(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&ZO(t[n]))return!0;return!1}function Cvt(t){const e=[],n=t.data,r=t;return r.data=Gee(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Gee(t,e){if(!t)return t;if(Goe(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]=Gee(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]=Gee(t[r],e));return n}return t}function Nvt(t,e){return t.data=Kee(t.data,e),delete t.attachments,t}function Kee(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]=Kee(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Kee(t[n],e));return t}const Svt=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],jvt=5;var ia;(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"})(ia||(ia={}));let Avt=class{constructor(e){this.replacer=e}encode(e){return(e.type===ia.EVENT||e.type===ia.ACK)&&ZO(e)?this.encodeAsBinary({type:e.type===ia.EVENT?ia.BINARY_EVENT:ia.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===ia.BINARY_EVENT||e.type===ia.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=Cvt(e),r=this.encodeAsString(n.packet),s=n.buffers;return s.unshift(r),s}};function Ixe(t){return Object.prototype.toString.call(t)==="[object Object]"}class Koe extends ql{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===ia.BINARY_EVENT;r||n.type===ia.BINARY_ACK?(n.type=r?ia.EVENT:ia.ACK,this.reconstructor=new _vt(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Goe(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(ia[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ia.BINARY_EVENT||r.type===ia.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 ia.CONNECT:return Ixe(n);case ia.DISCONNECT:return n===void 0;case ia.CONNECT_ERROR:return typeof n=="string"||Ixe(n);case ia.EVENT:case ia.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&Svt.indexOf(n[0])===-1);case ia.ACK:case ia.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class _vt{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=Nvt(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Evt=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Koe,Encoder:Avt,get PacketType(){return ia},protocol:jvt},Symbol.toStringTag,{value:"Module"}));function rm(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const kvt=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class UPe extends ql{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(kvt.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:ia.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:ia.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 ia.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 ia.EVENT:case ia.BINARY_EVENT:this.onevent(e);break;case ia.ACK:case ia.BINARY_ACK:this.onack(e);break;case ia.DISCONNECT:this.ondisconnect();break;case ia.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:ia.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:ia.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 a8(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}a8.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};a8.prototype.reset=function(){this.attempts=0};a8.prototype.setMin=function(t){this.ms=t};a8.prototype.setMax=function(t){this.max=t};a8.prototype.setJitter=function(t){this.jitter=t};class Yee extends ql{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,R$(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 a8({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||Evt;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 xvt(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){L$(()=>{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 UPe(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 n7={};function K0(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=gvt(t,e.path||"/socket.io"),r=n.source,s=n.id,a=n.path,o=n7[s]&&a in n7[s].nsps,l=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return l?c=new Yee(r,e):(n7[s]||(n7[s]=new Yee(r,e)),c=n7[s]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(K0,{Manager:Yee,Socket:UPe,io:K0,connect:K0});function zPe(t,e){return function(){return t.apply(e,arguments)}}const{toString:Tvt}=Object.prototype,{getPrototypeOf:Yoe}=Object,D$=(t=>e=>{const n=Tvt.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Om=t=>(t=t.toLowerCase(),e=>D$(e)===t),B$=t=>e=>typeof e===t,{isArray:o8}=Array,J9=B$("undefined");function Pvt(t){return t!==null&&!J9(t)&&t.constructor!==null&&!J9(t.constructor)&&eh(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const HPe=Om("ArrayBuffer");function Ivt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&HPe(t.buffer),e}const Fvt=B$("string"),eh=B$("function"),VPe=B$("number"),$$=t=>t!==null&&typeof t=="object",Ovt=t=>t===!0||t===!1,JO=t=>{if(D$(t)!=="object")return!1;const e=Yoe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Mvt=Om("Date"),Lvt=Om("File"),Rvt=Om("Blob"),Dvt=Om("FileList"),Bvt=t=>$$(t)&&eh(t.pipe),$vt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||eh(t.append)&&((e=D$(t))==="formdata"||e==="object"&&eh(t.toString)&&t.toString()==="[object FormData]"))},Uvt=Om("URLSearchParams"),[zvt,Hvt,Vvt,Wvt]=["ReadableStream","Request","Response","Headers"].map(Om),qvt=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function FT(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),o8(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 WPe(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 xw=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,qPe=t=>!J9(t)&&t!==xw;function Xee(){const{caseless:t}=qPe(this)&&this||{},e={},n=(r,s)=>{const a=t&&WPe(e,s)||s;JO(e[a])&&JO(r)?e[a]=Xee(e[a],r):JO(r)?e[a]=Xee({},r):o8(r)?e[a]=r.slice():e[a]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&FT(arguments[r],n);return e}const Gvt=(t,e,n,{allOwnKeys:r}={})=>(FT(e,(s,a)=>{n&&eh(s)?t[a]=zPe(s,n):t[a]=s},{allOwnKeys:r}),t),Kvt=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Yvt=(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)},Xvt=(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&&Yoe(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Qvt=(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},Zvt=t=>{if(!t)return null;if(o8(t))return t;let e=t.length;if(!VPe(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Jvt=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Yoe(Uint8Array)),ewt=(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])}},twt=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},nwt=Om("HTMLFormElement"),rwt=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Fxe=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),swt=Om("RegExp"),GPe=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};FT(n,(s,a)=>{let o;(o=e(s,a,t))!==!1&&(r[a]=o||s)}),Object.defineProperties(t,r)},iwt=t=>{GPe(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+"'")})}})},awt=(t,e)=>{const n={},r=s=>{s.forEach(a=>{n[a]=!0})};return o8(t)?r(t):r(String(t).split(e)),n},owt=()=>{},lwt=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,qV="abcdefghijklmnopqrstuvwxyz",Oxe="0123456789",KPe={DIGIT:Oxe,ALPHA:qV,ALPHA_DIGIT:qV+qV.toUpperCase()+Oxe},cwt=(t=16,e=KPe.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n};function uwt(t){return!!(t&&eh(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const dwt=t=>{const e=new Array(10),n=(r,s)=>{if($$(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const a=o8(r)?[]:{};return FT(r,(o,l)=>{const c=n(o,s+1);!J9(c)&&(a[l]=c)}),e[s]=void 0,a}}return r};return n(t,0)},fwt=Om("AsyncFunction"),hwt=t=>t&&($$(t)||eh(t))&&eh(t.then)&&eh(t.catch),YPe=((t,e)=>t?setImmediate:e?((n,r)=>(xw.addEventListener("message",({source:s,data:a})=>{s===xw&&a===n&&r.length&&r.shift()()},!1),s=>{r.push(s),xw.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",eh(xw.postMessage)),pwt=typeof queueMicrotask<"u"?queueMicrotask.bind(xw):typeof process<"u"&&process.nextTick||YPe,Ar={isArray:o8,isArrayBuffer:HPe,isBuffer:Pvt,isFormData:$vt,isArrayBufferView:Ivt,isString:Fvt,isNumber:VPe,isBoolean:Ovt,isObject:$$,isPlainObject:JO,isReadableStream:zvt,isRequest:Hvt,isResponse:Vvt,isHeaders:Wvt,isUndefined:J9,isDate:Mvt,isFile:Lvt,isBlob:Rvt,isRegExp:swt,isFunction:eh,isStream:Bvt,isURLSearchParams:Uvt,isTypedArray:Jvt,isFileList:Dvt,forEach:FT,merge:Xee,extend:Gvt,trim:qvt,stripBOM:Kvt,inherits:Yvt,toFlatObject:Xvt,kindOf:D$,kindOfTest:Om,endsWith:Qvt,toArray:Zvt,forEachEntry:ewt,matchAll:twt,isHTMLForm:nwt,hasOwnProperty:Fxe,hasOwnProp:Fxe,reduceDescriptors:GPe,freezeMethods:iwt,toObjectSet:awt,toCamelCase:rwt,noop:owt,toFiniteNumber:lwt,findKey:WPe,global:xw,isContextDefined:qPe,ALPHABET:KPe,generateString:cwt,isSpecCompliantForm:uwt,toJSONObject:dwt,isAsyncFn:fwt,isThenable:hwt,setImmediate:YPe,asap:pwt};function Ii(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)}Ar.inherits(Ii,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:Ar.toJSONObject(this.config),code:this.code,status:this.status}}});const XPe=Ii.prototype,QPe={};["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=>{QPe[t]={value:t}});Object.defineProperties(Ii,QPe);Object.defineProperty(XPe,"isAxiosError",{value:!0});Ii.from=(t,e,n,r,s,a)=>{const o=Object.create(XPe);return Ar.toFlatObject(t,o,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),Ii.call(o,t.message,e,n,r,s),o.cause=t,o.name=t.name,a&&Object.assign(o,a),o};const mwt=null;function Qee(t){return Ar.isPlainObject(t)||Ar.isArray(t)}function ZPe(t){return Ar.endsWith(t,"[]")?t.slice(0,-2):t}function Mxe(t,e,n){return t?t.concat(e).map(function(s,a){return s=ZPe(s),!n&&a?"["+s+"]":s}).join(n?".":""):e}function xwt(t){return Ar.isArray(t)&&!t.some(Qee)}const gwt=Ar.toFlatObject(Ar,{},null,function(e){return/^is[A-Z]/.test(e)});function U$(t,e,n){if(!Ar.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Ar.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,C){return!Ar.isUndefined(C[v])});const r=n.metaTokens,s=n.visitor||d,a=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&Ar.isSpecCompliantForm(e);if(!Ar.isFunction(s))throw new TypeError("visitor must be a function");function u(y){if(y===null)return"";if(Ar.isDate(y))return y.toISOString();if(!c&&Ar.isBlob(y))throw new Ii("Blob is not supported. Use a Buffer instead.");return Ar.isArrayBuffer(y)||Ar.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function d(y,v,C){let S=y;if(y&&!C&&typeof y=="object"){if(Ar.endsWith(v,"{}"))v=r?v:v.slice(0,-2),y=JSON.stringify(y);else if(Ar.isArray(y)&&xwt(y)||(Ar.isFileList(y)||Ar.endsWith(v,"[]"))&&(S=Ar.toArray(y)))return v=ZPe(v),S.forEach(function(I,L){!(Ar.isUndefined(I)||I===null)&&e.append(o===!0?Mxe([v],L,a):o===null?v:v+"[]",u(I))}),!1}return Qee(y)?!0:(e.append(Mxe(C,v,a),u(y)),!1)}const f=[],x=Object.assign(gwt,{defaultVisitor:d,convertValue:u,isVisitable:Qee});function g(y,v){if(!Ar.isUndefined(y)){if(f.indexOf(y)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(y),Ar.forEach(y,function(S,T){(!(Ar.isUndefined(S)||S===null)&&s.call(e,S,Ar.isString(T)?T.trim():T,v,x))===!0&&g(S,v?v.concat(T):[T])}),f.pop()}}if(!Ar.isObject(t))throw new TypeError("data must be an object");return g(t),e}function Lxe(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Xoe(t,e){this._pairs=[],t&&U$(t,this,e)}const JPe=Xoe.prototype;JPe.append=function(e,n){this._pairs.push([e,n])};JPe.toString=function(e){const n=e?function(r){return e.call(this,r,Lxe)}:Lxe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function bwt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function eIe(t,e,n){if(!e)return t;const r=n&&n.encode||bwt;Ar.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let a;if(s?a=s(e,n):a=Ar.isURLSearchParams(e)?e.toString():new Xoe(e,n).toString(r),a){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class Rxe{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){Ar.forEach(this.handlers,function(r){r!==null&&e(r)})}}const tIe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ywt=typeof URLSearchParams<"u"?URLSearchParams:Xoe,vwt=typeof FormData<"u"?FormData:null,wwt=typeof Blob<"u"?Blob:null,Cwt={isBrowser:!0,classes:{URLSearchParams:ywt,FormData:vwt,Blob:wwt},protocols:["http","https","file","blob","url","data"]},Qoe=typeof window<"u"&&typeof document<"u",Zee=typeof navigator=="object"&&navigator||void 0,Nwt=Qoe&&(!Zee||["ReactNative","NativeScript","NS"].indexOf(Zee.product)<0),Swt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",jwt=Qoe&&window.location.href||"http://localhost",Awt=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Qoe,hasStandardBrowserEnv:Nwt,hasStandardBrowserWebWorkerEnv:Swt,navigator:Zee,origin:jwt},Symbol.toStringTag,{value:"Module"})),Mu={...Awt,...Cwt};function _wt(t,e){return U$(t,new Mu.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,a){return Mu.isNode&&Ar.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},e))}function Ewt(t){return Ar.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function kwt(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 nIe(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&&Ar.isArray(s)?s.length:o,c?(Ar.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!Ar.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],a)&&Ar.isArray(s[o])&&(s[o]=kwt(s[o])),!l)}if(Ar.isFormData(t)&&Ar.isFunction(t.entries)){const n={};return Ar.forEachEntry(t,(r,s)=>{e(Ewt(r),s,n,0)}),n}return null}function Twt(t,e,n){if(Ar.isString(t))try{return(e||JSON.parse)(t),Ar.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(t)}const OT={transitional:tIe,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,a=Ar.isObject(e);if(a&&Ar.isHTMLForm(e)&&(e=new FormData(e)),Ar.isFormData(e))return s?JSON.stringify(nIe(e)):e;if(Ar.isArrayBuffer(e)||Ar.isBuffer(e)||Ar.isStream(e)||Ar.isFile(e)||Ar.isBlob(e)||Ar.isReadableStream(e))return e;if(Ar.isArrayBufferView(e))return e.buffer;if(Ar.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 _wt(e,this.formSerializer).toString();if((l=Ar.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return U$(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return a||s?(n.setContentType("application/json",!1),Twt(e)):e}],transformResponse:[function(e){const n=this.transitional||OT.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(Ar.isResponse(e)||Ar.isReadableStream(e))return e;if(e&&Ar.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"?Ii.from(l,Ii.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}}};Ar.forEach(["delete","get","head","post","put","patch"],t=>{OT.headers[t]={}});const Pwt=Ar.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"]),Iwt=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]&&Pwt[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Dxe=Symbol("internals");function r7(t){return t&&String(t).trim().toLowerCase()}function eM(t){return t===!1||t==null?t:Ar.isArray(t)?t.map(eM):String(t)}function Fwt(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 Owt=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function GV(t,e,n,r,s){if(Ar.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!Ar.isString(e)){if(Ar.isString(r))return e.indexOf(r)!==-1;if(Ar.isRegExp(r))return r.test(e)}}function Mwt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Lwt(t,e){const n=Ar.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 df{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function a(l,c,u){const d=r7(c);if(!d)throw new Error("header name must be a non-empty string");const f=Ar.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=eM(l))}const o=(l,c)=>Ar.forEach(l,(u,d)=>a(u,d,c));if(Ar.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(Ar.isString(e)&&(e=e.trim())&&!Owt(e))o(Iwt(e),n);else if(Ar.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=r7(e),e){const r=Ar.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return Fwt(s);if(Ar.isFunction(n))return n.call(this,s,r);if(Ar.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=r7(e),e){const r=Ar.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||GV(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function a(o){if(o=r7(o),o){const l=Ar.findKey(r,o);l&&(!n||GV(r,r[l],l,n))&&(delete r[l],s=!0)}}return Ar.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||GV(this,this[a],a,e,!0))&&(delete this[a],s=!0)}return s}normalize(e){const n=this,r={};return Ar.forEach(this,(s,a)=>{const o=Ar.findKey(r,a);if(o){n[o]=eM(s),delete n[a];return}const l=e?Mwt(a):String(a).trim();l!==a&&delete n[a],n[l]=eM(s),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Ar.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&Ar.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[Dxe]=this[Dxe]={accessors:{}}).accessors,s=this.prototype;function a(o){const l=r7(o);r[l]||(Lwt(s,o),r[l]=!0)}return Ar.isArray(e)?e.forEach(a):a(e),this}}df.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ar.reduceDescriptors(df.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});Ar.freezeMethods(df);function KV(t,e){const n=this||OT,r=e||n,s=df.from(r.headers);let a=r.data;return Ar.forEach(t,function(l){a=l.call(n,a,s.normalize(),e?e.status:void 0)}),s.normalize(),a}function rIe(t){return!!(t&&t.__CANCEL__)}function l8(t,e,n){Ii.call(this,t??"canceled",Ii.ERR_CANCELED,e,n),this.name="CanceledError"}Ar.inherits(l8,Ii,{__CANCEL__:!0});function sIe(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Ii("Request failed with status code "+n.status,[Ii.ERR_BAD_REQUEST,Ii.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Rwt(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Dwt(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 Bwt(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 jL=(t,e,n=3)=>{let r=0;const s=Dwt(50,250);return Bwt(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)},Bxe=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},$xe=t=>(...e)=>Ar.asap(()=>t(...e)),$wt=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,Uwt=Mu.hasStandardBrowserEnv?{write(t,e,n,r,s,a){const o=[t+"="+encodeURIComponent(e)];Ar.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),Ar.isString(r)&&o.push("path="+r),Ar.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 zwt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Hwt(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function iIe(t,e){return t&&!zwt(e)?Hwt(t,e):e}const Uxe=t=>t instanceof df?{...t}:t;function Q3(t,e){e=e||{};const n={};function r(u,d,f,x){return Ar.isPlainObject(u)&&Ar.isPlainObject(d)?Ar.merge.call({caseless:x},u,d):Ar.isPlainObject(d)?Ar.merge({},d):Ar.isArray(d)?d.slice():d}function s(u,d,f,x){if(Ar.isUndefined(d)){if(!Ar.isUndefined(u))return r(void 0,u,f,x)}else return r(u,d,f,x)}function a(u,d){if(!Ar.isUndefined(d))return r(void 0,d)}function o(u,d){if(Ar.isUndefined(d)){if(!Ar.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(Uxe(u),Uxe(d),f,!0)};return Ar.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=c[d]||s,x=f(t[d],e[d],d);Ar.isUndefined(x)&&f!==l||(n[d]=x)}),n}const aIe=t=>{const e=Q3({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:a,headers:o,auth:l}=e;e.headers=o=df.from(o),e.url=eIe(iIe(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(Ar.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&&Ar.isFunction(r)&&(r=r(e)),r||r!==!1&&$wt(e.url))){const u=s&&a&&Uwt.read(a);u&&o.set(s,u)}return e},Vwt=typeof XMLHttpRequest<"u",Wwt=Vwt&&function(t){return new Promise(function(n,r){const s=aIe(t);let a=s.data;const o=df.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 S(){if(!C)return;const I=df.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),F={data:!l||l==="text"||l==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:I,config:t,request:C};sIe(function(O){n(O),v()},function(O){r(O),v()},F),C=null}"onloadend"in C?C.onloadend=S:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(S)},C.onabort=function(){C&&(r(new Ii("Request aborted",Ii.ECONNABORTED,t,C)),C=null)},C.onerror=function(){r(new Ii("Network Error",Ii.ERR_NETWORK,t,C)),C=null},C.ontimeout=function(){let L=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const F=s.transitional||tIe;s.timeoutErrorMessage&&(L=s.timeoutErrorMessage),r(new Ii(L,F.clarifyTimeoutError?Ii.ETIMEDOUT:Ii.ECONNABORTED,t,C)),C=null},a===void 0&&o.setContentType(null),"setRequestHeader"in C&&Ar.forEach(o.toJSON(),function(L,F){C.setRequestHeader(F,L)}),Ar.isUndefined(s.withCredentials)||(C.withCredentials=!!s.withCredentials),l&&l!=="json"&&(C.responseType=s.responseType),u&&([x,y]=jL(u,!0),C.addEventListener("progress",x)),c&&C.upload&&([f,g]=jL(c),C.upload.addEventListener("progress",f),C.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(d=I=>{C&&(r(!I||I.type?new l8(null,t,C):I),C.abort(),C=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const T=Rwt(s.url);if(T&&Mu.protocols.indexOf(T)===-1){r(new Ii("Unsupported protocol "+T+":",Ii.ERR_BAD_REQUEST,t));return}C.send(a||null)})},qwt=(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 Ii?d:new l8(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,a(new Ii(`timeout ${e} of ms exceeded`,Ii.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=()=>Ar.asap(l),c}},Gwt=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},Kwt=async function*(t,e){for await(const n of Ywt(t))yield*Gwt(n,e)},Ywt=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()}},zxe=(t,e,n,r)=>{const s=Kwt(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})},z$=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",oIe=z$&&typeof ReadableStream=="function",Xwt=z$&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),lIe=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Qwt=oIe&&lIe(()=>{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}),Hxe=64*1024,Jee=oIe&&lIe(()=>Ar.isReadableStream(new Response("").body)),AL={stream:Jee&&(t=>t.body)};z$&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!AL[e]&&(AL[e]=Ar.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new Ii(`Response type '${e}' is not supported`,Ii.ERR_NOT_SUPPORT,r)})})})(new Response);const Zwt=async t=>{if(t==null)return 0;if(Ar.isBlob(t))return t.size;if(Ar.isSpecCompliantForm(t))return(await new Request(Mu.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Ar.isArrayBufferView(t)||Ar.isArrayBuffer(t))return t.byteLength;if(Ar.isURLSearchParams(t)&&(t=t+""),Ar.isString(t))return(await Xwt(t)).byteLength},Jwt=async(t,e)=>{const n=Ar.toFiniteNumber(t.getContentLength());return n??Zwt(e)},e3t=z$&&(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}=aIe(t);u=u?(u+"").toLowerCase():"text";let g=qwt([s,a&&a.toAbortSignal()],o),y;const v=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let C;try{if(c&&Qwt&&n!=="get"&&n!=="head"&&(C=await Jwt(d,r))!==0){let F=new Request(e,{method:"POST",body:r,duplex:"half"}),$;if(Ar.isFormData(r)&&($=F.headers.get("content-type"))&&d.setContentType($),F.body){const[O,U]=Bxe(C,jL($xe(c)));r=zxe(F.body,Hxe,O,U)}}Ar.isString(f)||(f=f?"include":"omit");const S="credentials"in Request.prototype;y=new Request(e,{...x,signal:g,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:S?f:void 0});let T=await fetch(y);const I=Jee&&(u==="stream"||u==="response");if(Jee&&(l||I&&v)){const F={};["status","statusText","headers"].forEach(Y=>{F[Y]=T[Y]});const $=Ar.toFiniteNumber(T.headers.get("content-length")),[O,U]=l&&Bxe($,jL($xe(l),!0))||[];T=new Response(zxe(T.body,Hxe,O,()=>{U&&U(),v&&v()}),F)}u=u||"text";let L=await AL[Ar.findKey(AL,u)||"text"](T,t);return!I&&v&&v(),await new Promise((F,$)=>{sIe(F,$,{data:L,headers:df.from(T.headers),status:T.status,statusText:T.statusText,config:t,request:y})})}catch(S){throw v&&v(),S&&S.name==="TypeError"&&/fetch/i.test(S.message)?Object.assign(new Ii("Network Error",Ii.ERR_NETWORK,t,y),{cause:S.cause||S}):Ii.from(S,S&&S.code,t,y)}}),ete={http:mwt,xhr:Wwt,fetch:e3t};Ar.forEach(ete,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Vxe=t=>`- ${t}`,t3t=t=>Ar.isFunction(t)||t===null||t===!1,cIe={getAdapter:t=>{t=Ar.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,!t3t(n)&&(r=ete[(o=String(n)).toLowerCase()],r===void 0))throw new Ii(`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(Vxe).join(`
`):" "+Vxe(a[0]):"as no adapter specified";throw new Ii("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:ete};function YV(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new l8(null,t)}function Wxe(t){return YV(t),t.headers=df.from(t.headers),t.data=KV.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),cIe.getAdapter(t.adapter||OT.adapter)(t).then(function(r){return YV(t),r.data=KV.call(t,t.transformResponse,r),r.headers=df.from(r.headers),r},function(r){return rIe(r)||(YV(t),r&&r.response&&(r.response.data=KV.call(t,t.transformResponse,r.response),r.response.headers=df.from(r.response.headers))),Promise.reject(r)})}const uIe="1.7.9",H$={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{H$[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const qxe={};H$.transitional=function(e,n,r){function s(a,o){return"[Axios v"+uIe+"] Transitional option '"+a+"'"+o+(r?". "+r:"")}return(a,o,l)=>{if(e===!1)throw new Ii(s(o," has been removed"+(n?" in "+n:"")),Ii.ERR_DEPRECATED);return n&&!qxe[o]&&(qxe[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}};H$.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function n3t(t,e,n){if(typeof t!="object")throw new Ii("options must be an object",Ii.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 Ii("option "+a+" must be "+c,Ii.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ii("Unknown option "+a,Ii.ERR_BAD_OPTION)}}const tM={assertOptions:n3t,validators:H$},s0=tM.validators;class b3{constructor(e){this.defaults=e,this.interceptors={request:new Rxe,response:new Rxe}}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&&tM.assertOptions(r,{silentJSONParsing:s0.transitional(s0.boolean),forcedJSONParsing:s0.transitional(s0.boolean),clarifyTimeoutError:s0.transitional(s0.boolean)},!1),s!=null&&(Ar.isFunction(s)?n.paramsSerializer={serialize:s}:tM.assertOptions(s,{encode:s0.function,serialize:s0.function},!0)),tM.assertOptions(n,{baseUrl:s0.spelling("baseURL"),withXsrfToken:s0.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=a&&Ar.merge(a.common,a[n.method]);a&&Ar.forEach(["delete","get","head","post","put","patch","common"],y=>{delete a[y]}),n.headers=df.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=[Wxe.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=Wxe.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=iIe(e.baseURL,e.url);return eIe(n,e.params,e.paramsSerializer)}}Ar.forEach(["delete","get","head","options"],function(e){b3.prototype[e]=function(n,r){return this.request(Q3(r||{},{method:e,url:n,data:(r||{}).data}))}});Ar.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}))}}b3.prototype[e]=n(),b3.prototype[e+"Form"]=n(!0)});class Zoe{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 l8(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 Zoe(function(s){e=s}),cancel:e}}}function r3t(t){return function(n){return t.apply(null,n)}}function s3t(t){return Ar.isObject(t)&&t.isAxiosError===!0}const tte={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(tte).forEach(([t,e])=>{tte[e]=t});function dIe(t){const e=new b3(t),n=zPe(b3.prototype.request,e);return Ar.extend(n,b3.prototype,e,{allOwnKeys:!0}),Ar.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return dIe(Q3(t,s))},n}const Ns=dIe(OT);Ns.Axios=b3;Ns.CanceledError=l8;Ns.CancelToken=Zoe;Ns.isCancel=rIe;Ns.VERSION=uIe;Ns.toFormData=U$;Ns.AxiosError=Ii;Ns.Cancel=Ns.CanceledError;Ns.all=function(e){return Promise.all(e)};Ns.spread=r3t;Ns.isAxiosError=s3t;Ns.mergeConfig=Q3;Ns.AxiosHeaders=df;Ns.formToJSON=t=>nIe(Ar.isHTMLForm(t)?new FormData(t):t);Ns.getAdapter=cIe.getAdapter;Ns.HttpStatusCode=tte;Ns.default=Ns;var s2="https://dextrabothypev2.nftinit.io/";async function i3t(t,e){if(e==1||e==null)return fetch(s2+"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(s2+"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 a3t(t,e,n,r){if(r==1||r==null)return fetch(s2+"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(s2+"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 bi(t,e){if(t)return await fetch(s2+"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 o3t(t,e){if(t)return await fetch(s2+"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 l3t(t,e){if(t)return await fetch(s2+"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 c3t(t,e){if(t)return await fetch(s2+"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 u3t(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 XV=null;function d3t(t){XV&&clearInterval(XV),XV=setInterval(async()=>{const e=localStorage.getItem("hyperTradeTokenExp"),n=Date.now()/1e3;(!e||e-n<600)&&await u3t(t)&&(localStorage.setItem("hyperTradeTokenExp",n+259200),console.log("Trade token refreshed"))},5*60*1e3)}const f3t=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=h.createContext(),h3t=({children:t})=>{const e=Pl(),{isConnected:n,address:r}=ds(),{signMessageAsync:s}=zoe(),[a,o]=h.useState("user"),[l,c]=h.useState(null),[u,d]=h.useState(0),[f,x]=h.useState(0),[g,y]=h.useState(!1),[v,C]=h.useState(!1),[S,T]=h.useState(!1),[I,L]=h.useState(0),[F,$]=h.useState(window.localStorage.getItem("hyperToken")),[O,U]=h.useState(window.localStorage.getItem("hyperAddress")),[Y,re]=h.useState(!1),[Q,q]=h.useState(!1),[te,fe]=h.useState(!1),[G,ie]=h.useState(null),[oe,K]=h.useState(!1),[H,ee]=h.useState(null),[se,pe]=h.useState(null),[Se,ge]=h.useState([]),[ve,be]=h.useState([]),[we,je]=h.useState([]),[Fe,Re]=h.useState(""),[Qe,Ye]=h.useState({activeRange:"",day:0,week:0,month:0}),[dt,st]=h.useState([]),at=h.useCallback(async()=>{const ln=window.localStorage.getItem("hyperToken"),Nn=window.localStorage.getItem("hyperAddress");if(!ln||!Nn){st([]);return}try{const dn=await bi(Nn.toLowerCase(),ln);dn!=null&&dn.success&&st((dn==null?void 0:dn.bot_slots_info)||[])}catch{}},[]);async function He(){var rt,nt;const ln=window.localStorage.getItem("hyperToken"),Nn=window.localStorage.getItem("hyperAddress"),dn=Aht(ln);if(ln&&dn!==!1){const Ut=await bi(Nn,ln);Ut.success?(st((Ut==null?void 0:Ut.bot_slots_info)||[]),c(Ut.telegram_chat_id),o(Ut.subscriber_role),d((rt=Ut==null?void 0:Ut.mushboomer_counts)==null?void 0:rt.eth),x((nt=Ut==null?void 0:Ut.mushboomer_counts)==null?void 0:nt.sol),y(Ut==null?void 0:Ut.referral_code),C(Ut==null?void 0:Ut.refcode),T(Ut==null?void 0:Ut.whitelist),L(Ut==null?void 0:Ut.subs_expire_day),$(localStorage.getItem("hyperToken")),U(localStorage.getItem("hyperAddress")),vn(),Kt()):st([])}else qe(1)}async function qe(ln){try{if(!r)throw new Error("No accounts found. Please connect your wallet.");const Nn=await i3t(r,ln);if(!Nn.success)return{success:!1,message:Nn.error_message};const dn=Nn.temp_password,rt=`dextrabot.io verification code : ${dn}`,nt=await s({message:rt}),Ut=await a3t(Nn.address,dn,nt,ln);if(Ut&&Ut.token){if(window.localStorage.setItem("hyperAddress",Ut.address),window.localStorage.setItem("hyperToken",Ut.token),Ut.trade_token){window.localStorage.setItem("hyperTradeToken",Ut.trade_token);const wn=Date.now()/1e3;window.localStorage.setItem("hyperTradeTokenExp",wn+(Ut.expires_in||259200)),d3t(Ut.address)}return He(),window.dispatchEvent(new Event("localStorageUpdated")),{success:!0,initToken:Ut.token}}else throw new Error("Failed to complete the signing process.")}catch(Nn){return console.error("Error during sign-in:",Nn),{success:!1,message:Nn.message||"An unknown error occurred."}}}const[vt,yt]=h.useState([]);async function Kt(){const ln=window.localStorage.getItem("hyperToken"),Nn=window.localStorage.getItem("hyperAddress");try{fe(!0);const dn=await l3t(r||Nn,ln);if(!dn.success){dn.error_message!="User not verified"&&fn.error(dn.error_message),dn.error_message=="User not verified";return}dn.success?yt(dn==null?void 0:dn.data):yt([])}catch(dn){dn.name!=="AbortError"&&(ie(dn.message),fn.error(dn.message)),yt([])}finally{fe(!1)}}const[jt,un]=h.useState([]);async function vn(){const ln=window.localStorage.getItem("hyperToken"),Nn=window.localStorage.getItem("hyperAddress");try{K(!0);const dn=await c3t(r||Nn,ln);if(!dn.success){dn.error_message!="User not verified"&&fn.error(dn.error_message),dn.error_message=="User not verified";return}dn.success?un(dn==null?void 0:dn.data):un([])}catch(dn){dn.name!=="AbortError"&&(ee(dn.message),fn.error(dn.message)),un([])}finally{K(!1)}}h.useEffect(()=>{window.localStorage.getItem("hyperToken")==null&&e.pathname!="/tracked-wallets"&&Q&&re(!0)},[n]),h.useEffect(()=>{!n&&!F||(e.pathname=="/wallet-management"||e.pathname.includes("referral")||e.pathname=="/leaderboard")&&F!=null&&F&&Kt()},[F]),h.useRef(!1),h.useEffect(()=>{if(e.pathname==="/"||e.pathname==="/sitemap"||e.pathname==="/videos"||!window.localStorage.getItem("hyperToken"))return;const dn=`notificationsFeedSocket_${r==null?void 0:r.toLowerCase()}`,rt=localStorage.getItem(dn);ge(rt?JSON.parse(rt):[]);const nt=K0("https://dextrabothypesocketv2.nftinit.io/");return pe(nt),nt.on("connect",()=>{console.log("Socket connected")}),nt.on("disconnect",()=>{console.log("Socket disconnected")}),nt.on("hyper_get_trade_message",async Ut=>{const wn=(Array.isArray(Ut)?Ut:[Ut]).map(xt=>({...xt,is_read:!1,trader_pnl:null}));ge(xt=>{const We=new Set(xt.map(ct=>ct==null?void 0:ct.oid)),Ke=[...wn==null?void 0:wn.filter(ct=>!(We!=null&&We.has(ct==null?void 0:ct.oid))),...xt].slice(0,100);return localStorage.setItem(dn,JSON.stringify(Ke)),Ke});const Jt=window.localStorage.getItem("hyperToken");if(!r||!Jt){console.log("User logged out before timeout - skipping PNL fetch.");return}const Vt=wn.map(xt=>xt==null?void 0:xt.trader_wallet).filter(Boolean)[0];try{const xt=await Ns.post("https://api-ui.hyperliquid.xyz/info",{aggregateByTime:!0,type:"userFills",user:Vt});if(xt.data){const We=f3t(xt.data),Pt=new Map(We==null?void 0:We.map(Ke=>[Ke==null?void 0:Ke.oid,Ke==null?void 0:Ke.pnl]));ge(Ke=>{const ct=Ke==null?void 0:Ke.map(Nt=>Pt!=null&&Pt.has(Nt==null?void 0:Nt.trader_oid)?{...Nt,trader_pnl:Pt==null?void 0:Pt.get(Nt==null?void 0:Nt.trader_oid)}:Nt);return localStorage.setItem(dn,JSON.stringify(ct)),ct})}else console.log("Unexpected API response")}catch(xt){console.error("PNL API error:",xt)}}),()=>{nt.disconnect()}},[F]),h.useEffect(()=>{if(!se||!r||!vt||vt.length===0)return;vt.map(Nn=>Nn.wallet_address);const ln=window.localStorage.getItem("hyperToken");return se.emit("subscribe",{login:r==null?void 0:r.toLowerCase(),token:ln}),()=>{}},[se,r,vt]);const Hn=async()=>{try{const ln=window.localStorage.getItem("hyperToken"),Nn="https://dextrabothypev2.nftinit.io/api/subscriber/announcement/getannouncements/";let dn={};r&&ln&&(dn={address:r.toLowerCase(),token:ln});const rt=await fetch(Nn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(dn)});if(!rt.ok)throw new Error(`Server responded with status ${rt.status}`);const nt=await rt.json();nt.success?be(nt):console.log(nt.error_message)}catch(ln){console.error("Error in handleAnnouncement:",ln)}};return h.useEffect(()=>{Hn();const ln=setInterval(()=>{Hn()},6e4);return()=>clearInterval(ln)},[n,F]),h.useEffect(()=>{(async()=>{try{const rt=(await(await fetch("https://dextradata.nftinit.io/api/hyper/terminal_coins/v2/")).json()).coins;je(rt)}catch(Nn){console.error("Data retrieval error:",Nn),Re(Nn.message)}})()},[]),i.jsx(Qr.Provider,{value:{subscriberRole:a,setSubscriberRole:o,subsExpireDay:I,setSubsExpireDay:L,hyperToken:F,setHyperToken:$,hyperAddress:O,setHyperAddress:U,signModalOpen:Y,setSignModalOpen:re,walletLogin:He,signIn:qe,copyTradeWatchList:vt,setCopyTradeWatchList:yt,trackedWatchList:jt,setTrackedWatchList:un,getCopyTradeWatchList:Kt,getTrackedWatchList:vn,copyWatchListLoading:te,setCopyWatchListLoading:fe,trackedWatchListLoading:oe,setTrackedWatchListLoading:K,copyWatchListError:G,setCopyWatchListError:ie,trackedWatchListError:H,setTrackedWatchListError:ee,signInConnectButtonOpen:Q,setSignInConnectButtonOpen:q,telegramChatId:l,setTelegramChatId:c,mushboomerETH:u,setMushboomerETH:d,isWhitelist:S,setIsWhitelist:T,mushboomerSOL:f,setMushboomerSOL:x,isReferralCode:g,setIsReferralCode:y,isReferralCodeName:v,setIsReferralCodeName:C,latestPnL:Qe,setLatestPnL:Ye,notificationData:Se,setNotificationData:ge,announcementData:ve,setAnnouncementData:be,handleAnnouncement:Hn,searchTerminalCoin:we,setSearchTerminalCoin:je,isSearchTerminalError:Fe,setIsSearchTerminalError:Re,botSlotsInfo:dt,setBotSlotsInfo:st,refreshBotSlots:at},children:t})};function p3t({open:t,setOpen:e,setGenModalOpen:n,setGenWalletSuccess:r,setGenWalletData:s,setShowPrivateKey:a}){return i.jsx(i.Fragment,{children:i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-[9999999999] font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Hi,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),fn.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 m3t=()=>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"})]}),ka=ke.memo(m3t),x3t=({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}=h.useContext(Qr),{address:v}=ds(),C=async()=>{const T=window.localStorage.getItem("hyperToken");if(!T){y(!0);return}if(!s){d("Please enter a name.");return}f(!0),d("");const I=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():I,token:T,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(L){console.error("An error has occurred:",L.message),d(L==null?void 0:L.message)}finally{f(!1)}},S=()=>{l(T=>!T)};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(ka,{})}):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:T=>{T.stopPropagation(),navigator.clipboard.writeText(n==null?void 0:n.address),fn.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:io,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:T=>{T.stopPropagation(),navigator.clipboard.writeText(n==null?void 0:n.private_key),fn.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:io,alt:"",className:"cursor-pointer"}),i.jsx("span",{onClick:()=>{S()},className:"p-1 rounded cursor-pointer",children:r?i.jsx(est,{className:"w-4 h-4"}):i.jsx(Zrt,{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:T=>a(T.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:Wo,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:o})]})]})})},g3t=({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}=h.useContext(Qr),{address:v}=ds(),C=async()=>{const S=window.localStorage.getItem("hyperToken");if(!S){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 T=window.localStorage.getItem("hyperAddress");try{const L=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:S,name:n,connet_wallet_address:d,agent_wallet_pkey:x})})).json();L.success?(e(L==null?void 0:L.wallet),r(""),c(),u(1)):(console.log("An error has occurred. Please try again."),a(L==null?void 0:L.error_message))}catch(I){console.error("An error has occurred:",I.message),a(I==null?void 0:I.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(ka,{})}):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:S=>r(S.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:S=>f(S.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:S=>g(S.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})]})})},fIe="6.15.0";function b3t(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 Eu(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 qs(t,e,n){for(let r in e){let s=e[r];const a=n?n[r]:null;a&&b3t(s,a,r),Object.defineProperty(t,r,{enumerable:!0,value:s,writable:!1})}}function c4(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=>c4(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 c4(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=>`${c4(r,e)}: ${c4(t[r],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function su(t,e){return t&&t.code===e}function Joe(t){return su(t,"CALL_EXCEPTION")}function Mo(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: ${c4(n)}`);for(const o in n){if(o==="shortMessage")continue;const l=n[o];a.push(o+"="+c4(l))}}a.push(`code=${e}`),a.push(`version=${fIe}`),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 qs(s,{code:e}),n&&Object.assign(s,n),s.shortMessage==null&&qs(s,{shortMessage:r}),s}function zr(t,e,n,r){if(!t)throw Mo(e,n,r)}function Dn(t,e,n,r){zr(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function hIe(t,e,n){n==null&&(n=""),n&&(n=": "+n),zr(t>=e,"missing argument"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),zr(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const y3t=["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 pIe(t){zr(y3t.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function I5(t,e,n){if(n==null&&(n=""),t!==e){let r=n,s="new";n&&(r+=".",s+=" "+n),zr(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function mIe(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}Dn(!1,"invalid BytesLike value",e||"value",t)}function js(t,e){return mIe(t,e,!1)}function iu(t,e){return mIe(t,e,!0)}function bo(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 V$(t){return bo(t,!0)||t instanceof Uint8Array}const Gxe="0123456789abcdef";function ns(t){const e=js(t);let n="0x";for(let r=0;r<e.length;r++){const s=e[r];n+=Gxe[(s&240)>>4]+Gxe[s&15]}return n}function $a(t){return"0x"+t.map(e=>ns(e).substring(2)).join("")}function P4(t){return bo(t,!0)?(t.length-2)/2:js(t).length}function _o(t,e,n){const r=js(t);return n!=null&&n>r.length&&zr(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),ns(r.slice(e??0,n??r.length))}function xIe(t,e,n){const r=js(t);zr(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),ns(s)}function y1(t,e){return xIe(t,e,!0)}function v3t(t,e){return xIe(t,e,!1)}const W$=BigInt(0),fm=BigInt(1),nte=9007199254740991;function w3t(t,e){const n=q$(t,"value"),r=BigInt(Ui(e,"width"));if(zr(n>>r===W$,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-fm){const s=(fm<<r)-fm;return-((~n&s)+fm)}return n}function gIe(t,e){let n=Ms(t,"value");const r=BigInt(Ui(e,"width")),s=fm<<r-fm;if(n<W$){n=-n,zr(n<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const a=(fm<<r)-fm;return(~n&a)+fm}else zr(n<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return n}function J7(t,e){const n=q$(t,"value"),r=BigInt(Ui(e,"bits"));return n&(fm<<r)-fm}function Ms(t,e){switch(typeof t){case"bigint":return t;case"number":return Dn(Number.isInteger(t),"underflow",e||"value",t),Dn(t>=-9007199254740991&&t<=nte,"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){Dn(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}Dn(!1,"invalid BigNumberish value",e||"value",t)}function q$(t,e){const n=Ms(t,e);return zr(n>=W$,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const Kxe="0123456789abcdef";function G$(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=Kxe[n>>4],e+=Kxe[n&15];return BigInt(e)}return Ms(t)}function Ui(t,e){switch(typeof t){case"bigint":return Dn(t>=-9007199254740991&&t<=nte,"overflow",e||"value",t),Number(t);case"number":return Dn(Number.isInteger(t),"underflow",e||"value",t),Dn(t>=-9007199254740991&&t<=nte,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return Ui(BigInt(t),e)}catch(n){Dn(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}Dn(!1,"invalid numeric value",e||"value",t)}function C3t(t){return Ui(G$(t))}function v1(t,e){let r=q$(t,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=Ui(e,"width");for(zr(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 dl(t){const e=q$(t,"value");if(e===W$)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=ns(V$(t)?t:dl(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const _L="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let zI=null;function N3t(t){if(zI==null){zI={};for(let n=0;n<_L.length;n++)zI[_L[n]]=BigInt(n)}const e=zI[t];return Dn(e!=null,"invalid base58 value","letter",t),e}const S3t=BigInt(0),rte=BigInt(58);function bIe(t){const e=js(t);let n=G$(e),r="";for(;n;)r=_L[Number(n%rte)]+r,n/=rte;for(let s=0;s<e.length&&!e[s];s++)r=_L[0]+r;return r}function j3t(t){let e=S3t;for(let n=0;n<t.length;n++)e*=rte,e+=N3t(t[n]);return e}function A3t(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return js(e)}function _3t(t){const e=js(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}var cN;class yIe{constructor(e,n,r){Qn(this,"filter");Qn(this,"emitter");Wn(this,cN);tn(this,cN,n),qs(this,{emitter:e,filter:r})}async removeListener(){Je(this,cN)!=null&&await this.emitter.off(this.filter,Je(this,cN))}}cN=new WeakMap;function E3t(t,e,n,r,s){Dn(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function vIe(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 k3t(t,e,n,r,s){return t==="OVERLONG"?(Dn(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),vIe(t,e,n))}const T3t=Object.freeze({error:E3t,ignore:vIe,replace:k3t});function P3t(t,e){e==null&&(e=T3t.error);const n=js(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 bd(t,e){Dn(typeof t=="string","invalid string value","str",t),e!=null&&(pIe(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);Dn(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 I3t(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function EL(t,e){return I3t(P3t(t,e))}function wIe(t){async function e(n,r){zr(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=n.url.split(":")[0].toLowerCase();zr(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),zr(s==="https"||!n.credentials||n.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let a=null;const o=new AbortController,l=setTimeout(()=>{a=Mo("request timeout","TIMEOUT"),o.abort()},n.timeout);r&&r.addListener(()=>{a=Mo("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 F3t=12,O3t=250;let Yxe=wIe();const M3t=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),L3t=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let QV=!1;async function CIe(t,e){try{const n=t.match(M3t);if(!n)throw new Error("invalid data");return new Uy(200,"OK",{"content-type":n[1]||"text/plain"},n[2]?A3t(n[3]):D3t(n[3]))}catch{return new Uy(599,"BAD REQUEST (invalid data: URI)",{},null,new i2(t))}}function NIe(t){async function e(n,r){try{const s=n.match(L3t);if(!s)throw new Error("invalid link");return new i2(`${t}${s[2]}`)}catch{return new Uy(599,"BAD REQUEST (invalid IPFS URI)",{},null,new i2(n))}}return e}const HI={data:CIe,ipfs:NIe("https://gateway.ipfs.io/ipfs/")},SIe=new WeakMap;var Hw,cy;class R3t{constructor(e){Wn(this,Hw);Wn(this,cy);tn(this,Hw,[]),tn(this,cy,!1),SIe.set(e,()=>{if(!Je(this,cy)){tn(this,cy,!0);for(const n of Je(this,Hw))setTimeout(()=>{n()},0);tn(this,Hw,[])}})}addListener(e){zr(!Je(this,cy),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),Je(this,Hw).push(e)}get cancelled(){return Je(this,cy)}checkSignal(){zr(!this.cancelled,"cancelled","CANCELLED",{})}}Hw=new WeakMap,cy=new WeakMap;function VI(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var uN,dN,Zp,Eg,fN,hN,Ac,zf,kg,Vw,Ww,qw,g0,Jp,uy,Gw,e_;const SB=class SB{constructor(e){Wn(this,Gw);Wn(this,uN);Wn(this,dN);Wn(this,Zp);Wn(this,Eg);Wn(this,fN);Wn(this,hN);Wn(this,Ac);Wn(this,zf);Wn(this,kg);Wn(this,Vw);Wn(this,Ww);Wn(this,qw);Wn(this,g0);Wn(this,Jp);Wn(this,uy);tn(this,hN,String(e)),tn(this,uN,!1),tn(this,dN,!0),tn(this,Zp,{}),tn(this,Eg,""),tn(this,fN,3e5),tn(this,Jp,{slotInterval:O3t,maxAttempts:F3t}),tn(this,uy,null)}get url(){return Je(this,hN)}set url(e){tn(this,hN,String(e))}get body(){return Je(this,Ac)==null?null:new Uint8Array(Je(this,Ac))}set body(e){if(e==null)tn(this,Ac,void 0),tn(this,zf,void 0);else if(typeof e=="string")tn(this,Ac,bd(e)),tn(this,zf,"text/plain");else if(e instanceof Uint8Array)tn(this,Ac,e),tn(this,zf,"application/octet-stream");else if(typeof e=="object")tn(this,Ac,bd(JSON.stringify(e))),tn(this,zf,"application/json");else throw new Error("invalid body")}hasBody(){return Je(this,Ac)!=null}get method(){return Je(this,Eg)?Je(this,Eg):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),tn(this,Eg,String(e).toUpperCase())}get headers(){const e=Object.assign({},Je(this,Zp));return Je(this,kg)&&(e.authorization=`Basic ${_3t(bd(Je(this,kg)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&Je(this,zf)&&(e["content-type"]=Je(this,zf)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,n){Je(this,Zp)[String(e).toLowerCase()]=String(n)}clearHeaders(){tn(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 Je(this,kg)||null}setCredentials(e,n){Dn(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),tn(this,kg,`${e}:${n}`)}get allowGzip(){return Je(this,dN)}set allowGzip(e){tn(this,dN,!!e)}get allowInsecureAuthentication(){return!!Je(this,uN)}set allowInsecureAuthentication(e){tn(this,uN,!!e)}get timeout(){return Je(this,fN)}set timeout(e){Dn(e>=0,"timeout must be non-zero","timeout",e),tn(this,fN,e)}get preflightFunc(){return Je(this,Vw)||null}set preflightFunc(e){tn(this,Vw,e)}get processFunc(){return Je(this,Ww)||null}set processFunc(e){tn(this,Ww,e)}get retryFunc(){return Je(this,qw)||null}set retryFunc(e){tn(this,qw,e)}get getUrlFunc(){return Je(this,uy)||Yxe}set getUrlFunc(e){tn(this,uy,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${Je(this,Ac)?ns(Je(this,Ac)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(Je(this,Jp).slotInterval=e.slotInterval),e.maxAttempts!=null&&(Je(this,Jp).maxAttempts=e.maxAttempts)}send(){return zr(Je(this,g0)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),tn(this,g0,new R3t(this)),Er(this,Gw,e_).call(this,0,Xxe()+this.timeout,0,this,new Uy(0,"",{},null,this))}cancel(){zr(Je(this,g0)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=SIe.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();zr(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 SB(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,tn(s,Zp,Object.assign({},Je(this,Zp))),Je(this,Ac)&&tn(s,Ac,new Uint8Array(Je(this,Ac))),tn(s,zf,Je(this,zf)),s}clone(){const e=new SB(this.url);return tn(e,Eg,Je(this,Eg)),Je(this,Ac)&&tn(e,Ac,Je(this,Ac)),tn(e,zf,Je(this,zf)),tn(e,Zp,Object.assign({},Je(this,Zp))),tn(e,kg,Je(this,kg)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),tn(e,Vw,Je(this,Vw)),tn(e,Ww,Je(this,Ww)),tn(e,qw,Je(this,qw)),tn(e,Jp,Object.assign({},Je(this,Jp))),tn(e,uy,Je(this,uy)),e}static lockConfig(){QV=!0}static getGateway(e){return HI[e.toLowerCase()]||null}static registerGateway(e,n){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(QV)throw new Error("gateways locked");HI[e]=n}static registerGetUrl(e){if(QV)throw new Error("gateways locked");Yxe=e}static createGetUrlFunc(e){return wIe(e)}static createDataGateway(){return CIe}static createIpfsGatewayFunc(e){return NIe(e)}};uN=new WeakMap,dN=new WeakMap,Zp=new WeakMap,Eg=new WeakMap,fN=new WeakMap,hN=new WeakMap,Ac=new WeakMap,zf=new WeakMap,kg=new WeakMap,Vw=new WeakMap,Ww=new WeakMap,qw=new WeakMap,g0=new WeakMap,Jp=new WeakMap,uy=new WeakMap,Gw=new WeakSet,e_=async function(e,n,r,s,a){var d,f,x;if(e>=Je(this,Jp).maxAttempts)return a.makeServerError("exceeded maximum retry limit");zr(Xxe()<=n,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await B3t(r);let o=this.clone();const l=(o.url.split(":")[0]||"").toLowerCase();if(l in HI){const g=await HI[l](o.url,VI(Je(s,g0)));if(g instanceof Uy){let y=g;if(this.processFunc){VI(Je(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,VI(Je(s,g0)));let u=new Uy(c.statusCode,c.statusMessage,c.headers,c.body,s);if(u.statusCode===301||u.statusCode===302){try{const g=u.headers.location||"";return Er(d=o.redirect(g),Gw,e_).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=Je(this,Jp).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof g=="string"&&g.match(/^[1-9][0-9]*$/)&&(y=parseInt(g)),Er(f=o.clone(),Gw,e_).call(f,e+1,n,y,s,u)}if(this.processFunc){VI(Je(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=Je(this,Jp).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return g.stall>=0&&(y=g.stall),Er(x=o.clone(),Gw,e_).call(x,e+1,n,y,s,u)}}return u};let i2=SB;var qk,Gk,Kk,Hf,pN,Kw;const Vfe=class Vfe{constructor(e,n,r,s,a){Wn(this,qk);Wn(this,Gk);Wn(this,Kk);Wn(this,Hf);Wn(this,pN);Wn(this,Kw);tn(this,qk,e),tn(this,Gk,n),tn(this,Kk,Object.keys(r).reduce((o,l)=>(o[l.toLowerCase()]=String(r[l]),o),{})),tn(this,Hf,s==null?null:new Uint8Array(s)),tn(this,pN,a||null),tn(this,Kw,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${Je(this,Hf)?ns(Je(this,Hf)):"null"}>`}get statusCode(){return Je(this,qk)}get statusMessage(){return Je(this,Gk)}get headers(){return Object.assign({},Je(this,Kk))}get body(){return Je(this,Hf)==null?null:new Uint8Array(Je(this,Hf))}get bodyText(){try{return Je(this,Hf)==null?"":EL(Je(this,Hf))}catch{zr(!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{zr(!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 Vfe(599,r,this.headers,this.body,Je(this,pN)||void 0);return tn(s,Kw,{message:e,error:n}),s}throwThrottleError(e,n){n==null?n=-1:Dn(Number.isInteger(n)&&n>=0,"invalid stall timeout","stall",n);const r=new Error(e||"throttling requests");throw qs(r,{stall:n,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return Je(this,Hf)!=null}get request(){return Je(this,pN)}ok(){return Je(this,Kw).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:n}=Je(this,Kw);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{Je(this,Hf)&&(s=EL(Je(this,Hf)))}catch{}zr(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:n,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};qk=new WeakMap,Gk=new WeakMap,Kk=new WeakMap,Hf=new WeakMap,pN=new WeakMap,Kw=new WeakMap;let Uy=Vfe;function Xxe(){return new Date().getTime()}function D3t(t){return bd(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,n)=>String.fromCharCode(parseInt(n,16))))}function B3t(t){return new Promise(e=>setTimeout(e,t))}function $3t(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function Qxe(t,e,n){let r=0;for(let s=0;s<n;s++)r=r*256+t[e+s];return r}function Zxe(t,e,n,r){const s=[];for(;n<e+1+r;){const a=jIe(t,n);s.push(a.result),n+=a.consumed,zr(n<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:s}}function jIe(t,e){zr(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=r=>{zr(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=Qxe(t,e+1,r);return n(e+1+r+s),Zxe(t,e,e+1+r,r+s)}else if(t[e]>=192){const r=t[e]-192;return n(e+1+r),Zxe(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;n(e+1+r);const s=Qxe(t,e+1,r);n(e+1+r+s);const a=ns(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=ns(t.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:$3t(t[e])}}function MT(t){const e=js(t,"data"),n=jIe(e,0);return Dn(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function Jxe(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function AIe(t){if(Array.isArray(t)){let r=[];if(t.forEach(function(a){r=r.concat(AIe(a))}),r.length<=55)return r.unshift(192+r.length),r;const s=Jxe(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(js(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=Jxe(e.length);return n.unshift(183+n.length),n.concat(e)}const ege="0123456789abcdef";function w1(t){let e="0x";for(const n of AIe(t))e+=ege[n>>4],e+=ege[n&15];return e}function U3t(t){const e=js(t,"randomBytes");e[6]=e[6]&15|64,e[8]=e[8]&63|128;const n=ns(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,ste=new Uint8Array(fd),z3t=["then"],WI={},_Ie=new WeakMap;function iw(t){return _Ie.get(t)}function tge(t,e){_Ie.set(t,e)}function s7(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function ite(t,e,n){return t.indexOf(null)>=0?e.map((r,s)=>r instanceof kL?ite(iw(r),r,n):r):t.reduce((r,s,a)=>{let o=e.getValue(s);return s in r||(n&&o instanceof kL&&(o=ite(iw(o),o,n)),r[s]=o),r},{})}var mN,Jg;let kL=(Jg=class extends Array{constructor(...n){const r=n[0];let s=n[1],a=(n[2]||[]).slice(),o=!0;r!==WI&&(s=n,a=[],o=!1);super(s.length);Wn(this,mN);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(tge(this,Object.freeze(s.map((u,d)=>{const f=a[d];return f!=null&&l.get(f)===1?f:null}))),tn(this,mN,[]),Je(this,mN)==null&&Je(this,mN),!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=Ui(d,"%index");if(g<0||g>=this.length)throw new RangeError("out of result range");const y=u[g];return y instanceof Error&&s7(`index ${g}`,y),y}if(z3t.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 tge(c,iw(this)),c}toArray(n){const r=[];return this.forEach((s,a)=>{s instanceof Error&&s7(`index ${a}`,s),n&&s instanceof Jg&&(s=s.toArray(n)),r.push(s)}),r}toObject(n){const r=iw(this);return r.reduce((s,a,o)=>(zr(a!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),ite(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=iw(this),a=[],o=[];for(let l=n;l<r;l++)a.push(this[l]),o.push(s[l]);return new Jg(WI,a,o)}filter(n,r){const s=iw(this),a=[],o=[];for(let l=0;l<this.length;l++){const c=this[l];c instanceof Error&&s7(`index ${l}`,c),n.call(r,c,l,this)&&(a.push(c),o.push(s[l]))}return new Jg(WI,a,o)}map(n,r){const s=[];for(let a=0;a<this.length;a++){const o=this[a];o instanceof Error&&s7(`index ${a}`,o),s.push(n.call(r,o,a,this))}return s}getValue(n){const r=iw(this).indexOf(n);if(r===-1)return;const s=this[r];return s instanceof Error&&s7(`property ${JSON.stringify(n)}`,s.error),s}static fromItems(n,r){return new Jg(WI,n,r)}},mN=new WeakMap,Jg);function nge(t){let e=dl(t);return zr(e.length<=fd,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:fd,offset:e.length}),e.length!==fd&&(e=iu($a([ste.slice(e.length%fd),e]))),e}class D1{constructor(e,n,r,s){Qn(this,"name");Qn(this,"type");Qn(this,"localName");Qn(this,"dynamic");qs(this,{name:e,type:n,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,n){Dn(!1,e,this.localName,n)}}var Tg,Yw,xN,nM;class ate{constructor(){Wn(this,xN);Wn(this,Tg);Wn(this,Yw);tn(this,Tg,[]),tn(this,Yw,0)}get data(){return $a(Je(this,Tg))}get length(){return Je(this,Yw)}appendWriter(e){return Er(this,xN,nM).call(this,iu(e.data))}writeBytes(e){let n=iu(e);const r=n.length%fd;return r&&(n=iu($a([n,ste.slice(r)]))),Er(this,xN,nM).call(this,n)}writeValue(e){return Er(this,xN,nM).call(this,nge(e))}writeUpdatableValue(){const e=Je(this,Tg).length;return Je(this,Tg).push(ste),tn(this,Yw,Je(this,Yw)+fd),n=>{Je(this,Tg)[e]=nge(n)}}}Tg=new WeakMap,Yw=new WeakMap,xN=new WeakSet,nM=function(e){return Je(this,Tg).push(e),tn(this,Yw,Je(this,Yw)+e.length),e.length};var Kd,Vf,Xw,Qw,dy,j5,lte,EIe;const Wfe=class Wfe{constructor(e,n,r){Wn(this,j5);Qn(this,"allowLoose");Wn(this,Kd);Wn(this,Vf);Wn(this,Xw);Wn(this,Qw);Wn(this,dy);qs(this,{allowLoose:!!n}),tn(this,Kd,iu(e)),tn(this,Xw,0),tn(this,Qw,null),tn(this,dy,r??1024),tn(this,Vf,0)}get data(){return ns(Je(this,Kd))}get dataLength(){return Je(this,Kd).length}get consumed(){return Je(this,Vf)}get bytes(){return new Uint8Array(Je(this,Kd))}subReader(e){const n=new Wfe(Je(this,Kd).slice(Je(this,Vf)+e),this.allowLoose,Je(this,dy));return tn(n,Qw,this),n}readBytes(e,n){let r=Er(this,j5,EIe).call(this,0,e,!!n);return Er(this,j5,lte).call(this,e),tn(this,Vf,Je(this,Vf)+r.length),r.slice(0,e)}readValue(){return G$(this.readBytes(fd))}readIndex(){return C3t(this.readBytes(fd))}};Kd=new WeakMap,Vf=new WeakMap,Xw=new WeakMap,Qw=new WeakMap,dy=new WeakMap,j5=new WeakSet,lte=function(e){var n;if(Je(this,Qw))return Er(n=Je(this,Qw),j5,lte).call(n,e);tn(this,Xw,Je(this,Xw)+e),zr(Je(this,dy)<1||Je(this,Xw)<=Je(this,dy)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${Je(this,dy)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:iu(Je(this,Kd)),offset:Je(this,Vf),length:e,info:{bytesRead:Je(this,Xw),dataLength:this.dataLength}})},EIe=function(e,n,r){let s=Math.ceil(n/fd)*fd;return Je(this,Vf)+s>Je(this,Kd).length&&(this.allowLoose&&r&&Je(this,Vf)+n<=Je(this,Kd).length?s=n:zr(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:iu(Je(this,Kd)),length:Je(this,Kd).length,offset:Je(this,Vf)+s})),Je(this,Kd).slice(Je(this,Vf),Je(this,Vf)+s)};let ote=Wfe;function Kf(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function ele(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 kIe(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Kf(t.outputLen),Kf(t.blockLen)}function dS(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 TIe(t,e){ele(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const ZV=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const PIe=t=>t instanceof Uint8Array,rM=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),sM=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),i0=(t,e)=>t<<32-e|t>>>e,H3t=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!H3t)throw new Error("Non little-endian hardware is not supported");const V3t=async()=>{};async function rge(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 V3t(),r+=a)}}function W3t(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function fS(t){if(typeof t=="string"&&(t=W3t(t)),!PIe(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function q3t(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!PIe(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}let tle=class{clone(){return this._cloneInto()}};const G3t={}.toString;function IIe(t,e){if(e!==void 0&&G3t.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function K$(t){const e=r=>t().update(fS(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function K3t(t=32){if(ZV&&typeof ZV.getRandomValues=="function")return ZV.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}let FIe=class extends tle{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,kIe(e);const r=fS(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 dS(this),this.iHash.update(e),this}digestInto(e){dS(this),ele(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 Y$=(t,e,n)=>new FIe(t,e).update(n).digest();Y$.create=(t,e)=>new FIe(t,e);function Y3t(t,e,n,r){kIe(t);const s=IIe({dkLen:32,asyncTick:10},r),{c:a,dkLen:o,asyncTick:l}=s;if(Kf(a),Kf(o),Kf(l),a<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=fS(e),u=fS(n),d=new Uint8Array(o),f=Y$.create(t,c),x=f._cloneInto().update(u);return{c:a,dkLen:o,asyncTick:l,DK:d,PRF:f,PRFSalt:x}}function X3t(t,e,n,r,s){return t.destroy(),e.destroy(),r&&r.destroy(),s.fill(0),n}function nle(t,e,n,r){const{c:s,dkLen:a,DK:o,PRF:l,PRFSalt:c}=Y3t(t,e,n,r);let u;const d=new Uint8Array(4),f=sM(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 S=0;S<v.length;S++)v[S]^=x[S]}}return X3t(l,c,o,u,x)}function Q3t(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 rle extends tle{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=sM(this.buffer)}update(e){dS(this);const{view:n,buffer:r,blockLen:s}=this;e=fS(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=sM(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){dS(this),TIe(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;Q3t(r,s-8,BigInt(this.length*8),a),this.process(r,0);const l=sM(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 Z3t=(t,e,n)=>t&e^~t&n,J3t=(t,e,n)=>t&e^t&n^e&n,e5t=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]),Cb=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Nb=new Uint32Array(64);let t5t=class extends rle{constructor(){super(64,32,8,!1),this.A=Cb[0]|0,this.B=Cb[1]|0,this.C=Cb[2]|0,this.D=Cb[3]|0,this.E=Cb[4]|0,this.F=Cb[5]|0,this.G=Cb[6]|0,this.H=Cb[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)Nb[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const x=Nb[f-15],g=Nb[f-2],y=i0(x,7)^i0(x,18)^x>>>3,v=i0(g,17)^i0(g,19)^g>>>10;Nb[f]=v+Nb[f-7]+y+Nb[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+Z3t(l,c,u)+e5t[f]+Nb[f]|0,v=(i0(r,2)^i0(r,13)^i0(r,22))+J3t(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(){Nb.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const c8=K$(()=>new t5t),qI=BigInt(2**32-1),cte=BigInt(32);function OIe(t,e=!1){return e?{h:Number(t&qI),l:Number(t>>cte&qI)}:{h:Number(t>>cte&qI)|0,l:Number(t&qI)|0}}function MIe(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}=OIe(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const n5t=(t,e)=>BigInt(t>>>0)<<cte|BigInt(e>>>0),r5t=(t,e,n)=>t>>>n,s5t=(t,e,n)=>t<<32-n|e>>>n,i5t=(t,e,n)=>t>>>n|e<<32-n,a5t=(t,e,n)=>t<<32-n|e>>>n,o5t=(t,e,n)=>t<<64-n|e>>>n-32,l5t=(t,e,n)=>t>>>n-32|e<<64-n,c5t=(t,e)=>e,u5t=(t,e)=>t,LIe=(t,e,n)=>t<<n|e>>>32-n,RIe=(t,e,n)=>e<<n|t>>>32-n,DIe=(t,e,n)=>e<<n-32|t>>>64-n,BIe=(t,e,n)=>t<<n-32|e>>>64-n;function d5t(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const f5t=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),h5t=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,p5t=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),m5t=(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,x5t=(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0),g5t=(t,e,n,r,s,a)=>e+n+r+s+a+(t/2**32|0)|0,Bi={fromBig:OIe,split:MIe,toBig:n5t,shrSH:r5t,shrSL:s5t,rotrSH:i5t,rotrSL:a5t,rotrBH:o5t,rotrBL:l5t,rotr32H:c5t,rotr32L:u5t,rotlSH:LIe,rotlSL:RIe,rotlBH:DIe,rotlBL:BIe,add:d5t,add3L:f5t,add3H:h5t,add4L:p5t,add4H:m5t,add5H:g5t,add5L:x5t},[b5t,y5t]=Bi.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))),Sb=new Uint32Array(80),jb=new Uint32Array(80);class v5t extends rle{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 I=0;I<16;I++,n+=4)Sb[I]=e.getUint32(n),jb[I]=e.getUint32(n+=4);for(let I=16;I<80;I++){const L=Sb[I-15]|0,F=jb[I-15]|0,$=Bi.rotrSH(L,F,1)^Bi.rotrSH(L,F,8)^Bi.shrSH(L,F,7),O=Bi.rotrSL(L,F,1)^Bi.rotrSL(L,F,8)^Bi.shrSL(L,F,7),U=Sb[I-2]|0,Y=jb[I-2]|0,re=Bi.rotrSH(U,Y,19)^Bi.rotrBH(U,Y,61)^Bi.shrSH(U,Y,6),Q=Bi.rotrSL(U,Y,19)^Bi.rotrBL(U,Y,61)^Bi.shrSL(U,Y,6),q=Bi.add4L(O,Q,jb[I-7],jb[I-16]),te=Bi.add4H(q,$,re,Sb[I-7],Sb[I-16]);Sb[I]=te|0,jb[I]=q|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:S,Hl:T}=this;for(let I=0;I<80;I++){const L=Bi.rotrSH(f,x,14)^Bi.rotrSH(f,x,18)^Bi.rotrBH(f,x,41),F=Bi.rotrSL(f,x,14)^Bi.rotrSL(f,x,18)^Bi.rotrBL(f,x,41),$=f&g^~f&v,O=x&y^~x&C,U=Bi.add5L(T,F,O,y5t[I],jb[I]),Y=Bi.add5H(U,S,L,$,b5t[I],Sb[I]),re=U|0,Q=Bi.rotrSH(r,s,28)^Bi.rotrBH(r,s,34)^Bi.rotrBH(r,s,39),q=Bi.rotrSL(r,s,28)^Bi.rotrBL(r,s,34)^Bi.rotrBL(r,s,39),te=r&a^r&l^a&l,fe=s&o^s&c^o&c;S=v|0,T=C|0,v=g|0,C=y|0,g=f|0,y=x|0,{h:f,l:x}=Bi.add(u|0,d|0,Y|0,re|0),u=l|0,d=c|0,l=a|0,c=o|0,a=r|0,o=s|0;const G=Bi.add3L(re,q,fe);r=Bi.add3H(G,Y,Q,te),s=G|0}({h:r,l:s}=Bi.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:a,l:o}=Bi.add(this.Bh|0,this.Bl|0,a|0,o|0),{h:l,l:c}=Bi.add(this.Ch|0,this.Cl|0,l|0,c|0),{h:u,l:d}=Bi.add(this.Dh|0,this.Dl|0,u|0,d|0),{h:f,l:x}=Bi.add(this.Eh|0,this.El|0,f|0,x|0),{h:g,l:y}=Bi.add(this.Fh|0,this.Fl|0,g|0,y|0),{h:v,l:C}=Bi.add(this.Gh|0,this.Gl|0,v|0,C|0),{h:S,l:T}=Bi.add(this.Hh|0,this.Hl|0,S|0,T|0),this.set(r,s,a,o,l,c,u,d,f,x,g,y,v,C,S,T)}roundClean(){Sb.fill(0),jb.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 sle=K$(()=>new v5t);function w5t(){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 sge=w5t(),ige=sge.crypto||sge.msCrypto;function C5t(t){switch(t){case"sha256":return c8.create();case"sha512":return sle.create()}Dn(!1,"invalid hashing algorithm name","algorithm",t)}function N5t(t,e){const n={sha256:c8,sha512:sle}[t];return Dn(n!=null,"invalid hmac algorithm","algorithm",t),Y$.create(n,e)}function S5t(t,e,n,r,s){const a={sha256:c8,sha512:sle}[s];return Dn(a!=null,"invalid pbkdf2 algorithm","algorithm",s),nle(a,t,e,{c:n,dkLen:r})}function j5t(t){zr(ige!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),Dn(Number.isInteger(t)&&t>0&&t<=1024,"invalid length","length",t);const e=new Uint8Array(t);return ige.getRandomValues(e),e}let $Ie=!1;const UIe=function(t,e,n){return N5t(t,e).update(n).digest()};let zIe=UIe;function u8(t,e,n){const r=js(e,"key"),s=js(n,"data");return ns(zIe(t,r,s))}u8._=UIe;u8.lock=function(){$Ie=!0};u8.register=function(t){if($Ie)throw new Error("computeHmac is locked");zIe=t};Object.freeze(u8);const[HIe,VIe,WIe]=[[],[],[]],A5t=BigInt(0),i7=BigInt(1),_5t=BigInt(2),E5t=BigInt(7),k5t=BigInt(256),T5t=BigInt(113);for(let t=0,e=i7,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],HIe.push(2*(5*r+n)),VIe.push((t+1)*(t+2)/2%64);let s=A5t;for(let a=0;a<7;a++)e=(e<<i7^(e>>E5t)*T5t)%k5t,e&_5t&&(s^=i7<<(i7<<BigInt(a))-i7);WIe.push(s)}const[P5t,I5t]=MIe(WIe,!0),age=(t,e,n)=>n>32?DIe(t,e,n):LIe(t,e,n),oge=(t,e,n)=>n>32?BIe(t,e,n):RIe(t,e,n);function F5t(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=age(u,d,1)^n[l],x=oge(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=VIe[o],c=age(s,a,l),u=oge(s,a,l),d=HIe[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]^=P5t[r],t[1]^=I5t[r]}n.fill(0)}let O5t=class qIe extends tle{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,Kf(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=rM(this.state)}keccak(){F5t(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){dS(this);const{blockLen:n,state:r}=this;e=fS(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){dS(this,!1),ele(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 Kf(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(TIe(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 qIe(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 M5t=(t,e,n)=>K$(()=>new O5t(e,t,n)),L5t=M5t(1,136,256/8);let GIe=!1;const KIe=function(t){return L5t(t)};let YIe=KIe;function go(t){const e=js(t,"data");return ns(YIe(e))}go._=KIe;go.lock=function(){GIe=!0};go.register=function(t){if(GIe)throw new TypeError("keccak256 is locked");YIe=t};Object.freeze(go);const R5t=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),XIe=Uint8Array.from({length:16},(t,e)=>e),D5t=XIe.map(t=>(9*t+5)%16);let ile=[XIe],ale=[D5t];for(let t=0;t<4;t++)for(let e of[ile,ale])e.push(e[t].map(n=>R5t[n]));const QIe=[[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)),B5t=ile.map((t,e)=>t.map(n=>QIe[e][n])),$5t=ale.map((t,e)=>t.map(n=>QIe[e][n])),U5t=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),z5t=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),GI=(t,e)=>t<<e|t>>>32-e;function lge(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 KI=new Uint32Array(16);class H5t extends rle{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)KI[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=U5t[g],C=z5t[g],S=ile[g],T=ale[g],I=B5t[g],L=$5t[g];for(let F=0;F<16;F++){const $=GI(r+lge(g,a,l,u)+KI[S[F]]+v,I[F])+f|0;r=f,f=u,u=GI(l,10)|0,l=a,a=$}for(let F=0;F<16;F++){const $=GI(s+lge(y,o,c,d)+KI[T[F]]+C,L[F])+x|0;s=x,x=d,d=GI(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(){KI.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const V5t=K$(()=>new H5t);let ZIe=!1;const JIe=function(t){return V5t(t)};let eFe=JIe;function d8(t){const e=js(t,"data");return ns(eFe(e))}d8._=JIe;d8.lock=function(){ZIe=!0};d8.register=function(t){if(ZIe)throw new TypeError("ripemd160 is locked");eFe=t};Object.freeze(d8);let tFe=!1;const nFe=function(t,e,n,r,s){return S5t(t,e,n,r,s)};let rFe=nFe;function E2(t,e,n,r,s){const a=js(t,"password"),o=js(e,"salt");return ns(rFe(a,o,n,r,s))}E2._=nFe;E2.lock=function(){tFe=!0};E2.register=function(t){if(tFe)throw new Error("pbkdf2 is locked");rFe=t};Object.freeze(E2);let sFe=!1;const iFe=function(t){return new Uint8Array(j5t(t))};let aFe=iFe;function s1(t){return aFe(t)}s1._=iFe;s1.lock=function(){sFe=!0};s1.register=function(t){if(sFe)throw new Error("randomBytes is locked");aFe=t};Object.freeze(s1);const ya=(t,e)=>t<<e|t>>>32-e;function cge(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++],S=t[e++]^n[r++],T=t[e++]^n[r++],I=t[e++]^n[r++],L=t[e++]^n[r++],F=t[e++]^n[r++],$=o,O=l,U=c,Y=u,re=d,Q=f,q=x,te=g,fe=y,G=v,ie=C,oe=S,K=T,H=I,ee=L,se=F;for(let pe=0;pe<8;pe+=2)re^=ya($+K|0,7),fe^=ya(re+$|0,9),K^=ya(fe+re|0,13),$^=ya(K+fe|0,18),G^=ya(Q+O|0,7),H^=ya(G+Q|0,9),O^=ya(H+G|0,13),Q^=ya(O+H|0,18),ee^=ya(ie+q|0,7),U^=ya(ee+ie|0,9),q^=ya(U+ee|0,13),ie^=ya(q+U|0,18),Y^=ya(se+oe|0,7),te^=ya(Y+se|0,9),oe^=ya(te+Y|0,13),se^=ya(oe+te|0,18),O^=ya($+Y|0,7),U^=ya(O+$|0,9),Y^=ya(U+O|0,13),$^=ya(Y+U|0,18),q^=ya(Q+re|0,7),te^=ya(q+Q|0,9),re^=ya(te+q|0,13),Q^=ya(re+te|0,18),oe^=ya(ie+G|0,7),fe^=ya(oe+ie|0,9),G^=ya(fe+oe|0,13),ie^=ya(G+fe|0,18),K^=ya(se+ee|0,7),H^=ya(K+se|0,9),ee^=ya(H+K|0,13),se^=ya(ee+H|0,18);s[a++]=o+$|0,s[a++]=l+O|0,s[a++]=c+U|0,s[a++]=u+Y|0,s[a++]=d+re|0,s[a++]=f+Q|0,s[a++]=x+q|0,s[a++]=g+te|0,s[a++]=y+fe|0,s[a++]=v+G|0,s[a++]=C+ie|0,s[a++]=S+oe|0,s[a++]=T+K|0,s[a++]=I+H|0,s[a++]=L+ee|0,s[a++]=F+se|0}function I4(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)cge(n,o,t,e,n,a),l>0&&(o+=16),cge(n,a,t,e+=16,n,o)}function oFe(t,e,n){const r=IIe({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:s,r:a,p:o,dkLen:l,asyncTick:c,maxmem:u,onProgress:d}=r;if(Kf(s),Kf(a),Kf(o),Kf(l),Kf(c),Kf(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=nle(c8,t,e,{c:1,dkLen:f*o}),v=rM(y),C=rM(new Uint8Array(f*s)),S=rM(new Uint8Array(f));let T=()=>{};if(d){const I=2*s*o,L=Math.max(Math.floor(I/1e4),1);let F=0;T=()=>{F++,d&&(!(F%L)||F===I)&&d(F/I)}}return{N:s,r:a,p:o,dkLen:l,blockSize32:x,V:C,B32:v,B:y,tmp:S,blockMixCb:T,asyncTick:c}}function lFe(t,e,n,r,s){const a=nle(c8,t,n,{c:1,dkLen:e});return n.fill(0),r.fill(0),s.fill(0),a}function W5t(t,e,n){const{N:r,r:s,p:a,dkLen:o,blockSize32:l,V:c,B32:u,B:d,tmp:f,blockMixCb:x}=oFe(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++)I4(c,C,c,C+=l,s),x();I4(c,(r-1)*l,u,y,s),x();for(let v=0;v<r;v++){const C=u[y+l-16]%r;for(let S=0;S<l;S++)f[S]=u[y+S]^c[C*l+S];I4(f,0,u,y,s),x()}}return lFe(t,o,d,c,f)}async function q5t(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}=oFe(t,e,n);for(let y=0;y<a;y++){const v=l*y;for(let S=0;S<l;S++)c[S]=u[v+S];let C=0;await rge(r-1,g,()=>{I4(c,C,c,C+=l,s),x()}),I4(c,(r-1)*l,u,v,s),x(),await rge(r,g,()=>{const S=u[v+l-16]%r;for(let T=0;T<l;T++)f[T]=u[v+T]^c[S*l+T];I4(f,0,u,v,s),x()})}return lFe(t,o,d,c,f)}let cFe=!1,uFe=!1;const dFe=async function(t,e,n,r,s,a,o){return await q5t(t,e,{N:n,r,p:s,dkLen:a,onProgress:o})},fFe=function(t,e,n,r,s,a){return W5t(t,e,{N:n,r,p:s,dkLen:a})};let hFe=dFe,pFe=fFe;async function f8(t,e,n,r,s,a,o){const l=js(t,"passwd"),c=js(e,"salt");return ns(await hFe(l,c,n,r,s,a,o))}f8._=dFe;f8.lock=function(){uFe=!0};f8.register=function(t){if(uFe)throw new Error("scrypt is locked");hFe=t};Object.freeze(f8);function h8(t,e,n,r,s,a){const o=js(t,"passwd"),l=js(e,"salt");return ns(pFe(o,l,n,r,s,a))}h8._=fFe;h8.lock=function(){cFe=!0};h8.register=function(t){if(cFe)throw new Error("scryptSync is locked");pFe=t};Object.freeze(h8);const mFe=function(t){return C5t("sha256").update(t).digest()};let xFe=mFe,gFe=!1;function xp(t){const e=js(t,"data");return ns(xFe(e))}xp._=mFe;xp.lock=function(){gFe=!0};xp.register=function(t){if(gFe)throw new Error("sha256 is locked");xFe=t};Object.freeze(xp);Object.freeze(xp);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const bFe=BigInt(0),X$=BigInt(1),G5t=BigInt(2),Q$=t=>t instanceof Uint8Array,K5t=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function hS(t){if(!Q$(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=K5t[t[n]];return e}function yFe(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function ole(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function pS(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 y3(t){return ole(hS(t))}function lle(t){if(!Q$(t))throw new Error("Uint8Array expected");return ole(hS(Uint8Array.from(t).reverse()))}function mS(t,e){return pS(t.toString(16).padStart(e*2,"0"))}function cle(t,e){return mS(t,e).reverse()}function Y5t(t){return pS(yFe(t))}function Kp(t,e,n){let r;if(typeof e=="string")try{r=pS(e)}catch(a){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${a}`)}else if(Q$(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 eE(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!Q$(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}function X5t(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 Q5t(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Z5t(t){let e;for(e=0;t>bFe;t>>=X$,e+=1);return e}function J5t(t,e){return t>>BigInt(e)&X$}const e6t=(t,e,n)=>t|(n?X$:bFe)<<BigInt(e),ule=t=>(G5t<<BigInt(t-1))-X$,JV=t=>new Uint8Array(t),uge=t=>Uint8Array.from(t);function vFe(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=JV(t),s=JV(t),a=0;const o=()=>{r.fill(1),s.fill(0),a=0},l=(...f)=>n(s,r,...f),c=(f=JV())=>{s=l(uge([0]),f),r=l(),f.length!==0&&(s=l(uge([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 eE(...x)};return(f,x)=>{o(),c(f);let g;for(;!(g=x(u()));)c();return o(),g}}const t6t={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 LT(t,e,n={}){const r=(s,a,o)=>{const l=t6t[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 n6t=Object.freeze(Object.defineProperty({__proto__:null,bitGet:J5t,bitLen:Z5t,bitMask:ule,bitSet:e6t,bytesToHex:hS,bytesToNumberBE:y3,bytesToNumberLE:lle,concatBytes:eE,createHmacDrbg:vFe,ensureBytes:Kp,equalBytes:X5t,hexToBytes:pS,hexToNumber:ole,numberToBytesBE:mS,numberToBytesLE:cle,numberToHexUnpadded:yFe,numberToVarBytesBE:Y5t,utf8ToBytes:Q5t,validateObject:LT},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fc=BigInt(0),jl=BigInt(1),aw=BigInt(2),r6t=BigInt(3),ute=BigInt(4),dge=BigInt(5),fge=BigInt(8);BigInt(9);BigInt(16);function Qd(t,e){const n=t%e;return n>=Fc?n:e+n}function s6t(t,e,n){if(n<=Fc||e<Fc)throw new Error("Expected power/modulo > 0");if(n===jl)return Fc;let r=jl;for(;e>Fc;)e&jl&&(r=r*t%n),t=t*t%n,e>>=jl;return r}function Ah(t,e,n){let r=t;for(;e-- >Fc;)r*=r,r%=n;return r}function dte(t,e){if(t===Fc||e<=Fc)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Qd(t,e),r=e,s=Fc,a=jl;for(;n!==Fc;){const l=r/n,c=r%n,u=s-a*l;r=n,n=c,s=a,a=u}if(r!==jl)throw new Error("invert: does not exist");return Qd(s,e)}function i6t(t){const e=(t-jl)/aw;let n,r,s;for(n=t-jl,r=0;n%aw===Fc;n/=aw,r++);for(s=aw;s<t&&s6t(s,e,t)!==t-jl;s++);if(r===1){const o=(t+jl)/ute;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+jl)/aw;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,jl<<BigInt(u-g-1));d=l.sqr(y),f=l.mul(f,y),x=l.mul(x,d),u=g}return f}}function a6t(t){if(t%ute===r6t){const e=(t+jl)/ute;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%fge===dge){const e=(t-dge)/fge;return function(r,s){const a=r.mul(s,aw),o=r.pow(a,e),l=r.mul(s,o),c=r.mul(r.mul(l,aw),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 i6t(t)}const o6t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function l6t(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=o6t.reduce((r,s)=>(r[s]="function",r),e);return LT(t,n)}function c6t(t,e,n){if(n<Fc)throw new Error("Expected power > 0");if(n===Fc)return t.ONE;if(n===jl)return e;let r=t.ONE,s=e;for(;n>Fc;)n&jl&&(r=t.mul(r,s)),s=t.sqr(s),n>>=jl;return r}function u6t(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 wFe(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function d6t(t,e,n=!1,r={}){if(t<=Fc)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:a}=wFe(t,e);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=a6t(t),l=Object.freeze({ORDER:t,BITS:s,BYTES:a,MASK:ule(s),ZERO:Fc,ONE:jl,create:c=>Qd(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Fc<=c&&c<t},is0:c=>c===Fc,isOdd:c=>(c&jl)===jl,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)=>c6t(l,c,u),div:(c,u)=>Qd(c*dte(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>dte(c,t),sqrt:r.sqrt||(c=>o(l,c)),invertBatch:c=>u6t(l,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?cle(c,a):mS(c,a),fromBytes:c=>{if(c.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${c.length}`);return n?lle(c):y3(c)}});return Object.freeze(l)}function CFe(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 NFe(t){const e=CFe(t);return e+Math.ceil(e/2)}function f6t(t,e,n=!1){const r=t.length,s=CFe(e),a=NFe(e);if(r<16||r<a||r>1024)throw new Error(`expected ${a}-1024 bytes of input, got ${r}`);const o=n?y3(t):lle(t),l=Qd(o,e-jl)+jl;return n?cle(l,s):mS(l,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const h6t=BigInt(0),eW=BigInt(1);function p6t(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>h6t;)a&eW&&(o=o.add(l)),l=l.double(),a>>=eW;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+=eW);const S=v,T=v+Math.abs(C)-1,I=y%2!==0,L=C<0;C===0?d=d.add(n(I,a[S])):u=u.add(n(L,a[T]))}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 SFe(t){return l6t(t.Fp),LT(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...wFe(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function m6t(t){const e=SFe(t);LT(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:x6t,hexToBytes:g6t}=n6t,gw={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=gw;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:x6t(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=gw,n=typeof t=="string"?g6t(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}=gw._parseInt(n.subarray(2)),{d:o,l}=gw._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}`}},$g=BigInt(0),Zh=BigInt(1);BigInt(2);const hge=BigInt(3);BigInt(4);function b6t(t){const e=m6t(t),{Fp:n}=e,r=e.toBytes||((y,v,C)=>{const S=v.toAffine();return eE(Uint8Array.from([4]),n.toBytes(S.x),n.toBytes(S.y))}),s=e.fromBytes||(y=>{const v=y.subarray(1),C=n.fromBytes(v.subarray(0,n.BYTES)),S=n.fromBytes(v.subarray(n.BYTES,2*n.BYTES));return{x:C,y:S}});function a(y){const{a:v,b:C}=e,S=n.sqr(y),T=n.mul(S,y);return n.add(n.add(T,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"&&$g<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:S,n:T}=e;if(v&&typeof y!="bigint"){if(y instanceof Uint8Array&&(y=hS(y)),typeof y!="string"||!v.includes(y.length))throw new Error("Invalid key");y=y.padStart(C*2,"0")}let I;try{I=typeof y=="bigint"?y:y3(Kp("private key",y,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof y}`)}return S&&(I=Qd(I,T)),l(I),I}const u=new Map;function d(y){if(!(y instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(v,C,S){if(this.px=v,this.py=C,this.pz=S,v==null||!n.isValid(v))throw new Error("x required");if(C==null||!n.isValid(C))throw new Error("y required");if(S==null||!n.isValid(S))throw new Error("z required")}static fromAffine(v){const{x:C,y:S}=v||{};if(!v||!n.isValid(C)||!n.isValid(S))throw new Error("invalid affine point");if(v instanceof f)throw new Error("projective point not allowed");const T=I=>n.eql(I,n.ZERO);return T(C)&&T(S)?f.ZERO:new f(C,S,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){const C=n.invertBatch(v.map(S=>S.pz));return v.map((S,T)=>S.toAffine(C[T])).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 S=n.sqr(C),T=a(v);if(!n.eql(S,T))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:S,pz:T}=this,{px:I,py:L,pz:F}=v,$=n.eql(n.mul(C,F),n.mul(I,T)),O=n.eql(n.mul(S,F),n.mul(L,T));return $&&O}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:v,b:C}=e,S=n.mul(C,hge),{px:T,py:I,pz:L}=this;let F=n.ZERO,$=n.ZERO,O=n.ZERO,U=n.mul(T,T),Y=n.mul(I,I),re=n.mul(L,L),Q=n.mul(T,I);return Q=n.add(Q,Q),O=n.mul(T,L),O=n.add(O,O),F=n.mul(v,O),$=n.mul(S,re),$=n.add(F,$),F=n.sub(Y,$),$=n.add(Y,$),$=n.mul(F,$),F=n.mul(Q,F),O=n.mul(S,O),re=n.mul(v,re),Q=n.sub(U,re),Q=n.mul(v,Q),Q=n.add(Q,O),O=n.add(U,U),U=n.add(O,U),U=n.add(U,re),U=n.mul(U,Q),$=n.add($,U),re=n.mul(I,L),re=n.add(re,re),U=n.mul(re,Q),F=n.sub(F,U),O=n.mul(re,Y),O=n.add(O,O),O=n.add(O,O),new f(F,$,O)}add(v){d(v);const{px:C,py:S,pz:T}=this,{px:I,py:L,pz:F}=v;let $=n.ZERO,O=n.ZERO,U=n.ZERO;const Y=e.a,re=n.mul(e.b,hge);let Q=n.mul(C,I),q=n.mul(S,L),te=n.mul(T,F),fe=n.add(C,S),G=n.add(I,L);fe=n.mul(fe,G),G=n.add(Q,q),fe=n.sub(fe,G),G=n.add(C,T);let ie=n.add(I,F);return G=n.mul(G,ie),ie=n.add(Q,te),G=n.sub(G,ie),ie=n.add(S,T),$=n.add(L,F),ie=n.mul(ie,$),$=n.add(q,te),ie=n.sub(ie,$),U=n.mul(Y,G),$=n.mul(re,te),U=n.add($,U),$=n.sub(q,U),U=n.add(q,U),O=n.mul($,U),q=n.add(Q,Q),q=n.add(q,Q),te=n.mul(Y,te),G=n.mul(re,G),q=n.add(q,te),te=n.sub(Q,te),te=n.mul(Y,te),G=n.add(G,te),Q=n.mul(q,G),O=n.add(O,Q),Q=n.mul(ie,G),$=n.mul(fe,$),$=n.sub($,Q),Q=n.mul(fe,q),U=n.mul(ie,U),U=n.add(U,Q),new f($,O,U)}subtract(v){return this.add(v.negate())}is0(){return this.equals(f.ZERO)}wNAF(v){return g.wNAFCached(this,u,v,C=>{const S=n.invertBatch(C.map(T=>T.pz));return C.map((T,I)=>T.toAffine(S[I])).map(f.fromAffine)})}multiplyUnsafe(v){const C=f.ZERO;if(v===$g)return C;if(l(v),v===Zh)return this;const{endo:S}=e;if(!S)return g.unsafeLadder(this,v);let{k1neg:T,k1:I,k2neg:L,k2:F}=S.splitScalar(v),$=C,O=C,U=this;for(;I>$g||F>$g;)I&Zh&&($=$.add(U)),F&Zh&&(O=O.add(U)),U=U.double(),I>>=Zh,F>>=Zh;return T&&($=$.negate()),L&&(O=O.negate()),O=new f(n.mul(O.px,S.beta),O.py,O.pz),$.add(O)}multiply(v){l(v);let C=v,S,T;const{endo:I}=e;if(I){const{k1neg:L,k1:F,k2neg:$,k2:O}=I.splitScalar(C);let{p:U,f:Y}=this.wNAF(F),{p:re,f:Q}=this.wNAF(O);U=g.constTimeNegate(L,U),re=g.constTimeNegate($,re),re=new f(n.mul(re.px,I.beta),re.py,re.pz),S=U.add(re),T=Y.add(Q)}else{const{p:L,f:F}=this.wNAF(C);S=L,T=F}return f.normalizeZ([S,T])[0]}multiplyAndAddUnsafe(v,C,S){const T=f.BASE,I=(F,$)=>$===$g||$===Zh||!F.equals(T)?F.multiplyUnsafe($):F.multiply($),L=I(this,C).add(I(v,S));return L.is0()?void 0:L}toAffine(v){const{px:C,py:S,pz:T}=this,I=this.is0();v==null&&(v=I?n.ONE:n.inv(T));const L=n.mul(C,v),F=n.mul(S,v),$=n.mul(T,v);if(I)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:L,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 hS(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=p6t(f,e.endo?Math.ceil(x/2):x);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:o}}function y6t(t){const e=SFe(t);return LT(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function v6t(t){const e=y6t(t),{Fp:n,n:r}=e,s=n.BYTES+1,a=2*n.BYTES+1;function o(G){return $g<G&&G<n.ORDER}function l(G){return Qd(G,r)}function c(G){return dte(G,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:x}=b6t({...e,toBytes(G,ie,oe){const K=ie.toAffine(),H=n.toBytes(K.x),ee=eE;return oe?ee(Uint8Array.from([ie.hasEvenY()?2:3]),H):ee(Uint8Array.from([4]),H,n.toBytes(K.y))},fromBytes(G){const ie=G.length,oe=G[0],K=G.subarray(1);if(ie===s&&(oe===2||oe===3)){const H=y3(K);if(!o(H))throw new Error("Point is not on curve");const ee=f(H);let se=n.sqrt(ee);const pe=(se&Zh)===Zh;return(oe&1)===1!==pe&&(se=n.neg(se)),{x:H,y:se}}else if(ie===a&&oe===4){const H=n.fromBytes(K.subarray(0,n.BYTES)),ee=n.fromBytes(K.subarray(n.BYTES,2*n.BYTES));return{x:H,y:ee}}else throw new Error(`Point of length ${ie} was invalid. Expected ${s} compressed bytes or ${a} uncompressed bytes`)}}),g=G=>hS(mS(G,e.nByteLength));function y(G){const ie=r>>Zh;return G>ie}function v(G){return y(G)?l(-G):G}const C=(G,ie,oe)=>y3(G.slice(ie,oe));class S{constructor(ie,oe,K){this.r=ie,this.s=oe,this.recovery=K,this.assertValidity()}static fromCompact(ie){const oe=e.nByteLength;return ie=Kp("compactSignature",ie,oe*2),new S(C(ie,0,oe),C(ie,oe,2*oe))}static fromDER(ie){const{r:oe,s:K}=gw.toSig(Kp("DER",ie));return new S(oe,K)}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(ie){return new S(this.r,this.s,ie)}recoverPublicKey(ie){const{r:oe,s:K,recovery:H}=this,ee=O(Kp("msgHash",ie));if(H==null||![0,1,2,3].includes(H))throw new Error("recovery id invalid");const se=H===2||H===3?oe+e.n:oe;if(se>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const pe=H&1?"03":"02",Se=u.fromHex(pe+g(se)),ge=c(se),ve=l(-ee*ge),be=l(K*ge),we=u.BASE.multiplyAndAddUnsafe(Se,ve,be);if(!we)throw new Error("point at infinify");return we.assertValidity(),we}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new S(this.r,l(-this.s),this.recovery):this}toDERRawBytes(){return pS(this.toDERHex())}toDERHex(){return gw.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return pS(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const T={isValidPrivateKey(G){try{return d(G),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const G=NFe(e.n);return f6t(e.randomBytes(G),e.n)},precompute(G=8,ie=u.BASE){return ie._setWindowSize(G),ie.multiply(BigInt(3)),ie}};function I(G,ie=!0){return u.fromPrivateKey(G).toRawBytes(ie)}function L(G){const ie=G instanceof Uint8Array,oe=typeof G=="string",K=(ie||oe)&&G.length;return ie?K===s||K===a:oe?K===2*s||K===2*a:G instanceof u}function F(G,ie,oe=!0){if(L(G))throw new Error("first arg must be private key");if(!L(ie))throw new Error("second arg must be public key");return u.fromHex(ie).multiply(d(G)).toRawBytes(oe)}const $=e.bits2int||function(G){const ie=y3(G),oe=G.length*8-e.nBitLength;return oe>0?ie>>BigInt(oe):ie},O=e.bits2int_modN||function(G){return l($(G))},U=ule(e.nBitLength);function Y(G){if(typeof G!="bigint")throw new Error("bigint expected");if(!($g<=G&&G<U))throw new Error(`bigint expected < 2^${e.nBitLength}`);return mS(G,e.nByteLength)}function re(G,ie,oe=Q){if(["recovered","canonical"].some(Fe=>Fe in oe))throw new Error("sign() legacy options not supported");const{hash:K,randomBytes:H}=e;let{lowS:ee,prehash:se,extraEntropy:pe}=oe;ee==null&&(ee=!0),G=Kp("msgHash",G),se&&(G=Kp("prehashed msgHash",K(G)));const Se=O(G),ge=d(ie),ve=[Y(ge),Y(Se)];if(pe!=null){const Fe=pe===!0?H(n.BYTES):pe;ve.push(Kp("extraEntropy",Fe))}const be=eE(...ve),we=Se;function je(Fe){const Re=$(Fe);if(!x(Re))return;const Qe=c(Re),Ye=u.BASE.multiply(Re).toAffine(),dt=l(Ye.x);if(dt===$g)return;const st=l(Qe*l(we+dt*ge));if(st===$g)return;let at=(Ye.x===dt?0:2)|Number(Ye.y&Zh),He=st;return ee&&y(st)&&(He=v(st),at^=1),new S(dt,He,at)}return{seed:be,k2sig:je}}const Q={lowS:e.lowS,prehash:!1},q={lowS:e.lowS,prehash:!1};function te(G,ie,oe=Q){const{seed:K,k2sig:H}=re(G,ie,oe),ee=e;return vFe(ee.hash.outputLen,ee.nByteLength,ee.hmac)(K,H)}u.BASE._setWindowSize(8);function fe(G,ie,oe,K=q){var Ye;const H=G;if(ie=Kp("msgHash",ie),oe=Kp("publicKey",oe),"strict"in K)throw new Error("options.strict was renamed to lowS");const{lowS:ee,prehash:se}=K;let pe,Se;try{if(typeof H=="string"||H instanceof Uint8Array)try{pe=S.fromDER(H)}catch(dt){if(!(dt instanceof gw.Err))throw dt;pe=S.fromCompact(H)}else if(typeof H=="object"&&typeof H.r=="bigint"&&typeof H.s=="bigint"){const{r:dt,s:st}=H;pe=new S(dt,st)}else throw new Error("PARSE");Se=u.fromHex(oe)}catch(dt){if(dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ee&&pe.hasHighS())return!1;se&&(ie=e.hash(ie));const{r:ge,s:ve}=pe,be=O(ie),we=c(ve),je=l(be*we),Fe=l(ge*we),Re=(Ye=u.BASE.multiplyAndAddUnsafe(Se,je,Fe))==null?void 0:Ye.toAffine();return Re?l(Re.x)===ge:!1}return{CURVE:e,getPublicKey:I,getSharedSecret:F,sign:te,verify:fe,ProjectivePoint:u,Signature:S,utils:T}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function w6t(t){return{hash:t,hmac:(e,...n)=>Y$(t,e,q3t(...n)),randomBytes:K3t}}function C6t(t,e){const n=r=>v6t({...t,...w6t(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const jFe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),pge=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),N6t=BigInt(1),fte=BigInt(2),mge=(t,e)=>(t+e/fte)/e;function S6t(t){const e=jFe,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,fte,e)*u%e,y=Ah(g,s,e)*g%e,v=Ah(y,a,e)*y%e,C=Ah(v,l,e)*v%e,S=Ah(C,c,e)*C%e,T=Ah(S,l,e)*v%e,I=Ah(T,n,e)*d%e,L=Ah(I,o,e)*y%e,F=Ah(L,r,e)*u%e,$=Ah(F,fte,e);if(!hte.eql(hte.sqr($),t))throw new Error("Cannot find square root");return $}const hte=d6t(jFe,void 0,void 0,{sqrt:S6t}),Ub=C6t({a:BigInt(0),b:BigInt(7),Fp:hte,n:pge,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=pge,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-N6t*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,o=BigInt("0x100000000000000000000000000000000"),l=mge(a*t,e),c=mge(-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}}}},c8);BigInt(0);Ub.ProjectivePoint;const tE="0x0000000000000000000000000000000000000000",xge="0x0000000000000000000000000000000000000000000000000000000000000000",j6t=`Ethereum Signed Message:
`,gge=BigInt(0),bge=BigInt(1),yge=BigInt(2),vge=BigInt(27),wge=BigInt(28),YI=BigInt(35),cC={};function Cge(t){return y1(dl(t),32)}var gN,b0,bN,Zw;const Wp=class Wp{constructor(e,n,r,s){Wn(this,gN);Wn(this,b0);Wn(this,bN);Wn(this,Zw);I5(e,cC,"Signature"),tn(this,gN,n),tn(this,b0,r),tn(this,bN,s),tn(this,Zw,null)}get r(){return Je(this,gN)}set r(e){Dn(P4(e)===32,"invalid r","value",e),tn(this,gN,ns(e))}get s(){return Dn(parseInt(Je(this,b0).substring(0,3))<8,"non-canonical s; use ._s","s",Je(this,b0)),Je(this,b0)}set s(e){Dn(P4(e)===32,"invalid s","value",e),tn(this,b0,ns(e))}get _s(){return Je(this,b0)}isValid(){return parseInt(Je(this,b0).substring(0,3))<8}get v(){return Je(this,bN)}set v(e){const n=Ui(e,"value");Dn(n===27||n===28,"invalid v","v",e),tn(this,bN,n)}get networkV(){return Je(this,Zw)}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=js(this.s);return this.yParity&&(e[0]|=128),ns(e)}get compactSerialized(){return $a([this.r,this.yParityAndS])}get serialized(){return $a([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(cC,this.r,this._s,this.v);return this.networkV&&tn(e,Zw,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=Ms(e,"v");return n==vge||n==wge?gge:(Dn(n>=YI,"invalid EIP-155 v","v",e),(n-YI)/yge)}static getChainIdV(e,n){return Ms(e)*yge+BigInt(35+n-27)}static getNormalizedV(e){const n=Ms(e);return n===gge||n===vge?27:n===bge||n===wge?28:(Dn(n>=YI,"invalid v","v",e),n&bge?27:28)}static from(e){function n(u,d){Dn(u,d,"signature",e)}if(e==null)return new Wp(cC,xge,xge,27);if(typeof e=="string"){const u=js(e,"signature");if(u.length===64){const d=ns(u.slice(0,32)),f=u.slice(32,64),x=f[0]&128?28:27;return f[0]&=127,new Wp(cC,d,ns(f),x)}if(u.length===65){const d=ns(u.slice(0,32)),f=ns(u.slice(32,64)),x=Wp.getNormalizedV(u[64]);return new Wp(cC,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=Cge(r),a=function(u,d){if(u!=null)return Cge(u);if(d!=null){n(bo(d,32),"invalid yParityAndS");const f=js(d);return f[0]&=127,ns(f)}n(!1,"missing s")}(e.s,e.yParityAndS),{networkV:o,v:l}=function(u,d,f){if(u!=null){const x=Ms(u);return{networkV:x>=YI?x:void 0,v:Wp.getNormalizedV(x)}}if(d!=null)return n(bo(d,32),"invalid yParityAndS"),{v:js(d)[0]&128?28:27};if(f!=null){switch(Ui(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(cC,s,a,l);return o&&tn(c,Zw,o),n(e.yParity==null||Ui(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),n(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};gN=new WeakMap,b0=new WeakMap,bN=new WeakMap,Zw=new WeakMap;let lu=Wp;var Pg;const lw=class lw{constructor(e){Wn(this,Pg);Dn(P4(e)===32,"invalid private key","privateKey","[REDACTED]"),tn(this,Pg,ns(e))}get privateKey(){return Je(this,Pg)}get publicKey(){return lw.computePublicKey(Je(this,Pg))}get compressedPublicKey(){return lw.computePublicKey(Je(this,Pg),!0)}sign(e){Dn(P4(e)===32,"invalid digest length","digest",e);const n=Ub.sign(iu(e),iu(Je(this,Pg)),{lowS:!0});return lu.from({r:v1(n.r,32),s:v1(n.s,32),v:n.recovery?28:27})}computeSharedSecret(e){const n=lw.computePublicKey(e);return ns(Ub.getSharedSecret(iu(Je(this,Pg)),js(n),!1))}static computePublicKey(e,n){let r=js(e,"key");if(r.length===32){const a=Ub.getPublicKey(r,!!n);return ns(a)}if(r.length===64){const a=new Uint8Array(65);a[0]=4,a.set(r,1),r=a}const s=Ub.ProjectivePoint.fromHex(r);return ns(s.toRawBytes(n))}static recoverPublicKey(e,n){Dn(P4(e)===32,"invalid digest length","digest",e);const r=lu.from(n);let s=Ub.Signature.fromCompact(iu($a([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const a=s.recoverPublicKey(iu(e));return Dn(a!=null,"invalid signature for digest","signature",n),"0x"+a.toHex(!1)}static addPoints(e,n,r){const s=Ub.ProjectivePoint.fromHex(lw.computePublicKey(e).substring(2)),a=Ub.ProjectivePoint.fromHex(lw.computePublicKey(n).substring(2));return"0x"+s.add(a).toHex(!!r)}};Pg=new WeakMap;let Y0=lw;const A6t=BigInt(0),_6t=BigInt(36);function Nge(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=js(go(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 dle={};for(let t=0;t<10;t++)dle[String(t)]=String(t);for(let t=0;t<26;t++)dle[String.fromCharCode(65+t)]=String(10+t);const Sge=15;function E6t(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(r=>dle[r]).join("");for(;e.length>=Sge;){let r=e.substring(0,Sge);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 k6t=function(){const t={};for(let e=0;e<36;e++){const n="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[n]=BigInt(e)}return t}();function T6t(t){t=t.toLowerCase();let e=A6t;for(let n=0;n<t.length;n++)e=e*_6t+k6t[t[n]];return e}function ua(t){if(Dn(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=Nge(t);return Dn(!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}$/)){Dn(t.substring(2,4)===E6t(t),"bad icap checksum","address",t);let e=T6t(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return Nge("0x"+e)}Dn(!1,"invalid address","address",t)}function P6t(t){const e=ua(t.from);let r=Ms(t.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,ua(_o(go(w1([e,r])),12))}function AFe(t){return t&&typeof t.getAddress=="function"}async function tW(t,e){const n=await e;return(n==null||n==="0x0000000000000000000000000000000000000000")&&(zr(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),Dn(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),ua(n)}function Oc(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?ua(t):(zr(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),tW(t,e.resolveName(t)));if(AFe(t))return tW(t,t.getAddress());if(t&&typeof t.then=="function")return tW(t,t);Dn(!1,"unsupported addressable value","target",t)}const bg={};function Rs(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new Uu(bg,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function va(t,e){return new Uu(bg,`bytes${e||""}`,t,{size:e})}const jge=Symbol.for("_ethers_typed");var Jw;const vg=class vg{constructor(e,n,r,s){Qn(this,"type");Qn(this,"value");Wn(this,Jw);Qn(this,"_typedSymbol");s==null&&(s=null),I5(bg,e,"Typed"),qs(this,{_typedSymbol:jge,type:n,value:r}),tn(this,Jw,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 Je(this,Jw)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return Je(this,Jw)===!0?-1:Je(this,Jw)===!1?this.value.length:null}static from(e,n){return new vg(bg,e,n)}static uint8(e){return Rs(e,8)}static uint16(e){return Rs(e,16)}static uint24(e){return Rs(e,24)}static uint32(e){return Rs(e,32)}static uint40(e){return Rs(e,40)}static uint48(e){return Rs(e,48)}static uint56(e){return Rs(e,56)}static uint64(e){return Rs(e,64)}static uint72(e){return Rs(e,72)}static uint80(e){return Rs(e,80)}static uint88(e){return Rs(e,88)}static uint96(e){return Rs(e,96)}static uint104(e){return Rs(e,104)}static uint112(e){return Rs(e,112)}static uint120(e){return Rs(e,120)}static uint128(e){return Rs(e,128)}static uint136(e){return Rs(e,136)}static uint144(e){return Rs(e,144)}static uint152(e){return Rs(e,152)}static uint160(e){return Rs(e,160)}static uint168(e){return Rs(e,168)}static uint176(e){return Rs(e,176)}static uint184(e){return Rs(e,184)}static uint192(e){return Rs(e,192)}static uint200(e){return Rs(e,200)}static uint208(e){return Rs(e,208)}static uint216(e){return Rs(e,216)}static uint224(e){return Rs(e,224)}static uint232(e){return Rs(e,232)}static uint240(e){return Rs(e,240)}static uint248(e){return Rs(e,248)}static uint256(e){return Rs(e,256)}static uint(e){return Rs(e,256)}static int8(e){return Rs(e,-8)}static int16(e){return Rs(e,-16)}static int24(e){return Rs(e,-24)}static int32(e){return Rs(e,-32)}static int40(e){return Rs(e,-40)}static int48(e){return Rs(e,-48)}static int56(e){return Rs(e,-56)}static int64(e){return Rs(e,-64)}static int72(e){return Rs(e,-72)}static int80(e){return Rs(e,-80)}static int88(e){return Rs(e,-88)}static int96(e){return Rs(e,-96)}static int104(e){return Rs(e,-104)}static int112(e){return Rs(e,-112)}static int120(e){return Rs(e,-120)}static int128(e){return Rs(e,-128)}static int136(e){return Rs(e,-136)}static int144(e){return Rs(e,-144)}static int152(e){return Rs(e,-152)}static int160(e){return Rs(e,-160)}static int168(e){return Rs(e,-168)}static int176(e){return Rs(e,-176)}static int184(e){return Rs(e,-184)}static int192(e){return Rs(e,-192)}static int200(e){return Rs(e,-200)}static int208(e){return Rs(e,-208)}static int216(e){return Rs(e,-216)}static int224(e){return Rs(e,-224)}static int232(e){return Rs(e,-232)}static int240(e){return Rs(e,-240)}static int248(e){return Rs(e,-248)}static int256(e){return Rs(e,-256)}static int(e){return Rs(e,-256)}static bytes1(e){return va(e,1)}static bytes2(e){return va(e,2)}static bytes3(e){return va(e,3)}static bytes4(e){return va(e,4)}static bytes5(e){return va(e,5)}static bytes6(e){return va(e,6)}static bytes7(e){return va(e,7)}static bytes8(e){return va(e,8)}static bytes9(e){return va(e,9)}static bytes10(e){return va(e,10)}static bytes11(e){return va(e,11)}static bytes12(e){return va(e,12)}static bytes13(e){return va(e,13)}static bytes14(e){return va(e,14)}static bytes15(e){return va(e,15)}static bytes16(e){return va(e,16)}static bytes17(e){return va(e,17)}static bytes18(e){return va(e,18)}static bytes19(e){return va(e,19)}static bytes20(e){return va(e,20)}static bytes21(e){return va(e,21)}static bytes22(e){return va(e,22)}static bytes23(e){return va(e,23)}static bytes24(e){return va(e,24)}static bytes25(e){return va(e,25)}static bytes26(e){return va(e,26)}static bytes27(e){return va(e,27)}static bytes28(e){return va(e,28)}static bytes29(e){return va(e,29)}static bytes30(e){return va(e,30)}static bytes31(e){return va(e,31)}static bytes32(e){return va(e,32)}static address(e){return new vg(bg,"address",e)}static bool(e){return new vg(bg,"bool",!!e)}static bytes(e){return new vg(bg,"bytes",e)}static string(e){return new vg(bg,"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 vg(bg,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===jge}static dereference(e,n){if(vg.isTyped(e)){if(e.type!==n)throw new Error(`invalid type: expecetd ${n}, got ${e.type}`);return e.value}return e}};Jw=new WeakMap;let Uu=vg;class I6t extends D1{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){let r=Uu.dereference(n,"string");try{r=ua(r)}catch(s){return this._throwError(s.message,n)}return e.writeValue(r)}decode(e){return ua(v1(e.readValue(),20))}}class F6t extends D1{constructor(n){super(n.name,n.type,"_",n.dynamic);Qn(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 _Fe(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 zr(d,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),zr(!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 Dn(!1,"invalid tuple value","tuple",n);Dn(e.length===r.length,"types/value length mismatch","tuple",n);let s=new ate,a=new ate,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 EFe(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(su(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(su(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)}),kL.fromItems(n,r)}class O6t extends D1{constructor(n,r,s){const a=n.type+"["+(r>=0?r:"")+"]",o=r===-1||n.dynamic;super("array",a,s,o);Qn(this,"coder");Qn(this,"length");qs(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)),hIe(s.length,a,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let l=0;l<s.length;l++)o.push(this.coder);return _Fe(n,o,s)}decode(n){let r=this.length;r===-1&&(r=n.readIndex(),zr(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 F6t(this.coder));return EFe(n,s)}}class M6t extends D1{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 kFe extends D1{constructor(e,n){super(e,e,n,!0)}defaultValue(){return"0x"}encode(e,n){n=iu(n);let r=e.writeValue(n.length);return r+=e.writeBytes(n),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class L6t extends kFe{constructor(e){super("bytes",e)}decode(e){return ns(super.decode(e))}}class R6t extends D1{constructor(n,r){let s="bytes"+String(n);super(s,s,r,!1);Qn(this,"size");qs(this,{size:n},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(n,r){let s=iu(Uu.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),n.writeBytes(s)}decode(n){return ns(n.readBytes(this.size))}}const D6t=new Uint8Array([]);class B6t extends D1{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes(D6t)}decode(e){return e.readBytes(0),null}}const $6t=BigInt(0),U6t=BigInt(1),z6t=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class H6t extends D1{constructor(n,r,s){const a=(r?"int":"uint")+n*8;super(a,a,s,!1);Qn(this,"size");Qn(this,"signed");qs(this,{size:n,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(n,r){let s=Ms(Uu.dereference(r,this.type)),a=J7(z6t,fd*8);if(this.signed){let o=J7(a,this.size*8-1);(s>o||s<-(o+U6t))&&this._throwError("value out-of-bounds",r),s=gIe(s,8*fd)}else(s<$6t||s>J7(a,this.size*8))&&this._throwError("value out-of-bounds",r);return n.writeValue(s)}decode(n){let r=J7(n.readValue(),this.size*8);return this.signed&&(r=w3t(r,this.size*8)),r}}class V6t extends kFe{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,bd(Uu.dereference(n,"string")))}decode(e){return EL(super.decode(e))}}class XI extends D1{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);Qn(this,"coders");qs(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 _Fe(n,this.coders,s)}decode(n){return EFe(n,this.coders)}}function nW(t,e){return{address:ua(t),storageKeys:e.map((n,r)=>(Dn(bo(n,32),"invalid slot",`storageKeys[${r}]`,n),n.toLowerCase()))}}function F5(t){if(Array.isArray(t))return t.map((n,r)=>Array.isArray(n)?(Dn(n.length===2,"invalid slot set",`value[${r}]`,n),nW(n[0],n[1])):(Dn(n!=null&&typeof n=="object","invalid address-slot set","value",t),nW(n.address,n.storageKeys)));Dn(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 nW(n,Object.keys(r).sort())});return e.sort((n,r)=>n.address.localeCompare(r.address)),e}function TFe(t){return{address:ua(t.address),nonce:Ms(t.nonce!=null?t.nonce:0),chainId:Ms(t.chainId!=null?t.chainId:0),signature:lu.from(t.signature)}}function RT(t){let e;return typeof t=="string"?e=Y0.computePublicKey(t,!1):e=t.publicKey,ua(go("0x"+e.substring(4)).substring(26))}function W6t(t,e){return RT(Y0.recoverPublicKey(t,e))}const Tc=BigInt(0),q6t=BigInt(2),G6t=BigInt(27),K6t=BigInt(28),Y6t=BigInt(35),X6t=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),rW=4096*32;function Q6t(t){return{blobToKzgCommitment:r=>{if("computeBlobProof"in t){if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return js(t.blobToKzgCommitment(ns(r)))}else if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return js(t.blobToKzgCommitment(r));if("blobToKZGCommitment"in t&&typeof t.blobToKZGCommitment=="function")return js(t.blobToKZGCommitment(ns(r)));Dn(!1,"unsupported KZG library","kzg",t)},computeBlobKzgProof:(r,s)=>{if("computeBlobProof"in t&&typeof t.computeBlobProof=="function")return js(t.computeBlobProof(ns(r),ns(s)));if("computeBlobKzgProof"in t&&typeof t.computeBlobKzgProof=="function")return t.computeBlobKzgProof(r,s);if("computeBlobKZGProof"in t&&typeof t.computeBlobKZGProof=="function")return js(t.computeBlobKZGProof(ns(r),ns(s)));Dn(!1,"unsupported KZG library","kzg",t)}}}function Age(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=xp(e).substring(4),"0x"+n}function p8(t){return t==="0x"?null:ua(t)}function Z$(t,e){try{return F5(t)}catch(n){Dn(!1,n.message,e,t)}}function Z6t(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:p8(s[1]),nonce:Xa(s[2],"nonce"),chainId:Xa(s[0],"chainId"),signature:lu.from({yParity:O5(s[3],"yParity"),r:y1(s[4],32),s:y1(s[5],32)})})}return n}catch(n){Dn(!1,n.message,e,t)}}function O5(t,e){return t==="0x"?0:Ui(t,e)}function Xa(t,e){if(t==="0x")return Tc;const n=Ms(t,e);return Dn(n<=X6t,"value exceeds uint size",e,n),n}function oa(t,e){const n=Ms(t,"value"),r=dl(n);return Dn(r.length<=32,"value too large",`tx.${e}`,n),r}function J$(t){return F5(t).map(e=>[e.address,e.storageKeys])}function J6t(t){return t.map(e=>[oa(e.chainId,"chainId"),e.address,oa(e.nonce,"nonce"),oa(e.signature.yParity,"yParity"),dl(e.signature.r),dl(e.signature.s)])}function eCt(t,e){Dn(Array.isArray(t),`invalid ${e}`,"value",t);for(let n=0;n<t.length;n++)Dn(bo(t[n],32),"invalid ${ param } hash",`value[${n}]`,t[n]);return t}function tCt(t){const e=MT(t);Dn(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:O5(e[0],"nonce"),gasPrice:Xa(e[1],"gasPrice"),gasLimit:Xa(e[2],"gasLimit"),to:p8(e[3]),value:Xa(e[4],"value"),data:ns(e[5]),chainId:Tc};if(e.length===6)return n;const r=Xa(e[6],"v"),s=Xa(e[7],"r"),a=Xa(e[8],"s");if(s===Tc&&a===Tc)n.chainId=r;else{let o=(r-Y6t)/q6t;o<Tc&&(o=Tc),n.chainId=o,Dn(o!==Tc||r===G6t||r===K6t,"non-canonical legacy v","v",e[6]),n.signature=lu.from({r:y1(e[7],32),s:y1(e[8],32),v:r})}return n}function nCt(t,e){const n=[oa(t.nonce,"nonce"),oa(t.gasPrice||0,"gasPrice"),oa(t.gasLimit,"gasLimit"),t.to||"0x",oa(t.value,"value"),t.data];let r=Tc;if(t.chainId!=Tc)r=Ms(t.chainId,"tx.chainId"),Dn(!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!==Tc&&(n.push(dl(r)),n.push("0x"),n.push("0x")),w1(n);let s=BigInt(27+e.yParity);return r!==Tc?s=lu.getChainIdV(r,e.v):BigInt(e.v)!==s&&Dn(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(dl(s)),n.push(dl(e.r)),n.push(dl(e.s)),w1(n)}function eU(t,e){let n;try{if(n=O5(e[0],"yParity"),n!==0&&n!==1)throw new Error("bad yParity")}catch{Dn(!1,"invalid yParity","yParity",e[0])}const r=y1(e[1],32),s=y1(e[2],32),a=lu.from({r,s,yParity:n});t.signature=a}function rCt(t){const e=MT(js(t).slice(1));Dn(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",ns(t));const n={type:2,chainId:Xa(e[0],"chainId"),nonce:O5(e[1],"nonce"),maxPriorityFeePerGas:Xa(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Xa(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Xa(e[4],"gasLimit"),to:p8(e[5]),value:Xa(e[6],"value"),data:ns(e[7]),accessList:Z$(e[8],"accessList")};return e.length===9||eU(n,e.slice(9)),n}function sCt(t,e){const n=[oa(t.chainId,"chainId"),oa(t.nonce,"nonce"),oa(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),oa(t.maxFeePerGas||0,"maxFeePerGas"),oa(t.gasLimit,"gasLimit"),t.to||"0x",oa(t.value,"value"),t.data,J$(t.accessList||[])];return e&&(n.push(oa(e.yParity,"yParity")),n.push(dl(e.r)),n.push(dl(e.s))),$a(["0x02",w1(n)])}function iCt(t){const e=MT(js(t).slice(1));Dn(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",ns(t));const n={type:1,chainId:Xa(e[0],"chainId"),nonce:O5(e[1],"nonce"),gasPrice:Xa(e[2],"gasPrice"),gasLimit:Xa(e[3],"gasLimit"),to:p8(e[4]),value:Xa(e[5],"value"),data:ns(e[6]),accessList:Z$(e[7],"accessList")};return e.length===8||eU(n,e.slice(8)),n}function aCt(t,e){const n=[oa(t.chainId,"chainId"),oa(t.nonce,"nonce"),oa(t.gasPrice||0,"gasPrice"),oa(t.gasLimit,"gasLimit"),t.to||"0x",oa(t.value,"value"),t.data,J$(t.accessList||[])];return e&&(n.push(oa(e.yParity,"recoveryParam")),n.push(dl(e.r)),n.push(dl(e.s))),$a(["0x01",w1(n)])}function oCt(t){let e=MT(js(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];Dn(Array.isArray(a),"invalid network format: blobs not an array","fields[1]",a),Dn(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),Dn(Array.isArray(l),"invalid network format: proofs not an array","fields[3]",l),Dn(a.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),Dn(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]}Dn(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${n}`,"data",ns(t));const s={type:3,chainId:Xa(e[0],"chainId"),nonce:O5(e[1],"nonce"),maxPriorityFeePerGas:Xa(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Xa(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Xa(e[4],"gasLimit"),to:p8(e[5]),value:Xa(e[6],"value"),data:ns(e[7]),accessList:Z$(e[8],"accessList"),maxFeePerBlobGas:Xa(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),Dn(s.to!=null,`invalid address for transaction type: ${n}`,"data",t),Dn(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let a=0;a<s.blobVersionedHashes.length;a++)Dn(bo(s.blobVersionedHashes[a],32),`invalid blobVersionedHash at index ${a}: must be length 32`,"data",t);return e.length===11||eU(s,e.slice(11)),s}function lCt(t,e,n){const r=[oa(t.chainId,"chainId"),oa(t.nonce,"nonce"),oa(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),oa(t.maxFeePerGas||0,"maxFeePerGas"),oa(t.gasLimit,"gasLimit"),t.to||tE,oa(t.value,"value"),t.data,J$(t.accessList||[]),oa(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),eCt(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(oa(e.yParity,"yParity")),r.push(dl(e.r)),r.push(dl(e.s)),n)?$a(["0x03",w1([r,n.map(s=>s.data),n.map(s=>s.commitment),n.map(s=>s.proof)])]):$a(["0x03",w1(r)])}function cCt(t){const e=MT(js(t).slice(1));Dn(Array.isArray(e)&&(e.length===10||e.length===13),"invalid field count for transaction type: 4","data",ns(t));const n={type:4,chainId:Xa(e[0],"chainId"),nonce:O5(e[1],"nonce"),maxPriorityFeePerGas:Xa(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Xa(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Xa(e[4],"gasLimit"),to:p8(e[5]),value:Xa(e[6],"value"),data:ns(e[7]),accessList:Z$(e[8],"accessList"),authorizationList:Z6t(e[9],"authorizationList")};return e.length===10||eU(n,e.slice(10)),n}function uCt(t,e){const n=[oa(t.chainId,"chainId"),oa(t.nonce,"nonce"),oa(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),oa(t.maxFeePerGas||0,"maxFeePerGas"),oa(t.gasLimit,"gasLimit"),t.to||"0x",oa(t.value,"value"),t.data,J$(t.accessList||[]),J6t(t.authorizationList||[])];return e&&(n.push(oa(e.yParity,"yParity")),n.push(dl(e.r)),n.push(dl(e.s))),$a(["0x04",w1(n)])}var em,yN,vN,wN,CN,NN,SN,jN,AN,_N,EN,kN,e3,fy,y0,hy,TN,PN,iM,Gf;let fle=(Gf=class{constructor(){Wn(this,PN);Wn(this,em);Wn(this,yN);Wn(this,vN);Wn(this,wN);Wn(this,CN);Wn(this,NN);Wn(this,SN);Wn(this,jN);Wn(this,AN);Wn(this,_N);Wn(this,EN);Wn(this,kN);Wn(this,e3);Wn(this,fy);Wn(this,y0);Wn(this,hy);Wn(this,TN);tn(this,em,null),tn(this,yN,null),tn(this,wN,0),tn(this,CN,Tc),tn(this,NN,null),tn(this,SN,null),tn(this,jN,null),tn(this,vN,"0x"),tn(this,AN,Tc),tn(this,_N,Tc),tn(this,EN,null),tn(this,kN,null),tn(this,e3,null),tn(this,fy,null),tn(this,y0,null),tn(this,hy,null),tn(this,TN,null)}get type(){return Je(this,em)}set type(e){switch(e){case null:tn(this,em,null);break;case 0:case"legacy":tn(this,em,0);break;case 1:case"berlin":case"eip-2930":tn(this,em,1);break;case 2:case"london":case"eip-1559":tn(this,em,2);break;case 3:case"cancun":case"eip-4844":tn(this,em,3);break;case 4:case"pectra":case"eip-7702":tn(this,em,4);break;default:Dn(!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=Je(this,yN);return e==null&&this.type===3?tE:e}set to(e){tn(this,yN,e==null?null:ua(e))}get nonce(){return Je(this,wN)}set nonce(e){tn(this,wN,Ui(e,"value"))}get gasLimit(){return Je(this,CN)}set gasLimit(e){tn(this,CN,Ms(e))}get gasPrice(){const e=Je(this,NN);return e==null&&(this.type===0||this.type===1)?Tc:e}set gasPrice(e){tn(this,NN,e==null?null:Ms(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=Je(this,SN);return e??(this.type===2||this.type===3?Tc:null)}set maxPriorityFeePerGas(e){tn(this,SN,e==null?null:Ms(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=Je(this,jN);return e??(this.type===2||this.type===3?Tc:null)}set maxFeePerGas(e){tn(this,jN,e==null?null:Ms(e,"maxFeePerGas"))}get data(){return Je(this,vN)}set data(e){tn(this,vN,ns(e))}get value(){return Je(this,AN)}set value(e){tn(this,AN,Ms(e,"value"))}get chainId(){return Je(this,_N)}set chainId(e){tn(this,_N,Ms(e))}get signature(){return Je(this,EN)||null}set signature(e){tn(this,EN,e==null?null:lu.from(e))}get accessList(){const e=Je(this,kN)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){tn(this,kN,e==null?null:F5(e))}get authorizationList(){const e=Je(this,TN)||null;return e==null&&this.type===4?[]:e}set authorizationList(e){tn(this,TN,e==null?null:e.map(n=>TFe(n)))}get maxFeePerBlobGas(){const e=Je(this,e3);return e==null&&this.type===3?Tc:e}set maxFeePerBlobGas(e){tn(this,e3,e==null?null:Ms(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=Je(this,fy);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){Dn(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let n=0;n<e.length;n++)Dn(bo(e[n],32),"invalid blobVersionedHash",`value[${n}]`,e[n])}tn(this,fy,e)}get blobs(){return Je(this,hy)==null?null:Je(this,hy).map(e=>Object.assign({},e))}set blobs(e){if(e==null){tn(this,hy,null);return}const n=[],r=[];for(let s=0;s<e.length;s++){const a=e[s];if(V$(a)){zr(Je(this,y0),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=js(a);if(Dn(o.length<=rW,"blob is too large",`blobs[${s}]`,a),o.length!==rW){const u=new Uint8Array(rW);u.set(o),o=u}const l=Je(this,y0).blobToKzgCommitment(o),c=ns(Je(this,y0).computeBlobKzgProof(o,l));n.push({data:ns(o),commitment:ns(l),proof:c}),r.push(Age(1,l))}else{const o=ns(a.commitment);n.push({data:ns(a.data),commitment:o,proof:ns(a.proof)}),r.push(Age(1,o))}}tn(this,hy,n),tn(this,fy,r)}get kzg(){return Je(this,y0)}set kzg(e){e==null?tn(this,y0,null):tn(this,y0,Q6t(e))}get hash(){return this.signature==null?null:go(Er(this,PN,iM).call(this,!0,!1))}get unsignedHash(){return go(this.unsignedSerialized)}get from(){return this.signature==null?null:W6t(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:Y0.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return Er(this,PN,iM).call(this,!0,!0)}get unsignedSerialized(){return Er(this,PN,iM).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=Je(this,e3)!=null||Je(this,fy);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&zr(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),zr(!n||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),zr(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 Gf.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 Gf;if(typeof e=="string"){const r=js(e);if(r[0]>=127)return Gf.from(tCt(r));switch(r[0]){case 1:return Gf.from(iCt(r));case 2:return Gf.from(rCt(r));case 3:return Gf.from(oCt(r));case 4:return Gf.from(cCt(r))}zr(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const n=new Gf;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=lu.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&&(Dn(n.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),Dn(n.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(Dn(n.isSigned(),"unsigned transaction cannot define '.from'","tx",e),Dn(n.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),n}},em=new WeakMap,yN=new WeakMap,vN=new WeakMap,wN=new WeakMap,CN=new WeakMap,NN=new WeakMap,SN=new WeakMap,jN=new WeakMap,AN=new WeakMap,_N=new WeakMap,EN=new WeakMap,kN=new WeakMap,e3=new WeakMap,fy=new WeakMap,y0=new WeakMap,hy=new WeakMap,TN=new WeakMap,PN=new WeakSet,iM=function(e,n){zr(!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 nCt(this,r);case 1:return aCt(this,r);case 2:return sCt(this,r);case 3:return lCt(this,r,n?this.blobs:null);case 4:return uCt(this,r)}zr(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})},Gf);function dCt(t){return Dn(typeof t.address=="string","invalid address for hashAuthorization","auth.address",t),go($a(["0x05",w1([t.chainId!=null?dl(t.chainId):"0x",ua(t.address),t.nonce!=null?dl(t.nonce):"0x"])]))}function C1(t){return go(bd(t))}var fCt="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 _ge=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Ege=4;function hCt(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 S=[],T=0,I=x;for(;;){let F=Math.floor(((C-T+1)*s-1)/I),$=0,O=r;for(;O-$>1;){let re=$+O>>>1;F<a[re]?O=re:$=re}if($==0)break;S.push($);let U=T+Math.floor(I*a[$]/s),Y=T+Math.floor(I*a[$+1]/s)-1;for(;!((U^Y)&g);)C=C<<1&v|d(),U=U<<1&v,Y=Y<<1&v|1;for(;U&~Y&y;)C=C&g|C<<1&v>>>1|d(),U=U<<1^g,Y=(Y^g)<<1|g|1;T=U,I=1+Y-U}let L=r-4;return S.map(F=>{switch(F-L){case 3:return L+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return L+256+(t[l++]<<8|t[l++]);case 1:return L+t[l++];default:return F-1}})}function pCt(t){let e=0;return()=>t[e++]}function PFe(t){return pCt(hCt(mCt(t)))}function mCt(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 xCt(t){return t&1?~t>>1:t>>1}function gCt(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=xCt(e());return n}function nE(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 IFe(t){return rE(()=>{let e=nE(t);if(e.length)return e})}function FFe(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(bCt(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(yCt(n,t))}return e.flat()}function rE(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function OFe(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)gCt(t,n).forEach((a,o)=>r[o].push(a));return r}function bCt(t,e){let n=1+e(),r=e(),s=rE(e);return OFe(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 yCt(t,e){let n=1+e();return OFe(n,1+t,e).map(s=>[s[0],s.slice(1)])}function vCt(t){let e=[],n=nE(t);return s(r([]),[]),e;function r(a){let o=t(),l=rE(()=>{let c=nE(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 wCt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function MFe(t){return`{${wCt(t)}}`}function CCt(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 xS(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 NCt(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 SCt="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 sE=44032,TL=4352,PL=4449,IL=4519,LFe=19,RFe=21,gS=28,FL=RFe*gS,jCt=LFe*FL,ACt=sE+jCt,_Ct=TL+LFe,ECt=PL+RFe,kCt=IL+gS;function t_(t){return t>>24&255}function DFe(t){return t&16777215}let pte,kge,mte,aM;function TCt(){let t=PFe(SCt);pte=new Map(IFe(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),kge=new Set(nE(t)),mte=new Map,aM=new Map;for(let[e,n]of FFe(t)){if(!kge.has(e)&&n.length==2){let[r,s]=n,a=aM.get(r);a||(a=new Map,aM.set(r,a)),a.set(s,e)}mte.set(e,n.reverse())}}function BFe(t){return t>=sE&&t<ACt}function PCt(t,e){if(t>=TL&&t<_Ct&&e>=PL&&e<ECt)return sE+(t-TL)*FL+(e-PL)*gS;if(BFe(t)&&e>IL&&e<kCt&&(t-sE)%gS==0)return t+(e-IL);{let n=aM.get(t);return n&&(n=n.get(e),n)?n:-1}}function $Fe(t){pte||TCt();let e=[],n=[],r=!1;function s(a){let o=pte.get(a);o&&(r=!0,a|=o),e.push(a)}for(let a of t)for(;;){if(a<128)e.push(a);else if(BFe(a)){let o=a-sE,l=o/FL|0,c=o%FL/gS|0,u=o%gS;s(TL+l),s(PL+c),u>0&&s(IL+u)}else{let o=mte.get(a);o?n.push(...o):s(a)}if(!n.length)break;a=n.pop()}if(r&&e.length>1){let a=t_(e[0]);for(let o=1;o<e.length;o++){let l=t_(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=t_(e[--c]),a<=l))break}a=t_(e[o])}}return e}function ICt(t){let e=[],n=[],r=-1,s=0;for(let a of t){let o=t_(a),l=DFe(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=PCt(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 UFe(t){return $Fe(t).map(DFe)}function FCt(t){return ICt($Fe(t))}const Tge=45,zFe=".",HFe=65039,VFe=1,OL=t=>Array.from(t);function iE(t,e){return t.P.has(e)||t.Q.has(e)}let OCt=class extends Array{get is_emoji(){return!0}},xte,WFe,bw,gte,qFe,F4,sW,qC,Kv,Pge,bte;function hle(){if(xte)return;let t=PFe(fCt);const e=()=>nE(t),n=()=>new Set(e()),r=(d,f)=>f.forEach(x=>d.add(x));xte=new Map(FFe(t)),WFe=n(),bw=e(),gte=new Set(e().map(d=>bw[d])),bw=new Set(bw),qFe=n(),n();let s=IFe(t),a=t();const o=()=>{let d=new Set;return e().forEach(f=>r(d,s[f])),r(d,e()),d};F4=rE(d=>{let f=rE(t).map(x=>x+96);if(f.length){let x=d>=a;f[0]-=32,f=xS(f),x&&(f=`Restricted[${f}]`);let g=o(),y=o(),v=!t();return{N:f,P:g,Q:y,M:v,R:x}}}),sW=n(),qC=new Map;let l=e().concat(OL(sW)).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),sW.has(d)||qC.set(d,g)});for(let{V:d,M:f}of new Set(qC.values())){let x=[];for(let y of d){let v=F4.filter(S=>iE(S,y)),C=x.find(({G:S})=>v.some(T=>S.has(T)));C||(C={G:new Set,V:[]},x.push(C)),C.V.push(y),r(C.G,v)}let g=x.flatMap(y=>OL(y.G));for(let{G:y,V:v}of x){let C=new Set(g.filter(S=>!y.has(S)));for(let S of v)f.set(S,C)}}Kv=new Set;let c=new Set;const u=d=>Kv.has(d)?c.add(d):Kv.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 Kv)!qC.has(d)&&!c.has(d)&&qC.set(d,VFe);r(Kv,UFe(Kv)),Pge=vCt(t).map(d=>OCt.from(d)).sort(NCt),bte=new Map;for(let d of Pge){let f=[bte];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===HFe?f.push(...g):f=g}for(let x of f)x.V=d}}function ple(t){return(GFe(t)?"":`${mle(tU([t]))} `)+MFe(t)}function mle(t){return`"${t}"`}function MCt(t){if(t.length>=4&&t[2]==Tge&&t[3]==Tge)throw new Error(`invalid label extension: "${xS(t.slice(0,4))}"`)}function LCt(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function RCt(t){let e=t[0],n=_ge.get(e);if(n)throw P_(`leading ${n}`);let r=t.length,s=-1;for(let a=1;a<r;a++){e=t[a];let o=_ge.get(e);if(o){if(s==a)throw P_(`${n} + ${o}`);s=a+1,n=o}}if(s==r)throw P_(`trailing ${n}`)}function tU(t,e=1/0,n=MFe){let r=[];DCt(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];GFe(l)&&(r.push(xS(t.slice(s,o))),r.push(n(l)),s=o+1)}return r.push(xS(t.slice(s,a))),r.join("")}function DCt(t){return hle(),bw.has(t)}function GFe(t){return hle(),qFe.has(t)}function BCt(t){return HCt($Ct(t,FCt,qCt))}function $Ct(t,e,n){if(!t)return[];hle();let r=0;return t.split(zFe).map(s=>{let a=CCt(s),o={input:a,offset:r};r+=a.length+1;try{let l=o.tokens=WCt(a,e,n),c=l.length,u;if(!c)throw new Error("empty label");let d=o.output=l.flat();if(LCt(d),!(o.emoji=c>1||l[0].is_emoji)&&d.every(x=>x<128))MCt(d),u="ASCII";else{let x=l.flatMap(g=>g.is_emoji?[]:g);if(!x.length)u="Emoji";else{if(bw.has(d[0]))throw P_("leading combining mark");for(let v=1;v<c;v++){let C=l[v];if(!C.is_emoji&&bw.has(C[0]))throw P_(`emoji + combining mark: "${xS(l[v-1])} + ${tU([C[0]])}"`)}RCt(d);let g=OL(new Set(x)),[y]=zCt(g);VCt(y,x),UCt(y,g),u=y.N}}o.type=u}catch(l){o.error=l}return o})}function UCt(t,e){let n,r=[];for(let s of e){let a=qC.get(s);if(a===VFe)return;if(a){let o=a.M.get(s);if(n=n?n.filter(l=>o.has(l)):OL(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(a=>iE(s,a)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function zCt(t){let e=F4;for(let n of t){let r=e.filter(s=>iE(s,n));if(!r.length)throw F4.some(s=>iE(s,n))?YFe(e[0],n):KFe(n);if(e=r,r.length==1)break}return e}function HCt(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 ${mle(tU(e,63))}: ${s}`)}return xS(r)}).join(zFe)}function KFe(t){return new Error(`disallowed character: ${ple(t)}`)}function YFe(t,e){let n=ple(e),r=F4.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function P_(t){return new Error(`illegal placement: ${t}`)}function VCt(t,e){for(let n of e)if(!iE(t,n))throw YFe(t,n);if(t.M){let n=UFe(e);for(let r=1,s=n.length;r<s;r++)if(gte.has(n[r])){let a=r+1;for(let o;a<s&>e.has(o=n[a]);a++)for(let l=r;l<a;l++)if(n[l]==o)throw new Error(`duplicate non-spacing marks: ${ple(o)}`);if(a-r>Ege)throw new Error(`excessive non-spacing marks: ${mle(tU(n.slice(r-1,a)))} (${a-r}/${Ege})`);r=a}}}function WCt(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let a=GCt(t);if(a)s.length&&(r.push(e(s)),s=[]),r.push(n(a));else{let o=t.pop();if(Kv.has(o))s.push(o);else{let l=xte.get(o);if(l)s.push(...l);else if(!WFe.has(o))throw KFe(o)}}}return s.length&&r.push(e(s)),r}function qCt(t){return t.filter(e=>e!=HFe)}function GCt(t,e){let n=bte,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 XFe=new Uint8Array(32);XFe.fill(0);function Ige(t){return Dn(t.length!==0,"invalid ENS name; empty component","comp",t),t}function QFe(t){const e=bd(KCt(t)),n=[];if(t.length===0)return n;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(n.push(Ige(e.slice(r,s))),r=s+1);return Dn(r<e.length,"invalid ENS name; empty component","name",t),n.push(Ige(e.slice(r))),n}function KCt(t){try{if(t.length===0)throw new Error("empty label");return BCt(t)}catch(e){Dn(!1,`invalid ENS name (${e.message})`,"name",t)}}function yte(t){Dn(typeof t=="string","invalid ENS name; not a string","name",t),Dn(t.length,"invalid ENS name (empty label)","name",t);let e=XFe;const n=QFe(t);for(;n.length;)e=go($a([e,go(n.pop())]));return ns(e)}function YCt(t,e){const n=e;return Dn(n<=255,"DNS encoded label cannot exceed 255","length",n),ns($a(QFe(t).map(r=>{Dn(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 XCt(t){return typeof t=="string"&&(t=bd(t)),go($a([bd(j6t),bd(String(t.length)),t]))}const ZFe=new Uint8Array(32);ZFe.fill(0);const QCt=BigInt(-1),JFe=BigInt(0),eOe=BigInt(1),ZCt=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function JCt(t){const e=js(t),n=e.length%32;return n?$a([e,ZFe.slice(n)]):ns(e)}const e4t=v1(eOe,32),t4t=v1(JFe,32),Fge={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},iW=["name","version","chainId","verifyingContract","salt"];function Oge(t){return function(e){return Dn(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const n4t={name:Oge("name"),version:Oge("version"),chainId:function(t){const e=Ms(t,"domain.chainId");return Dn(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):cm(e)},verifyingContract:function(t){try{return ua(t).toLowerCase()}catch{}Dn(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=js(t,"domain.salt");return Dn(e.length===32,'invalid domain value "salt"',"domain.salt",t),ns(e)}};function aW(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const n=e[1]==="",r=parseInt(e[2]);Dn(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const s=J7(ZCt,n?r-1:r),a=n?(s+eOe)*QCt:JFe;return function(o){const l=Ms(o,"value");return Dn(l>=a&&l<=s,`value out-of-bounds for ${t}`,"value",l),v1(n?gIe(l,256):l,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return Dn(n!==0&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(r){const s=js(r);return Dn(s.length===n,`invalid length for ${t}`,"value",r),JCt(r)}}}switch(t){case"address":return function(e){return y1(ua(e),32)};case"bool":return function(e){return e?e4t:t4t};case"bytes":return function(e){return go(e)};case"string":return function(e){return C1(e)}}return null}function Mge(t,e){return`${t}(${e.map(({name:n,type:r})=>r+" "+n).join(",")})`}function QI(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 Yk,Ig,IN,jB,tOe;const zh=class zh{constructor(e){Wn(this,jB);Qn(this,"primaryType");Wn(this,Yk);Wn(this,Ig);Wn(this,IN);tn(this,Ig,new Map),tn(this,IN,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}=QI(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)}),tn(this,Yk,JSON.stringify(a));for(const c in a){const u=new Set;for(const d of a[c]){Dn(!u.has(d.name),`duplicate variable name ${JSON.stringify(d.name)} in ${JSON.stringify(c)}`,"types",e),u.add(d.name);const f=QI(d.type).base;Dn(f!==c,`circular type reference to ${JSON.stringify(f)}`,"types",e),!aW(f)&&(Dn(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);Dn(o.length!==0,"missing primary type","types",e),Dn(o.length===1,`ambiguous primary types or unused types: ${o.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),qs(this,{primaryType:o[0]});function l(c,u){Dn(!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(),Je(this,Ig).set(c,Mge(c,a[c])+d.map(f=>Mge(f,a[f])).join(""))}}get types(){return JSON.parse(Je(this,Yk))}getEncoder(e){let n=Je(this,IN).get(e);return n||(n=Er(this,jB,tOe).call(this,e),Je(this,IN).set(e,n)),n}encodeType(e){const n=Je(this,Ig).get(e);return Dn(n,`unknown type: ${JSON.stringify(e)}`,"name",e),n}encodeData(e,n){return this.getEncoder(e)(n)}hashStruct(e,n){return go(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(aW(e))return r(e,n);const s=QI(e).array;if(s)return Dn(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),{});Dn(!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=Fge[r];Dn(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),n.push({name:r,type:s})}return n.sort((r,s)=>iW.indexOf(r.name)-iW.indexOf(s.name)),zh.hashStruct("EIP712Domain",{EIP712Domain:n},e)}static encode(e,n,r){return $a(["0x1901",zh.hashDomain(e),zh.from(n).hash(r)])}static hash(e,n,r){return go(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&&!bo(e.verifyingContract,20)&&(a[e.verifyingContract]="0x");const o=zh.from(n);o.visit(r,(l,c)=>(l==="address"&&!bo(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=[];iW.forEach(c=>{const u=e[c];u!=null&&(s[c]=n4t[c](u),a.push({name:c,type:Fge[c]}))});const o=zh.from(n);n=o.types;const l=Object.assign({},n);return Dn(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 ns(js(u));if(c.match(/^u?int/))return Ms(u).toString();switch(c){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return Dn(typeof u=="string","invalid string","value",u),u}Dn(!1,"unsupported type","type",c)})}}};Yk=new WeakMap,Ig=new WeakMap,IN=new WeakMap,jB=new WeakSet,tOe=function(e){{const s=aW(e);if(s)return s}const n=QI(e).array;if(n){const s=n.prefix,a=this.getEncoder(s);return o=>{Dn(n.count===-1||n.count===o.length,`array length mismatch; expected length ${n.count}`,"value",o);let l=o.map(a);return Je(this,Ig).has(s)&&(l=l.map(go)),go($a(l))}}const r=this.types[e];if(r){const s=C1(Je(this,Ig).get(e));return a=>{const o=r.map(({name:l,type:c})=>{const u=this.getEncoder(c)(a[l]);return Je(this,Ig).has(c)?go(u):u});return o.unshift(s),$a(o)}}Dn(!1,`unknown type: ${e}`,"type",e)};let bS=zh;function hd(t){const e=new Set;return t.forEach(n=>e.add(n)),Object.freeze(e)}const r4t="external public payable override",s4t=hd(r4t.split(" ")),nOe="constant external internal payable private public pure view override",i4t=hd(nOe.split(" ")),rOe="constructor error event fallback function receive struct",sOe=hd(rOe.split(" ")),iOe="calldata memory storage payable indexed",a4t=hd(iOe.split(" ")),o4t="tuple returns",l4t=[rOe,iOe,o4t,nOe].join(" "),c4t=hd(l4t.split(" ")),u4t={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},d4t=new RegExp("^(\\s*)"),f4t=new RegExp("^([0-9]+)"),h4t=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),aOe=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),oOe=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var Qc,tm,Xk,vte;const AB=class AB{constructor(e){Wn(this,Xk);Wn(this,Qc);Wn(this,tm);tn(this,Qc,0),tn(this,tm,e.slice())}get offset(){return Je(this,Qc)}get length(){return Je(this,tm).length-Je(this,Qc)}clone(){return new AB(Je(this,tm))}reset(){tn(this,Qc,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=Er(this,Xk,vte).call(this,Je(this,Qc)+1,e.match+1);return tn(this,Qc,e.match+1),n}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=[];for(;Je(this,Qc)<e.match-1;){const r=this.peek().linkNext;n.push(Er(this,Xk,vte).call(this,Je(this,Qc)+1,r)),tn(this,Qc,r)}return tn(this,Qc,e.match+1),n}peek(){if(Je(this,Qc)>=Je(this,tm).length)throw new Error("out-of-bounds");return Je(this,tm)[Je(this,Qc)]}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 yb(this,Qc)._++,e}toString(){const e=[];for(let n=Je(this,Qc);n<Je(this,tm).length;n++){const r=Je(this,tm)[n];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Qc=new WeakMap,tm=new WeakMap,Xk=new WeakSet,vte=function(e=0,n=0){return new AB(Je(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 _m=AB;function k2(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(d4t);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=u4t[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=Ui(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(h4t),l){if(c.text=l[1],a+=c.text.length,c4t.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(oOe)){c.type="TYPE";continue}c.type="ID";continue}if(l=o.match(f4t),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 _m(e.map(o=>Object.freeze(o)))}function Lge(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 nU(t,e){if(e.peekKeyword(sOe)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function N1(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 lOe(t){let e=N1(t,i4t);return Lge(e,hd("constant payable nonpayable".split(" "))),Lge(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 i1(t,e){return t.popParams().map(n=>cu.from(n,e))}function cOe(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return Ms(t.pop().text);throw new Error("invalid gas")}return null}function Z3(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const p4t=new RegExp(/^(.*)\[([0-9]*)\]$/);function Rge(t){const e=t.match(oOe);if(Dn(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const n=parseInt(e[2]);Dn(n!==0&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);Dn(n!==0&&n<=256&&n%8===0,"invalid numeric width","type",t)}return t}const qo={},gf=Symbol.for("_ethers_internal"),Dge="_ParamTypeInternal",Bge="_ErrorInternal",$ge="_EventInternal",Uge="_ConstructorInternal",zge="_FallbackInternal",Hge="_FunctionInternal",Vge="_StructInternal";var FN,oM;const Hh=class Hh{constructor(e,n,r,s,a,o,l,c){Wn(this,FN);Qn(this,"name");Qn(this,"type");Qn(this,"baseType");Qn(this,"indexed");Qn(this,"components");Qn(this,"arrayLength");Qn(this,"arrayChildren");if(I5(e,qo,"ParamType"),Object.defineProperty(this,gf,{value:Dge}),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("");qs(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 Er(this,FN,oM).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(k2(e),n)}catch{Dn(!1,"invalid param type","obj",e)}else if(e instanceof _m){let l="",c="",u=null;N1(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=Rge(e.popType("TYPE")),c=l);let d=null,f=null;for(;e.length&&e.peekType("BRACKET");){const v=e.pop();d=new Hh(qo,"",l,c,null,u,f,d),f=v.value,l+=v.text,c="array",u=null}let x=null;if(N1(e,a4t).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(qo,y,l,c,x,u,f,d)}const r=e.name;Dn(!r||typeof r=="string"&&r.match(aOe),"invalid name","obj.name",r);let s=e.indexed;s!=null&&(Dn(n,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let a=e.type,o=a.match(p4t);if(o){const l=parseInt(o[2]||"-1"),c=Hh.from({type:o[1],components:e.components});return new Hh(qo,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(qo,r||"",a,"tuple",s,l,null,null)}return a=Rge(e.type),new Hh(qo,r||"",a,a,s,null,null,null)}static isParamType(e){return e&&e[gf]===Dge}};FN=new WeakSet,oM=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;Er(d=o,FN,oM).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;Er(d=o[u],FN,oM).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 cu=Hh;class J3{constructor(e,n,r){Qn(this,"type");Qn(this,"inputs");I5(e,qo,"Fragment"),r=Object.freeze(r.slice()),qs(this,{type:n,inputs:r})}static from(e){if(typeof e=="string"){try{J3.from(JSON.parse(e))}catch{}return J3.from(k2(e))}if(e instanceof _m)switch(e.peekKeyword(sOe)){case"constructor":return qg.from(e);case"error":return ef.from(e);case"event":return P0.from(e);case"fallback":case"receive":return Cg.from(e);case"function":return I0.from(e);case"struct":return v3.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return qg.from(e);case"error":return ef.from(e);case"event":return P0.from(e);case"fallback":case"receive":return Cg.from(e);case"function":return I0.from(e);case"struct":return v3.from(e)}zr(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}Dn(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return qg.isFragment(e)}static isError(e){return ef.isFragment(e)}static isEvent(e){return P0.isFragment(e)}static isFunction(e){return I0.isFragment(e)}static isStruct(e){return v3.isFragment(e)}}class rU extends J3{constructor(n,r,s,a){super(n,r,a);Qn(this,"name");Dn(typeof s=="string"&&s.match(aOe),"invalid identifier","name",s),a=Object.freeze(a.slice()),qs(this,{name:s})}}function aE(t,e){return"("+e.map(n=>n.format(t)).join(t==="full"?", ":",")+")"}class ef extends rU{constructor(e,n,r){super(e,"error",n,r),Object.defineProperty(this,gf,{value:Bge})}get selector(){return C1(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+aE(e,this.inputs)),n.join(" ")}static from(e){if(ef.isFragment(e))return e;if(typeof e=="string")return ef.from(k2(e));if(e instanceof _m){const n=nU("error",e),r=i1(e);return Z3(e),new ef(qo,n,r)}return new ef(qo,e.name,e.inputs?e.inputs.map(cu.from):[])}static isFragment(e){return e&&e[gf]===Bge}}class P0 extends rU{constructor(n,r,s,a){super(n,"event",r,s);Qn(this,"anonymous");Object.defineProperty(this,gf,{value:$ge}),qs(this,{anonymous:a})}get topicHash(){return C1(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+aE(n,this.inputs)),n!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(n,r){return r=(r||[]).map(a=>cu.from(a)),new P0(qo,n,r,!1).topicHash}static from(n){if(P0.isFragment(n))return n;if(typeof n=="string")try{return P0.from(k2(n))}catch{Dn(!1,"invalid event fragment","obj",n)}else if(n instanceof _m){const r=nU("event",n),s=i1(n,!0),a=!!N1(n,hd(["anonymous"])).has("anonymous");return Z3(n),new P0(qo,r,s,a)}return new P0(qo,n.name,n.inputs?n.inputs.map(r=>cu.from(r,!0)):[],!!n.anonymous)}static isFragment(n){return n&&n[gf]===$ge}}class qg extends J3{constructor(n,r,s,a,o){super(n,r,s);Qn(this,"payable");Qn(this,"gas");Object.defineProperty(this,gf,{value:Uge}),qs(this,{payable:a,gas:o})}format(n){if(zr(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${aE(n,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(n){if(qg.isFragment(n))return n;if(typeof n=="string")try{return qg.from(k2(n))}catch{Dn(!1,"invalid constuctor fragment","obj",n)}else if(n instanceof _m){N1(n,hd(["constructor"]));const r=i1(n),s=!!N1(n,s4t).has("payable"),a=cOe(n);return Z3(n),new qg(qo,"constructor",r,s,a)}return new qg(qo,"constructor",n.inputs?n.inputs.map(cu.from):[],!!n.payable,n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[gf]===Uge}}class Cg extends J3{constructor(n,r,s){super(n,"fallback",r);Qn(this,"payable");Object.defineProperty(this,gf,{value:zge}),qs(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(Cg.isFragment(n))return n;if(typeof n=="string")try{return Cg.from(k2(n))}catch{Dn(!1,"invalid fallback fragment","obj",n)}else if(n instanceof _m){const r=n.toString(),s=n.peekKeyword(hd(["fallback","receive"]));if(Dn(s,"type must be fallback or receive","obj",r),n.popKeyword(hd(["fallback","receive"]))==="receive"){const c=i1(n);return Dn(c.length===0,"receive cannot have arguments","obj.inputs",c),N1(n,hd(["payable"])),Z3(n),new Cg(qo,[],!0)}let o=i1(n);o.length?Dn(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(c=>c.format("minimal")).join(", ")):o=[cu.from("bytes")];const l=lOe(n);if(Dn(l==="nonpayable"||l==="payable","fallback cannot be constants","obj.stateMutability",l),N1(n,hd(["returns"])).has("returns")){const c=i1(n);Dn(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(u=>u.format("minimal")).join(", "))}return Z3(n),new Cg(qo,o,l==="payable")}if(n.type==="receive")return new Cg(qo,[],!0);if(n.type==="fallback"){const r=[cu.from("bytes")],s=n.stateMutability==="payable";return new Cg(qo,r,s)}Dn(!1,"invalid fallback description","obj",n)}static isFragment(n){return n&&n[gf]===zge}}class I0 extends rU{constructor(n,r,s,a,o,l){super(n,"function",r,a);Qn(this,"constant");Qn(this,"outputs");Qn(this,"stateMutability");Qn(this,"payable");Qn(this,"gas");Object.defineProperty(this,gf,{value:Hge}),o=Object.freeze(o.slice()),qs(this,{constant:s==="view"||s==="pure",gas:l,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return C1(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+aE(n,this.inputs)),n!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(aE(n,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(n,r){return r=(r||[]).map(a=>cu.from(a)),new I0(qo,n,"view",r,[],null).selector}static from(n){if(I0.isFragment(n))return n;if(typeof n=="string")try{return I0.from(k2(n))}catch{Dn(!1,"invalid function fragment","obj",n)}else if(n instanceof _m){const s=nU("function",n),a=i1(n),o=lOe(n);let l=[];N1(n,hd(["returns"])).has("returns")&&(l=i1(n));const c=cOe(n);return Z3(n),new I0(qo,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 I0(qo,n.name,r,n.inputs?n.inputs.map(cu.from):[],n.outputs?n.outputs.map(cu.from):[],n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[gf]===Hge}}class v3 extends rU{constructor(e,n,r){super(e,"struct",n,r),Object.defineProperty(this,gf,{value:Vge})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return v3.from(k2(e))}catch{Dn(!1,"invalid struct fragment","obj",e)}else if(e instanceof _m){const n=nU("struct",e),r=i1(e);return Z3(e),new v3(qo,n,r)}return new v3(qo,e.name,e.inputs?e.inputs.map(cu.from):[])}static isFragment(e){return e&&e[gf]===Vge}}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 m4t=new RegExp(/^bytes([0-9]*)$/),x4t=new RegExp(/^(u?int)([0-9]*)$/);let oW=null,Wge=1024;function g4t(t,e,n,r){let s="missing revert data",a=null;const o=null;let l=null;if(n){s="execution reverted";const u=js(n);if(n=ns(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(ns(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(ns(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?ua(e.to):null,data:e.data||"0x"};return e.from&&(c.from=ua(e.from)),Mo(s,"CALL_EXCEPTION",{action:t,data:n,reason:a,transaction:c,invocation:o,revert:l})}var py,GC;const _B=class _B{constructor(){Wn(this,py)}getDefaultValue(e){const n=e.map(s=>Er(this,py,GC).call(this,cu.from(s)));return new XI(n,"_").defaultValue()}encode(e,n){hIe(n.length,e.length,"types/values length mismatch");const r=e.map(o=>Er(this,py,GC).call(this,cu.from(o))),s=new XI(r,"_"),a=new ate;return s.encode(a,n),a.data}decode(e,n,r){const s=e.map(o=>Er(this,py,GC).call(this,cu.from(o)));return new XI(s,"_").decode(new ote(n,r,Wge))}static _setDefaultMaxInflation(e){Dn(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),Wge=e}static defaultAbiCoder(){return oW==null&&(oW=new _B),oW}static getBuiltinCallException(e,n,r){return g4t(e,n,r,_B.defaultAbiCoder())}};py=new WeakSet,GC=function(e){if(e.isArray())return new O6t(Er(this,py,GC).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new XI(e.components.map(r=>Er(this,py,GC).call(this,r)),e.name);switch(e.baseType){case"address":return new I6t(e.name);case"bool":return new M6t(e.name);case"string":return new V6t(e.name);case"bytes":return new L6t(e.name);case"":return new B6t(e.name)}let n=e.type.match(x4t);if(n){let r=parseInt(n[2]||"256");return Dn(r!==0&&r<=256&&r%8===0,"invalid "+n[1]+" bit length","param",e),new H6t(r/8,n[1]==="int",e.name)}if(n=e.type.match(m4t),n){let r=parseInt(n[1]);return Dn(r!==0&&r<=32,"invalid bytes length","param",e),new R6t(r,e.name)}Dn(!1,"invalid type","type",e.type)};let oE=_B;class b4t{constructor(e,n,r){Qn(this,"fragment");Qn(this,"name");Qn(this,"signature");Qn(this,"topic");Qn(this,"args");const s=e.name,a=e.format();qs(this,{fragment:e,name:s,signature:a,topic:n,args:r})}}class y4t{constructor(e,n,r,s){Qn(this,"fragment");Qn(this,"name");Qn(this,"args");Qn(this,"signature");Qn(this,"selector");Qn(this,"value");const a=e.name,o=e.format();qs(this,{fragment:e,name:a,args:r,signature:o,selector:n,value:s})}}class v4t{constructor(e,n,r){Qn(this,"fragment");Qn(this,"name");Qn(this,"args");Qn(this,"signature");Qn(this,"selector");const s=e.name,a=e.format();qs(this,{fragment:e,name:s,args:r,signature:a,selector:n})}}class qge{constructor(e){Qn(this,"hash");Qn(this,"_isIndexed");qs(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const Gge={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"},Kge={"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&&Gge[t.toString()]&&(e=Gge[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var v0,w0,C0,Su,rx,lM,cM;const cw=class cw{constructor(e){Wn(this,rx);Qn(this,"fragments");Qn(this,"deploy");Qn(this,"fallback");Qn(this,"receive");Wn(this,v0);Wn(this,w0);Wn(this,C0);Wn(this,Su);let n=[];typeof e=="string"?n=JSON.parse(e):n=e,tn(this,C0,new Map),tn(this,v0,new Map),tn(this,w0,new Map);const r=[];for(const o of n)try{r.push(J3.from(o))}catch(l){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,l.message)}qs(this,{fragments:Object.freeze(r)});let s=null,a=!1;tn(this,Su,this.getAbiCoder()),this.fragments.forEach((o,l)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}qs(this,{deploy:o});return;case"fallback":o.inputs.length===0?a=!0:(Dn(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${l}]`,o),s=o,a=s.payable);return;case"function":c=Je(this,C0);break;case"event":c=Je(this,w0);break;case"error":c=Je(this,v0);break;default:return}const u=o.format();c.has(u)||c.set(u,o)}),this.deploy||qs(this,{deploy:qg.from("constructor()")}),qs(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 oE.defaultAbiCoder()}getFunctionName(e){const n=Er(this,rx,lM).call(this,e,null,!1);return Dn(n,"no matching function","key",e),n.name}hasFunction(e){return!!Er(this,rx,lM).call(this,e,null,!1)}getFunction(e,n){return Er(this,rx,lM).call(this,e,n||null,!0)}forEachFunction(e){const n=Array.from(Je(this,C0).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(Je(this,C0).get(s),r)}}getEventName(e){const n=Er(this,rx,cM).call(this,e,null,!1);return Dn(n,"no matching event","key",e),n.name}hasEvent(e){return!!Er(this,rx,cM).call(this,e,null,!1)}getEvent(e,n){return Er(this,rx,cM).call(this,e,n||null,!0)}forEachEvent(e){const n=Array.from(Je(this,w0).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(Je(this,w0).get(s),r)}}getError(e,n){if(bo(e)){const s=e.toLowerCase();if(Kge[s])return ef.from(Kge[s].signature);for(const a of Je(this,v0).values())if(s===a.selector)return a;return null}if(e.indexOf("(")===-1){const s=[];for(const[a,o]of Je(this,v0))a.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?ef.from("error Error(string)"):e==="Panic"?ef.from("error Panic(uint256)"):null;if(s.length>1){const a=s.map(o=>JSON.stringify(o.format())).join(", ");Dn(!1,`ambiguous error description (i.e. ${a})`,"name",e)}return s[0]}if(e=ef.from(e).format(),e==="Error(string)")return ef.from("error Error(string)");if(e==="Panic(uint256)")return ef.from("error Panic(uint256)");const r=Je(this,v0).get(e);return r||null}forEachError(e){const n=Array.from(Je(this,v0).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(Je(this,v0).get(s),r)}}_decodeParams(e,n){return Je(this,Su).decode(e,n)}_encodeParams(e,n){return Je(this,Su).encode(e,n)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);Dn(r,"unknown error","fragment",e),e=r}return Dn(_o(n,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",n),this._decodeParams(e.inputs,_o(n,4))}encodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);Dn(r,"unknown error","fragment",e),e=r}return $a([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);Dn(r,"unknown function","fragment",e),e=r}return Dn(_o(n,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",n),this._decodeParams(e.inputs,_o(n,4))}encodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);Dn(r,"unknown function","fragment",e),e=r}return $a([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionResult(e,n){if(typeof e=="string"){const a=this.getFunction(e);Dn(a,"unknown function","fragment",e),e=a}let r="invalid length for result data";const s=iu(n);if(s.length%32===0)try{return Je(this,Su).decode(e.outputs,s)}catch{r="could not decode result data"}zr(!1,r,"BAD_DATA",{value:ns(s),info:{method:e.name,signature:e.format()}})}makeError(e,n){const r=js(e,"data"),s=oE.getBuiltinCallException("call",n,r);if(s.message.startsWith("execution reverted (unknown custom error)")){const l=ns(r.slice(0,4)),c=this.getError(l);if(c)try{const u=Je(this,Su).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);Dn(r,"unknown function","fragment",e),e=r}return ns(Je(this,Su).encode(e.outputs,n||[]))}encodeFilterTopics(e,n){if(typeof e=="string"){const a=this.getEvent(e);Dn(a,"unknown event","eventFragment",e),e=a}zr(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"?C1(o):a.type==="bytes"?go(ns(o)):(a.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":a.type.match(/^u?int/)?o=v1(o):a.type.match(/^bytes/)?o=v3t(o,32):a.type==="address"&&Je(this,Su).encode(["address"],[o]),y1(ns(o),32));for(n.forEach((a,o)=>{const l=e.inputs[o];if(!l.indexed){Dn(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"?Dn(!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);Dn(o,"unknown event","eventFragment",e),e=o}const r=[],s=[],a=[];return e.anonymous||r.push(e.topicHash),Dn(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(C1(c));else if(o.type==="bytes")r.push(go(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(Je(this,Su).encode([o.type],[c]))}else s.push(o),a.push(c)}),{data:Je(this,Su).encode(s,a),topics:r}}decodeEventLog(e,n,r){if(typeof e=="string"){const g=this.getEvent(e);Dn(g,"unknown event","eventFragment",e),e=g}if(r!=null&&!e.anonymous){const g=e.topicHash;Dn(bo(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(cu.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?Je(this,Su).decode(s,$a(r)):null,c=Je(this,Su).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 qge(null);else if(o[y])v=new qge(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)}),kL.fromItems(u,d)}parseTransaction(e){const n=js(e.data,"tx.data"),r=Ms(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(ns(n.slice(0,4)));if(!s)return null;const a=Je(this,Su).decode(s.inputs,n.slice(4));return new y4t(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 b4t(n,n.topicHash,this.decodeEventLog(n,e.data,e.topics))}parseError(e){const n=ns(e),r=this.getError(_o(n,0,4));if(!r)return null;const s=Je(this,Su).decode(r.inputs,_o(n,4));return new v4t(r,r.selector,s)}static from(e){return e instanceof cw?e:typeof e=="string"?new cw(JSON.parse(e)):typeof e.formatJson=="function"?new cw(e.formatJson()):typeof e.format=="function"?new cw(e.format("json")):new cw(e)}};v0=new WeakMap,w0=new WeakMap,C0=new WeakMap,Su=new WeakMap,rx=new WeakSet,lM=function(e,n,r){if(bo(e)){const a=e.toLowerCase();for(const o of Je(this,C0).values())if(a===o.selector)return o;return null}if(e.indexOf("(")===-1){const a=[];for(const[o,l]of Je(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(", ");Dn(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return a[0]}const s=Je(this,C0).get(I0.from(e).format());return s||null},cM=function(e,n,r){if(bo(e)){const a=e.toLowerCase();for(const o of Je(this,w0).values())if(a===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const a=[];for(const[o,l]of Je(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(", ");Dn(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return a[0]}const s=Je(this,w0).get(P0.from(e).format());return s||null};let wte=cw;const uOe=BigInt(0);function O4(t){return t??null}function Nl(t){return t==null?null:t.toString()}class Yge{constructor(e,n,r){Qn(this,"gasPrice");Qn(this,"maxFeePerGas");Qn(this,"maxPriorityFeePerGas");qs(this,{gasPrice:O4(e),maxFeePerGas:O4(n),maxPriorityFeePerGas:O4(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:n,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:Nl(e),maxFeePerGas:Nl(n),maxPriorityFeePerGas:Nl(r)}}}function lE(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=ns(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]=Ms(t[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=Ui(t[s],`request.${s}`));return t.accessList&&(e.accessList=F5(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=>V$(s)?ns(s):Object.assign({},s))),e}var Fg;class w4t{constructor(e,n){Qn(this,"provider");Qn(this,"number");Qn(this,"hash");Qn(this,"timestamp");Qn(this,"parentHash");Qn(this,"parentBeaconBlockRoot");Qn(this,"nonce");Qn(this,"difficulty");Qn(this,"gasLimit");Qn(this,"gasUsed");Qn(this,"stateRoot");Qn(this,"receiptsRoot");Qn(this,"blobGasUsed");Qn(this,"excessBlobGas");Qn(this,"miner");Qn(this,"prevRandao");Qn(this,"extraData");Qn(this,"baseFeePerGas");Wn(this,Fg);tn(this,Fg,e.transactions.map(r=>typeof r!="string"?new cE(r,n):r)),qs(this,{provider:n,hash:O4(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:O4(e.prevRandao),extraData:e.extraData,baseFeePerGas:O4(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return Je(this,Fg).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=Je(this,Fg).slice();return e.length===0?[]:(zr(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:Nl(e),difficulty:Nl(n),extraData:r,gasLimit:Nl(s),gasUsed:Nl(a),blobGasUsed:Nl(this.blobGasUsed),excessBlobGas:Nl(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 Je(this,Fg).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let n;if(typeof e=="number")n=Je(this,Fg)[e];else{const r=e.toLowerCase();for(const s of Je(this,Fg))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;Dn(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return C4t(this)}}Fg=new WeakMap;class DT{constructor(e,n){Qn(this,"provider");Qn(this,"transactionHash");Qn(this,"blockHash");Qn(this,"blockNumber");Qn(this,"removed");Qn(this,"address");Qn(this,"data");Qn(this,"topics");Qn(this,"index");Qn(this,"transactionIndex");this.provider=n;const r=Object.freeze(e.topics.slice());qs(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 zr(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return zr(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return zr(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return N4t(this)}}var Qk;class dOe{constructor(e,n){Qn(this,"provider");Qn(this,"to");Qn(this,"from");Qn(this,"contractAddress");Qn(this,"hash");Qn(this,"index");Qn(this,"blockHash");Qn(this,"blockNumber");Qn(this,"logsBloom");Qn(this,"gasUsed");Qn(this,"blobGasUsed");Qn(this,"cumulativeGasUsed");Qn(this,"gasPrice");Qn(this,"blobGasPrice");Qn(this,"type");Qn(this,"status");Qn(this,"root");Wn(this,Qk);tn(this,Qk,Object.freeze(e.logs.map(s=>new DT(s,n))));let r=uOe;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),qs(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 Je(this,Qk)}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:Nl(this.cumulativeGasUsed),from:n,gasPrice:Nl(this.gasPrice),blobGasUsed:Nl(this.blobGasUsed),blobGasPrice:Nl(this.blobGasPrice),gasUsed:Nl(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 hOe(this)}reorderedEvent(e){return zr(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),fOe(this,e)}}Qk=new WeakMap;var my;const qfe=class qfe{constructor(e,n){Qn(this,"provider");Qn(this,"blockNumber");Qn(this,"blockHash");Qn(this,"index");Qn(this,"hash");Qn(this,"type");Qn(this,"to");Qn(this,"from");Qn(this,"nonce");Qn(this,"gasLimit");Qn(this,"gasPrice");Qn(this,"maxPriorityFeePerGas");Qn(this,"maxFeePerGas");Qn(this,"maxFeePerBlobGas");Qn(this,"data");Qn(this,"value");Qn(this,"chainId");Qn(this,"signature");Qn(this,"accessList");Qn(this,"blobVersionedHashes");Qn(this,"authorizationList");Wn(this,my);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,tn(this,my,-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:Nl(this.chainId),data:u,from:l,gasLimit:Nl(this.gasLimit),gasPrice:Nl(this.gasPrice),hash:s,maxFeePerGas:Nl(this.maxFeePerGas),maxPriorityFeePerGas:Nl(this.maxPriorityFeePerGas),maxFeePerBlobGas:Nl(this.maxFeePerBlobGas),nonce:c,signature:d,to:o,index:r,type:a,value:Nl(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 Eu({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=Je(this,my),o=-1,l=a===-1;const c=async()=>{if(l)return null;const{blockNumber:x,nonce:g}=await Eu({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<Je(this,my)&&(o=Je(this,my)));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 S=await v.getTransaction(C);if(S.from===this.from&&S.nonce===this.nonce){if(l)return null;const T=await this.provider.getTransactionReceipt(S.hash);if(T==null||x-T.blockNumber+1<r)return;let I="replaced";S.data===this.data&&S.to===this.to&&S.value===this.value?I="repriced":S.data==="0x"&&S.from===S.to&&S.value===uOe&&(I="cancelled"),zr(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:I==="replaced"||I==="cancelled",reason:I,replacement:S.replaceableTransaction(a),hash:S.hash,receipt:T})}}o++}},u=x=>{if(x==null||x.status!==0)return x;zr(!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(S=>S())};if(y.push(()=>{l=!0}),s>0){const S=setTimeout(()=>{v(),g(Mo("wait for transaction timeout","TIMEOUT"))},s);y.push(()=>{clearTimeout(S)})}const C=async S=>{if(await S.confirmations()>=r){v();try{x(u(S))}catch(T){g(T)}}};if(y.push(()=>{this.provider.off(this.hash,C)}),this.provider.on(this.hash,C),a>=0){const S=async()=>{try{await c()}catch(T){if(su(T,"TRANSACTION_REPLACED")){v(),g(T);return}}l||this.provider.once("block",S)};y.push(()=>{this.provider.off("block",S)}),this.provider.once("block",S)}})}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 zr(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),hOe(this)}reorderedEvent(e){return zr(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),zr(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),fOe(this,e)}replaceableTransaction(e){Dn(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const n=new qfe(this,this.provider);return tn(n,my,e),n}};my=new WeakMap;let cE=qfe;function C4t(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function fOe(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function hOe(t){return{orphan:"drop-transaction",tx:t}}function N4t(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 xle extends DT{constructor(n,r,s){super(n,n.provider);Qn(this,"interface");Qn(this,"fragment");Qn(this,"args");const a=r.decodeEventLog(s,n.data,n.topics);qs(this,{args:a,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class pOe extends DT{constructor(n,r){super(n,n.provider);Qn(this,"error");qs(this,{error:r})}}var ON;class S4t extends dOe{constructor(n,r,s){super(s,r);Wn(this,ON);tn(this,ON,n)}get logs(){return super.logs.map(n=>{const r=n.topics.length?Je(this,ON).getEvent(n.topics[0]):null;if(r)try{return new xle(n,Je(this,ON),r)}catch(s){return new pOe(n,s)}return n})}}ON=new WeakMap;var Zk;class gle extends cE{constructor(n,r,s){super(s,r);Wn(this,Zk);tn(this,Zk,n)}async wait(n,r){const s=await super.wait(n,r);return s==null?null:new S4t(Je(this,Zk),this.provider,s)}}Zk=new WeakMap;class mOe extends yIe{constructor(n,r,s,a){super(n,r,s);Qn(this,"log");qs(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 j4t extends mOe{constructor(e,n,r,s,a){super(e,n,r,new xle(a,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);qs(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const Xge=BigInt(0);function xOe(t){return t&&typeof t.call=="function"}function gOe(t){return t&&typeof t.estimateGas=="function"}function sU(t){return t&&typeof t.resolveName=="function"}function bOe(t){return t&&typeof t.sendTransaction=="function"}function yOe(t){if(t!=null){if(sU(t))return t;if(t.provider)return t.provider}}var Jk;class A4t{constructor(e,n,r){Wn(this,Jk);Qn(this,"fragment");if(qs(this,{fragment:n}),n.inputs.length<r.length)throw new Error("too many arguments");const s=e5(e.runner,"resolveName"),a=sU(s)?s:null;tn(this,Jk,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=>Oc(x,a))):Oc(f,a):f)));return e.interface.encodeFilterTopics(n,o)}())}getTopicFilter(){return Je(this,Jk)}}Jk=new WeakMap;function e5(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function yw(t){return t==null?null:t.provider||null}async function vOe(t,e){const n=Uu.dereference(t,"overrides");Dn(typeof n=="object","invalid overrides parameter","overrides",t);const r=lE(n);return Dn(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),Dn(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function _4t(t,e,n){const r=e5(t,"resolveName"),s=sU(r)?r:null;return await Promise.all(e.map((a,o)=>a.walkAsync(n[o],(l,c)=>(c=Uu.dereference(c,l),l==="address"?Oc(c,s):c))))}function E4t(t){const e=async function(o){const l=await vOe(o,["data"]);l.to=await t.getAddress(),l.from&&(l.from=await Oc(l.from,yOe(t.runner)));const c=t.interface,u=Ms(l.value||Xge,"overrides.value")===Xge,d=(l.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!d&&!u&&Dn(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),Dn(c.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data);const f=c.receive||c.fallback&&c.fallback.payable;return Dn(f||u,"cannot send value to non-payable fallback","overrides.value",l.value),Dn(c.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data),l},n=async function(o){const l=e5(t.runner,"call");zr(xOe(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 Joe(u)&&u.data?t.interface.makeError(u.data,c):u}},r=async function(o){const l=t.runner;zr(bOe(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await l.sendTransaction(await e(o)),u=yw(t.runner);return new gle(t.interface,u,c)},s=async function(o){const l=e5(t.runner,"estimateGas");return zr(gOe(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 qs(a,{_contract:t,estimateGas:s,populateTransaction:e,send:r,staticCall:n}),a}function k4t(t,e){const n=function(...u){const d=t.interface.getFunction(e,u);return zr(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 vOe(u.pop()),f.from&&(f.from=await Oc(f.from,yOe(t.runner)))),d.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const x=await _4t(t.runner,d.inputs,u);return Object.assign({},f,await Eu({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;zr(bOe(d),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await d.sendTransaction(await r(...u)),x=yw(t.runner);return new gle(t.interface,x,f)},o=async function(...u){const d=e5(t.runner,"estimateGas");return zr(gOe(d),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await d.estimateGas(await r(...u))},l=async function(...u){const d=e5(t.runner,"call");zr(xOe(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 Joe(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 qs(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 zr(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),c}function T4t(t,e){const n=function(...s){const a=t.interface.getEvent(e,s);return zr(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),a},r=function(...s){return new A4t(t,n(...s),s)};return qs(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 zr(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const ML=Symbol.for("_ethersInternal_contract"),wOe=new WeakMap;function P4t(t,e){wOe.set(t[ML],e)}function $f(t){return wOe.get(t[ML])}function I4t(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function ble(t,e){let n,r=null;if(Array.isArray(e)){const a=function(o){if(bo(o,32))return o;const l=t.interface.getEvent(o);return Dn(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"?bo(e,32)?n=[e]:(r=t.interface.getEvent(e),Dn(r,"unknown fragment","event",e),n=[r.topicHash]):I4t(e)?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):Dn(!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 n_(t,e){const{subs:n}=$f(t);return n.get((await ble(t,e)).tag)||null}async function Qge(t,e,n){const r=yw(t.runner);zr(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:a,topics:o}=await ble(t,n),{addr:l,subs:c}=$f(t);let u=c.get(a);if(!u){const f={address:l||t,topics:o},x=C=>{let S=s;if(S==null)try{S=t.interface.getEvent(C.topics[0])}catch{}if(S){const T=S,I=s?t.interface.decodeEventLog(s,C.data,C.topics):[];Nte(t,n,I,L=>new j4t(t,L,n,T,C))}else Nte(t,n,[],T=>new mOe(t,T,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 Cte=Promise.resolve();async function F4t(t,e,n,r){await Cte;const s=await n_(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(),$f(t).subs.delete(s.tag)),a>0}async function Nte(t,e,n,r){try{await Cte}catch{}const s=F4t(t,e,n,r);return Cte=s,await s}const ZI=["then"];var MAe;MAe=ML;const c9=class c9{constructor(e,n,r,s){Qn(this,"target");Qn(this,"interface");Qn(this,"runner");Qn(this,"filters");Qn(this,MAe);Qn(this,"fallback");Dn(typeof e=="string"||AFe(e),"invalid value for Contract target","target",e),r==null&&(r=null);const a=wte.from(n);qs(this,{target:e,runner:r,interface:a}),Object.defineProperty(this,ML,{value:{}});let o,l=null,c=null;if(s){const f=yw(r);c=new gle(this.interface,f,s)}let u=new Map;if(typeof e=="string")if(bo(e))l=e,o=Promise.resolve(e);else{const f=e5(r,"resolveName");if(!sU(f))throw Mo("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(x=>{if(x==null)throw Mo("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return $f(this).addr=x,x})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return $f(this).addr=f,f});P4t(this,{addrPromise:o,addr:l,deployTx:c,subs:u});const d=new Proxy({},{get:(f,x,g)=>{if(typeof x=="symbol"||ZI.indexOf(x)>=0)return Reflect.get(f,x,g);try{return this.getEvent(x)}catch(y){if(!su(y,"INVALID_ARGUMENT")||y.argument!=="key")throw y}},has:(f,x)=>ZI.indexOf(x)>=0?Reflect.has(f,x):Reflect.has(f,x)||this.interface.hasEvent(String(x))});return qs(this,{filters:d}),qs(this,{fallback:a.receive||a.fallback?E4t(this):null}),new Proxy(this,{get:(f,x,g)=>{if(typeof x=="symbol"||x in f||ZI.indexOf(x)>=0)return Reflect.get(f,x,g);try{return f.getFunction(x)}catch(y){if(!su(y,"INVALID_ARGUMENT")||y.argument!=="key")throw y}},has:(f,x)=>typeof x=="symbol"||x in f||ZI.indexOf(x)>=0?Reflect.has(f,x):f.interface.hasFunction(x)})}connect(e){return new c9(this.target,this.interface,e)}attach(e){return new c9(e,this.interface,this.runner)}async getAddress(){return await $f(this).addrPromise}async getDeployedCode(){const e=yw(this.runner);zr(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=yw(this.runner);return zr(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 $f(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),k4t(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),T4t(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}=$f(this),o=s||await a,{fragment:l,topics:c}=await ble(this,e),u={address:o,topics:c,fromBlock:n,toBlock:r},d=yw(this.runner);return zr(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 xle(f,this.interface,x)}catch(g){return new pOe(f,g)}return new DT(f,d)})}async on(e,n){const r=await Qge(this,"on",e);return r.listeners.push({listener:n,once:!1}),r.start(),this}async once(e,n){const r=await Qge(this,"once",e);return r.listeners.push({listener:n,once:!0}),r.start(),this}async emit(e,...n){return await Nte(this,e,n,null)}async listenerCount(e){if(e){const s=await n_(this,e);return s?s.listeners.length:0}const{subs:n}=$f(this);let r=0;for(const{listeners:s}of n.values())r+=s.length;return r}async listeners(e){if(e){const s=await n_(this,e);return s?s.listeners.map(({listener:a})=>a):[]}const{subs:n}=$f(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 n_(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(),$f(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const n=await n_(this,e);if(!n)return this;n.stop(),$f(this).subs.delete(n.tag)}else{const{subs:n}=$f(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 c9{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 Ste=c9;function O4t(){return Ste}let I_=class extends O4t(){};function lW(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):Dn(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class M4t{constructor(e){Qn(this,"name");qs(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 COe=new RegExp("^(ipfs)://(.*)$","i"),Zge=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),COe,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var xy,t3,gy,KC,EB,NOe;const C4=class C4{constructor(e,n,r){Wn(this,gy);Qn(this,"provider");Qn(this,"address");Qn(this,"name");Wn(this,xy);Wn(this,t3);qs(this,{provider:e,address:n,name:r}),tn(this,xy,null),tn(this,t3,new I_(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 Je(this,xy)==null&&tn(this,xy,(async()=>{try{return await Je(this,t3).supportsInterface("0x9061b923")}catch(e){if(su(e,"CALL_EXCEPTION"))return!1;throw tn(this,xy,null),e}})()),await Je(this,xy)}async getAddress(e){if(e==null&&(e=60),e===60)try{const a=await Er(this,gy,KC).call(this,"addr(bytes32)");return a==null||a===tE?null:a}catch(a){if(su(a,"CALL_EXCEPTION"))return null;throw a}if(e>=0&&e<2147483648){let a=e+2147483648;const o=await Er(this,gy,KC).call(this,"addr(bytes32,uint)",[a]);if(bo(o,20))return ua(o)}let n=null;for(const a of this.provider.plugins)if(a instanceof M4t&&a.supportsCoinType(e)){n=a;break}if(n==null)return null;const r=await Er(this,gy,KC).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;zr(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const n=await Er(this,gy,KC).call(this,"text(bytes32,string)",[e]);return n==null||n==="0x"?null:n}async getContentHash(){const e=await Er(this,gy,KC).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}://${bIe("0x"+n[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;zr(!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<Zge.length;r++){const s=n.match(Zge[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=lW(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 I_(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}",v1(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=lW(f)),e.push({type:"metadata-url",value:f});let x={};const g=await new i2(f).send();g.assertOk();try{x=g.bodyJson}catch{try{e.push({type:"!metadata",value:g.bodyText})}catch{const S=g.body;return S&&e.push({type:"!metadata",value:ns(S)}),{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(COe)==null)return e.push({type:"!imageUrl-ipfs",value:y}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:y}),y=lW(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 zr(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 Er(s=C4,EB,NOe).call(s,e,r);if(a!=null){const o=new C4(e,a,n);return r!==n&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};xy=new WeakMap,t3=new WeakMap,gy=new WeakSet,KC=async function(e,n){n=(n||[]).slice();const r=Je(this,t3).interface;n.unshift(yte(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),zr(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),n=[YCt(this.name,255),r.encodeFunctionData(s,n)],e="resolve(bytes,bytes)"),n.push({enableCcipRead:!0});try{const a=await Je(this,t3)[e](...n);return s?r.decodeFunctionResult(s,a)[0]:a}catch(a){if(!su(a,"CALL_EXCEPTION"))throw a}return null},EB=new WeakSet,NOe=async function(e,n){const r=await C4.getEnsAddress(e);try{const a=await new I_(r,["function resolver(bytes32) view returns (address)"],e).resolver(yte(n),{enableCcipRead:!0});return a===tE?null:a}catch(s){throw s}return null},Wn(C4,EB);let LL=C4;const Jge=BigInt(0);function aa(t,e){return function(n){return n==null?e:t(n)}}function uE(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 BT(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";zr(!1,`invalid value for value.${s} (${l})`,"BAD_DATA",{value:n})}}return r}}function L4t(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}Dn(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function yS(t){return Dn(bo(t,!0),"invalid data","value",t),t}function ru(t){return Dn(bo(t,32),"invalid hash","value",t),t}const R4t=BT({address:ua,blockHash:ru,blockNumber:Ui,data:yS,index:Ui,removed:aa(L4t,!1),topics:uE(ru),transactionHash:ru,transactionIndex:Ui},{index:["logIndex"]});function D4t(t){return R4t(t)}const B4t=BT({hash:aa(ru),parentHash:ru,parentBeaconBlockRoot:aa(ru,null),number:Ui,timestamp:Ui,nonce:aa(yS),difficulty:Ms,gasLimit:Ms,gasUsed:Ms,stateRoot:aa(ru,null),receiptsRoot:aa(ru,null),blobGasUsed:aa(Ms,null),excessBlobGas:aa(Ms,null),miner:aa(ua),prevRandao:aa(ru,null),extraData:yS,baseFeePerGas:aa(Ms)},{prevRandao:["mixHash"]});function $4t(t){const e=B4t(t);return e.transactions=t.transactions.map(n=>typeof n=="string"?n:SOe(n)),e}const U4t=BT({transactionIndex:Ui,blockNumber:Ui,transactionHash:ru,address:ua,topics:uE(ru),data:yS,index:Ui,blockHash:ru},{index:["logIndex"]});function z4t(t){return U4t(t)}const H4t=BT({to:aa(ua,null),from:aa(ua,null),contractAddress:aa(ua,null),index:Ui,root:aa(ns),gasUsed:Ms,blobGasUsed:aa(Ms,null),logsBloom:aa(yS),blockHash:ru,hash:ru,logs:uE(z4t),blockNumber:Ui,cumulativeGasUsed:Ms,effectiveGasPrice:aa(Ms),blobGasPrice:aa(Ms,null),status:aa(Ui),type:aa(Ui,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function V4t(t){return H4t(t)}function SOe(t){t.to&&Ms(t.to)===Jge&&(t.to="0x0000000000000000000000000000000000000000");const e=BT({hash:ru,index:aa(Ui,void 0),type:n=>n==="0x"||n==null?0:Ui(n),accessList:aa(F5,null),blobVersionedHashes:aa(uE(ru,!0),null),authorizationList:aa(uE(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:ua(n.address),chainId:Ms(n.chainId),nonce:Ms(n.nonce),signature:lu.from(r)}},!1),null),blockHash:aa(ru,null),blockNumber:aa(Ui,null),transactionIndex:aa(Ui,null),from:ua,gasPrice:aa(Ms),maxPriorityFeePerGas:aa(Ms),maxFeePerGas:aa(Ms),maxFeePerBlobGas:aa(Ms,null),gasLimit:Ms,to:aa(ua,null),value:Ms,nonce:Ui,data:yS,creates:aa(ua,null),chainId:aa(Ms,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=P6t(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=lu.from(t.signature):e.signature=lu.from(t),e.chainId==null){const n=e.signature.legacyChainId;n!=null&&(e.chainId=n)}return e.blockHash&&Ms(e.blockHash)===Jge&&(e.blockHash=null),e}const W4t="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class $T{constructor(e){Qn(this,"name");qs(this,{name:e})}clone(){return new $T(this.name)}}class iU extends $T{constructor(n,r){n==null&&(n=0);super(`org.ethers.network.plugins.GasCost#${n||0}`);Qn(this,"effectiveBlock");Qn(this,"txBase");Qn(this,"txCreate");Qn(this,"txDataZero");Qn(this,"txDataNonzero");Qn(this,"txAccessListStorageKey");Qn(this,"txAccessListAddress");const s={effectiveBlock:n};function a(o,l){let c=(r||{})[o];c==null&&(c=l),Dn(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),qs(this,s)}clone(){return new iU(this.effectiveBlock,this)}}class aU extends $T{constructor(n,r){super("org.ethers.plugins.network.Ens");Qn(this,"address");Qn(this,"targetNetwork");qs(this,{address:n||W4t,targetNetwork:r??1})}clone(){return new aU(this.address,this.targetNetwork)}}var eT,tT;class q4t extends $T{constructor(n,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");Wn(this,eT);Wn(this,tT);tn(this,eT,n),tn(this,tT,r)}get url(){return Je(this,eT)}get processFunc(){return Je(this,tT)}clone(){return this}}eT=new WeakMap,tT=new WeakMap;const cW=new Map;var MN,LN,by,e1;let ky=(e1=class{constructor(e,n){Wn(this,MN);Wn(this,LN);Wn(this,by);tn(this,MN,e),tn(this,LN,Ms(n)),tn(this,by,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return Je(this,MN)}set name(e){tn(this,MN,e)}get chainId(){return Je(this,LN)}set chainId(e){tn(this,LN,Ms(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Ms(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Ms(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Ms(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(Je(this,by).values())}attachPlugin(e){if(Je(this,by).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return Je(this,by).set(e.name,e.clone()),this}getPlugin(e){return Je(this,by).get(e)||null}getPlugins(e){return this.plugins.filter(n=>n.name.split("#")[0]===e)}clone(){const e=new e1(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 iU;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=F5(e.accessList);for(const a in s)r+=n.txAccessListAddress+n.txAccessListStorageKey*s[a].storageKeys.length}return r}static from(e){if(G4t(),e==null)return e1.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const n=cW.get(e);if(n)return n();if(typeof e=="bigint")return new e1("unknown",e);Dn(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){Dn(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const n=new e1(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&n.attachPlugin(new aU(e.ensAddress,e.ensNetwork)),n}Dn(!1,"invalid network","network",e)}static register(e,n){typeof e=="number"&&(e=BigInt(e));const r=cW.get(e);r&&Dn(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),cW.set(e,n)}},MN=new WeakMap,LN=new WeakMap,by=new WeakMap,e1);function e1e(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 t1e(t){return new q4t(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:e1e(l.maxFee,9),maxPriorityFeePerGas:e1e(l.maxPriorityFee,9)}}catch(a){zr(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:s,error:a})}})}let n1e=!1;function G4t(){if(n1e)return;n1e=!0;function t(e,n,r){const s=function(){const a=new ky(e,n);return r.ensNetwork!=null&&a.attachPlugin(new aU(null,r.ensNetwork)),a.attachPlugin(new iU),(r.plugins||[]).forEach(o=>{a.attachPlugin(o)}),a};ky.register(e,s),ky.register(n,s),r.altNames&&r.altNames.forEach(a=>{ky.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:[t1e("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[t1e("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 jte(t){return JSON.parse(JSON.stringify(t))}var Og,Gh,yy,N0,RN,uM;class K4t{constructor(e){Wn(this,RN);Wn(this,Og);Wn(this,Gh);Wn(this,yy);Wn(this,N0);tn(this,Og,e),tn(this,Gh,null),tn(this,yy,4e3),tn(this,N0,-2)}get pollingInterval(){return Je(this,yy)}set pollingInterval(e){tn(this,yy,e)}start(){Je(this,Gh)||(tn(this,Gh,Je(this,Og)._setTimeout(Er(this,RN,uM).bind(this),Je(this,yy))),Er(this,RN,uM).call(this))}stop(){Je(this,Gh)&&(Je(this,Og)._clearTimeout(Je(this,Gh)),tn(this,Gh,null))}pause(e){this.stop(),e&&tn(this,N0,-2)}resume(){this.start()}}Og=new WeakMap,Gh=new WeakMap,yy=new WeakMap,N0=new WeakMap,RN=new WeakSet,uM=async function(){try{const e=await Je(this,Og).getBlockNumber();if(Je(this,N0)===-2){tn(this,N0,e);return}if(e!==Je(this,N0)){for(let n=Je(this,N0)+1;n<=e;n++){if(Je(this,Gh)==null)return;await Je(this,Og).emit("block",n)}tn(this,N0,e)}}catch{}Je(this,Gh)!=null&&tn(this,Gh,Je(this,Og)._setTimeout(Er(this,RN,uM).bind(this),Je(this,yy)))};var n3,r3,vy;class yle{constructor(e){Wn(this,n3);Wn(this,r3);Wn(this,vy);tn(this,n3,e),tn(this,vy,!1),tn(this,r3,n=>{this._poll(n,Je(this,n3))})}async _poll(e,n){throw new Error("sub-classes must override this")}start(){Je(this,vy)||(tn(this,vy,!0),Je(this,r3).call(this,-2),Je(this,n3).on("block",Je(this,r3)))}stop(){Je(this,vy)&&(tn(this,vy,!1),Je(this,n3).off("block",Je(this,r3)))}pause(e){this.stop()}resume(){this.start()}}n3=new WeakMap,r3=new WeakMap,vy=new WeakMap;var DN,Mg;class Y4t extends yle{constructor(n,r){super(n);Wn(this,DN);Wn(this,Mg);tn(this,DN,r),tn(this,Mg,-2)}pause(n){n&&tn(this,Mg,-2),super.pause(n)}async _poll(n,r){const s=await r.getBlock(Je(this,DN));s!=null&&(Je(this,Mg)===-2?tn(this,Mg,s.number):s.number>Je(this,Mg)&&(r.emit(Je(this,DN),s.number),tn(this,Mg,s.number)))}}DN=new WeakMap,Mg=new WeakMap;var kB;class X4t extends yle{constructor(n,r){super(n);Wn(this,kB);tn(this,kB,jte(r))}async _poll(n,r){throw new Error("@TODO")}}kB=new WeakMap;var BN;class Q4t extends yle{constructor(n,r){super(n);Wn(this,BN);tn(this,BN,r)}async _poll(n,r){const s=await r.getTransactionReceipt(Je(this,BN));s&&r.emit(Je(this,BN),s)}}BN=new WeakMap;var Lg,$N,UN,wy,Kh,TB,jOe;class vle{constructor(e,n){Wn(this,TB);Wn(this,Lg);Wn(this,$N);Wn(this,UN);Wn(this,wy);Wn(this,Kh);tn(this,Lg,e),tn(this,$N,jte(n)),tn(this,UN,Er(this,TB,jOe).bind(this)),tn(this,wy,!1),tn(this,Kh,-2)}start(){Je(this,wy)||(tn(this,wy,!0),Je(this,Kh)===-2&&Je(this,Lg).getBlockNumber().then(e=>{tn(this,Kh,e)}),Je(this,Lg).on("block",Je(this,UN)))}stop(){Je(this,wy)&&(tn(this,wy,!1),Je(this,Lg).off("block",Je(this,UN)))}pause(e){this.stop(),e&&tn(this,Kh,-2)}resume(){this.start()}}Lg=new WeakMap,$N=new WeakMap,UN=new WeakMap,wy=new WeakMap,Kh=new WeakMap,TB=new WeakSet,jOe=async function(e){if(Je(this,Kh)===-2)return;const n=jte(Je(this,$N));n.fromBlock=Je(this,Kh)+1,n.toBlock=e;const r=await Je(this,Lg).getLogs(n);if(r.length===0){Je(this,Kh)<e-60&&tn(this,Kh,e-60);return}for(const s of r)Je(this,Lg).emit(Je(this,$N),s),tn(this,Kh,s.blockNumber)};const Z4t=BigInt(2),J4t=10;function JI(t){return t&&typeof t.then=="function"}function dM(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 AOe{constructor(e){Qn(this,"name");qs(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function eNt(t){return JSON.parse(JSON.stringify(t))}function Ate(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function uW(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(bo(t,32)){const n=t.toLowerCase();return{type:"transaction",tag:dM("tx",{hash:n}),hash:n}}if(t.orphan){const n=t;return{type:"orphan",tag:dM("orphan",n),filter:eNt(n)}}if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map(s=>s==null?null:Array.isArray(s)?Ate(s.map(a=>a.toLowerCase())):s.toLowerCase())};if(n.address){const s=[],a=[],o=l=>{bo(l)?s.push(l):a.push((async()=>{s.push(await Oc(l,e))})())};Array.isArray(n.address)?n.address.forEach(o):o(n.address),a.length&&await Promise.all(a),r.address=Ate(s.map(l=>l.toLowerCase()))}return{filter:r,tag:dM("event",r),type:"event"}}Dn(!1,"unknown ProviderEvent","event",t)}function dW(){return new Date().getTime()}const tNt={cacheTimeout:250,pollingInterval:4e3};var ju,Cy,Au,zN,Wf,s3,Ny,Rg,nT,Yh,HN,VN,qi,Rf,_te,Ete,r_,kte,s_,fM;class nNt{constructor(e,n){Wn(this,qi);Wn(this,ju);Wn(this,Cy);Wn(this,Au);Wn(this,zN);Wn(this,Wf);Wn(this,s3);Wn(this,Ny);Wn(this,Rg);Wn(this,nT);Wn(this,Yh);Wn(this,HN);Wn(this,VN);if(tn(this,VN,Object.assign({},tNt,n||{})),e==="any")tn(this,s3,!0),tn(this,Wf,null);else if(e){const r=ky.from(e);tn(this,s3,!1),tn(this,Wf,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else tn(this,s3,!1),tn(this,Wf,null);tn(this,Rg,-1),tn(this,Ny,new Map),tn(this,ju,new Map),tn(this,Cy,new Map),tn(this,Au,null),tn(this,zN,!1),tn(this,nT,1),tn(this,Yh,new Map),tn(this,HN,!1)}get pollingInterval(){return Je(this,VN).pollingInterval}get provider(){return this}get plugins(){return Array.from(Je(this,Cy).values())}attachPlugin(e){if(Je(this,Cy).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return Je(this,Cy).set(e.name,e.connect(this)),this}getPlugin(e){return Je(this,Cy).get(e)||null}get disableCcipRead(){return Je(this,HN)}set disableCcipRead(e){tn(this,HN,!!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 i2(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{}zr(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)}zr(!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 w4t($4t(e),this)}_wrapLog(e,n){return new DT(D4t(e),this)}_wrapTransactionReceipt(e,n){return new dOe(V4t(e),this)}_wrapTransactionResponse(e,n){return new cE(SOe(e),this)}_detectNetwork(){zr(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){zr(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Ui(await Er(this,qi,Rf).call(this,{method:"getBlockNumber"}),"%response");return Je(this,Rg)>=0&&tn(this,Rg,e),e}_getAddress(e){return Oc(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(bo(e))return bo(e,32)?e:cm(e);if(typeof e=="bigint"&&(e=Ui(e,"blockTag")),typeof e=="number")return e>=0?cm(e):Je(this,Rg)>=0?cm(Je(this,Rg)+e):this.getBlockNumber().then(n=>cm(n+e));Dn(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const n=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?Ate(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=lE(e),r=[];if(["to","from"].forEach(s=>{if(n[s]==null)return;const a=Oc(n[s],this);JI(a)?r.push(async function(){n[s]=await a}()):n[s]=a}),n.blockTag!=null){const s=this._getBlockTag(n.blockTag);JI(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(Je(this,Wf)==null){const s=(async()=>{try{const a=await this._detectNetwork();return this.emit("network",a,null),a}catch(a){throw Je(this,Wf)===s&&tn(this,Wf,null),a}})();return tn(this,Wf,s),(await s).clone()}const e=Je(this,Wf),[n,r]=await Promise.all([e,this._detectNetwork()]);return n.chainId!==r.chainId&&(Je(this,s3)?(this.emit("network",r,n),Je(this,Wf)===e&&tn(this,Wf,Promise.resolve(r))):zr(!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 Eu({_block:Er(this,qi,kte).call(this,"latest",!1),gasPrice:(async()=>{try{const d=await Er(this,qi,Rf).call(this,{method:"getGasPrice"});return Ms(d,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const d=await Er(this,qi,Rf).call(this,{method:"getPriorityFee"});return Ms(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*Z4t+c),new Yge(a,l,c)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new i2(r.url),a=await r.processFunc(n,this,s);return new Yge(a.gasPrice,a.maxFeePerGas,a.maxPriorityFeePerGas)}return await n()}async estimateGas(e){let n=this._getTransactionRequest(e);return JI(n)&&(n=await n),Ms(await Er(this,qi,Rf).call(this,{method:"estimateGas",transaction:n}),"%response")}async call(e){const{tx:n,blockTag:r}=await Eu({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await Er(this,qi,Ete).call(this,Er(this,qi,_te).call(this,n,r,e.enableCcipRead?0:-1))}async getBalance(e,n){return Ms(await Er(this,qi,r_).call(this,{method:"getBalance"},e,n),"%response")}async getTransactionCount(e,n){return Ui(await Er(this,qi,r_).call(this,{method:"getTransactionCount"},e,n),"%response")}async getCode(e,n){return ns(await Er(this,qi,r_).call(this,{method:"getCode"},e,n))}async getStorage(e,n,r){const s=Ms(n,"position");return ns(await Er(this,qi,r_).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:n,hash:r,network:s}=await Eu({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),a=fle.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 Eu({network:this.getNetwork(),params:Er(this,qi,kte).call(this,e,!!n)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:n,params:r}=await Eu({network:this.getNetwork(),params:Er(this,qi,Rf).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,n)}async getTransactionReceipt(e){const{network:n,params:r}=await Eu({network:this.getNetwork(),params:Er(this,qi,Rf).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await Er(this,qi,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 Eu({network:this.getNetwork(),result:Er(this,qi,Rf).call(this,{method:"getTransactionResult",hash:e})});return n==null?null:ns(n)}async getLogs(e){let n=this._getFilter(e);JI(n)&&(n=await n);const{network:r,params:s}=await Eu({network:this.getNetwork(),params:Er(this,qi,Rf).call(this,{method:"getLogs",filter:n})});return s.map(a=>this._wrapLog(a,r))}_getProvider(e){zr(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await LL.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=ua(e);const n=yte(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await LL.getEnsAddress(this),a=await new I_(r,["function resolver(bytes32) view returns (address)"],this).resolver(n);if(a==null||a===tE)return null;const l=await new I_(a,["function name(bytes32) view returns (string)"],this).name(n);return await this.resolveName(l)!==e?null:l}catch(r){if(su(r,"BAD_DATA")&&r.value==="0x"||su(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(Mo("timeout","TIMEOUT",{reason:"timeout"})))},r)),c(await this.getBlockNumber())})}async waitForBlock(e){zr(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const n=Je(this,Yh).get(e);n&&(n.timer&&clearTimeout(n.timer),Je(this,Yh).delete(e))}_setTimeout(e,n){n==null&&(n=0);const r=yb(this,nT)._++,s=()=>{Je(this,Yh).delete(r),e()};if(this.paused)Je(this,Yh).set(r,{timer:null,func:s,time:n});else{const a=setTimeout(s,n);Je(this,Yh).set(r,{timer:a,func:s,time:dW()})}return r}_forEachSubscriber(e){for(const n of Je(this,ju).values())e(n.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new AOe(e.type);case"block":{const n=new K4t(this);return n.pollingInterval=this.pollingInterval,n}case"safe":case"finalized":return new Y4t(this,e.type);case"event":return new vle(this,e.filter);case"transaction":return new Q4t(this,e.hash);case"orphan":return new X4t(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,n){for(const r of Je(this,ju).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=n,r.started&&n.start(),Je(this,Au)!=null&&n.pause(Je(this,Au));break}}async on(e,n){const r=await Er(this,qi,fM).call(this,e);return r.listeners.push({listener:n,once:!1}),r.started||(r.subscriber.start(),r.started=!0,Je(this,Au)!=null&&r.subscriber.pause(Je(this,Au))),this}async once(e,n){const r=await Er(this,qi,fM).call(this,e);return r.listeners.push({listener:n,once:!0}),r.started||(r.subscriber.start(),r.started=!0,Je(this,Au)!=null&&r.subscriber.pause(Je(this,Au))),this}async emit(e,...n){const r=await Er(this,qi,s_).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 yIe(this,o?null:a,e);try{a.call(this,...n,l)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),Je(this,ju).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await Er(this,qi,s_).call(this,e);return r?r.listeners.length:0}let n=0;for(const{listeners:r}of Je(this,ju).values())n+=r.length;return n}async listeners(e){if(e){const r=await Er(this,qi,s_).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let n=[];for(const{listeners:r}of Je(this,ju).values())n=n.concat(r.map(({listener:s})=>s));return n}async off(e,n){const r=await Er(this,qi,s_).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(),Je(this,ju).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:n,started:r,subscriber:s}=await Er(this,qi,fM).call(this,e);r&&s.stop(),Je(this,ju).delete(n)}else for(const[n,{started:r,subscriber:s}]of Je(this,ju))r&&s.stop(),Je(this,ju).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 Je(this,zN)}destroy(){this.removeAllListeners();for(const e of Je(this,Yh).keys())this._clearTimeout(e);tn(this,zN,!0)}get paused(){return Je(this,Au)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(tn(this,Rg,-1),Je(this,Au)!=null){if(Je(this,Au)==!!e)return;zr(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(n=>n.pause(e)),tn(this,Au,!!e);for(const n of Je(this,Yh).values())n.timer&&clearTimeout(n.timer),n.time=dW()-n.time}resume(){if(Je(this,Au)!=null){this._forEachSubscriber(e=>e.resume()),tn(this,Au,null);for(const e of Je(this,Yh).values()){let n=e.time;n<0&&(n=0),e.time=dW(),setTimeout(e.func,n)}}}}ju=new WeakMap,Cy=new WeakMap,Au=new WeakMap,zN=new WeakMap,Wf=new WeakMap,s3=new WeakMap,Ny=new WeakMap,Rg=new WeakMap,nT=new WeakMap,Yh=new WeakMap,HN=new WeakMap,VN=new WeakMap,qi=new WeakSet,Rf=async function(e){const n=Je(this,VN).cacheTimeout;if(n<0)return await this._perform(e);const r=dM(e.method,e);let s=Je(this,Ny).get(r);return s||(s=this._perform(e),Je(this,Ny).set(r,s),setTimeout(()=>{Je(this,Ny).get(r)===s&&Je(this,Ny).delete(r)},n)),await s},_te=async function(e,n,r){zr(r<J4t,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:n,enableCcipRead:!0})});const s=lE(e);try{return ns(await this._perform({method:"call",transaction:s,blockTag:n}))}catch(a){if(!this.disableCcipRead&&Joe(a)&&a.data&&r>=0&&n==="latest"&&s.to!=null&&_o(a.data,0,4)==="0x556f1830"){const o=a.data,l=await Oc(s.to,this);let c;try{c=oNt(_o(a.data,4))}catch(f){zr(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}zr(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);zr(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:$a([c.selector,aNt([u,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:d});try{const f=await Er(this,qi,_te).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}},Ete=async function(e){const{value:n}=await Eu({network:this.getNetwork(),value:e});return n},r_=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 Er(this,qi,Ete).call(this,Er(this,qi,Rf).call(this,Object.assign(e,{address:s,blockTag:a})))},kte=async function(e,n){if(bo(e,32))return await Er(this,qi,Rf).call(this,{method:"getBlock",blockHash:e,includeTransactions:n});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await Er(this,qi,Rf).call(this,{method:"getBlock",blockTag:r,includeTransactions:n})},s_=async function(e,n){let r=await uW(e,this);return r.type==="event"&&n&&n.length>0&&n[0].removed===!0&&(r=await uW({orphan:"drop-log",log:n[0]},this)),Je(this,ju).get(r.tag)||null},fM=async function(e){const n=await uW(e,this),r=n.tag;let s=Je(this,ju).get(r);return s||(s={subscriber:this._getSubscriber(n),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},Je(this,ju).set(r,s)),s};function rNt(t,e){try{const n=Tte(t,e);if(n)return EL(n)}catch{}return null}function Tte(t,e){if(t==="0x")return null;try{const n=Ui(_o(t,e,e+32)),r=Ui(_o(t,n,n+32));return _o(t,n+32,n+32+r)}catch{}return null}function r1e(t){const e=dl(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 sNt(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const iNt=new Uint8Array([]);function aNt(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(iNt),n+=32;for(let r=0;r<t.length;r++){const s=js(t[r]);e[r]=r1e(n),e.push(r1e(s.length)),e.push(sNt(s)),n+=32+Math.ceil(s.length/32)*32}return $a(e)}const s1e="0x0000000000000000000000000000000000000000000000000000000000000000";function oNt(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};zr(P4(t)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=_o(t,0,32);zr(_o(n,0,12)===_o(s1e,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=_o(n,12);try{const r=[],s=Ui(_o(t,32,64)),a=Ui(_o(t,s,s+32)),o=_o(t,s+32);for(let l=0;l<a;l++){const c=rNt(o,l*32);if(c==null)throw new Error("abort");r.push(c)}e.urls=r}catch{zr(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=Tte(t,64);if(r==null)throw new Error("abort");e.calldata=r}catch{zr(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}zr(_o(t,100,128)===_o(s1e,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=_o(t,96,100);try{const r=Tte(t,128);if(r==null)throw new Error("abort");e.extraData=r}catch{zr(!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 kv(t,e){if(t.provider)return t.provider;zr(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function i1e(t,e){let n=lE(e);if(n.to!=null&&(n.to=Oc(n.to,t)),n.from!=null){const r=n.from;n.from=Promise.all([t.getAddress(),Oc(r,t)]).then(([s,a])=>(Dn(s.toLowerCase()===a.toLowerCase(),"transaction from mismatch","tx.from",a),s))}else n.from=t.getAddress();return await Eu(n)}class wle{constructor(e){Qn(this,"provider");qs(this,{provider:e||null})}async getNonce(e){return kv(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await i1e(this,e)}async populateTransaction(e){const n=kv(this,"populateTransaction"),r=await i1e(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=Ms(r.chainId);Dn(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)?Dn(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&a&&Dn(!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();zr(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?(zr(!a,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):zr(!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 Eu(r)}async populateAuthorization(e){const n=Object.assign({},e);return n.chainId==null&&(n.chainId=(await kv(this,"getNetwork").getNetwork()).chainId),n.nonce==null&&(n.nonce=await this.getNonce()),n}async estimateGas(e){return kv(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return kv(this,"call").call(await this.populateCall(e))}async resolveName(e){return await kv(this,"resolveName").resolveName(e)}async sendTransaction(e){const n=kv(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=fle.from(r);return await n.broadcastTransaction(await this.signTransaction(s))}authorize(e){zr(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}var WN,hM;const Gfe=class Gfe extends wle{constructor(n,r){super(r);Wn(this,WN);Qn(this,"address");qs(this,{address:n})}async getAddress(){return this.address}connect(n){return new Gfe(this.address,n)}async signTransaction(n){Er(this,WN,hM).call(this,"transactions","signTransaction")}async signMessage(n){Er(this,WN,hM).call(this,"messages","signMessage")}async signTypedData(n,r,s){Er(this,WN,hM).call(this,"typed-data","signTypedData")}};WN=new WeakSet,hM=function(n,r){zr(!1,`VoidSigner cannot sign ${n}`,"UNSUPPORTED_OPERATION",{operation:r})};let Pte=Gfe;function lNt(t){return JSON.parse(JSON.stringify(t))}var rd,S0,i3,Sy,a3,qN,y2,Ite,Fte;class _Oe{constructor(e){Wn(this,y2);Wn(this,rd);Wn(this,S0);Wn(this,i3);Wn(this,Sy);Wn(this,a3);Wn(this,qN);tn(this,rd,e),tn(this,S0,null),tn(this,i3,Er(this,y2,Ite).bind(this)),tn(this,Sy,!1),tn(this,a3,null),tn(this,qN,!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(){Je(this,Sy)||(tn(this,Sy,!0),Er(this,y2,Ite).call(this,-2))}stop(){Je(this,Sy)&&(tn(this,Sy,!1),tn(this,qN,!0),Er(this,y2,Fte).call(this),Je(this,rd).off("block",Je(this,i3)))}pause(e){e&&Er(this,y2,Fte).call(this),Je(this,rd).off("block",Je(this,i3))}resume(){this.start()}}rd=new WeakMap,S0=new WeakMap,i3=new WeakMap,Sy=new WeakMap,a3=new WeakMap,qN=new WeakMap,y2=new WeakSet,Ite=async function(e){try{Je(this,S0)==null&&tn(this,S0,this._subscribe(Je(this,rd)));let n=null;try{n=await Je(this,S0)}catch(a){if(!su(a,"UNSUPPORTED_OPERATION")||a.operation!=="eth_newFilter")throw a}if(n==null){tn(this,S0,null),Je(this,rd)._recoverSubscriber(this,this._recover(Je(this,rd)));return}const r=await Je(this,rd).getNetwork();if(Je(this,a3)||tn(this,a3,r),Je(this,a3).chainId!==r.chainId)throw new Error("chaid changed");if(Je(this,qN))return;const s=await Je(this,rd).send("eth_getFilterChanges",[n]);await this._emitResults(Je(this,rd),s)}catch(n){console.log("@TODO",n)}Je(this,rd).once("block",Je(this,i3))},Fte=function(){const e=Je(this,S0);e&&(tn(this,S0,null),e.then(n=>{Je(this,rd).destroyed||Je(this,rd).send("eth_uninstallFilter",[n])}))};var o3;class cNt extends _Oe{constructor(n,r){super(n);Wn(this,o3);tn(this,o3,lNt(r))}_recover(n){return new vle(n,Je(this,o3))}async _subscribe(n){return await n.send("eth_newFilter",[Je(this,o3)])}async _emitResults(n,r){for(const s of r)n.emit(Je(this,o3),n._wrapLog(s,n._network))}}o3=new WeakMap;class uNt extends _Oe{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,n){for(const r of n)e.emit("pending",r)}}const dNt="bigint,boolean,function,number,string,symbol".split(/,/g);function pM(t){if(t==null||dNt.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(pM);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 fNt(t){return new Promise(e=>{setTimeout(e,t)})}function uC(t){return t&&t.toLowerCase()}function a1e(t){return t&&typeof t.pollingInterval=="number"}const EOe={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class fW extends wle{constructor(n,r){super(n);Qn(this,"address");r=ua(r),qs(this,{address:r})}connect(n){zr(!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=pM(n),s=[];if(r.from){const o=r.from;s.push((async()=>{const l=await Oc(o,this.provider);Dn(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 Oc(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(su(d,"CANCELLED")||su(d,"BAD_DATA")||su(d,"NETWORK_ERROR")||su(d,"UNSUPPORTED_OPERATION")){d.info==null&&(d.info={}),d.info.sendTransactionHash=s,o(d);return}if(su(d,"INVALID_ARGUMENT")&&(c++,d.info==null&&(d.info={}),d.info.sendTransactionHash=s,c>10)){o(d);return}this.provider.emit("error",Mo("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=pM(n);if(r.from){const a=await Oc(r.from,this.provider);Dn(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"?bd(n):n;return await this.provider.send("personal_sign",[ns(r),this.address.toLowerCase()])}async signTypedData(n,r,s){const a=pM(s),o=await bS.resolveNames(n,r,a,async l=>{const c=await Oc(l);return Dn(c!=null,"TypedData does not support null address","value",l),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(bS.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"?bd(n):n;return await this.provider.send("eth_sign",[this.address.toLowerCase(),ns(r)])}}var l3,GN,Dg,j0,nm,Xh,Yd,rT,Ote;class hNt extends nNt{constructor(n,r){super(n,r);Wn(this,rT);Wn(this,l3);Wn(this,GN);Wn(this,Dg);Wn(this,j0);Wn(this,nm);Wn(this,Xh);Wn(this,Yd);tn(this,GN,1),tn(this,l3,Object.assign({},EOe,r||{})),tn(this,Dg,[]),tn(this,j0,null),tn(this,Xh,null),tn(this,Yd,null);{let a=null;const o=new Promise(l=>{a=l});tn(this,nm,{promise:o,resolve:a})}const s=this._getOption("staticNetwork");typeof s=="boolean"?(Dn(!s||n!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&n!=null&&tn(this,Xh,ky.from(n))):s&&(Dn(n==null||s.matches(n),"staticNetwork MUST match network object","options",r),tn(this,Xh,s))}_getOption(n){return Je(this,l3)[n]}get _network(){return zr(Je(this,Xh),"network is not available yet","NETWORK_ERROR"),Je(this,Xh)}async _perform(n){if(n.method==="call"||n.method==="estimateGas"){let s=n.transaction;if(s&&s.type!=null&&Ms(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(Je(this,Xh))return Je(this,Xh)}else return n;return Je(this,Yd)?await Je(this,Yd):this.ready?(tn(this,Yd,(async()=>{try{const r=ky.from(Ms(await this.send("eth_chainId",[])));return tn(this,Yd,null),r}catch(r){throw tn(this,Yd,null),r}})()),await Je(this,Yd)):(tn(this,Yd,(async()=>{const r={id:yb(this,GN)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let s;try{s=(await this._send(r))[0],tn(this,Yd,null)}catch(a){throw tn(this,Yd,null),this.emit("debug",{action:"receiveRpcError",error:a}),a}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return ky.from(Ms(s.result));throw this.getRpcError(r,s)})()),await Je(this,Yd))}_start(){Je(this,nm)==null||Je(this,nm).resolve==null||(Je(this,nm).resolve(),tn(this,nm,null),(async()=>{for(;Je(this,Xh)==null&&!this.destroyed;)try{tn(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",Mo("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:n}})),await fNt(1e3)}Er(this,rT,Ote).call(this)})())}async _waitUntilReady(){if(Je(this,nm)!=null)return await Je(this,nm).promise}_getSubscriber(n){return n.type==="pending"?new uNt(this):n.type==="event"?this._getOption("polling")?new vle(this,n.filter):new cNt(this,n.filter):n.type==="orphan"&&n.filter.orphan==="drop-log"?new AOe("orphan"):super._getSubscriber(n)}get ready(){return Je(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(Ms(n[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{n[s]!=null&&(r[s]=ns(n[s]))}),n.accessList&&(r.accessList=F5(n.accessList)),n.blobVersionedHashes&&(r.blobVersionedHashes=n.blobVersionedHashes.map(s=>s.toLowerCase())),n.authorizationList&&(r.authorizationList=n.authorizationList.map(s=>{const a=TFe(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:[uC(n.address),n.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[uC(n.address),n.blockTag]};case"getCode":return{method:"eth_getCode",args:[uC(n.address),n.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[uC(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(uC):n.filter.address=uC(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 Mo("insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.params[0],info:{payload:n,error:a}});if(c.match(/nonce/i)&&c.match(/too low/i))return Mo("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=Mte(a),u=oE.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(mNt(a));if(typeof a.message=="string"&&a.message.match(/user denied|ethers-user-denied/i))return Mo("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 Mo("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:a}});if(o.match(/nonce/i)&&o.match(/too low/i))return Mo("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:a}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Mo("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:a}});if(o.match(/only replay-protected/i))return Mo("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?Mo("unsupported operation","UNSUPPORTED_OPERATION",{operation:n.method,info:{error:a,payload:n}}):Mo("could not coalesce error","UNKNOWN_ERROR",{error:a,payload:n})}send(n,r){if(this.destroyed)return Promise.reject(Mo("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n}));const s=yb(this,GN)._++,a=new Promise((o,l)=>{Je(this,Dg).push({resolve:o,reject:l,payload:{method:n,params:r,id:s,jsonrpc:"2.0"}})});return Er(this,rT,Ote).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 fW(this,a[n])}const{accounts:s}=await Eu({network:this.getNetwork(),accounts:r});n=ua(n);for(const a of s)if(ua(a)===n)return new fW(this,n);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new fW(this,r))}destroy(){Je(this,j0)&&(clearTimeout(Je(this,j0)),tn(this,j0,null));for(const{payload:n,reject:r}of Je(this,Dg))r(Mo("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n.method}));tn(this,Dg,[]),super.destroy()}}l3=new WeakMap,GN=new WeakMap,Dg=new WeakMap,j0=new WeakMap,nm=new WeakMap,Xh=new WeakMap,Yd=new WeakMap,rT=new WeakSet,Ote=function(){if(Je(this,j0))return;const n=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");tn(this,j0,setTimeout(()=>{tn(this,j0,null);const r=Je(this,Dg);for(tn(this,Dg,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==Je(this,l3).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>Je(this,l3).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(Mo("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=Mo("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 jy;class pNt extends hNt{constructor(n,r){super(n,r);Wn(this,jy);let s=this._getOption("pollingInterval");s==null&&(s=EOe.pollingInterval),tn(this,jy,s)}_getSubscriber(n){const r=super._getSubscriber(n);return a1e(r)&&(r.pollingInterval=Je(this,jy)),r}get pollingInterval(){return Je(this,jy)}set pollingInterval(n){if(!Number.isInteger(n)||n<0)throw new Error("invalid interval");tn(this,jy,n),this._forEachSubscriber(r=>{a1e(r)&&(r.pollingInterval=Je(this,jy))})}}jy=new WeakMap;function Mte(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&bo(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const n=Mte(t[e]);if(n)return n}return null}if(typeof t=="string")try{return Mte(JSON.parse(t))}catch{}return null}function Lte(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const n in t)Lte(t[n],e);if(typeof t=="string")try{return Lte(JSON.parse(t),e)}catch{}}}function mNt(t){const e=[];return Lte(t,e),e}var KN,YN;const uw=class uw extends pNt{constructor(n,r,s){const a=Object.assign({},s??{},{batchMaxCount:1});Dn(n&&n.request,"invalid EIP-1193 provider","ethereum",n);super(r,a);Wn(this,KN);Wn(this,YN);tn(this,YN,null),s&&s.providerInfo&&tn(this,YN,s.providerInfo),tn(this,KN,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 Je(this,YN)}async send(n,r){return await this._start(),await super.send(n,r)}async _send(n){Dn(!Array.isArray(n),"EIP-1193 does not support batch request","payload",n);try{const r=await Je(this,KN).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 Je(this,KN).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 uw(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 uw(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 uw)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 uw(y,void 0,{providerInfo:v}))}else l(Mo("filter returned unknown info","UNSUPPORTED_OPERATION",{value:x}))}}else{const{provider:x,info:g}=c[0];o(new uw(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"))})}};KN=new WeakMap,YN=new WeakMap;let RL=uw;var XN;const Kfe=class Kfe extends wle{constructor(n,r){super(r);Qn(this,"address");Wn(this,XN);Dn(n&&typeof n.sign=="function","invalid private key","privateKey","[ REDACTED ]"),tn(this,XN,n);const s=RT(this.signingKey.publicKey);qs(this,{address:s})}get signingKey(){return Je(this,XN)}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(n){return new Kfe(Je(this,XN),n)}async signTransaction(n){n=lE(n);const{to:r,from:s}=await Eu({to:n.to?Oc(n.to,this):void 0,from:n.from?Oc(n.from,this):void 0});r!=null&&(n.to=r),s!=null&&(n.from=s),n.from!=null&&(Dn(ua(n.from)===this.address,"transaction from address mismatch","tx.from",n.from),delete n.from);const a=fle.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(XCt(n)).serialized}authorizeSync(n){Dn(typeof n.address=="string","invalid address for authorizeSync","auth.address",n);const r=this.signingKey.sign(dCt(n));return Object.assign({},{address:ua(n.address),nonce:Ms(n.nonce||0),chainId:Ms(n.chainId||0)},{signature:r})}async authorize(n){return n=Object.assign({},n,{address:await Oc(n.address,this)}),this.authorizeSync(await this.populateAuthorization(n))}async signTypedData(n,r,s){const a=await bS.resolveNames(n,r,s,async o=>{zr(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 zr(l!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:o}),l});return this.signingKey.sign(bS.hash(a.domain,r,a.value)).serialized}};XN=new WeakMap;let DL=Kfe;const BL=" !#$%&'()*+,-./<=>?@[]^_`{|}~",xNt=/^[a-z]*$/i;function o1e(t,e){let n=97;return t.reduce((r,s)=>(s===e?n++:s.match(xNt)?r.push(String.fromCharCode(n)+s):(n=97,r.push(s)),r),[])}function gNt(t,e){for(let s=BL.length-1;s>=0;s--)t=t.split(BL[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 o1e(o1e(n,";"),":")}function bNt(t){return Dn(t[0]==="0","unsupported auwl data","data",t),gNt(t.substring(1+2*BL.length),t.substring(1,1+2*BL.length))}class yNt{constructor(e){Qn(this,"locale");qs(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}var QN,sT,c3,iT,Rte;class vNt extends yNt{constructor(n,r,s){super(n);Wn(this,iT);Wn(this,QN);Wn(this,sT);Wn(this,c3);tn(this,QN,r),tn(this,sT,s),tn(this,c3,null)}get _data(){return Je(this,QN)}_decodeWords(){return bNt(Je(this,QN))}getWord(n){const r=Er(this,iT,Rte).call(this);return Dn(n>=0&&n<r.length,`invalid word index: ${n}`,"index",n),r[n]}getWordIndex(n){return Er(this,iT,Rte).call(this).indexOf(n)}}QN=new WeakMap,sT=new WeakMap,c3=new WeakMap,iT=new WeakSet,Rte=function(){if(Je(this,c3)==null){const n=this._decodeWords();if(C1(n.join(`
`)+`
`)!==Je(this,sT))throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);tn(this,c3,n)}return Je(this,c3)};const wNt="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",CNt="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60";let hW=null;class t5 extends vNt{constructor(){super("en",wNt,CNt)}static wordlist(){return hW==null&&(hW=new t5),hW}}function kOe(t){return(1<<t)-1<<8-t&255}function NNt(t){return(1<<t)-1&255}function pW(t,e){pIe("NFKD"),e==null&&(e=t5.wordlist());const n=e.split(t);Dn(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"));Dn(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=kOe(o),c=js(xp(r.slice(0,a/8)))[0]&l;return Dn(c===(r[r.length-1]&l),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),ns(r.slice(0,a/8))}function mW(t,e){Dn(t.length%4===0&&t.length>=16&&t.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),e==null&&(e=t5.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]&NNt(8-r)),r+=3);const s=t.length/4,a=parseInt(xp(t).substring(2,4),16)&kOe(s);return n[n.length-1]<<=s,n[n.length-1]|=a>>8-s,e.join(n.map(o=>e.getWord(o)))}const xW={};class vS{constructor(e,n,r,s,a){Qn(this,"phrase");Qn(this,"password");Qn(this,"wordlist");Qn(this,"entropy");s==null&&(s=""),a==null&&(a=t5.wordlist()),I5(e,xW,"Mnemonic"),qs(this,{phrase:r,password:s,wordlist:a,entropy:n})}computeSeed(){const e=bd("mnemonic"+this.password,"NFKD");return E2(bd(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,n,r){const s=pW(e,r);return e=mW(js(s),r),new vS(xW,s,e,n,r)}static fromEntropy(e,n,r){const s=js(e,"entropy"),a=mW(s,r);return new vS(xW,ns(s),a,n,r)}static entropyToPhrase(e,n){const r=js(e,"entropy");return mW(r,n)}static phraseToEntropy(e,n){return pW(e,n)}static isValidMnemonic(e,n){try{return pW(e,n),!0}catch{}return!1}}/*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */var Xc=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)},gW=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},mM,Rh,d0;const SNt={16:10,24:12,32:14},jNt=[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],_h=[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],eF=[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],ANt=[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],_Nt=[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],ENt=[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],kNt=[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],TNt=[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],PNt=[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],INt=[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],FNt=[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],ONt=[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],MNt=[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],LNt=[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],RNt=[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 bW(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 Cle{get key(){return Xc(this,mM,"f").slice()}constructor(e){if(mM.set(this,void 0),Rh.set(this,void 0),d0.set(this,void 0),!(this instanceof Cle))throw Error("AES must be instanitated with `new`");gW(this,mM,new Uint8Array(e),"f");const n=SNt[this.key.length];if(n==null)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");gW(this,d0,[],"f"),gW(this,Rh,[],"f");for(let d=0;d<=n;d++)Xc(this,d0,"f").push([0,0,0,0]),Xc(this,Rh,"f").push([0,0,0,0]);const r=(n+1)*4,s=this.key.length/4,a=bW(this.key);let o;for(let d=0;d<s;d++)o=d>>2,Xc(this,d0,"f")[o][d%4]=a[d],Xc(this,Rh,"f")[n-o][d%4]=a[d];let l=0,c=s,u;for(;c<r;){if(u=a[s-1],a[0]^=_h[u>>16&255]<<24^_h[u>>8&255]<<16^_h[u&255]<<8^_h[u>>24&255]^jNt[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]^=_h[u&255]^_h[u>>8&255]<<8^_h[u>>16&255]<<16^_h[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,Xc(this,d0,"f")[f][x]=a[d],Xc(this,Rh,"f")[n-f][x]=a[d++],c++}for(let d=1;d<n;d++)for(let f=0;f<4;f++)u=Xc(this,Rh,"f")[d][f],Xc(this,Rh,"f")[d][f]=ONt[u>>24&255]^MNt[u>>16&255]^LNt[u>>8&255]^RNt[u&255]}encrypt(e){if(e.length!=16)throw new TypeError("invalid plaintext size (must be 16 bytes)");const n=Xc(this,d0,"f").length-1,r=[0,0,0,0];let s=bW(e);for(let l=0;l<4;l++)s[l]^=Xc(this,d0,"f")[0][l];for(let l=1;l<n;l++){for(let c=0;c<4;c++)r[c]=ANt[s[c]>>24&255]^_Nt[s[(c+1)%4]>>16&255]^ENt[s[(c+2)%4]>>8&255]^kNt[s[(c+3)%4]&255]^Xc(this,d0,"f")[l][c];s=r.slice()}const a=new Uint8Array(16);let o=0;for(let l=0;l<4;l++)o=Xc(this,d0,"f")[n][l],a[4*l]=(_h[s[l]>>24&255]^o>>24)&255,a[4*l+1]=(_h[s[(l+1)%4]>>16&255]^o>>16)&255,a[4*l+2]=(_h[s[(l+2)%4]>>8&255]^o>>8)&255,a[4*l+3]=(_h[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=Xc(this,Rh,"f").length-1,r=[0,0,0,0];let s=bW(e);for(let l=0;l<4;l++)s[l]^=Xc(this,Rh,"f")[0][l];for(let l=1;l<n;l++){for(let c=0;c<4;c++)r[c]=TNt[s[c]>>24&255]^PNt[s[(c+3)%4]>>16&255]^INt[s[(c+2)%4]>>8&255]^FNt[s[(c+1)%4]&255]^Xc(this,Rh,"f")[l][c];s=r.slice()}const a=new Uint8Array(16);let o=0;for(let l=0;l<4;l++)o=Xc(this,Rh,"f")[n][l],a[4*l]=(eF[s[l]>>24&255]^o>>24)&255,a[4*l+1]=(eF[s[(l+3)%4]>>16&255]^o>>16)&255,a[4*l+2]=(eF[s[(l+2)%4]>>8&255]^o>>8)&255,a[4*l+3]=(eF[s[(l+1)%4]&255]^o)&255;return a}}mM=new WeakMap,Rh=new WeakMap,d0=new WeakMap;class TOe{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 Cle(n)},name:{enumerable:!0,value:e}})}}var tF=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},dC=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)},i_,mg;class Nle extends TOe{constructor(e,n){if(super("ECC",e,Nle),i_.set(this,void 0),mg.set(this,void 0),n){if(n.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");tF(this,i_,new Uint8Array(n),"f")}else tF(this,i_,new Uint8Array(16),"f");tF(this,mg,this.iv,"f")}get iv(){return new Uint8Array(dC(this,i_,"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++)dC(this,mg,"f")[s]^=e[r+s];tF(this,mg,this.aes.encrypt(dC(this,mg,"f")),"f"),n.set(dC(this,mg,"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]^dC(this,mg,"f")[a],dC(this,mg,"f")[a]=e[r+a]}return n}}i_=new WeakMap,mg=new WeakMap;var fC=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},Eh=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)},a_,Yv,Dh;class wS extends TOe{constructor(e,n){super("CTR",e,wS),a_.set(this,void 0),Yv.set(this,void 0),Dh.set(this,void 0),fC(this,Dh,new Uint8Array(16),"f"),Eh(this,Dh,"f").fill(0),fC(this,a_,Eh(this,Dh,"f"),"f"),fC(this,Yv,16,"f"),n==null&&(n=1),typeof n=="number"?this.setCounterValue(n):this.setCounterBytes(n)}get counter(){return new Uint8Array(Eh(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)Eh(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");Eh(this,Dh,"f").set(e)}increment(){for(let e=15;e>=0;e--)if(Eh(this,Dh,"f")[e]===255)Eh(this,Dh,"f")[e]=0;else{Eh(this,Dh,"f")[e]++;break}}encrypt(e){var n,r;const s=new Uint8Array(e);for(let a=0;a<s.length;a++)Eh(this,Yv,"f")===16&&(fC(this,a_,this.aes.encrypt(Eh(this,Dh,"f")),"f"),fC(this,Yv,0,"f"),this.increment()),s[a]^=Eh(this,a_,"f")[fC(this,Yv,(r=Eh(this,Yv,"f"),n=r++,r),"f"),n];return s}decrypt(e){return this.encrypt(e)}}a_=new WeakMap,Yv=new WeakMap,Dh=new WeakMap;function DNt(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 POe(t){return typeof t=="string"&&!t.startsWith("0x")&&(t="0x"+t),iu(t)}function a7(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function UT(t){return typeof t=="string"?bd(t,"NFKC"):iu(t)}function Cl(t,e){const n=e.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);Dn(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(Dn(!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 POe(o);if(s==="array"&&Array.isArray(o)||s===typeof o)return o;Dn(!1,`wrong type found for ${s} `,"path",r)}return o}const IOe="m/44'/60'/0'/0/0";function l1e(t){try{const e=JSON.parse(t);if((e.version!=null?parseInt(e.version):0)===3)return!0}catch{}return!1}function BNt(t,e,n){if(Cl(t,"crypto.cipher:string")==="aes-128-ctr"){const s=Cl(t,"crypto.cipherparams.iv:data!"),a=new wS(e,s);return ns(a.decrypt(n))}zr(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}function $L(t,e){const n=js(e),r=Cl(t,"crypto.ciphertext:data!"),s=ns(go($a([n.slice(16,32),r]))).substring(2);Dn(s===Cl(t,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const a=BNt(t,n.slice(0,16),r),o=RT(a);if(t.address){let u=t.address.toLowerCase();u.startsWith("0x")||(u="0x"+u),Dn(ua(u)===o,"keystore address/privateKey mismatch","address",t.address)}const l={address:o,privateKey:a};if(Cl(t,"x-ethers.version:string")==="0.1"){const u=n.slice(32,64),d=Cl(t,"x-ethers.mnemonicCiphertext:data!"),f=Cl(t,"x-ethers.mnemonicCounter:data!"),x=new wS(u,f);l.mnemonic={path:Cl(t,"x-ethers.path:string")||IOe,locale:Cl(t,"x-ethers.locale:string")||"en",entropy:ns(js(x.decrypt(d)))}}return l}function FOe(t){const e=Cl(t,"crypto.kdf:string");if(e&&typeof e=="string"){if(e.toLowerCase()==="scrypt"){const n=Cl(t,"crypto.kdfparams.salt:data!"),r=Cl(t,"crypto.kdfparams.n:int!"),s=Cl(t,"crypto.kdfparams.r:int!"),a=Cl(t,"crypto.kdfparams.p:int!");Dn(r>0&&(r&r-1)===0,"invalid kdf.N","kdf.N",r),Dn(s>0&&a>0,"invalid kdf","kdf",e);const o=Cl(t,"crypto.kdfparams.dklen:int!");return Dn(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=Cl(t,"crypto.kdfparams.salt:data!"),r=Cl(t,"crypto.kdfparams.prf:string!"),s=r.split("-").pop();Dn(s==="sha256"||s==="sha512","invalid kdf.pdf","kdf.pdf",r);const a=Cl(t,"crypto.kdfparams.c:int!"),o=Cl(t,"crypto.kdfparams.dklen:int!");return Dn(o===32,"invalid kdf.dklen","kdf.dklen",o),{name:"pbkdf2",salt:n,count:a,dkLen:o,algorithm:s}}}Dn(!1,"unsupported key-derivation function","kdf",e)}function $Nt(t,e){const n=JSON.parse(t),r=UT(e),s=FOe(n);if(s.name==="pbkdf2"){const{salt:f,count:x,dkLen:g,algorithm:y}=s,v=E2(r,f,x,g,y);return $L(n,v)}zr(s.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:s});const{salt:a,N:o,r:l,p:c,dkLen:u}=s,d=h8(r,a,o,l,c,u);return $L(n,d)}function c1e(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}async function UNt(t,e,n){const r=JSON.parse(t),s=UT(e),a=FOe(r);if(a.name==="pbkdf2"){n&&(n(0),await c1e(0));const{salt:x,count:g,dkLen:y,algorithm:v}=a,C=E2(s,x,g,y,v);return n&&(n(1),await c1e(0)),$L(r,C)}zr(a.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:a});const{salt:o,N:l,r:c,p:u,dkLen:d}=a,f=await f8(s,o,l,c,u,d,n);return $L(r,f)}function OOe(t){const e=t.salt!=null?js(t.salt,"options.salt"):s1(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)),Dn(typeof n=="number"&&n>0&&Number.isSafeInteger(n)&&(BigInt(n)&BigInt(n-1))===BigInt(0),"invalid scrypt N parameter","options.N",n),Dn(typeof r=="number"&&r>0&&Number.isSafeInteger(r),"invalid scrypt r parameter","options.r",r),Dn(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 MOe(t,e,n,r){const s=js(n.privateKey,"privateKey"),a=r.iv!=null?js(r.iv,"options.iv"):s1(16);Dn(a.length===16,"invalid options.iv length","options.iv",r.iv);const o=r.uuid!=null?js(r.uuid,"options.uuid"):s1(16);Dn(o.length===16,"invalid options.uuid length","options.uuid",r.iv);const l=t.slice(0,16),c=t.slice(16,32),u=new wS(l,a),d=js(u.encrypt(s)),f=go($a([c,d])),x={address:n.address.substring(2).toLowerCase(),id:U3t(o),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ns(a).substring(2)},ciphertext:ns(d).substring(2),kdf:"scrypt",kdfparams:{salt:ns(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/${fIe}`,y=n.mnemonic.path||IOe,v=n.mnemonic.locale||"en",C=t.slice(32,64),S=js(n.mnemonic.entropy,"account.mnemonic.entropy"),T=s1(16),I=new wS(C,T),L=js(I.encrypt(S)),F=new Date,O="UTC--"+(F.getUTCFullYear()+"-"+a7(F.getUTCMonth()+1,2)+"-"+a7(F.getUTCDate(),2)+"T"+a7(F.getUTCHours(),2)+"-"+a7(F.getUTCMinutes(),2)+"-"+a7(F.getUTCSeconds(),2)+".0Z")+"--"+x.address;x["x-ethers"]={client:g,gethFilename:O,path:y,locale:v,mnemonicCounter:ns(T).substring(2),mnemonicCiphertext:ns(L).substring(2),version:"0.1"}}return JSON.stringify(x)}function LOe(t,e,n){n==null&&(n={});const r=UT(e),s=OOe(n),a=h8(r,s.salt,s.N,s.r,s.p,64);return MOe(js(a),s,t,n)}async function ROe(t,e,n){n==null&&(n={});const r=UT(e),s=OOe(n),a=await f8(r,s.salt,s.N,s.r,s.p,64,n.progressCallback);return MOe(js(a),s,t,n)}const yW="m/44'/60'/0'/0/0",zNt=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),M4=2147483648,HNt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),VNt="0123456789abcdef";function UL(t,e){let n="";for(;t;)n=VNt[t%16]+n,t=Math.trunc(t/16);for(;n.length<e*2;)n="0"+n;return"0x"+n}function Dte(t){const e=js(t),n=_o(xp(xp(e)),0,4),r=$a([e,n]);return bIe(r)}const f0={};function DOe(t,e,n,r){const s=new Uint8Array(37);t&M4?(zr(r!=null,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),s.set(js(r),1)):s.set(js(n));for(let o=24;o>=0;o-=8)s[33+(o>>3)]=t>>24-o&255;const a=js(u8("sha512",e,s));return{IL:a.slice(0,32),IR:a.slice(32)}}function BOe(t,e){const n=e.split("/");Dn(n.length>0,"invalid path","path",e),n[0]==="m"&&(Dn(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));Dn(o<M4,"invalid path index",`path[${s}]`,a),r=r.deriveChild(M4+o)}else if(a.match(/^[0-9]+$/)){const o=parseInt(a);Dn(o<M4,"invalid path index",`path[${s}]`,a),r=r.deriveChild(o)}else Dn(!1,"invalid path component",`path[${s}]`,a)}return r}var aT,Bte,u3,o_;const qp=class qp extends DL{constructor(n,r,s,a,o,l,c,u,d){super(r,d);Wn(this,aT);Qn(this,"publicKey");Qn(this,"fingerprint");Qn(this,"parentFingerprint");Qn(this,"mnemonic");Qn(this,"chainCode");Qn(this,"path");Qn(this,"index");Qn(this,"depth");I5(n,f0,"HDNodeWallet"),qs(this,{publicKey:r.compressedPublicKey});const f=_o(d8(xp(this.publicKey)),0,4);qs(this,{parentFingerprint:s,fingerprint:f,chainCode:a,path:o,index:l,depth:c}),qs(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 ROe(Er(this,aT,Bte).call(this),n,{progressCallback:r})}encryptSync(n){return LOe(Er(this,aT,Bte).call(this),n)}get extendedKey(){return zr(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Dte($a(["0x0488ADE4",UL(this.depth,1),this.parentFingerprint,UL(this.index,4),this.chainCode,$a(["0x00",this.privateKey])]))}hasPath(){return this.path!=null}neuter(){return new dE(f0,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(n){const r=Ui(n,"index");Dn(r<=4294967295,"invalid index","index",r);let s=this.path;s&&(s+="/"+(r&2147483647),r&M4&&(s+="'"));const{IR:a,IL:o}=DOe(r,this.chainCode,this.publicKey,this.privateKey),l=new Y0(v1((G$(o)+BigInt(this.privateKey))%HNt,32));return new qp(f0,l,this.fingerprint,ns(a),s,r,this.depth+1,this.mnemonic,this.provider)}derivePath(n){return BOe(this,n)}static fromExtendedKey(n){const r=dl(j3t(n));Dn(r.length===82||Dte(r.slice(0,78))===n,"invalid extended key","extendedKey","[ REDACTED ]");const s=r[4],a=ns(r.slice(5,9)),o=parseInt(ns(r.slice(9,13)).substring(2),16),l=ns(r.slice(13,45)),c=r.slice(45,78);switch(ns(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const u=ns(c);return new dE(f0,RT(u),u,a,l,null,o,s,null)}case"0x0488ade4":case"0x04358394 ":if(c[0]!==0)break;return new qp(f0,new Y0(c.slice(1)),a,l,null,o,s,null,null)}Dn(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(n,r,s){var o;n==null&&(n=""),r==null&&(r=yW),s==null&&(s=t5.wordlist());const a=vS.fromEntropy(s1(16),n,s);return Er(o=qp,u3,o_).call(o,a.computeSeed(),a).derivePath(r)}static fromMnemonic(n,r){var s;return r||(r=yW),Er(s=qp,u3,o_).call(s,n.computeSeed(),n).derivePath(r)}static fromPhrase(n,r,s,a){var l;r==null&&(r=""),s==null&&(s=yW),a==null&&(a=t5.wordlist());const o=vS.fromPhrase(n,r,a);return Er(l=qp,u3,o_).call(l,o.computeSeed(),o).derivePath(s)}static fromSeed(n){var r;return Er(r=qp,u3,o_).call(r,n,null)}};aT=new WeakSet,Bte=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},u3=new WeakSet,o_=function(n,r){Dn(V$(n),"invalid seed","seed","[REDACTED]");const s=js(n,"seed");Dn(s.length>=16&&s.length<=64,"invalid seed","seed","[REDACTED]");const a=js(u8("sha512",zNt,s)),o=new Y0(ns(a.slice(0,32)));return new qp(f0,o,"0x00000000",ns(a.slice(32)),"m",0,0,r,null)},Wn(qp,u3);let F_=qp;class dE extends Pte{constructor(n,r,s,a,o,l,c,u,d){super(r,d);Qn(this,"publicKey");Qn(this,"fingerprint");Qn(this,"parentFingerprint");Qn(this,"chainCode");Qn(this,"path");Qn(this,"index");Qn(this,"depth");I5(n,f0,"HDNodeVoidWallet"),qs(this,{publicKey:s});const f=_o(d8(xp(s)),0,4);qs(this,{publicKey:s,fingerprint:f,parentFingerprint:a,chainCode:o,path:l,index:c,depth:u})}connect(n){return new dE(f0,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,n)}get extendedKey(){return zr(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Dte($a(["0x0488B21E",UL(this.depth,1),this.parentFingerprint,UL(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(n){const r=Ui(n,"index");Dn(r<=4294967295,"invalid index","index",r);let s=this.path;s&&(s+="/"+(r&2147483647),r&M4&&(s+="'"));const{IR:a,IL:o}=DOe(r,this.chainCode,this.publicKey,null),l=Y0.addPoints(o,this.publicKey,!0),c=RT(l);return new dE(f0,c,l,this.fingerprint,ns(a),s,r,this.depth+1,this.provider)}derivePath(n){return BOe(this,n)}}function u1e(t){try{if(JSON.parse(t).encseed)return!0}catch{}return!1}function d1e(t,e){const n=JSON.parse(t),r=UT(e),s=ua(Cl(n,"ethaddr:string!")),a=POe(Cl(n,"encseed:string!"));Dn(a&&a.length%16===0,"invalid encseed","json",t);const o=js(E2(r,r,2e3,32,"sha256")).slice(0,16),l=a.slice(0,16),c=a.slice(16),u=new Nle(o,l),d=DNt(js(u.decrypt(c)));let f="";for(let x=0;x<d.length;x++)f+=String.fromCharCode(d[x]);return{address:s,privateKey:C1(f)}}function f1e(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}var oT,V0,$te;let fE=(V0=class extends DL{constructor(e,n){typeof e=="string"&&!e.startsWith("0x")&&(e="0x"+e);let r=typeof e=="string"?new Y0(e):e;super(r,n)}connect(e){return new V0(this.signingKey,e)}async encrypt(e,n){const r={address:this.address,privateKey:this.privateKey};return await ROe(r,e,{progressCallback:n})}encryptSync(e){const n={address:this.address,privateKey:this.privateKey};return LOe(n,e)}static async fromEncryptedJson(e,n,r){var a;let s=null;return l1e(e)?s=await UNt(e,n,r):u1e(e)&&(r&&(r(0),await f1e(0)),s=d1e(e,n),r&&(r(1),await f1e(0))),Er(a=V0,oT,$te).call(a,s)}static fromEncryptedJsonSync(e,n){var s;let r=null;return l1e(e)?r=$Nt(e,n):u1e(e)?r=d1e(e,n):Dn(!1,"invalid JSON wallet","json","[ REDACTED ]"),Er(s=V0,oT,$te).call(s,r)}static createRandom(e){const n=F_.createRandom();return e?n.connect(e):n}static fromPhrase(e,n){const r=F_.fromPhrase(e);return n?r.connect(n):r}},oT=new WeakSet,$te=function(e){if(Dn(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&e.mnemonic.locale==="en"){const r=vS.fromEntropy(e.mnemonic.entropy),s=F_.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 V0(e.privateKey);return Dn(n.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),n},Wn(V0,oT),V0);async function h1e(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=lu.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 CS=({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 $Oe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},p1e=ke.createContext&&ke.createContext($Oe),WNt=["attr","size","title"];function qNt(t,e){if(t==null)return{};var n=GNt(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 GNt(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 zL(){return zL=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},zL.apply(this,arguments)}function m1e(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 HL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?m1e(Object(n),!0).forEach(function(r){KNt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):m1e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KNt(t,e,n){return e=YNt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YNt(t){var e=XNt(t,"string");return typeof e=="symbol"?e:e+""}function XNt(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 UOe(t){return t&&t.map((e,n)=>ke.createElement(e.tag,HL({key:n},e.attr),UOe(e.child)))}function Ol(t){return e=>ke.createElement(QNt,zL({attr:HL({},t.attr)},e),UOe(t.child))}function QNt(t){var e=n=>{var{attr:r,size:s,title:a}=t,o=qNt(t,WNt),l=s||n.size||"1em",c;return n.className&&(c=n.className),t.className&&(c=(c?c+" ":"")+t.className),ke.createElement("svg",zL({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:c,style:HL(HL({color:t.color||n.color},n.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),a&&ke.createElement("title",null,a),t.children)};return p1e!==void 0?ke.createElement(p1e.Consumer,null,n=>e(n)):e($Oe)}function ZNt(t){return Ol({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 zT(t){return Ol({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 JNt(t){return Ol({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 Sle(t){return Ol({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 la(t){return Ol({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 ca(t){return Ol({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 eSt(t){return Ol({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 tSt(t){return Ol({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 nSt(t){return Ol({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 rSt(t){return Ol({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 sSt(t){return Ol({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 a2(t){return Ol({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 o2(t){return Ol({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 l2(t){return Ol({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 zOe(t){return Ol({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 iSt=({handleListRequest:t,isLighterInfoValue:e,handleLighterWalletInfo:n})=>{var fe;const r="https://dextrabothypev2.nftinit.io",{setSignModalOpen:s}=h.useContext(Qr),[a,o]=h.useState(""),[l,c]=h.useState(""),[u,d]=h.useState(""),[f,x]=h.useState(""),[g,y]=h.useState(!1),[v,C]=h.useState(!1),[S,T]=h.useState(""),[I,L]=h.useState(""),[F,$]=h.useState(!0),[O,U]=h.useState({}),Y=G=>/^\d*$/.test(G),re=G=>{["e","E","+","-"].includes(G.key)&&G.preventDefault()},Q=a.trim()!==""&&l.trim()!==""&&u.trim()!==""&&f.trim()!=="",q=async()=>{if(!Q){T("Please fill in all fields.");return}try{C(!0),T(""),L("");const G=window.localStorage.getItem("hyperToken"),ie=window.localStorage.getItem("hyperAddress");if(!G||!ie){s(!0),C(!1);return}const oe={address:ie.toLowerCase(),token:G,wallet_name:a,main_wallet:l,api_wallet_idx:f,api_wallet_private_key:u},H=await(await fetch(`${r}/api/wallet/generate-lighter`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(oe)})).json();H!=null&&H.success?(fn.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(ie),o(""),c(""),d(""),x(""),T(""),L(H==null?void 0:H.message)):T((H==null?void 0:H.error_message)||"An error has occurred.")}catch(G){T(G.message||"An error has occurred.")}finally{C(!1)}},te=async(G,ie)=>{console.log("id :>> ",G);const oe=`${G}_${ie}`;try{U(Se=>({...Se,[oe]:!0})),T(""),L("");const K=window.localStorage.getItem("hyperToken"),H=window.localStorage.getItem("hyperAddress");if(!K||!H){s(!0),U(Se=>({...Se,[oe]:!1}));return}const ee={address:H.toLowerCase(),token:K,wallet_id:Number(G)},pe=await(await fetch(`${r}/api/wallet/delete-lighter`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ee)})).json();pe!=null&&pe.success?(fn.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(H),T(""),L(pe==null?void 0:pe.message)):T((pe==null?void 0:pe.error_message)||"An error has occurred.")}catch(K){T(K.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(ka,{})}),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:G=>o(G.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:G=>c(G.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:G=>d(G.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(G=>!G),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(la,{size:14}):i.jsx(ca,{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:G=>{const ie=G.target.value.trim();if(ie==="")return x("");Y(ie)&&x(ie)},onKeyDown:re,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&&q()},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(Xie,{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((G,ie)=>(ie==null?void 0:ie.wallet_created_data)-(G==null?void 0:G.wallet_created_data)))==null?void 0:fe.map((G,ie)=>{var oe,K;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:((oe=G==null?void 0:G.wallet_name)==null?void 0:oe.length)>18?((K=G==null?void 0:G.wallet_name)==null?void 0:K.slice(0,18))+"...":G==null?void 0:G.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:(G==null?void 0:G.wallet_address.slice(0,6))+"..."+(G==null?void 0:G.wallet_address.slice(-4))}),i.jsx("img",{onClick:H=>{H.stopPropagation(),navigator.clipboard.writeText(G==null?void 0:G.wallet_address),fn.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:io,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:$c(G==null?void 0:G.wallet_created_data)}),O[`${G==null?void 0:G.wallet_id}_${G==null?void 0:G.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(G==null?void 0:G.wallet_id,G==null?void 0:G.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"})})]})},ie)}))})]}):""}),S&&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:Wo,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:S})]}),I&&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:Tae,alt:"Dextrabot",className:"w-4 h-4"}),i.jsx("p",{className:"text-[#67FFBD] text-[13px] font-normal font-['Inter'] leading-4",children:I})]})]})},x1e=({handleListRequest:t,isExtendedInfoValue:e,handleExtendedWalletInfo:n})=>{var ge;const r="https://dextrabothypev2.nftinit.io",{setSignModalOpen:s}=h.useContext(Qr),[a,o]=h.useState(""),[l,c]=h.useState(""),[u,d]=h.useState(""),[f,x]=h.useState(""),[g,y]=h.useState(""),[v,C]=h.useState(""),[S,T]=h.useState(!1),[I,L]=h.useState(!1),[F,$]=h.useState(!1),[O,U]=h.useState(!1),[Y,re]=h.useState(!1),[Q,q]=h.useState(""),[te,fe]=h.useState(""),[G,ie]=h.useState(!0),[oe,K]=h.useState({}),H=ve=>/^\d*$/.test(ve),ee=ve=>{["e","E","+","-"].includes(ve.key)&&ve.preventDefault()},se=a.trim()!==""&&l.trim()!==""&&u.trim()!==""&&f.trim()!==""&&g.trim()!==""&&v.trim()!=="",pe=async()=>{if(!se){q("Please fill in all fields.");return}try{re(!0),q(""),fe("");const ve=window.localStorage.getItem("hyperToken"),be=window.localStorage.getItem("hyperAddress");if(!ve||!be){s(!0),re(!1);return}const we={address:be.toLowerCase(),token:ve,wallet_name:a,main_wallet:l,api_key:f,stark_public:u,stark_private:g,vault_number:v},Fe=await(await fetch(`${r}/api/wallet/generate-extended`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(we)})).json();Fe!=null&&Fe.success?(fn.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(be),o(""),c(""),d(""),x(""),y(""),C(""),q(""),fe(Fe==null?void 0:Fe.message)):q((Fe==null?void 0:Fe.error_message)||"An error has occurred.")}catch(ve){q(ve.message||"An error has occurred.")}finally{re(!1)}},Se=async(ve,be)=>{console.log("id :>> ",ve);const we=`${ve}_${be}`;try{K(dt=>({...dt,[we]:!0})),q(""),fe("");const je=window.localStorage.getItem("hyperToken"),Fe=window.localStorage.getItem("hyperAddress");if(!je||!Fe){s(!0),K(dt=>({...dt,[we]:!1}));return}const Re={address:Fe.toLowerCase(),token:je,wallet_id:Number(ve)},Ye=await(await fetch(`${r}/api/wallet/delete-extended`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Re)})).json();Ye!=null&&Ye.success?(t(),fn.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(Fe),q(""),fe(Ye==null?void 0:Ye.message)):q((Ye==null?void 0:Ye.error_message)||"An error has occurred.")}catch(je){q(je.message||"An error has occurred.")}finally{re(!1)}};return i.jsxs("div",{className:"flex flex-col items-start gap-2 w-full relative",children:[Y&&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(ka,{})}),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:ve=>o(ve.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:Y})})]}),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:ve=>c(ve.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:Y})})]}),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:ve=>x(ve.target.value),autoComplete:"off",placeholder:"API_KEY",type:S?"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:Y}),i.jsx("button",{type:"button",onClick:()=>T(ve=>!ve),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:Y,children:S?i.jsx(la,{size:14}):i.jsx(ca,{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:ve=>d(ve.target.value),autoComplete:"off",placeholder:"STARK_KEY_PUBLIC",type:I?"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:Y}),i.jsx("button",{type:"button",onClick:()=>L(ve=>!ve),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:Y,children:I?i.jsx(la,{size:14}):i.jsx(ca,{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:ve=>y(ve.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:Y}),i.jsx("button",{type:"button",onClick:()=>$(ve=>!ve),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:Y,children:F?i.jsx(la,{size:14}):i.jsx(ca,{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:ve=>{const be=ve.target.value.trim();if(be==="")return C("");H(be)&&C(be)},onKeyDown:ee,inputMode:"numeric",autoComplete:"off",type:O?"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:Y}),i.jsx("button",{type:"button",onClick:()=>U(ve=>!ve),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:Y,children:O?i.jsx(la,{size:14}):i.jsx(ca,{size:14})})]})]})]}),i.jsx("button",{onClick:()=>{!Y&&pe()},disabled:Y,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:()=>ie(!G),children:[i.jsx("span",{className:"text-white text-sm font-medium font-['Inter'] leading-normal",children:"Extended Wallets"}),i.jsx(Xie,{className:`w-3.5 h-3.5 transition-transform text-white ${G?"":"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:G&&((ge=[...e].sort((ve,be)=>(be==null?void 0:be.wallet_created_data)-(ve==null?void 0:ve.wallet_created_data)))==null?void 0:ge.map((ve,be)=>{var we,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:((we=ve==null?void 0:ve.wallet_name)==null?void 0:we.length)>18?((je=ve==null?void 0:ve.wallet_name)==null?void 0:je.slice(0,18))+"...":ve==null?void 0:ve.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:(ve==null?void 0:ve.wallet_address.slice(0,6))+"..."+(ve==null?void 0:ve.wallet_address.slice(-4))}),i.jsx("img",{onClick:Fe=>{Fe.stopPropagation(),navigator.clipboard.writeText(ve==null?void 0:ve.wallet_address),fn.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:io,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:$c(ve==null?void 0:ve.wallet_created_data)}),oe[`${ve==null?void 0:ve.wallet_id}_${ve==null?void 0:ve.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:()=>{Se(ve==null?void 0:ve.wallet_id,ve==null?void 0:ve.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"})})]})},be)}))})]}):""}),Q&&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:Wo,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:Q})]}),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:Tae,alt:"Dextrabot",className:"w-4 h-4"}),i.jsx("p",{className:"text-[#67FFBD] text-[13px] font-normal font-['Inter'] leading-4",children:te})]})]})},HOe=({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"})}),aSt=({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:S,handleExtendedWalletInfo:T,isPacificaInfoValue:I,handlePacificaWalletInfo:L,isSelectAPIMenu:F,setIsSelectAPIMenu:$})=>{var ge,ve;const{setSignModalOpen:O}=h.useContext(Qr),{address:U}=ds(),Y=Pl(),[re,Q]=h.useState(!0),[q,te]=h.useState(!1),[fe,G]=h.useState(!1);h.useEffect(()=>{const be=Y.hash,we=localStorage.getItem("isWalletSelectMenu");if(be){const je=be.split("#").filter(Boolean);je[2]&&$(je[2].toUpperCase()),we==="LIGHTER"?$("LIGHTER"):we==="EXTENDED"?$("EXTENDED"):we==="PACIFICA"?$("PACIFICA"):we==="HYPER"&&$("HYPERLIQUID")}},[Y.hash]),h.useEffect(()=>{(async()=>{var Fe;const we=window.localStorage.getItem("hyperToken"),je=(Fe=U||window.localStorage.getItem("hyperAddress"))==null?void 0:Fe.toLowerCase();if(!we){O(!0);return}if(je&&we)try{const Re=await bi(je,we);te(!!(Re!=null&&Re.is_generated))}catch{te(!1)}finally{G(!0)}})()},[U,O]);const ie=be=>{var Qe,Ye,dt,st,at,He;const we=(be==null?void 0:be.code)||((Qe=be==null?void 0:be.error)==null?void 0:Qe.code)||((dt=(Ye=be==null?void 0:be.info)==null?void 0:Ye.error)==null?void 0:dt.code)||((st=be==null?void 0:be.cause)==null?void 0:st.code)||"",je=typeof we=="string"?we.toUpperCase():String(we).toUpperCase(),Fe=String((be==null?void 0:be.message)||"").toUpperCase();if(je==="ACTION_REJECTED"||je==="4001"||Fe.includes("USER REJECT")||Fe.includes("USER DENIED")){e("Request cancelled by user.");return}if([typeof be=="string"?be:"",be==null?void 0:be.message,be==null?void 0:be.code,be==null?void 0:be.name,be==null?void 0:be.shortMessage,(at=be==null?void 0:be.cause)==null?void 0:at.message,(He=be==null?void 0:be.cause)==null?void 0:He.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 be=="string"?be:(be==null?void 0:be.message)||"Something went wrong.")},oe=()=>{if(!window.ethereum)throw new Error("MetaMask not found.");return window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0xa4b1"}]})},K=async be=>{var Fe,Re;if(q)return;const we=window.localStorage.getItem("hyperToken");if(!we||!U){O(!0);return}r(!0),e("");const je=window.localStorage.getItem("hyperAddress");try{await window.ethereum.request({method:"eth_chainId"})!=="0xa4b1"&&await oe();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:U?U.toLowerCase():je,token:we})})).json();if(!(dt!=null&&dt.success)){ie((dt==null?void 0:dt.error_message)||"Agent could not be produced.");return}if(!window.ethereum)throw new Error("MetaMask not found.");const at=await new RL(window.ethereum).getSigner(),He=await h1e(be,dt,at),vt=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:He.signature,action:He.action,nonce:He.nonce,address:U?U.toLowerCase():je,token:we})})).json();if(vt!=null&&vt.success){if(((Fe=vt==null?void 0:vt.result)==null?void 0:Fe.status)==="err"){ie(((Re=vt==null?void 0:vt.result)==null?void 0:Re.response)||"Approval failed."),r(!1);return}s(),a(1),d(U||je)}else ie((vt==null?void 0:vt.error_message)||"Approval failed.")}catch(Qe){ie(Qe)}finally{r(!1)}},H=async be=>{var Fe,Re;if(q)return;const we=window.localStorage.getItem("hyperToken");if(!we||!U){O(!0);return}r(!0),e("");const je=window.localStorage.getItem("hyperAddress");try{await window.ethereum.request({method:"eth_chainId"})!=="0xa4b1"&&await oe();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:U?U.toLowerCase():je,token:we})})).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 at=await new RL(window.ethereum).getSigner(),He=await h1e(be,dt,at),vt=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:He.signature,action:He.action,nonce:He.nonce,address:U?U.toLowerCase():je,token:we})})).json();if(vt!=null&&vt.success){if(((Fe=vt==null?void 0:vt.result)==null?void 0:Fe.status)==="err"){ie(((Re=vt==null?void 0:vt.result)==null?void 0:Re.response)||"Approve builder fee failed"),r(!1);return}K(1),y(U||je)}else ie((vt==null?void 0:vt.error_message)||"Approval failed."),r(!1)}catch(Qe){ie(Qe),r(!1)}},ee=h.useMemo(()=>u?u.some(be=>{var we;return((we=(be==null?void 0:be.name)??"")==null?void 0:we.trim().toLowerCase())==="dextrabot"}):!1,[u]),se=Number(((ge=o==null?void 0:o.marginSummary)==null?void 0:ge.accountValue)??0),pe=`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.`,Se=n||c||l||f||!fe&&U;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(vW,{title:"HYPERLIQUID",set_click:()=>$("HYPERLIQUID"),isSelectAPIMenu:F}),i.jsx(vW,{title:"LIGHTER",set_click:()=>$("LIGHTER"),isSelectAPIMenu:F}),i.jsx(vW,{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(HOe,{className:"w-4 h-4"})]})]})}),Se?i.jsx("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:i.jsx(ka,{})}):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:[U&&i.jsx("img",{src:Sme,alt:"agent icon"}),U||"--"]}),!q&&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(t1,{className:"w-4 h-4 text-[#929292] hover:text-white"})}),i.jsx("span",{className:`${se>=5?"text-[#1DE674]":"text-[#929292]"} `,children:se===0||se?"$"+Ir(se):"--"})]})]}),(se===0&&!ee||se<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:Sme,alt:"agent icon"}),"You’re ready to trade!"]}):"":se>0?se>=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(CS,{className:"text-[#FFB14B] w-[18px] h-[18px] min-w-[18px] min-h-[18px]"}),"Your Hyperliquid perps balance is $",Ir(se)," 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(CS,{className:"text-[#FFB14B] w-[18px] h-[18px] min-w-[18px] min-h-[18px]"}),"Please fund your Hyperliquid Perpetual balance to start trading"]})})]})]}),q?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:Wo,alt:"Dextrabot"}),i.jsx("p",{className:"whitespace-pre-line text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:pe})]}):i.jsxs(i.Fragment,{children:[x!=null&&Number(x)>0?ee?"":i.jsx("div",{onClick:()=>{K(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:be=>{be.preventDefault(),se>=5&&!l&&H(2)},className:`${se>=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:()=>Q(!re),children:[i.jsx("span",{className:"text-white text-sm font-medium font-['Inter'] leading-normal",children:"API Wallets"}),i.jsx(Xie,{className:`w-3.5 h-3.5 transition-transform text-white ${re?"":"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:re&&((ve=[...u].sort((be,we)=>(we==null?void 0:we.validUntil)-(be==null?void 0:be.validUntil)))==null?void 0:ve.map((be,we)=>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:`${(be==null?void 0:be.name)==="dextrabot"?"text-white":"text-[#929292]"} text-[11px] font-normal min-w-[110px]`,children:be==null?void 0:be.name})}),i.jsxs("span",{className:`${(be==null?void 0:be.name)==="dextrabot"?"text-white":"text-[#929292]"} text-[11px] font-normal font-['Inter'] leading-4 min-w-max`,children:["Valid until:"," ",Sht(be==null?void 0:be.validUntil)]})]})},we)))})]}):""}),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:Wo,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(iSt,{handleListRequest:s,isLighterInfoValue:v,handleLighterWalletInfo:C})}):F==="EXTENDED"?i.jsx("div",{className:"flex items-center justify-start w-full",children:i.jsx(x1e,{handleListRequest:s,isExtendedInfoValue:S,handleExtendedWalletInfo:T})}):i.jsx("div",{className:"flex items-center justify-start w-full",children:i.jsx(x1e,{handleListRequest:s,isExtendedInfoValue:S,handleExtendedWalletInfo:T})})]})},vW=({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}),g1e=({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 M5({open:t,setOpen:e,handleListRequest:n,handlePageChange:r,source:s}){const{isConnected:a,address:o}=ds(),{hyperToken:l}=h.useContext(Qr);Pl();const[c,u]=h.useState("HYPERLIQUID");h.useEffect(()=>{t&&s&&u(s)},[t,s]);const[d,f]=h.useState([]),[x,g]=h.useState(""),[y,v]=h.useState(!1),[C,S]=h.useState(""),[T,I]=h.useState(!1),[L,F]=h.useState(!1),[$,O]=h.useState(!1),[U,Y]=h.useState("account"),[re,Q]=h.useState(!1),q=h.useRef(null),[te,fe]=h.useState([]),[G,ie]=h.useState(""),[oe,K]=h.useState(""),[H,ee]=h.useState(!1),[se,pe]=h.useState(""),[Se,ge]=h.useState(""),[ve,be]=h.useState(""),[we,je]=h.useState(!1),[Fe,Re]=h.useState(!1),[Qe,Ye]=h.useState(null),[dt,st]=h.useState(!1),[at,He]=h.useState([]),[qe,vt]=h.useState([]),[yt,Kt]=h.useState([]),[jt,un]=h.useState([]),[vn,Hn]=h.useState(!1),[ln,Nn]=h.useState(null),dn=[{id:"account",name:"Add API Wallet",href:"#account",icon:g1e},{id:"generate",name:"Generate HL Wallet",href:"#generate",icon:g1e}];function rt(...We){return We.filter(Boolean).join(" ")}const nt=async(We,Pt)=>{try{Pt===1&&Re(!0);const Ke=await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:We})});if(!Ke.ok)throw new Error("Network response was not ok");const ct=await Ke.json();ct&&(Ye(ct),Re(!1))}catch(Ke){console.error("Error fetching user balance info:",Ke),Re(!1)}},Ut=async We=>{try{st(!0);const Pt=await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"extraAgents",user:We})});if(!Pt.ok)throw new Error("Network response was not ok");const Ke=await Pt.json();Ke&&(He(Ke),st(!1))}catch(Pt){console.error("Error fetching user balance info:",Pt),st(!1)}},wn=async We=>{const Pt=window.localStorage.getItem("hyperToken"),Ke=window.localStorage.getItem("hyperAddress");if(!(!Pt||!We))try{const ct=await fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:We?We.toLowerCase():Ke,token:Pt})});if(!ct.ok)throw new Error("Network response was not ok");const Nt=await ct.json();Nt.success&&vt((Nt==null?void 0:Nt.data)||[])}catch(ct){console.error("Error fetching user balance info:",ct)}},Jt=async We=>{const Pt=window.localStorage.getItem("hyperToken"),Ke=window.localStorage.getItem("hyperAddress");if(!(!Pt||!We))try{const ct=await fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-extended",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:We?We.toLowerCase():Ke,token:Pt})});if(!ct.ok)throw new Error("Network response was not ok");const Nt=await ct.json();Nt.success&&Kt((Nt==null?void 0:Nt.data)||[])}catch(ct){console.error("Error fetching user balance info:",ct)}},Vt=async We=>{try{Hn(!0);const Pt=await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"maxBuilderFee",user:We,builder:"0x49ae63056b3a0be0b166813ee687309ab653c07c"})});if(!Pt.ok)throw new Error("Network response was not ok");const Ke=await Pt.text(),ct=parseInt(Ke,10);Nn(ct),Hn(!1)}catch(Pt){console.error("Error fetching user balance info:",Pt),Hn(!1)}};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&o&&t&&(nt(o,1),Ut(o),wn(o),Jt(o),Vt(o))},[t]),h.useEffect(()=>{var Ke;return!t||U!="account"||(at==null?void 0:at.some(ct=>((ct==null?void 0:ct.name)??"").trim().toLowerCase()==="dextrabot"))?void 0:(Number(((Ke=Qe==null?void 0:Qe.marginSummary)==null?void 0:Ke.accountValue)??0)<5?q.current||(q.current=setInterval(()=>{nt(o,2)},1e4)):q.current&&(clearInterval(q.current),q.current=null),()=>{q.current&&(clearInterval(q.current),q.current=null)})},[Qe,t,U,o]),h.useEffect(()=>{const We=window.localStorage.getItem("hyperToken");(!o||!a||!We)&&(e(!1),g(""),S(""),be(""))},[o,a,l]);const xt=()=>{window.localStorage.getItem("hyperToken")&&o&&t?(nt(o,1),Ut(o),Vt(o)):fn.error("Please connect wallet")};return h.useEffect(()=>{if(t&&!re)if((at==null?void 0:at.length)>0){const We=at==null?void 0:at.some(Ke=>((Ke==null?void 0:Ke.name)??"").trim().toLowerCase()==="dextrabot"),Pt=localStorage.getItem("isWalletSelectMenu");Y(Pt==="LIGHTER"||Pt==="EXTENDED"||Pt==="PACIFICA"?"account":Pt==="HYPER"?We?"generate":"account":We&&(qe==null?void 0:qe.length)>0&&(yt==null?void 0:yt.length)>0&&(jt==null?void 0:jt.length)>0?"generate":"account"),Q(!0)}else Y("account"),Q(!0)},[at,re]),i.jsxs(i.Fragment,{children:[i.jsx(p3t,{open:$,setOpen:O,setGenModalOpen:e,setGenWalletSuccess:F,setGenWalletData:f,setShowPrivateKey:I}),i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-[9999999998] font-manrope",children:[i.jsx(fa,{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(Ji,{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:`${L&&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:We=>{We.preventDefault(),y&&U==="generate"||U==="account"&&we?fn.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"}}):U==="generate"&&L&&Object.keys(d).length>0?(O(!0),I(!1)):(e(!1),g(""),S(""),be(""),He([]),Nn(null),Q(!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:Na})})}),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:U,onChange:We=>{const Pt=We.target.value;if(!y){if(U==="generate"&&Pt!=="generate"&&L&&Object.keys(d).length>0){I(!1),O(!0);return}if(U==="account"&&Pt!=="account"&&we){fn.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}Y(Pt),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:dn==null?void 0:dn.map(We=>i.jsx("option",{value:We==null?void 0:We.id,children:We==null?void 0:We.name},We==null?void 0:We.id))}),i.jsx(g9,{"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:dn==null?void 0:dn.map(We=>{const Pt=(We==null?void 0:We.id)===U;return i.jsxs("a",{href:We==null?void 0:We.href,onClick:Ke=>{Ke.preventDefault();const ct=We==null?void 0:We.id;if(y)return;if(U==="generate"&&ct!=="generate"&&L&&Object.keys(d).length>0){I(!1),O(!0);return}if(U==="account"&&ct!=="account"&&we){fn.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}Y(ct);const Nt=document.querySelector(We.href);Nt&&Nt.scrollIntoView({behavior:"smooth",block:"start"}),g("")},"aria-current":Pt?"page":void 0,className:rt(Pt?"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(We.icon,{"aria-hidden":"true",className:rt(Pt?"text-white group-hover:text-white":"text-[#878787] group-hover:text-white","-ml-0.5 mr-2 size-[18px]")}),i.jsx("span",{children:We==null?void 0:We.name})]},We==null?void 0:We.id)})})})]}),U==="generate"?i.jsx(x3t,{loading:y,genWalletSuccess:L,genWalletData:d,showPrivateKey:T,genWalletName:x,setGenWalletName:g,errorMessage:C,setShowPrivateKey:I,setErrorMessage:S,setLoading:v,setGenWalletData:f,setGenWalletSuccess:F,handleListRequest:n,handlePageChange:r}):U==="agent"?i.jsx(g3t,{agentWalletData:te,setAgentWalletData:fe,agentWalletName:G,setAgentWalletName:ie,errorAgentMessage:oe,setErrorAgentMessage:K,loadingAgent:H,setLoadingAgent:ee,handleListRequest:n,handlePageChange:r,agentWalletAddress:se,setAgentWalletAddress:pe,agentWalletPkey:Se,setAgentWalletPkey:ge}):U==="account"?i.jsx(aSt,{errorConnectMessage:ve,setErrorConnectMessage:be,loadingConnect:we,setLoadingConnect:je,handleListRequest:n,handlePageChange:r,isBalanceValue:Qe,isBalanceLoading:Fe,isAgentInfoLoading:dt,isAgentInfoValue:at,handleAgentWalletInfo:Ut,isBuilderFeeLoading:vn,isBuilderFeeValue:ln,refreshAgent:xt,handleBuilderFeeInfo:Vt,isLighterInfoValue:qe,handleLighterWalletInfo:wn,isExtendedInfoValue:yt,handleExtendedWalletInfo:Jt,isPacificaInfoValue:jt,handlePacificaWalletInfo:Jt,isSelectAPIMenu:c,setIsSelectAPIMenu:u}):""]})})})})})]})]})}var ff="top",gp="bottom",bp="right",hf="left",jle="auto",HT=[ff,gp,bp,hf],NS="start",hE="end",oSt="clippingParents",VOe="viewport",o7="popper",lSt="reference",b1e=HT.reduce(function(t,e){return t.concat([e+"-"+NS,e+"-"+hE])},[]),WOe=[].concat(HT,[jle]).reduce(function(t,e){return t.concat([e,e+"-"+NS,e+"-"+hE])},[]),cSt="beforeRead",uSt="read",dSt="afterRead",fSt="beforeMain",hSt="main",pSt="afterMain",mSt="beforeWrite",xSt="write",gSt="afterWrite",bSt=[cSt,uSt,dSt,fSt,hSt,pSt,mSt,xSt,gSt];function fx(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 n5(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 Ale(t){if(typeof ShadowRoot>"u")return!1;var e=sh(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function ySt(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)||!fx(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 vSt(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)||!fx(s)||(Object.assign(s.style,l),Object.keys(a).forEach(function(c){s.removeAttribute(c)}))})}}const qOe={name:"applyStyles",enabled:!0,phase:"write",fn:ySt,effect:vSt,requires:["computeStyles"]};function X0(t){return t.split("-")[0]}var w3=Math.max,VL=Math.min,SS=Math.round;function Ute(){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 GOe(){return!/^((?!chrome|android).)*safari/i.test(Ute())}function jS(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&&SS(r.width)/t.offsetWidth||1,a=t.offsetHeight>0&&SS(r.height)/t.offsetHeight||1);var o=n5(t)?sh(t):window,l=o.visualViewport,c=!GOe()&&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 _le(t){var e=jS(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 KOe(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Ale(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function S1(t){return sh(t).getComputedStyle(t)}function wSt(t){return["table","td","th"].indexOf(fx(t))>=0}function T2(t){return((n5(t)?t.ownerDocument:t.document)||window.document).documentElement}function oU(t){return fx(t)==="html"?t:t.assignedSlot||t.parentNode||(Ale(t)?t.host:null)||T2(t)}function y1e(t){return!cp(t)||S1(t).position==="fixed"?null:t.offsetParent}function CSt(t){var e=/firefox/i.test(Ute()),n=/Trident/i.test(Ute());if(n&&cp(t)){var r=S1(t);if(r.position==="fixed")return null}var s=oU(t);for(Ale(s)&&(s=s.host);cp(s)&&["html","body"].indexOf(fx(s))<0;){var a=S1(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 VT(t){for(var e=sh(t),n=y1e(t);n&&wSt(n)&&S1(n).position==="static";)n=y1e(n);return n&&(fx(n)==="html"||fx(n)==="body"&&S1(n).position==="static")?e:n||CSt(t)||e}function Ele(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function O_(t,e,n){return w3(t,VL(e,n))}function NSt(t,e,n){var r=O_(t,e,n);return r>n?n:r}function YOe(){return{top:0,right:0,bottom:0,left:0}}function XOe(t){return Object.assign({},YOe(),t)}function QOe(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var SSt=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,XOe(typeof e!="number"?e:QOe(e,HT))};function jSt(t){var e,n=t.state,r=t.name,s=t.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,l=X0(n.placement),c=Ele(l),u=[hf,bp].indexOf(l)>=0,d=u?"height":"width";if(!(!a||!o)){var f=SSt(s.padding,n),x=_le(a),g=c==="y"?ff:hf,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],S=VT(a),T=S?c==="y"?S.clientHeight||0:S.clientWidth||0:0,I=v/2-C/2,L=f[g],F=T-x[d]-f[y],$=T/2-x[d]/2+I,O=O_(L,$,F),U=c;n.modifiersData[r]=(e={},e[U]=O,e.centerOffset=O-$,e)}}function ASt(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)||KOe(e.elements.popper,s)&&(e.elements.arrow=s))}const _St={name:"arrow",enabled:!0,phase:"main",fn:jSt,effect:ASt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function AS(t){return t.split("-")[1]}var ESt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function kSt(t,e){var n=t.x,r=t.y,s=e.devicePixelRatio||1;return{x:SS(n*s)/s||0,y:SS(r*s)/s||0}}function v1e(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 S=o.hasOwnProperty("x"),T=o.hasOwnProperty("y"),I=hf,L=ff,F=window;if(u){var $=VT(n),O="clientHeight",U="clientWidth";if($===sh(n)&&($=T2(n),S1($).position!=="static"&&l==="absolute"&&(O="scrollHeight",U="scrollWidth")),$=$,s===ff||(s===hf||s===bp)&&a===hE){L=gp;var Y=f&&$===F&&F.visualViewport?F.visualViewport.height:$[O];v-=Y-r.height,v*=c?1:-1}if(s===hf||(s===ff||s===gp)&&a===hE){I=bp;var re=f&&$===F&&F.visualViewport?F.visualViewport.width:$[U];g-=re-r.width,g*=c?1:-1}}var Q=Object.assign({position:l},u&&ESt),q=d===!0?kSt({x:g,y:v},sh(n)):{x:g,y:v};if(g=q.x,v=q.y,c){var te;return Object.assign({},Q,(te={},te[L]=T?"0":"",te[I]=S?"0":"",te.transform=(F.devicePixelRatio||1)<=1?"translate("+g+"px, "+v+"px)":"translate3d("+g+"px, "+v+"px, 0)",te))}return Object.assign({},Q,(e={},e[L]=T?v+"px":"",e[I]=S?g+"px":"",e.transform="",e))}function TSt(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:X0(e.placement),variation:AS(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,v1e(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,v1e(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 PSt={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:TSt,data:{}};var nF={passive:!0};function ISt(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,nF)}),l&&c.addEventListener("resize",n.update,nF),function(){a&&u.forEach(function(d){d.removeEventListener("scroll",n.update,nF)}),l&&c.removeEventListener("resize",n.update,nF)}}const FSt={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:ISt,data:{}};var OSt={left:"right",right:"left",bottom:"top",top:"bottom"};function xM(t){return t.replace(/left|right|bottom|top/g,function(e){return OSt[e]})}var MSt={start:"end",end:"start"};function w1e(t){return t.replace(/start|end/g,function(e){return MSt[e]})}function kle(t){var e=sh(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Tle(t){return jS(T2(t)).left+kle(t).scrollLeft}function LSt(t,e){var n=sh(t),r=T2(t),s=n.visualViewport,a=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){a=s.width,o=s.height;var u=GOe();(u||!u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:a,height:o,x:l+Tle(t),y:c}}function RSt(t){var e,n=T2(t),r=kle(t),s=(e=t.ownerDocument)==null?void 0:e.body,a=w3(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=w3(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),l=-r.scrollLeft+Tle(t),c=-r.scrollTop;return S1(s||n).direction==="rtl"&&(l+=w3(n.clientWidth,s?s.clientWidth:0)-a),{width:a,height:o,x:l,y:c}}function Ple(t){var e=S1(t),n=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function ZOe(t){return["html","body","#document"].indexOf(fx(t))>=0?t.ownerDocument.body:cp(t)&&Ple(t)?t:ZOe(oU(t))}function M_(t,e){var n;e===void 0&&(e=[]);var r=ZOe(t),s=r===((n=t.ownerDocument)==null?void 0:n.body),a=sh(r),o=s?[a].concat(a.visualViewport||[],Ple(r)?r:[]):r,l=e.concat(o);return s?l:l.concat(M_(oU(o)))}function zte(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function DSt(t,e){var n=jS(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 C1e(t,e,n){return e===VOe?zte(LSt(t,n)):n5(e)?DSt(e,n):zte(RSt(T2(t)))}function BSt(t){var e=M_(oU(t)),n=["absolute","fixed"].indexOf(S1(t).position)>=0,r=n&&cp(t)?VT(t):t;return n5(r)?e.filter(function(s){return n5(s)&&KOe(s,r)&&fx(s)!=="body"}):[]}function $St(t,e,n,r){var s=e==="clippingParents"?BSt(t):[].concat(e),a=[].concat(s,[n]),o=a[0],l=a.reduce(function(c,u){var d=C1e(t,u,r);return c.top=w3(d.top,c.top),c.right=VL(d.right,c.right),c.bottom=VL(d.bottom,c.bottom),c.left=w3(d.left,c.left),c},C1e(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 JOe(t){var e=t.reference,n=t.element,r=t.placement,s=r?X0(r):null,a=r?AS(r):null,o=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,c;switch(s){case ff: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 hf:c={x:e.x-n.width,y:l};break;default:c={x:e.x,y:e.y}}var u=s?Ele(s):null;if(u!=null){var d=u==="y"?"height":"width";switch(a){case NS:c[u]=c[u]-(e[d]/2-n[d]/2);break;case hE:c[u]=c[u]+(e[d]/2-n[d]/2);break}}return c}function pE(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?oSt:l,u=n.rootBoundary,d=u===void 0?VOe:u,f=n.elementContext,x=f===void 0?o7:f,g=n.altBoundary,y=g===void 0?!1:g,v=n.padding,C=v===void 0?0:v,S=XOe(typeof C!="number"?C:QOe(C,HT)),T=x===o7?lSt:o7,I=t.rects.popper,L=t.elements[y?T:x],F=$St(n5(L)?L:L.contextElement||T2(t.elements.popper),c,d,o),$=jS(t.elements.reference),O=JOe({reference:$,element:I,strategy:"absolute",placement:s}),U=zte(Object.assign({},I,O)),Y=x===o7?U:$,re={top:F.top-Y.top+S.top,bottom:Y.bottom-F.bottom+S.bottom,left:F.left-Y.left+S.left,right:Y.right-F.right+S.right},Q=t.modifiersData.offset;if(x===o7&&Q){var q=Q[s];Object.keys(re).forEach(function(te){var fe=[bp,gp].indexOf(te)>=0?1:-1,G=[ff,gp].indexOf(te)>=0?"y":"x";re[te]+=q[G]*fe})}return re}function USt(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?WOe:c,d=AS(r),f=d?l?b1e:b1e.filter(function(y){return AS(y)===d}):HT,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]=pE(t,{placement:v,boundary:s,rootBoundary:a,padding:o})[X0(v)],y},{});return Object.keys(g).sort(function(y,v){return g[y]-g[v]})}function zSt(t){if(X0(t)===jle)return[];var e=xM(t);return[w1e(t),e,w1e(e)]}function HSt(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,S=X0(C),T=S===C,I=c||(T||!y?[xM(C)]:zSt(C)),L=[C].concat(I).reduce(function(ge,ve){return ge.concat(X0(ve)===jle?USt(e,{placement:ve,boundary:d,rootBoundary:f,padding:u,flipVariations:y,allowedAutoPlacements:v}):ve)},[]),F=e.rects.reference,$=e.rects.popper,O=new Map,U=!0,Y=L[0],re=0;re<L.length;re++){var Q=L[re],q=X0(Q),te=AS(Q)===NS,fe=[ff,gp].indexOf(q)>=0,G=fe?"width":"height",ie=pE(e,{placement:Q,boundary:d,rootBoundary:f,altBoundary:x,padding:u}),oe=fe?te?bp:hf:te?gp:ff;F[G]>$[G]&&(oe=xM(oe));var K=xM(oe),H=[];if(a&&H.push(ie[q]<=0),l&&H.push(ie[oe]<=0,ie[K]<=0),H.every(function(ge){return ge})){Y=Q,U=!1;break}O.set(Q,H)}if(U)for(var ee=y?3:1,se=function(ve){var be=L.find(function(we){var je=O.get(we);if(je)return je.slice(0,ve).every(function(Fe){return Fe})});if(be)return Y=be,"break"},pe=ee;pe>0;pe--){var Se=se(pe);if(Se==="break")break}e.placement!==Y&&(e.modifiersData[r]._skip=!0,e.placement=Y,e.reset=!0)}}const VSt={name:"flip",enabled:!0,phase:"main",fn:HSt,requiresIfExists:["offset"],data:{_skip:!1}};function N1e(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 S1e(t){return[ff,bp,gp,hf].some(function(e){return t[e]>=0})}function WSt(t){var e=t.state,n=t.name,r=e.rects.reference,s=e.rects.popper,a=e.modifiersData.preventOverflow,o=pE(e,{elementContext:"reference"}),l=pE(e,{altBoundary:!0}),c=N1e(o,r),u=N1e(l,s,a),d=S1e(c),f=S1e(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 qSt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:WSt};function GSt(t,e,n){var r=X0(t),s=[hf,ff].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,[hf,bp].indexOf(r)>=0?{x:l,y:o}:{x:o,y:l}}function KSt(t){var e=t.state,n=t.options,r=t.name,s=n.offset,a=s===void 0?[0,0]:s,o=WOe.reduce(function(d,f){return d[f]=GSt(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 YSt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:KSt};function XSt(t){var e=t.state,n=t.name;e.modifiersData[n]=JOe({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const QSt={name:"popperOffsets",enabled:!0,phase:"read",fn:XSt,data:{}};function ZSt(t){return t==="x"?"y":"x"}function JSt(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=pE(e,{boundary:c,rootBoundary:u,padding:f,altBoundary:d}),S=X0(e.placement),T=AS(e.placement),I=!T,L=Ele(S),F=ZSt(L),$=e.modifiersData.popperOffsets,O=e.rects.reference,U=e.rects.popper,Y=typeof v=="function"?v(Object.assign({},e.rects,{placement:e.placement})):v,re=typeof Y=="number"?{mainAxis:Y,altAxis:Y}:Object.assign({mainAxis:0,altAxis:0},Y),Q=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if($){if(a){var te,fe=L==="y"?ff:hf,G=L==="y"?gp:bp,ie=L==="y"?"height":"width",oe=$[L],K=oe+C[fe],H=oe-C[G],ee=g?-U[ie]/2:0,se=T===NS?O[ie]:U[ie],pe=T===NS?-U[ie]:-O[ie],Se=e.elements.arrow,ge=g&&Se?_le(Se):{width:0,height:0},ve=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:YOe(),be=ve[fe],we=ve[G],je=O_(0,O[ie],ge[ie]),Fe=I?O[ie]/2-ee-je-be-re.mainAxis:se-je-be-re.mainAxis,Re=I?-O[ie]/2+ee+je+we+re.mainAxis:pe+je+we+re.mainAxis,Qe=e.elements.arrow&&VT(e.elements.arrow),Ye=Qe?L==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,dt=(te=Q==null?void 0:Q[L])!=null?te:0,st=oe+Fe-dt-Ye,at=oe+Re-dt,He=O_(g?VL(K,st):K,oe,g?w3(H,at):H);$[L]=He,q[L]=He-oe}if(l){var qe,vt=L==="x"?ff:hf,yt=L==="x"?gp:bp,Kt=$[F],jt=F==="y"?"height":"width",un=Kt+C[vt],vn=Kt-C[yt],Hn=[ff,hf].indexOf(S)!==-1,ln=(qe=Q==null?void 0:Q[F])!=null?qe:0,Nn=Hn?un:Kt-O[jt]-U[jt]-ln+re.altAxis,dn=Hn?Kt+O[jt]+U[jt]-ln-re.altAxis:vn,rt=g&&Hn?NSt(Nn,Kt,dn):O_(g?Nn:un,Kt,g?dn:vn);$[F]=rt,q[F]=rt-Kt}e.modifiersData[r]=q}}const ejt={name:"preventOverflow",enabled:!0,phase:"main",fn:JSt,requiresIfExists:["offset"]};function tjt(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function njt(t){return t===sh(t)||!cp(t)?kle(t):tjt(t)}function rjt(t){var e=t.getBoundingClientRect(),n=SS(e.width)/t.offsetWidth||1,r=SS(e.height)/t.offsetHeight||1;return n!==1||r!==1}function sjt(t,e,n){n===void 0&&(n=!1);var r=cp(e),s=cp(e)&&rjt(e),a=T2(e),o=jS(t,s,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((fx(e)!=="body"||Ple(a))&&(l=njt(e)),cp(e)?(c=jS(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):a&&(c.x=Tle(a))),{x:o.left+l.scrollLeft-c.x,y:o.top+l.scrollTop-c.y,width:o.width,height:o.height}}function ijt(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 ajt(t){var e=ijt(t);return bSt.reduce(function(n,r){return n.concat(e.filter(function(s){return s.phase===r}))},[])}function ojt(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function ljt(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 j1e={placement:"bottom",modifiers:[],strategy:"absolute"};function A1e(){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 cjt(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,s=e.defaultOptions,a=s===void 0?j1e:s;return function(l,c,u){u===void 0&&(u=a);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},j1e,a),modifiersData:{},elements:{reference:l,popper:c},attributes:{},styles:{}},f=[],x=!1,g={state:d,setOptions:function(S){var T=typeof S=="function"?S(d.options):S;v(),d.options=Object.assign({},a,d.options,T),d.scrollParents={reference:n5(l)?M_(l):l.contextElement?M_(l.contextElement):[],popper:M_(c)};var I=ajt(ljt([].concat(r,d.options.modifiers)));return d.orderedModifiers=I.filter(function(L){return L.enabled}),y(),g.update()},forceUpdate:function(){if(!x){var S=d.elements,T=S.reference,I=S.popper;if(A1e(T,I)){d.rects={reference:sjt(T,VT(I),d.options.strategy==="fixed"),popper:_le(I)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(re){return d.modifiersData[re.name]=Object.assign({},re.data)});for(var L=0;L<d.orderedModifiers.length;L++){if(d.reset===!0){d.reset=!1,L=-1;continue}var F=d.orderedModifiers[L],$=F.fn,O=F.options,U=O===void 0?{}:O,Y=F.name;typeof $=="function"&&(d=$({state:d,options:U,name:Y,instance:g})||d)}}}},update:ojt(function(){return new Promise(function(C){g.forceUpdate(),C(d)})}),destroy:function(){v(),x=!0}};if(!A1e(l,c))return g;g.setOptions(u).then(function(C){!x&&u.onFirstUpdate&&u.onFirstUpdate(C)});function y(){d.orderedModifiers.forEach(function(C){var S=C.name,T=C.options,I=T===void 0?{}:T,L=C.effect;if(typeof L=="function"){var F=L({state:d,name:S,instance:g,options:I}),$=function(){};f.push(F||$)}})}function v(){f.forEach(function(C){return C()}),f=[]}return g}}var ujt=[FSt,QSt,PSt,qOe,YSt,VSt,ejt,_St,qSt],djt=cjt({defaultModifiers:ujt}),fjt="tippy-box",eMe="tippy-content",hjt="tippy-backdrop",tMe="tippy-arrow",nMe="tippy-svg-arrow",Xv={passive:!0,capture:!0},rMe=function(){return document.body};function wW(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Ile(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function sMe(t,e){return typeof t=="function"?t.apply(void 0,e):t}function _1e(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function pjt(t){return t.split(/\s+/).filter(Boolean)}function YC(t){return[].concat(t)}function E1e(t,e){t.indexOf(e)===-1&&t.push(e)}function mjt(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function xjt(t){return t.split("-")[0]}function WL(t){return[].slice.call(t)}function k1e(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function L_(){return document.createElement("div")}function lU(t){return["Element","Fragment"].some(function(e){return Ile(t,e)})}function gjt(t){return Ile(t,"NodeList")}function iMe(t){return Ile(t,"MouseEvent")}function bjt(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function yjt(t){return lU(t)?[t]:gjt(t)?WL(t):Array.isArray(t)?t:WL(document.querySelectorAll(t))}function CW(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function T1e(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function aMe(t){var e,n=YC(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function vjt(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=xjt(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,S=a.left-n+g>c,T=n-a.right-y>c;return v||C||S||T})}function NW(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(s){t[r](s,n)})}function P1e(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 E0={isTouch:!1},I1e=0;function wjt(){E0.isTouch||(E0.isTouch=!0,window.performance&&document.addEventListener("mousemove",oMe))}function oMe(){var t=performance.now();t-I1e<20&&(E0.isTouch=!1,document.removeEventListener("mousemove",oMe)),I1e=t}function Cjt(){var t=document.activeElement;if(bjt(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function Njt(){document.addEventListener("touchstart",wjt,Xv),window.addEventListener("blur",Cjt)}var Sjt=typeof window<"u"&&typeof document<"u",jjt=Sjt?!!window.msCrypto:!1,Ajt={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},_jt={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},mm=Object.assign({appendTo:rMe,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},Ajt,_jt),Ejt=Object.keys(mm),kjt=function(e){var n=Object.keys(e);n.forEach(function(r){mm[r]=e[r]})};function lMe(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 Tjt(t,e){var n=e?Object.keys(lMe(Object.assign({},mm,{plugins:e}))):Ejt,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 F1e(t,e){var n=Object.assign({},e,{content:sMe(e.content,[t])},e.ignoreAttributes?{}:Tjt(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 Pjt=function(){return"innerHTML"};function Hte(t,e){t[Pjt()]=e}function O1e(t){var e=L_();return t===!0?e.className=tMe:(e.className=nMe,lU(t)?e.appendChild(t):Hte(e,t)),e}function M1e(t,e){lU(e.content)?(Hte(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Hte(t,e.content):t.textContent=e.content)}function Vte(t){var e=t.firstElementChild,n=WL(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(eMe)}),arrow:n.find(function(r){return r.classList.contains(tMe)||r.classList.contains(nMe)}),backdrop:n.find(function(r){return r.classList.contains(hjt)})}}function cMe(t){var e=L_(),n=L_();n.className=fjt,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=L_();r.className=eMe,r.setAttribute("data-state","hidden"),M1e(r,t.props),e.appendChild(n),n.appendChild(r),s(t.props,t.props);function s(a,o){var l=Vte(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)&&M1e(u,t.props),o.arrow?d?a.arrow!==o.arrow&&(c.removeChild(d),c.appendChild(O1e(o.arrow))):c.appendChild(O1e(o.arrow)):d&&c.removeChild(d)}return{popper:e,onUpdate:s}}cMe.$$tippy=!0;var Ijt=1,rF=[],SW=[];function Fjt(t,e){var n=F1e(t,Object.assign({},mm,lMe(k1e(e)))),r,s,a,o=!1,l=!1,c=!1,u=!1,d,f,x,g=[],y=_1e(st,n.interactiveDebounce),v,C=Ijt++,S=null,T=mjt(n.plugins),I={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},L={id:C,reference:t,popper:L_(),popperInstance:S,props:n,state:I,plugins:T,clearDelayTimeouts:Nn,setProps:dn,setContent:rt,show:nt,hide:Ut,hideWithInteractivity:wn,enable:Hn,disable:ln,unmount:Jt,destroy:Vt};if(!n.render)return L;var F=n.render(L),$=F.popper,O=F.onUpdate;$.setAttribute("data-tippy-root",""),$.id="tippy-"+L.id,L.popper=$,t._tippy=L,$._tippy=L;var U=T.map(function(xt){return xt.fn(L)}),Y=t.hasAttribute("aria-expanded");return Qe(),ee(),oe(),K("onCreate",[L]),n.showOnCreate&&un(),$.addEventListener("mouseenter",function(){L.props.interactive&&L.state.isVisible&&L.clearDelayTimeouts()}),$.addEventListener("mouseleave",function(){L.props.interactive&&L.props.trigger.indexOf("mouseenter")>=0&&fe().addEventListener("mousemove",y)}),L;function re(){var xt=L.props.touch;return Array.isArray(xt)?xt:[xt,0]}function Q(){return re()[0]==="hold"}function q(){var xt;return!!((xt=L.props.render)!=null&&xt.$$tippy)}function te(){return v||t}function fe(){var xt=te().parentNode;return xt?aMe(xt):document}function G(){return Vte($)}function ie(xt){return L.state.isMounted&&!L.state.isVisible||E0.isTouch||d&&d.type==="focus"?0:wW(L.props.delay,xt?0:1,mm.delay)}function oe(xt){xt===void 0&&(xt=!1),$.style.pointerEvents=L.props.interactive&&!xt?"":"none",$.style.zIndex=""+L.props.zIndex}function K(xt,We,Pt){if(Pt===void 0&&(Pt=!0),U.forEach(function(ct){ct[xt]&&ct[xt].apply(ct,We)}),Pt){var Ke;(Ke=L.props)[xt].apply(Ke,We)}}function H(){var xt=L.props.aria;if(xt.content){var We="aria-"+xt.content,Pt=$.id,Ke=YC(L.props.triggerTarget||t);Ke.forEach(function(ct){var Nt=ct.getAttribute(We);if(L.state.isVisible)ct.setAttribute(We,Nt?Nt+" "+Pt:Pt);else{var Ht=Nt&&Nt.replace(Pt,"").trim();Ht?ct.setAttribute(We,Ht):ct.removeAttribute(We)}})}}function ee(){if(!(Y||!L.props.aria.expanded)){var xt=YC(L.props.triggerTarget||t);xt.forEach(function(We){L.props.interactive?We.setAttribute("aria-expanded",L.state.isVisible&&We===te()?"true":"false"):We.removeAttribute("aria-expanded")})}}function se(){fe().removeEventListener("mousemove",y),rF=rF.filter(function(xt){return xt!==y})}function pe(xt){if(!(E0.isTouch&&(c||xt.type==="mousedown"))){var We=xt.composedPath&&xt.composedPath()[0]||xt.target;if(!(L.props.interactive&&P1e($,We))){if(YC(L.props.triggerTarget||t).some(function(Pt){return P1e(Pt,We)})){if(E0.isTouch||L.state.isVisible&&L.props.trigger.indexOf("click")>=0)return}else K("onClickOutside",[L,xt]);L.props.hideOnClick===!0&&(L.clearDelayTimeouts(),L.hide(),l=!0,setTimeout(function(){l=!1}),L.state.isMounted||be())}}}function Se(){c=!0}function ge(){c=!1}function ve(){var xt=fe();xt.addEventListener("mousedown",pe,!0),xt.addEventListener("touchend",pe,Xv),xt.addEventListener("touchstart",ge,Xv),xt.addEventListener("touchmove",Se,Xv)}function be(){var xt=fe();xt.removeEventListener("mousedown",pe,!0),xt.removeEventListener("touchend",pe,Xv),xt.removeEventListener("touchstart",ge,Xv),xt.removeEventListener("touchmove",Se,Xv)}function we(xt,We){Fe(xt,function(){!L.state.isVisible&&$.parentNode&&$.parentNode.contains($)&&We()})}function je(xt,We){Fe(xt,We)}function Fe(xt,We){var Pt=G().box;function Ke(ct){ct.target===Pt&&(NW(Pt,"remove",Ke),We())}if(xt===0)return We();NW(Pt,"remove",f),NW(Pt,"add",Ke),f=Ke}function Re(xt,We,Pt){Pt===void 0&&(Pt=!1);var Ke=YC(L.props.triggerTarget||t);Ke.forEach(function(ct){ct.addEventListener(xt,We,Pt),g.push({node:ct,eventType:xt,handler:We,options:Pt})})}function Qe(){Q()&&(Re("touchstart",dt,{passive:!0}),Re("touchend",at,{passive:!0})),pjt(L.props.trigger).forEach(function(xt){if(xt!=="manual")switch(Re(xt,dt),xt){case"mouseenter":Re("mouseleave",at);break;case"focus":Re(jjt?"focusout":"blur",He);break;case"focusin":Re("focusout",He);break}})}function Ye(){g.forEach(function(xt){var We=xt.node,Pt=xt.eventType,Ke=xt.handler,ct=xt.options;We.removeEventListener(Pt,Ke,ct)}),g=[]}function dt(xt){var We,Pt=!1;if(!(!L.state.isEnabled||qe(xt)||l)){var Ke=((We=d)==null?void 0:We.type)==="focus";d=xt,v=xt.currentTarget,ee(),!L.state.isVisible&&iMe(xt)&&rF.forEach(function(ct){return ct(xt)}),xt.type==="click"&&(L.props.trigger.indexOf("mouseenter")<0||o)&&L.props.hideOnClick!==!1&&L.state.isVisible?Pt=!0:un(xt),xt.type==="click"&&(o=!Pt),Pt&&!Ke&&vn(xt)}}function st(xt){var We=xt.target,Pt=te().contains(We)||$.contains(We);if(!(xt.type==="mousemove"&&Pt)){var Ke=jt().concat($).map(function(ct){var Nt,Ht=ct._tippy,Rt=(Nt=Ht.popperInstance)==null?void 0:Nt.state;return Rt?{popperRect:ct.getBoundingClientRect(),popperState:Rt,props:n}:null}).filter(Boolean);vjt(Ke,xt)&&(se(),vn(xt))}}function at(xt){var We=qe(xt)||L.props.trigger.indexOf("click")>=0&&o;if(!We){if(L.props.interactive){L.hideWithInteractivity(xt);return}vn(xt)}}function He(xt){L.props.trigger.indexOf("focusin")<0&&xt.target!==te()||L.props.interactive&&xt.relatedTarget&&$.contains(xt.relatedTarget)||vn(xt)}function qe(xt){return E0.isTouch?Q()!==xt.type.indexOf("touch")>=0:!1}function vt(){yt();var xt=L.props,We=xt.popperOptions,Pt=xt.placement,Ke=xt.offset,ct=xt.getReferenceClientRect,Nt=xt.moveTransition,Ht=q()?Vte($).arrow:null,Rt=ct?{getBoundingClientRect:ct,contextElement:ct.contextElement||te()}:t,hn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(En){var Rn=En.state;if(q()){var Mn=G(),Yn=Mn.box;["placement","reference-hidden","escaped"].forEach(function(Zn){Zn==="placement"?Yn.setAttribute("data-placement",Rn.placement):Rn.attributes.popper["data-popper-"+Zn]?Yn.setAttribute("data-"+Zn,""):Yn.removeAttribute("data-"+Zn)}),Rn.attributes.popper={}}}},yn=[{name:"offset",options:{offset:Ke}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Nt}},hn];q()&&Ht&&yn.push({name:"arrow",options:{element:Ht,padding:3}}),yn.push.apply(yn,(We==null?void 0:We.modifiers)||[]),L.popperInstance=djt(Rt,$,Object.assign({},We,{placement:Pt,onFirstUpdate:x,modifiers:yn}))}function yt(){L.popperInstance&&(L.popperInstance.destroy(),L.popperInstance=null)}function Kt(){var xt=L.props.appendTo,We,Pt=te();L.props.interactive&&xt===rMe||xt==="parent"?We=Pt.parentNode:We=sMe(xt,[Pt]),We.contains($)||We.appendChild($),L.state.isMounted=!0,vt()}function jt(){return WL($.querySelectorAll("[data-tippy-root]"))}function un(xt){L.clearDelayTimeouts(),xt&&K("onTrigger",[L,xt]),ve();var We=ie(!0),Pt=re(),Ke=Pt[0],ct=Pt[1];E0.isTouch&&Ke==="hold"&&ct&&(We=ct),We?r=setTimeout(function(){L.show()},We):L.show()}function vn(xt){if(L.clearDelayTimeouts(),K("onUntrigger",[L,xt]),!L.state.isVisible){be();return}if(!(L.props.trigger.indexOf("mouseenter")>=0&&L.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(xt.type)>=0&&o)){var We=ie(!1);We?s=setTimeout(function(){L.state.isVisible&&L.hide()},We):a=requestAnimationFrame(function(){L.hide()})}}function Hn(){L.state.isEnabled=!0}function ln(){L.hide(),L.state.isEnabled=!1}function Nn(){clearTimeout(r),clearTimeout(s),cancelAnimationFrame(a)}function dn(xt){if(!L.state.isDestroyed){K("onBeforeUpdate",[L,xt]),Ye();var We=L.props,Pt=F1e(t,Object.assign({},We,k1e(xt),{ignoreAttributes:!0}));L.props=Pt,Qe(),We.interactiveDebounce!==Pt.interactiveDebounce&&(se(),y=_1e(st,Pt.interactiveDebounce)),We.triggerTarget&&!Pt.triggerTarget?YC(We.triggerTarget).forEach(function(Ke){Ke.removeAttribute("aria-expanded")}):Pt.triggerTarget&&t.removeAttribute("aria-expanded"),ee(),oe(),O&&O(We,Pt),L.popperInstance&&(vt(),jt().forEach(function(Ke){requestAnimationFrame(Ke._tippy.popperInstance.forceUpdate)})),K("onAfterUpdate",[L,xt])}}function rt(xt){L.setProps({content:xt})}function nt(){var xt=L.state.isVisible,We=L.state.isDestroyed,Pt=!L.state.isEnabled,Ke=E0.isTouch&&!L.props.touch,ct=wW(L.props.duration,0,mm.duration);if(!(xt||We||Pt||Ke)&&!te().hasAttribute("disabled")&&(K("onShow",[L],!1),L.props.onShow(L)!==!1)){if(L.state.isVisible=!0,q()&&($.style.visibility="visible"),oe(),ve(),L.state.isMounted||($.style.transition="none"),q()){var Nt=G(),Ht=Nt.box,Rt=Nt.content;CW([Ht,Rt],0)}x=function(){var yn;if(!(!L.state.isVisible||u)){if(u=!0,$.offsetHeight,$.style.transition=L.props.moveTransition,q()&&L.props.animation){var Cn=G(),En=Cn.box,Rn=Cn.content;CW([En,Rn],ct),T1e([En,Rn],"visible")}H(),ee(),E1e(SW,L),(yn=L.popperInstance)==null||yn.forceUpdate(),K("onMount",[L]),L.props.animation&&q()&&je(ct,function(){L.state.isShown=!0,K("onShown",[L])})}},Kt()}}function Ut(){var xt=!L.state.isVisible,We=L.state.isDestroyed,Pt=!L.state.isEnabled,Ke=wW(L.props.duration,1,mm.duration);if(!(xt||We||Pt)&&(K("onHide",[L],!1),L.props.onHide(L)!==!1)){if(L.state.isVisible=!1,L.state.isShown=!1,u=!1,o=!1,q()&&($.style.visibility="hidden"),se(),be(),oe(!0),q()){var ct=G(),Nt=ct.box,Ht=ct.content;L.props.animation&&(CW([Nt,Ht],Ke),T1e([Nt,Ht],"hidden"))}H(),ee(),L.props.animation?q()&&we(Ke,L.unmount):L.unmount()}}function wn(xt){fe().addEventListener("mousemove",y),E1e(rF,y),y(xt)}function Jt(){L.state.isVisible&&L.hide(),L.state.isMounted&&(yt(),jt().forEach(function(xt){xt._tippy.unmount()}),$.parentNode&&$.parentNode.removeChild($),SW=SW.filter(function(xt){return xt!==L}),L.state.isMounted=!1,K("onHidden",[L]))}function Vt(){L.state.isDestroyed||(L.clearDelayTimeouts(),L.unmount(),Ye(),delete t._tippy,L.state.isDestroyed=!0,K("onDestroy",[L]))}}function m8(t,e){e===void 0&&(e={});var n=mm.plugins.concat(e.plugins||[]);Njt();var r=Object.assign({},e,{plugins:n}),s=yjt(t),a=s.reduce(function(o,l){var c=l&&Fjt(l,r);return c&&o.push(c),o},[]);return lU(t)?a[0]:a}m8.defaultProps=mm;m8.setDefaultProps=kjt;m8.currentInput=E0;Object.assign({},qOe,{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 Wte={clientX:0,clientY:0},sF=[];function uMe(t){var e=t.clientX,n=t.clientY;Wte={clientX:e,clientY:n}}function Ojt(t){t.addEventListener("mousemove",uMe)}function Mjt(t){t.removeEventListener("mousemove",uMe)}var dMe={name:"followCursor",defaultValue:!1,fn:function(e){var n=e.reference,r=aMe(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,S=e.props.followCursor,T=v.clientX,I=v.clientY,L=n.getBoundingClientRect(),F=T-L.left,$=I-L.top;(C||!e.props.interactive)&&e.setProps({getReferenceClientRect:function(){var U=n.getBoundingClientRect(),Y=T,re=I;S==="initial"&&(Y=U.left+F,re=U.top+$);var Q=S==="horizontal"?U.top:re,q=S==="vertical"?U.right:Y,te=S==="horizontal"?U.bottom:re,fe=S==="vertical"?U.left:Y;return{width:q-fe,height:te-Q,top:Q,right:q,bottom:te,left:fe}}})}function g(){e.props.followCursor&&(sF.push({instance:e,doc:r}),Ojt(r))}function y(){sF=sF.filter(function(v){return v.instance!==e}),sF.filter(function(v){return v.doc===r}).length===0&&Mjt(r)}return{onCreate:g,onDestroy:y,onBeforeUpdate:function(){l=e.props},onAfterUpdate:function(C,S){var T=S.followCursor;s||T!==void 0&&l.followCursor!==T&&(y(),T?(g(),e.state.isMounted&&!a&&!c()&&u()):(d(),f()))},onMount:function(){e.props.followCursor&&!a&&(o&&(x(Wte),o=!1),c()||u())},onTrigger:function(C,S){iMe(S)&&(Wte={clientX:S.clientX,clientY:S.clientY}),a=S.type==="focus"},onHidden:function(){e.props.followCursor&&(f(),d(),o=!0)}}}};m8.setDefaultProps({render:cMe});function as({content:t,children:e,align:n="center"}){const r=h.useRef(null),s=h.useRef(null),a=h.useRef(null),o=h.useRef(null);return h.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)})}},[]),h.useEffect(()=>{if(!r.current)return;const l=typeof t!="string";l&&(s.current=document.createElement("div"),a.current=die.createRoot(s.current),a.current.render(t));const c=m8(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:[dMe],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,()=>{c.destroy(),a.current&&Promise.resolve().then(()=>{var u;(u=a.current)==null||u.unmount()})}},[t]),h.isValidElement(e)?h.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 j1;(function(t){t.HEX="BYTES_HEX",t.UINT8ARRAY="BYTES_UINT8ARRAY"})(j1||(j1={}));const yd={number:ap.BIGINT,bytes:j1.HEX},yi={number:ap.HEX,bytes:j1.HEX};var Ug;(function(t){t.EARLIEST="earliest",t.LATEST="latest",t.PENDING="pending",t.SAFE="safe",t.FINALIZED="finalized",t.COMMITTED="committed"})(Ug||(Ug={}));var R_;(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"})(R_||(R_={}));const Fle=Object.getPrototypeOf(Uint8Array);var L1e=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 R1e=Symbol.for("web3/base-provider");class WT{static isWeb3Provider(e){return e instanceof WT||!!(e&&e[R1e])}get[R1e](){return!0}send(e,n){this.request(e).then(r=>{n(null,r)}).catch(r=>{n(r)})}sendAsync(e){return L1e(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 L1e(this,void 0,void 0,function*(){return(yield n(s)).result})},e.asEIP1193Provider=void 0,e}}class Ljt extends Array{constructor(e){super(),this._accountProvider=e}}const Rjt=100,Djt=101,Bjt=201,$jt=202,Ujt=203,zjt=204,Hjt=205,Vjt=206,Wjt=207,qjt=208,Gjt=300,Kjt=301,Yjt=310,Xjt=311,Qjt=400,Zjt=402,Jjt=405,e8t=407,t8t=408,n8t=410,r8t=411,s8t=412,i8t=413,a8t=414,o8t=415,l8t=416,c8t=417,u8t=418,d8t=419,f8t=420,h8t=421,p8t=422,m8t=423,x8t=424,g8t=425,b8t=426,y8t=427,v8t=428,w8t=429,C8t=430,N8t=431,S8t=432,j8t=433,A8t=434,_8t=435,E8t=436,k8t=437,T8t=438,P8t=439,I8t=440,F8t=441,O8t=500,M8t=503,L8t=505,R8t=506,D8t=507,B8t=600,$8t=602,U8t=603,z8t=604,H8t=701,V8t=702,W8t=703,q8t=704,G8t=705,K8t=706,Y8t=707,X8t=709,Q8t=801,Z8t=802,J8t=4001,eAt=4100,tAt=4200,nAt=4900,rAt=4901,sAt=902,iAt=903,aAt=1001,oAt=1002,lAt=1003,cAt=1004,uAt=1005,dAt=1006,fAt=1008,hAt=1009,pAt=1010,mAt=1011,xAt=1012,gAt=1014,bAt=1015,yAt=1100,fMe=1101,vAt=1200,qL=-32700,GL=-32600,KL=-32601,YL=-32602,XL=-32603,QL=-32e3,ZL=-32001,JL=-32002,eR=-32003,tR=-32004,nR=-32005,rR=-32006;class xi extends Error{get innerError(){return this.cause instanceof D_?this.cause.errors:this.cause}set innerError(e){Array.isArray(e)?this.cause=new D_(e):this.cause=e}constructor(e,n){super(e),Array.isArray(n)?this.cause=new D_(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 D_ extends xi{constructor(e){super(`Multiple errors occurred: [${e.map(n=>n.message).join("], [")}]`),this.code=qjt,this.errors=e}}class Vi extends xi{constructor(e,n){super(`Invalid value given "${xi.convertToString(e,!0)}". Error: ${n}.`),this.name=this.constructor.name}}class D1e extends xi{constructor(){super("Private key must be 32 bytes."),this.code=H8t}}class wAt extends xi{constructor(){super("Invalid Private Key, Not a valid string or uint8Array"),this.code=V8t}}class CAt extends xi{constructor(e){super(`"${e}"`),this.code=Z8t}}class hMe extends xi{constructor(){super("Invalid key derivation function"),this.code=W8t}}class NAt extends xi{constructor(){super("Key derivation failed - possibly wrong password"),this.code=q8t}}class SAt extends xi{constructor(){super("Unsupported key store version"),this.code=G8t}}class jAt extends xi{constructor(){super("Password cannot be empty"),this.code=K8t}}class AAt extends xi{constructor(){super("Initialization vector must be 16 bytes"),this.code=Y8t}}class _At extends xi{constructor(){super("c > 1000, pbkdf2 is less secure with less iterations"),this.code=X8t}}class qT extends xi{constructor(e,n){super(e),this.code=O8t,n&&(this.errorCode=n.code,this.errorReason=n.reason)}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{errorCode:this.errorCode,errorReason:this.errorReason})}}class qte extends qT{constructor(e){super("Connection not open",e),this.code=M8t}}class EAt extends qT{constructor(e){super(`Maximum number of reconnect attempts reached! (${e})`),this.code=L8t}}class kAt extends qT{constructor(){super("CONNECTION ERROR: Provider started to reconnect before the response got received!"),this.code=R8t}}class TAt extends qT{constructor(e){super(`Request already sent with following id: ${e}`),this.code=D8t}}class vd extends xi{constructor(e,n){super(e),this.code=Gjt,this.receipt=n}}class B1e extends xi{constructor(e,n){super(`The resolver at ${e} does not implement requested method: "${n}".`),this.address=e,this.name=n,this.code=Kjt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{address:this.address,name:this.name})}}class cU extends vd{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 cU(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 C3 extends vd{constructor(e){super("Error happened while trying to execute a function inside a smart contract"),this.code=Yjt,this.cause=new cU(e)}}class PAt extends Vi{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=Xjt}}class IAt extends xi{constructor(e){super(`ENS is not supported on network ${e}`),this.code=sAt}}class FAt extends xi{constructor(){super("Network not synced"),this.code=iAt}}class $1e extends xi{constructor(e){super(`Invalid parameters passed. "${typeof e<"u"?e:""}"`),this.hint=e,this.code=Wjt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{hint:this.hint})}}class Gte extends xi{constructor(){super(...arguments),this.code=Bjt}}class Qx extends xi{constructor(){super("The method you're trying to call is not implemented."),this.code=$jt}}class pMe extends xi{constructor(){super(...arguments),this.code=Ujt}}class OAt extends xi{constructor(){super(...arguments),this.code=zjt}}class Qi extends xi{constructor(e,n){super(e),this.code=Hjt,this.props=n??{}}}class MAt extends xi{constructor(e){super(`A plugin with the namespace: ${e} has already been registered.`),this.code=Vjt}}class gM extends xi{constructor(){super(...arguments),this.code=B8t}}class Kte extends xi{constructor(e){super(`Client URL "${e}" is invalid.`),this.code=$8t}}class yg extends xi{constructor(){super(...arguments),this.code=U8t}}class LAt extends xi{constructor(){super(...arguments),this.code=z8t}}class RAt extends Vi{constructor(){super(...arguments),this.code=Q8t}}class Ole extends xi{constructor(e,n){super(e),this.receipt=n,this.code=Qjt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{receipt:this.receipt})}}class sR extends xi{constructor(e,n,r,s){super(`Transaction has been reverted by the EVM${r===void 0?"":`:
${xi.convertToString(r)}`}`),this.reason=e,this.signature=n,this.receipt=r,this.data=s,this.code=Zjt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reason:this.reason,signature:this.signature,receipt:this.receipt,data:this.data})}}class mMe extends sR{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=T8t}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 xMe extends Ole{constructor(e){super(`Transaction has been reverted by the EVM${e===void 0?"":`:
${xi.convertToString(e)}`}`,e),this.code=Jjt}}class DAt extends Ole{constructor(){super("Raw transaction undefined"),this.code=e8t}}class U1e extends Ole{constructor(){super("Transaction not found"),this.code=C8t}}class BAt extends Vi{constructor(e){super(e,"invalid transaction with invalid sender"),this.code=t8t}}class $At extends Vi{constructor(e){super(e,"invalid transaction with invalid receiver"),this.code=k8t}}class UAt extends Vi{constructor(){super("MissingCustomChainError","If tx.common is provided it must have tx.common.customChain"),this.code=n8t}}class zAt extends Vi{constructor(){super("MissingCustomChainIdError","If tx.common is provided it must have tx.common.customChain and tx.common.customChain.chainId"),this.code=r8t}}class HAt extends Vi{constructor(e){super(JSON.stringify(e),"Chain Id doesnt match in tx.chainId tx.common.customChain.chainId"),this.code=s8t}}class VAt extends Vi{constructor(e){super(JSON.stringify(e),"Chain doesnt match in tx.chain tx.common.basechain"),this.code=_8t}}class WAt extends Vi{constructor(e){super(JSON.stringify(e),"hardfork doesnt match in tx.hardfork tx.common.hardfork"),this.code=E8t}}class qAt extends Vi{constructor(){super("CommonOrChainAndHardforkError","Please provide the common object or the chain and hardfork property but not all together."),this.code=i8t}}class GAt extends Vi{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=a8t}}class KAt extends xi{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=I8t}}class YAt extends Vi{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=o8t,this.cause=new KAt}}class XAt extends xi{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=F8t}}class QAt extends Vi{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=A8t,this.cause=new XAt}}class ZAt extends Vi{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=l8t}}class JAt extends Vi{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=c8t}}class e7t extends Vi{constructor(e){super(e,"eip-1559 transactions don't support gasPrice"),this.code=u8t}}class gMe extends Vi{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=d8t}}class t7t extends Vi{constructor(e){super(e,"invalid transaction object"),this.code=f8t}}class n7t extends Vi{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=h8t}}class r7t extends Vi{constructor(){super("UnableToPopulateNonceError","unable to populate nonce, no from address available"),this.code=p8t}}class s7t extends Vi{constructor(){super("Eip1559NotSupportedError","Network doesn't support eip-1559"),this.code=m8t}}class z1e extends Vi{constructor(e){super(e,"unsupported transaction type"),this.code=x8t}}class bMe extends Vi{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=g8t}}class i7t extends xi{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=N8t}}function yMe(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 vMe extends xi{constructor(e){super(`Transaction was not mined within ${e.numberOfSeconds} seconds. ${yMe(e.transactionHash)}`),this.code=b8t}}class wMe extends xi{constructor(e){super(`Transaction started at ${e.starterBlockNumber} but was not mined within ${e.numberOfBlocks} blocks. ${yMe(e.transactionHash)}`),this.code=S8t}}class a7t extends Vi{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=y8t}}class o7t extends Vi{constructor(e){super(`receipt: ${JSON.stringify(e.receipt)}`,"Receipt missing block number"),this.code=v8t}}class Yte extends xi{constructor(e){super(`Invalid signature. "${e}"`),this.code=j8t}}class H1e extends Vi{constructor(){super("LocalWalletNotAvailableError","Attempted to index account in local wallet, but no wallet is available"),this.code=w8t}}class l7t extends xi{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=P8t}}class L4 extends Vi{constructor(e){super(e,"can not parse as byte data"),this.code=oAt}}class Mle extends Vi{constructor(e){super(e,"can not parse as number data"),this.code=lAt}}class Lle extends Vi{constructor(e){super(e,"invalid ethereum address"),this.code=uAt}}class c7t extends Vi{constructor(e){super(e,"not a valid string"),this.code=aAt}}class CMe extends Vi{constructor(e){super(e,"invalid unit"),this.code=cAt}}class NMe extends Vi{constructor(e){super(e,"not a valid unit. Must be a positive integer"),this.code=bAt}}class u7t extends Vi{constructor(e){super(e,"can not be converted to hex"),this.code=dAt}}class SMe extends Vi{constructor(e){super(e,"value greater than the nibble width"),this.code=gAt}}class Rle extends Vi{constructor(e){super(e,"not a valid boolean."),this.code=fAt}}class d7t extends Vi{constructor(e){super(e,"not a valid unsigned integer."),this.code=hAt}}class V1e extends Vi{constructor(e){super(e,"invalid size given."),this.code=pAt}}class W1e extends Vi{constructor(e){super(e,"value is larger than size."),this.code=mAt}}class f7t extends Vi{constructor(e){super(e,"invalid string given"),this.code=xAt}}const h7t=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"),q1e=t=>h7t(t)?t.error.message:"";class F0 extends xi{constructor(e,n,r,s){var a;super(n??`Returned error: ${Array.isArray(e)?e.map(l=>q1e(l)).join(","):q1e(e)}`),this.code=Rjt,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 D_(o):this.cause=o}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{data:this.data,request:this.request,statusCode:this.statusCode})}}class uU extends F0{constructor(e,n){super(e,void 0,n),this.code=Djt;let r;"error"in e?r=e.error:e instanceof Array&&(r=e.map(s=>s.error)),Array.isArray(r)?this.cause=new D_(r):this.cause=r}}class G1e extends xi{constructor(e,n){super(`Web3Config hardfork doesnt match in defaultHardfork ${e} and common.hardfork ${n}`),this.code=fMe}}class K1e extends xi{constructor(e,n){super(`Web3Config chain doesnt match in defaultHardfork ${e} and common.hardfork ${n}`),this.code=fMe}}const jMe="An Rpc error has occured with a code of *code*",Du={[qL]:{message:"Parse error",description:"Invalid JSON"},[GL]:{message:"Invalid request",description:"JSON is not a valid request object "},[KL]:{message:"Method not found",description:"Method does not exist "},[YL]:{message:"Invalid params",description:"Invalid method parameters"},[XL]:{message:"Internal error",description:"Internal JSON-RPC error"},[QL]:{message:"Invalid input",description:"Missing or invalid parameters"},[ZL]:{message:"Resource not found",description:"Requested resource not found"},[JL]:{message:"Resource unavailable",description:"Requested resource not available"},[eR]:{message:"Transaction rejected",description:"Transaction creation failed"},[tR]:{message:"Method not supported",description:"Method is not implemented"},[nR]:{message:"Limit exceeded",description:"Request exceeds defined limit"},[rR]:{message:"JSON-RPC version not supported",description:"Version of JSON-RPC protocol is not supported"},[J8t]:{name:"User Rejected Request",message:"The user rejected the request."},[eAt]:{name:"Unauthorized",message:"The requested method and/or account has not been authorized by the user."},[tAt]:{name:"Unsupported Method",message:"The Provider does not support the requested method."},[nAt]:{name:"Disconnected",message:"The Provider is disconnected from all chains."},[rAt]:{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 xi{constructor(e,n){super(n??jMe.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 p7t extends xi{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:jMe.replace("*code*",(o=e==null?void 0:e.toString())!==null&&o!==void 0?o:'""'))}this.code=e,this.data=n}}class m7t extends ch{constructor(e){super(e,Du[qL].message),this.code=qL}}class x7t extends ch{constructor(e){super(e,Du[GL].message),this.code=GL}}class g7t extends ch{constructor(e){super(e,Du[KL].message),this.code=KL}}class b7t extends ch{constructor(e){super(e,Du[YL].message),this.code=YL}}class y7t extends ch{constructor(e){super(e,Du[XL].message),this.code=XL}}class v7t extends ch{constructor(e){super(e,Du[QL].message),this.code=QL}}class w7t extends ch{constructor(e){super(e,Du[tR].message),this.code=tR}}class C7t extends ch{constructor(e){super(e,Du[JL].message),this.code=JL}}class N7t extends ch{constructor(e){super(e,Du[ZL].message),this.code=ZL}}class S7t extends ch{constructor(e){super(e,Du[rR].message),this.code=rR}}class j7t extends ch{constructor(e){super(e,Du[eR].message),this.code=eR}}class A7t extends ch{constructor(e){super(e,Du[nR].message),this.code=nR}}const Sd=new Map;Sd.set(qL,{error:m7t});Sd.set(GL,{error:x7t});Sd.set(KL,{error:g7t});Sd.set(YL,{error:b7t});Sd.set(XL,{error:y7t});Sd.set(QL,{error:v7t});Sd.set(tR,{error:w7t});Sd.set(JL,{error:C7t});Sd.set(eR,{error:j7t});Sd.set(ZL,{error:N7t});Sd.set(rR,{error:S7t});Sd.set(nR,{error:A7t});class _7t extends xi{constructor(e){super(`Format for the type ${e} is unsupported`),this.type=e,this.code=vAt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type})}}function tf(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function E7t(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function k7t(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function x8(t,...e){if(!k7t(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 Dle(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");tf(t.outputLen),tf(t.blockLen)}function r5(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 Ble(t,e){x8(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const AMe={number:tf,bool:E7t,bytes:x8,hash:Dle,exists:r5,output:Ble},iF=BigInt(2**32-1),Y1e=BigInt(32);function T7t(t,e=!1){return e?{h:Number(t&iF),l:Number(t>>Y1e&iF)}:{h:Number(t>>Y1e&iF)|0,l:Number(t&iF)|0}}function P7t(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}=T7t(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const I7t=(t,e,n)=>t<<n|e>>>32-n,F7t=(t,e,n)=>e<<n|t>>>32-n,O7t=(t,e,n)=>e<<n-32|t>>>64-n,M7t=(t,e,n)=>t<<n-32|e>>>64-n,bM=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const yM=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),vM=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),a0=(t,e)=>t<<32-e|t>>>e,wa=(t,e)=>t<<e|t>>>32-e>>>0,iR=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,L7t=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function aR(t){for(let e=0;e<t.length;e++)t[e]=L7t(t[e])}function _S(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function ES(t){return typeof t=="string"&&(t=_S(t)),x8(t),t}function oR(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];x8(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 $le{clone(){return this._cloneInto()}}const R7t={}.toString;function _Me(t,e){if(e!==void 0&&R7t.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function EMe(t){const e=r=>t().update(ES(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function kMe(t=32){if(bM&&typeof bM.getRandomValues=="function")return bM.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}const TMe=[],PMe=[],IMe=[],D7t=BigInt(0),l7=BigInt(1),B7t=BigInt(2),$7t=BigInt(7),U7t=BigInt(256),z7t=BigInt(113);for(let t=0,e=l7,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],TMe.push(2*(5*r+n)),PMe.push((t+1)*(t+2)/2%64);let s=D7t;for(let a=0;a<7;a++)e=(e<<l7^(e>>$7t)*z7t)%U7t,e&B7t&&(s^=l7<<(l7<<BigInt(a))-l7);IMe.push(s)}const[H7t,V7t]=P7t(IMe,!0),X1e=(t,e,n)=>n>32?O7t(t,e,n):I7t(t,e,n),Q1e=(t,e,n)=>n>32?M7t(t,e,n):F7t(t,e,n);function W7t(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=X1e(u,d,1)^n[l],x=Q1e(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=PMe[o],c=X1e(s,a,l),u=Q1e(s,a,l),d=TMe[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]^=H7t[r],t[1]^=V7t[r]}n.fill(0)}class Ule extends $le{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,tf(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=yM(this.state)}keccak(){iR||aR(this.state32),W7t(this.state32,this.rounds),iR||aR(this.state32),this.posOut=0,this.pos=0}update(e){r5(this);const{blockLen:n,state:r}=this;e=ES(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){r5(this,!1),x8(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 tf(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ble(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 Ule(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 q7t=(t,e,n)=>EMe(()=>new Ule(e,t,n)),Z1e=q7t(1,136,256/8),lR=AMe.bytes;function FMe(t){if(!(t instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof t}`);return new TextDecoder().decode(t)}function G7t(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 K7t(t){return e=>(AMe.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=K7t(Z1e);return t.create=Z1e.create,t})();var xa;(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})(xa||(xa={}));var Xte;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Xte||(Xte={}));const ks=xa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ng=t=>{switch(typeof t){case"undefined":return ks.undefined;case"string":return ks.string;case"number":return Number.isNaN(t)?ks.nan:ks.number;case"boolean":return ks.boolean;case"function":return ks.function;case"bigint":return ks.bigint;case"symbol":return ks.symbol;case"object":return Array.isArray(t)?ks.array:t===null?ks.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ks.promise:typeof Map<"u"&&t instanceof Map?ks.map:typeof Set<"u"&&t instanceof Set?ks.set:typeof Date<"u"&&t instanceof Date?ks.date:ks.object;default:return ks.unknown}},ts=xa.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"]),Y7t=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,xa.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 kS=(t,e)=>{let n;switch(t.code){case ts.invalid_type:t.received===ks.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ts.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,xa.jsonStringifyReplacer)}`;break;case ts.unrecognized_keys:n=`Unrecognized key(s) in object: ${xa.joinValues(t.keys,", ")}`;break;case ts.invalid_union:n="Invalid input";break;case ts.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${xa.joinValues(t.options)}`;break;case ts.invalid_enum_value:n=`Invalid enum value. Expected ${xa.joinValues(t.options)}, received '${t.received}'`;break;case ts.invalid_arguments:n="Invalid function arguments";break;case ts.invalid_return_type:n="Invalid function return type";break;case ts.invalid_date:n="Invalid date";break;case ts.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}"`:xa.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ts.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 ts.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 ts.custom:n="Invalid input";break;case ts.invalid_intersection_types:n="Intersection results could not be merged";break;case ts.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ts.not_finite:n="Number must be finite";break;default:n=e.defaultError,xa.assertNever(t)}return{message:n}};let OMe=kS;function X7t(t){OMe=t}function cR(){return OMe}const uR=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}},Q7t=[];function Cs(t,e){const n=cR(),r=uR({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===kS?void 0:kS].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 li;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 li;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 li=Object.freeze({status:"aborted"}),u4=t=>({status:"dirty",value:t}),jd=t=>({status:"valid",value:t}),Qte=t=>t.status==="aborted",Zte=t=>t.status==="dirty",s5=t=>t.status==="valid",mE=t=>typeof Promise<"u"&&t instanceof Promise;var Ws;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ws||(Ws={}));class hx{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 J1e=(t,e)=>{if(s5(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 Fi(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 zi{get description(){return this._def.description}_getType(e){return Ng(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ng(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:Ng(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(mE(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:Ng(e)},s=this._parseSync({data:e,path:r.path,parent:r});return J1e(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:Ng(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:n});return s5(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=>s5(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:Ng(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(mE(s)?s:Promise.resolve(s));return J1e(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:ts.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 Em({schema:this,typeName:ui.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 Q0.create(this,this._def)}nullable(){return f2.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vm.create(this)}promise(){return PS.create(this,this._def)}or(e){return yE.create([this,e],this._def)}and(e){return vE.create(this,e,this._def)}transform(e){return new Em({...Fi(this._def),schema:this,typeName:ui.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new jE({...Fi(this._def),innerType:this,defaultValue:n,typeName:ui.ZodDefault})}brand(){return new zle({typeName:ui.ZodBranded,type:this,...Fi(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new AE({...Fi(this._def),innerType:this,catchValue:n,typeName:ui.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return GT.create(this,e)}readonly(){return _E.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z7t=/^c[^\s-]{8,}$/i,J7t=/^[0-9a-z]+$/,e_t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,t_t=/^[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,n_t=/^[a-z0-9_-]{21}$/i,r_t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,s_t=/^[-+]?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)?)??$/,i_t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,a_t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let jW;const o_t=/^(?:(?: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])$/,l_t=/^(?:(?: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])$/,c_t=/^(([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]))$/,u_t=/^(([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])$/,d_t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,f_t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,MMe="((\\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])))",h_t=new RegExp(`^${MMe}$`);function LMe(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 p_t(t){return new RegExp(`^${LMe(t)}$`)}function RMe(t){let e=`${MMe}T${LMe(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 m_t(t,e){return!!((e==="v4"||!e)&&o_t.test(t)||(e==="v6"||!e)&&c_t.test(t))}function x_t(t,e){if(!r_t.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 g_t(t,e){return!!((e==="v4"||!e)&&l_t.test(t)||(e==="v6"||!e)&&u_t.test(t))}class xm extends zi{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ks.string){const a=this._getOrReturnCtx(e);return Cs(a,{code:ts.invalid_type,expected:ks.string,received:a.parsedType}),li}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),Cs(s,{code:ts.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),Cs(s,{code:ts.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?Cs(s,{code:ts.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&Cs(s,{code:ts.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")i_t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"email",code:ts.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")jW||(jW=new RegExp(a_t,"u")),jW.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"emoji",code:ts.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")t_t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"uuid",code:ts.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")n_t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"nanoid",code:ts.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Z7t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"cuid",code:ts.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")J7t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"cuid2",code:ts.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")e_t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"ulid",code:ts.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),Cs(s,{validation:"url",code:ts.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),Cs(s,{validation:"regex",code:ts.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),Cs(s,{code:ts.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),Cs(s,{code:ts.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),Cs(s,{code:ts.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?RMe(a).test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{code:ts.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?h_t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{code:ts.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?p_t(a).test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{code:ts.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?s_t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"duration",code:ts.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?m_t(e.data,a.version)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"ip",code:ts.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?x_t(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"jwt",code:ts.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?g_t(e.data,a.version)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"cidr",code:ts.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?d_t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"base64",code:ts.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?f_t.test(e.data)||(s=this._getOrReturnCtx(e,s),Cs(s,{validation:"base64url",code:ts.invalid_string,message:a.message}),r.dirty()):xa.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:ts.invalid_string,...Ws.errToObj(r)})}_addCheck(e){return new xm({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ws.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ws.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ws.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ws.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ws.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ws.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ws.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ws.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ws.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ws.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ws.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ws.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ws.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,...Ws.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,...Ws.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ws.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ws.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Ws.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ws.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ws.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ws.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ws.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ws.errToObj(n)})}nonempty(e){return this.min(1,Ws.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:ui.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Fi(t)});function b_t(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 c2 extends zi{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)!==ks.number){const a=this._getOrReturnCtx(e);return Cs(a,{code:ts.invalid_type,expected:ks.number,received:a.parsedType}),li}let r;const s=new Hu;for(const a of this._def.checks)a.kind==="int"?xa.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Cs(r,{code:ts.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),Cs(r,{code:ts.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),Cs(r,{code:ts.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?b_t(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),Cs(r,{code:ts.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Cs(r,{code:ts.not_finite,message:a.message}),s.dirty()):xa.assertNever(a);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ws.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ws.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ws.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ws.toString(n))}setLimit(e,n,r,s){return new c2({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ws.toString(s)}]})}_addCheck(e){return new c2({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ws.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ws.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ws.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ws.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ws.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ws.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ws.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ws.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ws.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"&&xa.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)}}c2.create=t=>new c2({checks:[],typeName:ui.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Fi(t)});class u2 extends zi{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)!==ks.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),Cs(r,{code:ts.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),Cs(r,{code:ts.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),Cs(r,{code:ts.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):xa.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Cs(n,{code:ts.invalid_type,expected:ks.bigint,received:n.parsedType}),li}gte(e,n){return this.setLimit("min",e,!0,Ws.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ws.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ws.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ws.toString(n))}setLimit(e,n,r,s){return new u2({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ws.toString(s)}]})}_addCheck(e){return new u2({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ws.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ws.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ws.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ws.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ws.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}}u2.create=t=>new u2({checks:[],typeName:ui.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Fi(t)});class xE extends zi{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ks.boolean){const r=this._getOrReturnCtx(e);return Cs(r,{code:ts.invalid_type,expected:ks.boolean,received:r.parsedType}),li}return jd(e.data)}}xE.create=t=>new xE({typeName:ui.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Fi(t)});class i5 extends zi{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ks.date){const a=this._getOrReturnCtx(e);return Cs(a,{code:ts.invalid_type,expected:ks.date,received:a.parsedType}),li}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Cs(a,{code:ts.invalid_date}),li}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),Cs(s,{code:ts.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),Cs(s,{code:ts.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):xa.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new i5({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ws.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ws.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}}i5.create=t=>new i5({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ui.ZodDate,...Fi(t)});class dR extends zi{_parse(e){if(this._getType(e)!==ks.symbol){const r=this._getOrReturnCtx(e);return Cs(r,{code:ts.invalid_type,expected:ks.symbol,received:r.parsedType}),li}return jd(e.data)}}dR.create=t=>new dR({typeName:ui.ZodSymbol,...Fi(t)});class gE extends zi{_parse(e){if(this._getType(e)!==ks.undefined){const r=this._getOrReturnCtx(e);return Cs(r,{code:ts.invalid_type,expected:ks.undefined,received:r.parsedType}),li}return jd(e.data)}}gE.create=t=>new gE({typeName:ui.ZodUndefined,...Fi(t)});class bE extends zi{_parse(e){if(this._getType(e)!==ks.null){const r=this._getOrReturnCtx(e);return Cs(r,{code:ts.invalid_type,expected:ks.null,received:r.parsedType}),li}return jd(e.data)}}bE.create=t=>new bE({typeName:ui.ZodNull,...Fi(t)});class TS extends zi{constructor(){super(...arguments),this._any=!0}_parse(e){return jd(e.data)}}TS.create=t=>new TS({typeName:ui.ZodAny,...Fi(t)});class N3 extends zi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jd(e.data)}}N3.create=t=>new N3({typeName:ui.ZodUnknown,...Fi(t)});class A1 extends zi{_parse(e){const n=this._getOrReturnCtx(e);return Cs(n,{code:ts.invalid_type,expected:ks.never,received:n.parsedType}),li}}A1.create=t=>new A1({typeName:ui.ZodNever,...Fi(t)});class fR extends zi{_parse(e){if(this._getType(e)!==ks.undefined){const r=this._getOrReturnCtx(e);return Cs(r,{code:ts.invalid_type,expected:ks.void,received:r.parsedType}),li}return jd(e.data)}}fR.create=t=>new fR({typeName:ui.ZodVoid,...Fi(t)});class vm extends zi{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==ks.array)return Cs(n,{code:ts.invalid_type,expected:ks.array,received:n.parsedType}),li;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.length<s.exactLength.value;(o||l)&&(Cs(n,{code:o?ts.too_big:ts.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&&(Cs(n,{code:ts.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&&(Cs(n,{code:ts.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 hx(n,o,n.path,l)))).then(o=>Hu.mergeArray(r,o));const a=[...n.data].map((o,l)=>s.type._parseSync(new hx(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:Ws.toString(n)}})}max(e,n){return new vm({...this._def,maxLength:{value:e,message:Ws.toString(n)}})}length(e,n){return new vm({...this._def,exactLength:{value:e,message:Ws.toString(n)}})}nonempty(e){return this.min(1,e)}}vm.create=(t,e)=>new vm({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ui.ZodArray,...Fi(e)});function XC(t){if(t instanceof Vo){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Q0.create(XC(r))}return new Vo({...t._def,shape:()=>e})}else return t instanceof vm?new vm({...t._def,type:XC(t.element)}):t instanceof Q0?Q0.create(XC(t.unwrap())):t instanceof f2?f2.create(XC(t.unwrap())):t instanceof px?px.create(t.items.map(e=>XC(e))):t}class Vo extends zi{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=xa.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==ks.object){const u=this._getOrReturnCtx(e);return Cs(u,{code:ts.invalid_type,expected:ks.object,received:u.parsedType}),li}const{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof A1&&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 hx(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof A1){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&&(Cs(s,{code:ts.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 hx(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 Ws.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:Ws.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:ui.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 xa.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 xa.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Vo({...this._def,shape:()=>n})}deepPartial(){return XC(this)}partial(e){const n={};for(const r of xa.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 xa.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof Q0;)a=a._def.innerType;n[r]=a}return new Vo({...this._def,shape:()=>n})}keyof(){return DMe(xa.objectKeys(this.shape))}}Vo.create=(t,e)=>new Vo({shape:()=>t,unknownKeys:"strip",catchall:A1.create(),typeName:ui.ZodObject,...Fi(e)});Vo.strictCreate=(t,e)=>new Vo({shape:()=>t,unknownKeys:"strict",catchall:A1.create(),typeName:ui.ZodObject,...Fi(e)});Vo.lazycreate=(t,e)=>new Vo({shape:t,unknownKeys:"strip",catchall:A1.create(),typeName:ui.ZodObject,...Fi(e)});class yE extends zi{_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 Cs(n,{code:ts.invalid_union,unionErrors:o}),li}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 Cs(n,{code:ts.invalid_union,unionErrors:l}),li}}get options(){return this._def.options}}yE.create=(t,e)=>new yE({options:t,typeName:ui.ZodUnion,...Fi(e)});const xg=t=>t instanceof CE?xg(t.schema):t instanceof Em?xg(t.innerType()):t instanceof NE?[t.value]:t instanceof d2?t.options:t instanceof SE?xa.objectValues(t.enum):t instanceof jE?xg(t._def.innerType):t instanceof gE?[void 0]:t instanceof bE?[null]:t instanceof Q0?[void 0,...xg(t.unwrap())]:t instanceof f2?[null,...xg(t.unwrap())]:t instanceof zle||t instanceof _E?xg(t.unwrap()):t instanceof AE?xg(t._def.innerType):[];class dU extends zi{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ks.object)return Cs(n,{code:ts.invalid_type,expected:ks.object,received:n.parsedType}),li;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}):(Cs(n,{code:ts.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),li)}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=xg(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 dU({typeName:ui.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...Fi(r)})}}function Jte(t,e){const n=Ng(t),r=Ng(e);if(t===e)return{valid:!0,data:t};if(n===ks.object&&r===ks.object){const s=xa.objectKeys(e),a=xa.objectKeys(t).filter(l=>s.indexOf(l)!==-1),o={...t,...e};for(const l of a){const c=Jte(t[l],e[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===ks.array&&r===ks.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=Jte(o,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===ks.date&&r===ks.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class vE extends zi{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,o)=>{if(Qte(a)||Qte(o))return li;const l=Jte(a.value,o.value);return l.valid?((Zte(a)||Zte(o))&&n.dirty(),{status:n.value,value:l.data}):(Cs(r,{code:ts.invalid_intersection_types}),li)};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}))}}vE.create=(t,e,n)=>new vE({left:t,right:e,typeName:ui.ZodIntersection,...Fi(n)});class px extends zi{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ks.array)return Cs(r,{code:ts.invalid_type,expected:ks.array,received:r.parsedType}),li;if(r.data.length<this._def.items.length)return Cs(r,{code:ts.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),li;!this._def.rest&&r.data.length>this._def.items.length&&(Cs(r,{code:ts.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 hx(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 px({...this._def,rest:e})}}px.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new px({items:t,typeName:ui.ZodTuple,rest:null,...Fi(e)})};class wE extends zi{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!==ks.object)return Cs(r,{code:ts.invalid_type,expected:ks.object,received:r.parsedType}),li;const s=[],a=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:a._parse(new hx(r,l,r.path,l)),value:o._parse(new hx(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 zi?new wE({keyType:e,valueType:n,typeName:ui.ZodRecord,...Fi(r)}):new wE({keyType:xm.create(),valueType:e,typeName:ui.ZodRecord,...Fi(n)})}}class hR extends zi{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!==ks.map)return Cs(r,{code:ts.invalid_type,expected:ks.map,received:r.parsedType}),li;const s=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>({key:s._parse(new hx(r,l,r.path,[u,"key"])),value:a._parse(new hx(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 li;(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 li;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}hR.create=(t,e,n)=>new hR({valueType:e,keyType:t,typeName:ui.ZodMap,...Fi(n)});class a5 extends zi{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ks.set)return Cs(r,{code:ts.invalid_type,expected:ks.set,received:r.parsedType}),li;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(Cs(r,{code:ts.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&&(Cs(r,{code:ts.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 li;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 hx(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(e,n){return new a5({...this._def,minSize:{value:e,message:Ws.toString(n)}})}max(e,n){return new a5({...this._def,maxSize:{value:e,message:Ws.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}a5.create=(t,e)=>new a5({valueType:t,minSize:null,maxSize:null,typeName:ui.ZodSet,...Fi(e)});class R4 extends zi{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ks.function)return Cs(n,{code:ts.invalid_type,expected:ks.function,received:n.parsedType}),li;function r(l,c){return uR({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cR(),kS].filter(u=>!!u),issueData:{code:ts.invalid_arguments,argumentsError:c}})}function s(l,c){return uR({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cR(),kS].filter(u=>!!u),issueData:{code:ts.invalid_return_type,returnTypeError:c}})}const a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof PS){const l=this;return jd(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 jd(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 R4({...this._def,args:px.create(e).rest(N3.create())})}returns(e){return new R4({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new R4({args:e||px.create([]).rest(N3.create()),returns:n||N3.create(),typeName:ui.ZodFunction,...Fi(r)})}}class CE extends zi{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})}}CE.create=(t,e)=>new CE({getter:t,typeName:ui.ZodLazy,...Fi(e)});class NE extends zi{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Cs(n,{received:n.data,code:ts.invalid_literal,expected:this._def.value}),li}return{status:"valid",value:e.data}}get value(){return this._def.value}}NE.create=(t,e)=>new NE({value:t,typeName:ui.ZodLiteral,...Fi(e)});function DMe(t,e){return new d2({values:t,typeName:ui.ZodEnum,...Fi(e)})}class d2 extends zi{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Cs(n,{expected:xa.joinValues(r),received:n.parsedType,code:ts.invalid_type}),li}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 Cs(n,{received:n.data,code:ts.invalid_enum_value,options:r}),li}return jd(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 d2.create(e,{...this._def,...n})}exclude(e,n=this._def){return d2.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}d2.create=DMe;class SE extends zi{_parse(e){const n=xa.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ks.string&&r.parsedType!==ks.number){const s=xa.objectValues(n);return Cs(r,{expected:xa.joinValues(s),received:r.parsedType,code:ts.invalid_type}),li}if(this._cache||(this._cache=new Set(xa.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=xa.objectValues(n);return Cs(r,{received:r.data,code:ts.invalid_enum_value,options:s}),li}return jd(e.data)}get enum(){return this._def.values}}SE.create=(t,e)=>new SE({values:t,typeName:ui.ZodNativeEnum,...Fi(e)});class PS extends zi{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ks.promise&&n.common.async===!1)return Cs(n,{code:ts.invalid_type,expected:ks.promise,received:n.parsedType}),li;const r=n.parsedType===ks.promise?n.data:Promise.resolve(n.data);return jd(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}PS.create=(t,e)=>new PS({type:t,typeName:ui.ZodPromise,...Fi(e)});class Em extends zi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ui.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=>{Cs(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 li;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?li:c.status==="dirty"||n.value==="dirty"?u4(c.value):c});{if(n.value==="aborted")return li;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?li:l.status==="dirty"||n.value==="dirty"?u4(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"?li:(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"?li:(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(!s5(o))return li;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=>s5(o)?Promise.resolve(s.transform(o.value,a)).then(l=>({status:n.value,value:l})):li);xa.assertNever(s)}}Em.create=(t,e,n)=>new Em({schema:t,typeName:ui.ZodEffects,effect:e,...Fi(n)});Em.createWithPreprocess=(t,e,n)=>new Em({schema:e,effect:{type:"preprocess",transform:t},typeName:ui.ZodEffects,...Fi(n)});class Q0 extends zi{_parse(e){return this._getType(e)===ks.undefined?jd(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Q0.create=(t,e)=>new Q0({innerType:t,typeName:ui.ZodOptional,...Fi(e)});class f2 extends zi{_parse(e){return this._getType(e)===ks.null?jd(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}f2.create=(t,e)=>new f2({innerType:t,typeName:ui.ZodNullable,...Fi(e)});class jE extends zi{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===ks.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}jE.create=(t,e)=>new jE({innerType:t,typeName:ui.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fi(e)});class AE extends zi{_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 mE(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}}AE.create=(t,e)=>new AE({innerType:t,typeName:ui.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fi(e)});class pR extends zi{_parse(e){if(this._getType(e)!==ks.nan){const r=this._getOrReturnCtx(e);return Cs(r,{code:ts.invalid_type,expected:ks.nan,received:r.parsedType}),li}return{status:"valid",value:e.data}}}pR.create=t=>new pR({typeName:ui.ZodNaN,...Fi(t)});const y_t=Symbol("zod_brand");class zle extends zi{_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 GT extends zi{_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"?li:a.status==="dirty"?(n.dirty(),u4(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"?li: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 GT({in:e,out:n,typeName:ui.ZodPipeline})}}class _E extends zi{_parse(e){const n=this._def.innerType._parse(e),r=s=>(s5(s)&&(s.value=Object.freeze(s.value)),s);return mE(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}_E.create=(t,e)=>new _E({innerType:t,typeName:ui.ZodReadonly,...Fi(e)});function ebe(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function BMe(t,e={},n){return t?TS.create().superRefine((r,s)=>{const a=t(r);if(a instanceof Promise)return a.then(o=>{if(!o){const l=ebe(e,r),c=l.fatal??n??!0;s.addIssue({code:"custom",...l,fatal:c})}});if(!a){const o=ebe(e,r),l=o.fatal??n??!0;s.addIssue({code:"custom",...o,fatal:l})}}):TS.create()}const v_t={object:Vo.lazycreate};var ui;(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"})(ui||(ui={}));const w_t=(t,e={message:`Input not instance of ${t.name}`})=>BMe(n=>n instanceof t,e),$Me=xm.create,UMe=c2.create,C_t=pR.create,N_t=u2.create,zMe=xE.create,S_t=i5.create,j_t=dR.create,A_t=gE.create,__t=bE.create,ene=TS.create,E_t=N3.create,k_t=A1.create,T_t=fR.create,HMe=vm.create,wM=Vo.create,P_t=Vo.strictCreate,VMe=yE.create,I_t=dU.create,F_t=vE.create,WMe=px.create,O_t=wE.create,M_t=hR.create,L_t=a5.create,R_t=R4.create,D_t=CE.create,B_t=NE.create,$_t=d2.create,U_t=SE.create,z_t=PS.create,tbe=Em.create,H_t=Q0.create,V_t=f2.create,W_t=Em.createWithPreprocess,q_t=GT.create,G_t=()=>$Me().optional(),K_t=()=>UMe().optional(),Y_t=()=>zMe().optional(),X_t={string:t=>xm.create({...t,coerce:!0}),number:t=>c2.create({...t,coerce:!0}),boolean:t=>xE.create({...t,coerce:!0}),bigint:t=>u2.create({...t,coerce:!0}),date:t=>i5.create({...t,coerce:!0})},Q_t=li,nbe=Object.freeze(Object.defineProperty({__proto__:null,BRAND:y_t,DIRTY:u4,EMPTY_PATH:Q7t,INVALID:li,NEVER:Q_t,OK:jd,ParseStatus:Hu,Schema:zi,ZodAny:TS,ZodArray:vm,ZodBigInt:u2,ZodBoolean:xE,ZodBranded:zle,ZodCatch:AE,ZodDate:i5,ZodDefault:jE,ZodDiscriminatedUnion:dU,ZodEffects:Em,ZodEnum:d2,ZodError:th,get ZodFirstPartyTypeKind(){return ui},ZodFunction:R4,ZodIntersection:vE,ZodIssueCode:ts,ZodLazy:CE,ZodLiteral:NE,ZodMap:hR,ZodNaN:pR,ZodNativeEnum:SE,ZodNever:A1,ZodNull:bE,ZodNullable:f2,ZodNumber:c2,ZodObject:Vo,ZodOptional:Q0,ZodParsedType:ks,ZodPipeline:GT,ZodPromise:PS,ZodReadonly:_E,ZodRecord:wE,ZodSchema:zi,ZodSet:a5,ZodString:xm,ZodSymbol:dR,ZodTransformer:Em,ZodTuple:px,ZodType:zi,ZodUndefined:gE,ZodUnion:yE,ZodUnknown:N3,ZodVoid:fR,addIssueToContext:Cs,any:ene,array:HMe,bigint:N_t,boolean:zMe,coerce:X_t,custom:BMe,date:S_t,datetimeRegex:RMe,defaultErrorMap:kS,discriminatedUnion:I_t,effect:tbe,enum:$_t,function:R_t,getErrorMap:cR,getParsedType:Ng,instanceof:w_t,intersection:F_t,isAborted:Qte,isAsync:mE,isDirty:Zte,isValid:s5,late:v_t,lazy:D_t,literal:B_t,makeIssue:uR,map:M_t,nan:C_t,nativeEnum:U_t,never:k_t,null:__t,nullable:V_t,number:UMe,object:wM,get objectUtil(){return Xte},oboolean:Y_t,onumber:K_t,optional:H_t,ostring:G_t,pipeline:q_t,preprocess:W_t,promise:z_t,quotelessJson:Y7t,record:O_t,set:L_t,setErrorMap:X7t,strictObject:P_t,string:$Me,symbol:j_t,transformer:tbe,tuple:WMe,undefined:A_t,union:VMe,unknown:E_t,get util(){return xa},void:T_t},Symbol.toStringTag,{value:"Module"})),Z_t=t=>t.message?t.message:"unspecified error";class IS extends xi{constructor(e){super(),this.code=yAt,this.errors=e,super.message=`Web3 validator found ${e.length} error[s]:
${this._compileErrors().join(`
`)}`}_compileErrors(){return this.errors.map(Z_t)}}const J_t=["bool","int","uint","bytes","string","address","tuple"],qMe=t=>typeof t=="object"&&"type"in t&&"name"in t,Hle=t=>typeof t=="string",Ta=t=>typeof t=="string"&&/^((-)?0x[0-9a-f]+|(0x))$/i.test(t);function GMe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/))}const mR=t=>typeof t=="number"||typeof t=="bigint"||typeof t=="string"&&/^((-0x|0x|-)?[0-9a-f]+|(0x))$/i.test(t);function Vle(t){if(typeof t!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof t}`);return t.startsWith("0x")}const Wle=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()}`)},e9t=["hex","number","blockNumber","blockNumberOrTag","filter","bloom"],L5=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),J_t.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}},AW=(t,e={})=>{if(Object.keys(e).includes("type"))throw new IS([{keyword:"eth",message:'Either "eth" or "type" can be presented in schema',params:{eth:t},instancePath:"",schemaPath:""}]);const{baseType:r,baseTypeSize:s}=L5(t);if(!r&&!e9t.includes(t))throw new IS([{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}:{}},xR=(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=[];qMe(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}=L5(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=xR(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:xR(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:AW(a)},g>=0&&{minItems:g,maxItems:g});x.items.push(y)}else Array.isArray(x.items)?x.items.push(Object.assign({$id:o},AW(a))):x.items.push(Object.assign({$id:o},AW(a)));x=n}return n},qle=t=>xR(t),Gle=(t,e)=>e===1?t:Gle(t[0],e-1),B_=(t,e,n)=>{const r=[];for(const[s,a]of t.entries()){let o,l,c=[];qMe(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}=L5(o),x=Array.isArray(e)?e[s]:e[l];if(u==="tuple"&&!d)r.push(B_(c,x,n));else if(u==="tuple"&&d){const g=[];for(const y of x)if(f.length>1){const v=Gle(y,f.length-1),C=[];for(const S of v)C.push(B_(c,S,n));g.push(C)}else g.push(B_(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}`)},fU=t=>{if(!Ta(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)},hU=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"&&Ta(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"&&!Ta(t))return hU(BigInt(t));throw new Mle(t)},gR=(t,e,n="0")=>{if(typeof t=="string"&&!Ta(t))return t.padStart(e,n);const r=typeof t=="string"&&Ta(t)?t:hU(t),[s,a]=r.startsWith("-")?["-0x",r.slice(3)]:["0x",r.slice(2)];return`${s}${a.padStart(e,n)}`};function B1(t){let e="0x";for(const n of t){const r=n.toString(16);e+=r.length===1?`0${r}`:r}return e}const Zx={zero:48,nine:57,A:65,F:70,a:97,f:102};function rbe(t){if(t>=Zx.zero&&t<=Zx.nine)return t-Zx.zero;if(t>=Zx.A&&t<=Zx.F)return t-(Zx.A-10);if(t>=Zx.a&&t<=Zx.f)return t-(Zx.a-10)}function R5(t){let e=0;if(t.startsWith("0")&&(t[1]==="x"||t[1]==="X")&&(e=2),t.length%2!==0)throw new L4(`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=rbe(t.charCodeAt(a++)),l=rbe(t.charCodeAt(a++));if(o===void 0||l===void 0)throw new L4(`Invalid byte sequence ("${t[a-2]}${t[a-1]}" in "${t}").`);r[s]=o*16+l}return r}function pU(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 YMe=Object.freeze(Object.defineProperty({__proto__:null,abiSchemaToJsonSchema:xR,codePointToInt:KMe,ensureIfUint8Array:pU,ethAbiToJsonSchema:qle,fetchArrayElement:Gle,hexToNumber:fU,hexToUint8Array:R5,numberToHex:hU,padLeft:gR,parseBaseType:L5,transformJsonDataToAbiFormat:B_,uint8ArrayToHexString:B1},Symbol.toStringTag,{value:"Module"})),tne=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"},P2=(t,e={abiType:"bytes"})=>{if(typeof t!="string"&&!Array.isArray(t)&&!tne(t)||typeof t=="string"&&Ta(t)&&t.startsWith("-")||typeof t=="string"&&!Ta(t))return!1;let n;if(typeof t=="string"){if(t.length%2!==0)return!1;n=R5(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}=L5(e.abiType);return r?n.length===r:!0}return e!=null&&e.size?n.length===(e==null?void 0:e.size):!0},XMe=t=>{if(!/^(0x)?[0-9a-f]{40}$/i.test(t))return!1;const e=t.slice(2),n=_S(e.toLowerCase()),r=B1(pd(pU(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"&&!tne(t))return!1;let n;return tne(t)?n=B1(t):typeof t=="string"&&!Ta(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?XMe(n):!0:!1},o5=(t,e)=>{if(e===BigInt(0))return BigInt(1);let n=t;for(let r=1;r<e;r+=1)n*=t;return n},_1=(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}=L5(e.abiType);s&&(n=s)}else e.bitSize&&(n=e.bitSize);const r=o5(BigInt(2),BigInt(n??256))-BigInt(1);try{const s=typeof t=="string"&&Ta(t)?BigInt(fU(t)):BigInt(t);return s>=0&&s<=r}catch{return!1}},EE=(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}=L5(e.abiType);if(o!=="int")return!1;a&&(n=a)}else e.bitSize&&(n=e.bitSize);const r=o5(BigInt(2),BigInt((n??256)-1)),s=BigInt(-1)*o5(BigInt(2),BigInt((n??256)-1));try{const a=typeof t=="string"&&Ta(t)?BigInt(fU(t)):BigInt(t);return a>=s&&a<=r}catch{return!1}},QMe=t=>!!(EE(t)||typeof t=="string"&&/[0-9.]/.test(t)&&t.indexOf(".")===t.lastIndexOf(".")||typeof t=="number"),ZMe=t=>_1(t),Uc=t=>Object.values(Ug).includes(t),nne=t=>Uc(t)||ZMe(t),g8=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)),mU=(t,e)=>{if(typeof e=="string"&&!Ta(e)||!g8(t))return!1;const n=typeof e=="string"?R5(e):e,r=B1(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(!g8(t)||!ih(e))return!1;const n=gR(e,64);return mU(t,n)},n9t=(t,e)=>!g8(t)||!ih(e)?!1:mU(t,e),r9t=t=>["number","string","boolean"].includes(typeof t)?typeof t=="boolean"?!0:typeof t=="string"&&!Ta(t)?t==="1"||t==="0":typeof t=="string"&&Ta(t)?t==="0x1"||t==="0x0":t===1||t===0:!1,Nr=t=>t==null,FS=t=>typeof t=="object"&&!Nr(t)&&!Array.isArray(t)&&!(t instanceof Fle),bR=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)),s9t=(t,e)=>!g8(t)||!bR(e)?!1:mU(t,e),i9t=t=>{const e=["fromBlock","toBlock","address","topics","blockHash"];if(Nr(t)||typeof t!="object"||!Object.keys(t).every(n=>e.includes(n))||!Nr(t.fromBlock)&&!nne(t.fromBlock)||!Nr(t.toBlock)&&!nne(t.toBlock))return!1;if(!Nr(t.address)){if(Array.isArray(t.address)){if(!t.address.every(n=>ih(n)))return!1}else if(!ih(t.address))return!1}return!(!Nr(t.topics)&&!t.topics.every(n=>Nr(n)?!0:Array.isArray(n)?n.every(r=>bR(r)):!!bR(n)))},l5={address:t=>ih(t),bloom:t=>g8(t),blockNumber:t=>ZMe(t),blockTag:t=>Uc(t),blockNumberOrTag:t=>nne(t),bool:t=>r9t(t),bytes:t=>P2(t),filter:t=>i9t(t),hex:t=>Ta(t),uint:t=>_1(t),int:t=>EE(t),number:t=>QMe(t),string:t=>Hle(t)};for(let t=8;t<=256;t+=8)l5[`int${t}`]=e=>EE(e,{bitSize:t}),l5[`uint${t}`]=e=>_1(e,{bitSize:t});for(let t=1;t<=32;t+=1)l5[`bytes${t}`]=e=>P2(e,{size:t});l5.bytes256=l5.bytes;const l_=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=l_(t.properties[n]);r&&(e[n]=r)}return Array.isArray(t.required)?wM(e).partial().required(t.required.reduce((n,r)=>Object.assign(Object.assign({},n),{[r]:!0}),{})):wM(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=l_(s);a&&r.push(a)}return WMe(r)}const e=Array.isArray(t.items)?t.items[0]:t.items;let n=HMe(l_(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 VMe(t.oneOf.map(e=>l_(e)));if(t!=null&&t.format){if(!l5[t.format])throw new _7t(t.format);return ene().refine(l5[t.format],e=>({params:{value:e,format:t.format}}))}return t!=null&&t.type&&(t==null?void 0:t.type)!=="object"&&typeof nbe[String(t.type)]=="function"?nbe[String(t.type)]():wM({data:ene()}).partial()};class d4{static factory(){return d4.validatorInstance||(d4.validatorInstance=new d4),d4.validatorInstance}validate(e,n,r){var s,a;const l=l_(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 IS(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===ts.too_big)a="maxItems",l=`${u}/maxItems`,o={limit:n.maximum},s=`must NOT have more than ${n.maximum} items`;else if(n.code===ts.too_small)a="minItems",l=`${u}/minItems`,o={limit:n.minimum},s=`must NOT have fewer than ${n.minimum} items`;else if(n.code===ts.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 a9t{constructor(){this._validator=d4.factory()}validateJSONSchema(e,n,r){return this._validator.validate(e,n,r)}validate(e,n,r={silent:!1}){var s,a;const o=qle(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 IS([{instancePath:"/0",schemaPath:"/",keyword:"required",message:"empty schema against data can not be validated",params:n}]);return this._validator.validate(o,n,r)}}}const Js=new a9t;function I2(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 xU(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 gU={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")},rne="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",mx=t=>{if(Js.validate(["bytes"],[t]),I2(t))return t;if(Array.isArray(t))return new Uint8Array(t);if(typeof t=="string")return R5(t);throw new L4(t)},{uint8ArrayToHexString:o9t}=YMe,Ki=t=>o9t(mx(t)),xo=t=>typeof t=="string"&&t.slice(0,2).toLowerCase()!=="0x"?mx(`0x${t}`):mx(t),KT=t=>(Js.validate(["hex"],[t]),fU(t)),l9t=KT,lc=(t,e)=>{typeof t!="bigint"&&Js.validate(["int"],[t]);let n=hU(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},c9t=lc,u9t=t=>KT(t).toString(),km=t=>{Js.validate(["string"],[t]);let e=t.replace(/^(?:\u0000)/,"");return e=e.replace(/(?:\u0000)$/,""),Ki(new TextEncoder().encode(e))},JMe=km,d9t=km,bU=t=>FMe(xo(t)),f9t=t=>typeof t=="string"?bU(t):(Js.validate(["bytes"],[t]),FMe(t)),Kle=_S,h9t=bU,eLe=t=>{Js.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}`},p9t=eLe,tLe=t=>new TextDecoder("ascii").decode(xo(t)),m9t=tLe,E1=(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":lc(t);if(typeof t=="bigint")return e?"bigint":lc(t);if(I2(t))return e?"bytes":Ki(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":lc(t);if(Ta(t))return e?"bytes":t;if(mR(t)&&!EE(t)&&!_1(t))return e?"bytes":`0x${t}`;if(mR(t)&&!EE(t)&&_1(t))return e?"uint":lc(t);if(!Number.isFinite(t))return e?"string":km(t)}throw new u7t(t)},af=t=>{if(typeof t=="number")return t>1e20?(console.warn(rne),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"&&Ta(t))return KT(t);try{return af(BigInt(t))}catch{throw new Mle(t)}},vw=t=>{if(typeof t=="number")return BigInt(t);if(typeof t=="bigint")return t;if(typeof t=="string"&&mR(t))return t.startsWith("-")?-BigInt(t.substring(1)):BigInt(t);throw new Mle(t)},x9t=(t,e)=>{let n;if(typeof e=="string"){if(n=gU[e],!n)throw new CMe(e)}else{if(e<0||!Number.isInteger(e))throw new NMe(e);n=o5(BigInt(10),BigInt(e))}const r=String(af(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)},g9t=(t,e)=>{Js.validate(["number"],[t]);let n;if(typeof e=="string"){if(n=gU[e],!n)throw new CMe(e)}else{if(e<0||!Number.isInteger(e))throw new NMe(e);n=o5(BigInt(10),BigInt(e))}let r=t;typeof r=="number"&&(r<1e-15&&console.warn(rne),r>1e20?(console.warn(rne),r=BigInt(r)):r=r.toLocaleString("fullwide",{useGrouping:!1,maximumFractionDigits:20}));const[s,a]=String(typeof r=="string"&&!Ta(r)?r:af(r)).split(".").concat(""),l=BigInt(`${s}${a}`)*n,c=a.length;return c===0?l.toString():l.toString().slice(0,-c)},Nx=t=>{if(!ih(t,!1))throw new Lle(t);const e=t.toLowerCase().replace(/^0x/i,""),n=B1(pd(pU(Kle(e))));if(Nr(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},nLe=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"&&!Ta(t)&&(t==="1"||t==="0"||t==="false"||t==="true"))return t==="true"?!0:t==="false"?!1:!!Number(t);if(typeof t=="string"&&Ta(t)&&(t==="0x1"||t==="0x0"))return!!af(t);throw new Rle(t)};let Yle=class extends Loe{constructor(){super(...arguments),this.maxListeners=Number.MAX_SAFE_INTEGER}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}};const b9t=Ta,y9t=mR,v9t=XMe,w9t=ih,C9t=g8,N9t=mU,S9t=t9t,j9t=n9t,A9t=bR,_9t=s9t,E9t=(t,e)=>{const n=typeof t=="string"&&Uc(t),r=typeof e=="string"&&Uc(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={[Ug.EARLIEST]:1,[Ug.FINALIZED]:2,[Ug.SAFE]:3,[Ug.LATEST]:4,[Ug.PENDING]:5};return o[t]<o[e]?-1:1}if(n&&!r||!n&&r)throw new f7t("Cannot compare blocktag with provided non-blocktag input.");const s=BigInt(t),a=BigInt(e);return s<a?-1:s===a?0:1},Ty=t=>typeof t=="object"&&!Nr(t)&&Object.keys(t).length!==0&&["input","data","from","gas","gasPrice","gasLimit","address","jsonInterface","syncWithContext","dataInputFill"].some(e=>e in t),oi=Nr,sbe=t=>typeof t=="object"&&!Nr(t)&&!Array.isArray(t)&&!(t instanceof Fle),F2=(t,...e)=>{if(!sbe(t))return t;const n=Object.assign({},t);for(const r of e)for(const s in r)sbe(r[s])?(n[s]||(n[s]={}),n[s]=F2(n[s],r[s])):!Nr(r[s])&&Object.hasOwnProperty.call(r,s)&&(Array.isArray(r[s])||r[s]instanceof Fle?n[s]=r[s].slice(0):n[s]=r[s]);return n},OS=(t,e,n="0")=>typeof t=="string"?Ta(t)?gR(t,e,n):t.padStart(e,n):(Js.validate(["int"],[t]),gR(t,e,n)),rLe=(t,e,n="0")=>{if(typeof t=="string"&&!Ta(t))return t.padEnd(e,n);const r=typeof t=="string"&&Ta(t)?t:lc(t),s=r.startsWith("-")?3:2;return Js.validate([r.startsWith("-")?"int":"uint"],[t]),r.padEnd(e+s,n)},sLe=rLe,kE=OS,iLe=(t,e=64)=>{Js.validate(["int"],[t]);const n=af(t);if(n>=0)return OS(E1(n),e);const r=o5(BigInt(2),BigInt(e*4));if(-n>=r)throw new SMe(`value: ${t}, nibbleWidth: ${e}`);const a=BigInt(n)+r;return OS(lc(a),e)},k9t=(t,e=64)=>{Js.validate(["int"],[t]);const n=af(t);if(n<0)return n;const r=Math.ceil(Math.log(Number(n))/Math.log(2));if(r>e*4)throw new SMe(`value: "${t}", nibbleWidth: "${e}"`);if(e*4!==r)return n;const s=o5(BigInt(2),BigInt(e)*BigInt(4));return af(BigInt(n)-s)},{parseBaseType:T9t}=YMe,Sg=t=>typeof t=="object"&&!Nr(t)&&"number"in t&&"bytes"in t,P9t=(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&&FS(r.items)?r=r.items:r.items&&Array.isArray(r.items)&&(r=r.items[parseInt(a,10)]),r&&a&&(s=a)}return r},TE=(t,e,n)=>{try{const{baseType:r,baseTypeSize:s}=T9t(e);if(r==="int"||r==="uint")switch(n.number){case ap.NUMBER:return Number(vw(t));case ap.HEX:return lc(vw(t));case ap.STR:return vw(t).toString();case ap.BIGINT:return vw(t);default:throw new Gte(`Invalid format: ${String(n.number)}`)}if(r==="bytes"){let a;switch(s?typeof t=="string"?a=OS(t,s*2):I2(t)&&(a=Ad(new Uint8Array(s-t.length),t)):a=t,n.bytes){case j1.HEX:return Ki(mx(a));case j1.UINT8ARRAY:return mx(a);default:throw new Gte(`Invalid format: ${String(n.bytes)}`)}}if(r==="string")return String(t)}catch{return t}return t},ibe=({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]))}),Nr(d==null?void 0:d.items))return delete r[s],a.pop(),!0;if(FS(d.items)&&!Nr(d.items.format)){for(let f=0;f<t.length;f+=1)r[s][f]=TE(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)yU(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]=TE(t[f],d.items[f].format,o);return a.pop(),!0}}return!1},yU=(t,e,n,r,s=[])=>{var a;if(!FS(t)&&!Array.isArray(t))return TE(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")ibe({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=P9t(e,n,s);if(Nr(u)){delete o[l],n.pop();continue}if(FS(c)){yU(c,e,n,r,s),n.pop();continue}if(!ibe({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]=TE(c,u.format,r),n.pop()}}return o},es=(t,e,n=yd)=>{let r;FS(e)?r=F2({},e):Array.isArray(e)?r=[...e]:r=e;const s=FS(t)?t:qle(t);if(!s.properties&&!s.items&&!s.format)throw new Gte("Invalid json schema for formatting");return yU(r,s,[],n)},aLe="0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",MS=t=>{let e;return typeof t=="bigint"||typeof t=="number"?e=_S(t.toString()):Array.isArray(t)?e=new Uint8Array(t):typeof t=="string"&&!Ta(t)?e=_S(t):e=mx(t),Ki(pd(pU(e)))},YT=t=>{let e;typeof t=="string"?t.startsWith("0x")&&Ta(t)?e=xo(t):e=_S(t):e=t;const n=MS(e);return n===aLe?void 0:n},ah=t=>{const e=YT(t);return Nr(e)?aLe:e},I9t=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=E1(t,!0),n=E1(t),!e.startsWith("int")&&!e.startsWith("uint")&&(e="bytes")}return(e.startsWith("int")||e.startsWith("uint"))&&typeof n=="string"&&!/^(-)?0x/i.test(n)&&(n=vw(n)),[e,n]},F9t=t=>t.startsWith("int[")?`int256${t.slice(3)}`:t==="int"?"int256":t.startsWith("uint[")?`uint256'${t.slice(4)}`:t==="uint"?"uint256":t,_W=(t,e)=>{const n=/^(\d+).*$/.exec(t.slice(e));return n?parseInt(n[1],10):0},abe=t=>t.toString(2).length,obe=(t,e)=>{const n=e.toString();if(t==="string"){if(typeof e=="string")return km(e);throw new c7t(e)}if(t==="bool"||t==="boolean"){if(typeof e=="boolean")return e?"01":"00";throw new Rle(e)}if(t==="address"){if(!ih(n))throw new Lle(n);return n}const r=F9t(t);if(t.startsWith("uint")){const s=_W(r,4);if(s%8||s<8||s>256)throw new V1e(n);const a=af(n);if(abe(a)>s)throw new W1e(n);if(a<BigInt(0))throw new d7t(n);return s?kE(a.toString(16),s/8*2):a.toString(16)}if(t.startsWith("int")){const s=_W(r,3);if(s%8||s<8||s>256)throw new V1e(t);const a=af(n);if(abe(a)>s)throw new W1e(n);return a<BigInt(0)?iLe(a.toString(),s/8*2):s?kE(a.toString(16),s/4):a.toString(16)}if(r==="bytes"){if(n.replace(/^0x/i,"").length%2!==0)throw new L4(n);return n}if(t.startsWith("bytes")){if(n.replace(/^0x/i,"").length%2!==0)throw new L4(n);const s=_W(t,5);if(!s||s<1||s>64||s<n.replace(/^0x/i,"").length/2)throw new L4(n);return sLe(n,s*2)}return""},oLe=t=>{const[e,n]=I9t(t);return Array.isArray(n)?n.map(a=>obe(e,a).replace("0x","")).join(""):obe(e,n).replace("0x","")},Xle=(...t)=>`0x${t.map(oLe).join("").toLowerCase()}`,O9t=(...t)=>YT(Xle(...t)),M9t=(...t)=>ah(Xle(...t)),L9t=t=>YT(`0x${(typeof t=="number"?t.toString():t).padStart(64,"0")}`);function R9t(t){return kMe(t)}const PE=t=>R9t(t),D9t=t=>Ki(PE(t));var vU=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 lLe(t){return(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function cLe(t,e,n){return vU(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 Qle(t,e){let n;return[new Promise((s,a)=>{n=setInterval(function o(){return vU(this,void 0,void 0,function*(){try{const l=yield cLe(t,e);Nr(l)||(clearInterval(n),s(l))}catch(l){clearInterval(n),a(l)}}),o}(),e)}),n]}function B9t(t,e){return vU(this,void 0,void 0,function*(){return Qle(t,e)[0]})}function Zle(t,e){let n;const r=new Promise((s,a)=>{n=setTimeout(()=>{a(e)},t)});return[n,r]}function uLe(t,e){let n;const r=new Promise((s,a)=>{n=setInterval(()=>{vU(this,void 0,void 0,function*(){const o=yield t();o&&(clearInterval(n),a(o))})},e)});return[n,r]}const Jle=()=>{const t=PE(16);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Ki(t);return[e.substring(2,10),e.substring(10,14),e.substring(14,18),e.substring(18,22),e.substring(22,34)].join("-")},ece=t=>{const e=t.error.code;return Sd.has(e)||e>=-32099&&e<=-32e3},zy=t=>!Array.isArray(t)&&!!t&&t.jsonrpc==="2.0"&&"result"in t&&Nr(t.error)&&(typeof t.id=="number"||typeof t.id=="string"),Hy=t=>!Array.isArray(t)&&t.jsonrpc==="2.0"&&!!t&&Nr(t.result)&&"error"in t&&(typeof t.id=="number"||typeof t.id=="string"),wU=t=>!Array.isArray(t)&&!!t&&t.jsonrpc==="2.0"&&!Nr(t.params)&&!Nr(t.method),dLe=t=>!Array.isArray(t)&&!!t&&t.jsonrpc==="2.0"&&"id"in t&&"result"in t,yR=t=>zy(t)||Hy(t),tce=t=>Array.isArray(t)?t.every(yR):yR(t),IE=t=>Array.isArray(t)&&t.length>0&&tce(t);let CM;const fLe=t=>{CM=t},c5=t=>{var e,n,r,s;return typeof CM<"u"&&(CM+=1),{jsonrpc:(e=t.jsonrpc)!==null&&e!==void 0?e:"2.0",id:(r=(n=t.id)!==null&&n!==void 0?n:CM)!==null&&r!==void 0?r:Jle(),method:t.method,params:(s=t.params)!==null&&s!==void 0?s:void 0}},nce=t=>t.map(e=>c5(e)),h0=t=>Array.isArray(t)&&t.length>0,$9t=Object.freeze(Object.defineProperty({__proto__:null,isBatchRequest:h0,isBatchResponse:IE,isResponseRpcError:ece,isResponseWithError:Hy,isResponseWithNotification:wU,isResponseWithResult:zy,isSubscriptionResult:dLe,isValidResponse:tce,setRequestIdStart:fLe,toBatchPayload:nce,toPayload:c5,validateResponse:yR},Symbol.toStringTag,{value:"Module"}));var EW=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())})},hLe;class vR{constructor({timeout:e,eagerStart:n,timeoutMessage:r}={timeout:0,eagerStart:!1,timeoutMessage:"DeferredPromise timed out"}){this[hLe]="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 EW(this,void 0,void 0,function*(){return this._promise.then(e,n)})}catch(e){return EW(this,void 0,void 0,function*(){return this._promise.catch(e)})}finally(e){return EW(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 pMe(this._timeoutMessage))}_clearTimeout(){this._timeoutId&&clearTimeout(this._timeoutId)}}hLe=Symbol.toStringTag;class pLe{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 uU({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 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())})};class rce extends WT{constructor(){super(...arguments),this._eventEmitter=new Loe,this._chainId="",this._accounts=[]}_getChainId(){return lbe(this,void 0,void 0,function*(){var e;const n=yield this.request(c5({method:"eth_chainId",params:[]}));return(e=n==null?void 0:n.result)!==null&&e!==void 0?e:""})}_getAccounts(){return lbe(this,void 0,void 0,function*(){var e;const n=yield this.request(c5({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 p7t(e,n))}_onAccountsChanged(){this._eventEmitter.emit("accountsChanged",this._accounts)}}var kW=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 U9t={autoReconnect:!0,delay:5e3,maxAttempts:5},z9t=1e3;class mLe extends rce{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 Kte(e);this._socketPath=e,this._socketOptions=n,this._reconnectOptions=Object.assign(Object.assign({},U9t),r??{}),this._pendingRequestsQueue=new Map,this._sentRequestsQueue=new Map,this._init(),this.connect(),this.chunkResponseParser=new pLe(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 qT(`Error while connecting to ${this._socketPath}. Reason: ${e.message}`):new Kte(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??z9t;this._removeSocketListeners(),this.getStatus()!=="disconnected"&&this._closeSocketConnection(r,n),this._onDisconnect(r,n)}safeDisconnect(e,n){return kW(this,arguments,void 0,function*(r,s,a=!1,o=1e3){let l=0;yield kW(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 kAt),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 EAt(this._reconnectOptions.maxAttempts))))}request(e){return kW(this,void 0,void 0,function*(){if(oi(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 LAt("Request Id not defined");if(this._sentRequestsQueue.has(n))throw new TAt(n);const r=new vR;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(!(oi(n)||n.length===0))for(const r of n){if(wU(r)&&r.method.endsWith("_subscription")){this._eventEmitter.emit("message",r);return}const s=IE(r)?r[0].id:r.id,a=this._sentRequestsQueue.get(s);if(!a)return;(IE(r)||zy(r)||Hy(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 qte(e)),this._pendingRequestsQueue.delete(r)}),this._sentRequestsQueue.size>0&&this._sentRequestsQueue.forEach((n,r)=>{n.deferredPromise.reject(new qte(e)),this._sentRequestsQueue.delete(r)}),this._removeSocketListeners()}}const xLe=Object.freeze(Object.defineProperty({__proto__:null,ChunkResponseParser:pLe,Eip1193Provider:rce,EventEmitter:Yle,SocketProvider:mLe,Web3DeferredPromise:vR,asciiToHex:eLe,bytesToHex:Ki,bytesToUint8Array:mx,checkAddressCheckSum:v9t,compareBlockNumbers:E9t,convert:yU,convertScalarValue:TE,encodePacked:Xle,ethUnitMap:gU,format:es,fromAscii:p9t,fromDecimal:c9t,fromTwosComplement:k9t,fromUtf8:JMe,fromWei:x9t,getStorageSlotNumForLongString:L9t,hexToAscii:tLe,hexToBytes:xo,hexToNumber:KT,hexToNumberString:u9t,hexToString:h9t,hexToUtf8:bU,isAddress:w9t,isBatchRequest:h0,isBatchResponse:IE,isBloom:C9t,isContractAddressInBloom:j9t,isContractInitOptions:Ty,isDataFormat:Sg,isHex:y9t,isHexStrict:b9t,isInBloom:N9t,isNullish:oi,isPromise:lLe,isResponseRpcError:ece,isResponseWithError:Hy,isResponseWithNotification:wU,isResponseWithResult:zy,isSubscriptionResult:dLe,isTopic:A9t,isTopicInBloom:_9t,isUint8Array:I2,isUserEthereumAddressInBloom:S9t,isValidResponse:tce,jsonRpc:$9t,keccak256:MS,keccak256Wrapper:MS,leftPad:kE,mergeDeep:F2,numberToHex:lc,padLeft:OS,padRight:rLe,pollTillDefined:B9t,pollTillDefinedAndReturnIntervalId:Qle,processSolidityEncodePackedArgs:oLe,randomBytes:PE,randomHex:D9t,rejectIfConditionAtInterval:uLe,rejectIfTimeout:Zle,rightPad:sLe,setRequestIdStart:fLe,sha3:YT,sha3Raw:ah,soliditySha3:O9t,soliditySha3Raw:M9t,stringToHex:d9t,toAscii:m9t,toBatchPayload:nce,toBigInt:vw,toBool:nLe,toChecksumAddress:Nx,toDecimal:l9t,toHex:E1,toNumber:af,toPayload:c5,toTwosComplement:iLe,toUtf8:f9t,toWei:g9t,uint8ArrayConcat:Ad,uint8ArrayEquals:xU,utf8ToBytes:Kle,utf8ToHex:km,uuidV4:Jle,validateResponse:yR,waitWithTimeout:cLe},Symbol.toStringTag,{value:"Module"}));class CU{constructor(){this._emitter=new Yle}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 u5;(function(t){t.CONFIG_CHANGE="CONFIG_CHANGE"})(u5||(u5={}));class H9t extends CU{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:E1(25e8),enableExperimentalFeatures:{useSubscriptionWhenCheckingBlockTimeout:!1,useRpcCallSpecification:!1},transactionBuilder:void 0,transactionTypeParser:void 0,customTransactionSchema:void 0,defaultReturnFormat:yd,ignoreGasPricing:!1},this.setConfig(e??{})}setConfig(e){const n=Object.keys(e);for(const r of n)this._triggerConfigChange(r,e[r]),!oi(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(!oi(this.config.defaultCommon)&&!oi(this.config.defaultCommon.baseChain)&&e!==this.config.defaultCommon.baseChain)throw new K1e(this.config.defaultChain,e);this._triggerConfigChange("defaultChain",e),this.config.defaultChain=e}get defaultHardfork(){return this.config.defaultHardfork}set defaultHardfork(e){if(!oi(this.config.defaultCommon)&&!oi(this.config.defaultCommon.hardfork)&&e!==this.config.defaultCommon.hardfork)throw new G1e(this.config.defaultCommon.hardfork,e);this._triggerConfigChange("defaultHardfork",e),this.config.defaultHardfork=e}get defaultCommon(){return this.config.defaultCommon}set defaultCommon(e){if(!oi(this.config.defaultHardfork)&&!oi(e)&&!oi(e.hardfork)&&this.config.defaultHardfork!==e.hardfork)throw new G1e(this.config.defaultHardfork,e.hardfork);if(!oi(this.config.defaultChain)&&!oi(e)&&!oi(e.baseChain)&&this.config.defaultChain!==e.baseChain)throw new K1e(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(u5.CONFIG_CHANGE,{name:e,oldValue:this.config[e],newValue:n})}}var aF={exports:{}},cbe;function V9t(){return cbe||(cbe=1,function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Lu<"u"&&Lu,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(G){return G&&DataView.prototype.isPrototypeOf(G)}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(G){return G&&d.indexOf(Object.prototype.toString.call(G))>-1};function x(G){if(typeof G!="string"&&(G=String(G)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(G)||G==="")throw new TypeError('Invalid character in header field name: "'+G+'"');return G.toLowerCase()}function g(G){return typeof G!="string"&&(G=String(G)),G}function y(G){var ie={next:function(){var oe=G.shift();return{done:oe===void 0,value:oe}}};return c.iterable&&(ie[Symbol.iterator]=function(){return ie}),ie}function v(G){this.map={},G instanceof v?G.forEach(function(ie,oe){this.append(oe,ie)},this):Array.isArray(G)?G.forEach(function(ie){this.append(ie[0],ie[1])},this):G&&Object.getOwnPropertyNames(G).forEach(function(ie){this.append(ie,G[ie])},this)}v.prototype.append=function(G,ie){G=x(G),ie=g(ie);var oe=this.map[G];this.map[G]=oe?oe+", "+ie:ie},v.prototype.delete=function(G){delete this.map[x(G)]},v.prototype.get=function(G){return G=x(G),this.has(G)?this.map[G]:null},v.prototype.has=function(G){return this.map.hasOwnProperty(x(G))},v.prototype.set=function(G,ie){this.map[x(G)]=g(ie)},v.prototype.forEach=function(G,ie){for(var oe in this.map)this.map.hasOwnProperty(oe)&&G.call(ie,this.map[oe],oe,this)},v.prototype.keys=function(){var G=[];return this.forEach(function(ie,oe){G.push(oe)}),y(G)},v.prototype.values=function(){var G=[];return this.forEach(function(ie){G.push(ie)}),y(G)},v.prototype.entries=function(){var G=[];return this.forEach(function(ie,oe){G.push([oe,ie])}),y(G)},c.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function C(G){if(G.bodyUsed)return Promise.reject(new TypeError("Already read"));G.bodyUsed=!0}function S(G){return new Promise(function(ie,oe){G.onload=function(){ie(G.result)},G.onerror=function(){oe(G.error)}})}function T(G){var ie=new FileReader,oe=S(ie);return ie.readAsArrayBuffer(G),oe}function I(G){var ie=new FileReader,oe=S(ie);return ie.readAsText(G),oe}function L(G){for(var ie=new Uint8Array(G),oe=new Array(ie.length),K=0;K<ie.length;K++)oe[K]=String.fromCharCode(ie[K]);return oe.join("")}function F(G){if(G.slice)return G.slice(0);var ie=new Uint8Array(G.byteLength);return ie.set(new Uint8Array(G)),ie.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(G){this.bodyUsed=this.bodyUsed,this._bodyInit=G,G?typeof G=="string"?this._bodyText=G:c.blob&&Blob.prototype.isPrototypeOf(G)?this._bodyBlob=G:c.formData&&FormData.prototype.isPrototypeOf(G)?this._bodyFormData=G:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(G)?this._bodyText=G.toString():c.arrayBuffer&&c.blob&&u(G)?(this._bodyArrayBuffer=F(G.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(G)||f(G))?this._bodyArrayBuffer=F(G):this._bodyText=G=Object.prototype.toString.call(G):this._bodyText="",this.headers.get("content-type")||(typeof G=="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(G)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var G=C(this);if(G)return G;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 G=C(this);return G||(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(T)}),this.text=function(){var G=C(this);if(G)return G;if(this._bodyBlob)return I(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(L(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(re)}),this.json=function(){return this.text().then(JSON.parse)},this}var O=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function U(G){var ie=G.toUpperCase();return O.indexOf(ie)>-1?ie:G}function Y(G,ie){if(!(this instanceof Y))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');ie=ie||{};var oe=ie.body;if(G instanceof Y){if(G.bodyUsed)throw new TypeError("Already read");this.url=G.url,this.credentials=G.credentials,ie.headers||(this.headers=new v(G.headers)),this.method=G.method,this.mode=G.mode,this.signal=G.signal,!oe&&G._bodyInit!=null&&(oe=G._bodyInit,G.bodyUsed=!0)}else this.url=String(G);if(this.credentials=ie.credentials||this.credentials||"same-origin",(ie.headers||!this.headers)&&(this.headers=new v(ie.headers)),this.method=U(ie.method||this.method||"GET"),this.mode=ie.mode||this.mode||null,this.signal=ie.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&oe)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(oe),(this.method==="GET"||this.method==="HEAD")&&(ie.cache==="no-store"||ie.cache==="no-cache")){var K=/([?&])_=[^&]*/;if(K.test(this.url))this.url=this.url.replace(K,"$1_="+new Date().getTime());else{var H=/\?/;this.url+=(H.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Y.prototype.clone=function(){return new Y(this,{body:this._bodyInit})};function re(G){var ie=new FormData;return G.trim().split("&").forEach(function(oe){if(oe){var K=oe.split("="),H=K.shift().replace(/\+/g," "),ee=K.join("=").replace(/\+/g," ");ie.append(decodeURIComponent(H),decodeURIComponent(ee))}}),ie}function Q(G){var ie=new v,oe=G.replace(/\r?\n[\t ]+/g," ");return oe.split("\r").map(function(K){return K.indexOf(`
`)===0?K.substr(1,K.length):K}).forEach(function(K){var H=K.split(":"),ee=H.shift().trim();if(ee){var se=H.join(":").trim();ie.append(ee,se)}}),ie}$.call(Y.prototype);function q(G,ie){if(!(this instanceof q))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');ie||(ie={}),this.type="default",this.status=ie.status===void 0?200:ie.status,this.ok=this.status>=200&&this.status<300,this.statusText=ie.statusText===void 0?"":""+ie.statusText,this.headers=new v(ie.headers),this.url=ie.url||"",this._initBody(G)}$.call(q.prototype),q.prototype.clone=function(){return new q(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},q.error=function(){var G=new q(null,{status:0,statusText:""});return G.type="error",G};var te=[301,302,303,307,308];q.redirect=function(G,ie){if(te.indexOf(ie)===-1)throw new RangeError("Invalid status code");return new q(null,{status:ie,headers:{location:G}})},o.DOMException=l.DOMException;try{new o.DOMException}catch{o.DOMException=function(ie,oe){this.message=ie,this.name=oe;var K=Error(ie);this.stack=K.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function fe(G,ie){return new Promise(function(oe,K){var H=new Y(G,ie);if(H.signal&&H.signal.aborted)return K(new o.DOMException("Aborted","AbortError"));var ee=new XMLHttpRequest;function se(){ee.abort()}ee.onload=function(){var Se={status:ee.status,statusText:ee.statusText,headers:Q(ee.getAllResponseHeaders()||"")};Se.url="responseURL"in ee?ee.responseURL:Se.headers.get("X-Request-URL");var ge="response"in ee?ee.response:ee.responseText;setTimeout(function(){oe(new q(ge,Se))},0)},ee.onerror=function(){setTimeout(function(){K(new TypeError("Network request failed"))},0)},ee.ontimeout=function(){setTimeout(function(){K(new TypeError("Network request failed"))},0)},ee.onabort=function(){setTimeout(function(){K(new o.DOMException("Aborted","AbortError"))},0)};function pe(Se){try{return Se===""&&l.location.href?l.location.href:Se}catch{return Se}}ee.open(H.method,pe(H.url),!0),H.credentials==="include"?ee.withCredentials=!0:H.credentials==="omit"&&(ee.withCredentials=!1),"responseType"in ee&&(c.blob?ee.responseType="blob":c.arrayBuffer&&H.headers.get("Content-Type")&&H.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(ee.responseType="arraybuffer")),ie&&typeof ie.headers=="object"&&!(ie.headers instanceof v)?Object.getOwnPropertyNames(ie.headers).forEach(function(Se){ee.setRequestHeader(Se,g(ie.headers[Se]))}):H.headers.forEach(function(Se,ge){ee.setRequestHeader(ge,Se)}),H.signal&&(H.signal.addEventListener("abort",se),ee.onreadystatechange=function(){ee.readyState===4&&H.signal.removeEventListener("abort",se)}),ee.send(typeof H._bodyInit>"u"?null:H._bodyInit)})}return fe.polyfill=!0,l.fetch||(l.fetch=fe,l.Headers=v,l.Request=Y,l.Response=q),o.Headers=v,o.Request=Y,o.Response=q,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}(aF,aF.exports)),aF.exports}var W9t=V9t();const q9t=Pi(W9t);var G9t=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 NU extends WT{constructor(e,n){if(super(),!NU.validateClientUrl(e))throw new Kte(e);this.clientUrl=e,this.httpProviderOptions=n}static validateClientUrl(e){return typeof e=="string"?/^http(s)?:\/\//i.test(e):!1}getStatus(){throw new Qx}supportsSubscriptions(){return!1}request(e,n){var r;return G9t(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 q9t(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 F0(yield a.json(),void 0,void 0,a.status);return yield a.json()})}on(){throw new Qx}removeListener(){throw new Qx}once(){throw new Qx}removeAllListeners(){throw new Qx}connect(){throw new Qx}disconnect(){throw new Qx}reset(){throw new Qx}reconnect(){throw new Qx}}var QC=null;typeof WebSocket<"u"?QC=WebSocket:typeof MozWebSocket<"u"?QC=MozWebSocket:typeof global<"u"?QC=global.WebSocket||global.MozWebSocket:typeof window<"u"?QC=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(QC=self.WebSocket||self.MozWebSocket);const K9t=QC;class gLe extends mLe{constructor(e,n,r){super(e,n,r)}_validateProviderPath(e){return typeof e=="string"?/^ws(s)?:\/\//i.test(e):!1}getStatus(){if(this._socketConnection&&!oi(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 K9t(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 qte;(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 bLe=t=>WT.isWeb3Provider(t),yLe=t=>typeof t!="string"&&"request"in t&&t.request.constructor.name==="Function",vLe=t=>typeof t!="string"&&"request"in t&&t.request.constructor.name==="AsyncFunction",wLe=t=>typeof t!="string"&&"send"in t,CLe=t=>typeof t!="string"&&"sendAsync"in t,wR=t=>t&&(bLe(t)||vLe(t)||yLe(t)||CLe(t)||wLe(t)),Y9t=t=>t&&"supportsSubscriptions"in t?t.supportsSubscriptions():!!(t&&typeof t!="string"&&"on"in t);var TW=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())})},LS;(function(t){t.PROVIDER_CHANGED="PROVIDER_CHANGED",t.BEFORE_PROVIDER_CHANGE="BEFORE_PROVIDER_CHANGE"})(LS||(LS={}));const ube={HttpProvider:NU,WebsocketProvider:gLe};class S3 extends CU{constructor(e,n,r){super(),oi(e)||this.setProvider(e),this.useRpcCallSpecification=n,oi(r)||(this.middleware=r)}static get providers(){return ube}get provider(){return this._provider}get providers(){return ube}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 gM(`Can't autodetect provider for "${e}"`);else oi(e)?n=void 0:n=e;return this.emit(LS.BEFORE_PROVIDER_CHANGE,this._provider),this._provider=n,this.emit(LS.PROVIDER_CHANGED,this._provider),!0}setMiddleware(e){this.middleware=e}send(e){return TW(this,void 0,void 0,function*(){const n=Object.assign({},e);let r=yield this._sendRequest(n);if(oi(this.middleware)||(r=yield this.middleware.processResponse(r)),zy(r))return r.result;throw new F0(r)})}sendBatch(e){return TW(this,void 0,void 0,function*(){return yield this._sendRequest(e)})}_sendRequest(e){return TW(this,void 0,void 0,function*(){const{provider:n}=this;if(oi(n))throw new gM("Provider not available. Use `.setProvider` or `.provider=` to initialize the provider.");let r=h0(e)?nce(e):c5(e);if(oi(this.middleware)||(r=yield this.middleware.processRequest(r)),bLe(n)){let s;try{s=yield n.request(r)}catch(a){s=a}return this._processJsonRpcResponse(r,s,{legacy:!1,error:!1})}if(vLe(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(yLe(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));lLe(c)&&c.then(l).catch(d=>{try{const f=this._processJsonRpcResponse(r,d,{legacy:!0,error:!0});a(f)}catch(f){a(f)}})});if(wLe(n))return new Promise((s,a)=>{n.send(r,(o,l)=>{if(o)return a(this._processJsonRpcResponse(r,o,{legacy:!0,error:!0}));if(oi(l))throw new F0({},'Got a "nullish" response from provider.');return s(this._processJsonRpcResponse(r,l,{legacy:!0,error:!1}))})});if(CLe(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 gM("Provider does not have a request or send method to use.")})}_processJsonRpcResponse(e,n,{legacy:r,error:s}){if(oi(n))return this._buildResponse(e,null,s);if(Hy(n)){if(this.useRpcCallSpecification&&ece(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(!S3._isReverted(n))throw new uU(n,e)}if(zy(n))return n;if(n instanceof Error)throw S3._isReverted(n),n;if(!r&&h0(e)&&IE(n)||r&&!s&&h0(e))return n;if(r&&s&&h0(e))throw n;if(r&&!Hy(n)&&!zy(n))return this._buildResponse(e,n,s);throw h0(e)&&!Array.isArray(n)?new F0(n,"Got normal response for a batch request."):!h0(e)&&Array.isArray(n)?new F0(n,"Got batch response for a normal request."):new F0(n,"Invalid response")}static _isReverted(e){let n;if(Hy(e)?n=e.error:e instanceof Error&&(n=e),n!=null&&n.message.includes("revert"))throw new C3(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 c7=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 CR{constructor(e,n,r=!1){this.requestManager=e,this.registeredSubscriptions=n,this.tolerateUnlinkedSubscription=r,this._subscriptions=new Map,this.requestManager.on(LS.BEFORE_PROVIDER_CHANGE,()=>c7(this,void 0,void 0,function*(){yield this.unsubscribe()})),this.requestManager.on(LS.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 yg("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 c7(this,arguments,void 0,function*(r,s,a=yd){const o=this.registeredSubscriptions[r];if(!o)throw new yg("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 c7(this,void 0,void 0,function*(){if(!this.requestManager.provider)throw new gM("Provider not available");if(!this.supportsSubscriptions())throw new yg("The current provider does not support subscriptions");if(e.id&&this._subscriptions.has(e.id))throw new yg(`Subscription with id "${e.id}" already exists`);if(yield e.sendSubscriptionRequest(),oi(e.id))throw new yg("Subscription is not subscribed yet.");return this._subscriptions.set(e.id,e),e.id})}removeSubscription(e){return c7(this,void 0,void 0,function*(){const{id:n}=e;if(oi(n))throw new yg("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 yg(`Subscription with id "${n.toString()}" does not exists`);return yield e.sendUnsubscribeRequest(),this._subscriptions.delete(n),n})}unsubscribe(e){return c7(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 oi(this.requestManager.provider)?!1:Y9t(this.requestManager.provider)}}var u7=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 XT extends CU{constructor(e,n){var r;super(),this.args=e;const{requestManager:s}=n,{subscriptionManager:a}=n;s?this._subscriptionManager=new CR(s,{},!0):this._subscriptionManager=a,this._returnFormat=(r=n==null?void 0:n.returnFormat)!==null&&r!==void 0?r:yd}get id(){return this._id}get lastBlock(){return this._lastBlock}subscribe(){return u7(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&&wU(e)&&this._processSubscriptionResult(e==null?void 0:e.params.result)}sendSubscriptionRequest(){return u7(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 u7(this,void 0,void 0,function*(){yield this.unsubscribe(),yield this.subscribe()})}unsubscribe(){return u7(this,void 0,void 0,function*(){this.id&&(yield this._subscriptionManager.removeSubscription(this))})}sendUnsubscribeRequest(){return u7(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 hC=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 NR extends Ljt{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")&&!Nr(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 Nr(n)?void 0:this[n]}return this[e]}remove(e){if(typeof e=="string"){const n=this._addressMap.get(e.toLowerCase());return Nr(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 hC(this,void 0,void 0,function*(){return Promise.all(this.map(r=>hC(this,void 0,void 0,function*(){return r.encrypt(e,n)})))})}decrypt(e,n,r){return hC(this,void 0,void 0,function*(){const s=yield Promise.all(e.map(a=>hC(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 hC(this,void 0,void 0,function*(){const r=NR.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 hC(this,void 0,void 0,function*(){const r=NR.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 B0={web:bM};function NLe(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 SLe(t,e,n){if(!B0.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 B0.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 sce(t,e,n,r="aes-128-ctr",s=!0){if(NLe(e,n,r),B0.web){const[a,o]=await SLe(r,e,n),l=await B0.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(B0.node){const a=B0.node.createCipheriv(r,e,n);return a.setAutoPadding(s),oR(a.update(t),a.final())}else throw new Error("The environment doesn't have AES module")}async function X9t(t,e,n,r){const s=t.slice(-16);for(let o=0;o<16;o++)s[o]^=n[o]^16;return(await sce(s,e,n,r)).slice(0,16)}async function Q9t(t,e,n,r="aes-128-ctr",s=!0){if(NLe(e,n,r),B0.web){const[a,o]=await SLe(r,e,n);if(!s&&o.name==="aes-cbc"){const u=await X9t(t,e,n,r);t=oR(t,u)}const l=await B0.web.subtle.decrypt(o,a,t),c=new Uint8Array(l);if(o.name==="aes-cbc"){const u=await sce(c,e,n,r);if(!G7t(u,t))throw new Error("AES: wrong padding")}return c}else if(B0.node){const a=B0.node.createDecipheriv(r,e,n);return a.setAutoPadding(s),oR(a.update(t),a.final())}else throw new Error("The environment doesn't have AES module")}class jLe extends $le{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,Dle(e);const r=ES(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 r5(this),this.iHash.update(e),this}digestInto(e){r5(this),x8(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 ice=(t,e,n)=>new jLe(t,e).update(n).digest();ice.create=(t,e)=>new jLe(t,e);function Z9t(t,e,n,r){Dle(t);const s=_Me({dkLen:32,asyncTick:10},r),{c:a,dkLen:o,asyncTick:l}=s;if(tf(a),tf(o),tf(l),a<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=ES(e),u=ES(n),d=new Uint8Array(o),f=ice.create(t,c),x=f._cloneInto().update(u);return{c:a,dkLen:o,asyncTick:l,DK:d,PRF:f,PRFSalt:x}}function J9t(t,e,n,r,s){return t.destroy(),e.destroy(),r&&r.destroy(),s.fill(0),n}function ace(t,e,n,r){const{c:s,dkLen:a,DK:o,PRF:l,PRFSalt:c}=Z9t(t,e,n,r);let u;const d=new Uint8Array(4),f=vM(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 S=0;S<v.length;S++)v[S]^=x[S]}}return J9t(l,c,o,u,x)}function eEt(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,nEt=(t,e,n)=>t&e^t&n^e&n;class rEt extends $le{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=vM(this.buffer)}update(e){r5(this);const{view:n,buffer:r,blockLen:s}=this;e=ES(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=vM(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){r5(this),Ble(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;eEt(r,s-8,BigInt(this.length*8),a),this.process(r,0);const l=vM(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 sEt=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]),Ab=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_b=new Uint32Array(64);class iEt extends rEt{constructor(){super(64,32,8,!1),this.A=Ab[0]|0,this.B=Ab[1]|0,this.C=Ab[2]|0,this.D=Ab[3]|0,this.E=Ab[4]|0,this.F=Ab[5]|0,this.G=Ab[6]|0,this.H=Ab[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)_b[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const x=_b[f-15],g=_b[f-2],y=a0(x,7)^a0(x,18)^x>>>3,v=a0(g,17)^a0(g,19)^g>>>10;_b[f]=v+_b[f-7]+y+_b[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)+sEt[f]+_b[f]|0,v=(a0(r,2)^a0(r,13)^a0(r,22))+nEt(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(){_b.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const SU=EMe(()=>new iEt);function ALe(t,e,n,r,s){if(!["sha256","sha512"].includes(s))throw new Error("Only sha256 and sha512 are supported");return lR(t),lR(e),ace(SU,t,e,{c:n,dkLen:r})}function dbe(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++],S=t[e++]^n[r++],T=t[e++]^n[r++],I=t[e++]^n[r++],L=t[e++]^n[r++],F=t[e++]^n[r++],$=o,O=l,U=c,Y=u,re=d,Q=f,q=x,te=g,fe=y,G=v,ie=C,oe=S,K=T,H=I,ee=L,se=F;for(let pe=0;pe<8;pe+=2)re^=wa($+K|0,7),fe^=wa(re+$|0,9),K^=wa(fe+re|0,13),$^=wa(K+fe|0,18),G^=wa(Q+O|0,7),H^=wa(G+Q|0,9),O^=wa(H+G|0,13),Q^=wa(O+H|0,18),ee^=wa(ie+q|0,7),U^=wa(ee+ie|0,9),q^=wa(U+ee|0,13),ie^=wa(q+U|0,18),Y^=wa(se+oe|0,7),te^=wa(Y+se|0,9),oe^=wa(te+Y|0,13),se^=wa(oe+te|0,18),O^=wa($+Y|0,7),U^=wa(O+$|0,9),Y^=wa(U+O|0,13),$^=wa(Y+U|0,18),q^=wa(Q+re|0,7),te^=wa(q+Q|0,9),re^=wa(te+q|0,13),Q^=wa(re+te|0,18),oe^=wa(ie+G|0,7),fe^=wa(oe+ie|0,9),G^=wa(fe+oe|0,13),ie^=wa(G+fe|0,18),K^=wa(se+ee|0,7),H^=wa(K+se|0,9),ee^=wa(H+K|0,13),se^=wa(ee+H|0,18);s[a++]=o+$|0,s[a++]=l+O|0,s[a++]=c+U|0,s[a++]=u+Y|0,s[a++]=d+re|0,s[a++]=f+Q|0,s[a++]=x+q|0,s[a++]=g+te|0,s[a++]=y+fe|0,s[a++]=v+G|0,s[a++]=C+ie|0,s[a++]=S+oe|0,s[a++]=T+K|0,s[a++]=I+H|0,s[a++]=L+ee|0,s[a++]=F+se|0}function PW(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)dbe(n,o,t,e,n,a),l>0&&(o+=16),dbe(n,a,t,e+=16,n,o)}function aEt(t,e,n){const r=_Me({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:s,r:a,p:o,dkLen:l,asyncTick:c,maxmem:u,onProgress:d}=r;if(tf(s),tf(a),tf(o),tf(l),tf(c),tf(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=ace(SU,t,e,{c:1,dkLen:f*o}),v=yM(y),C=yM(new Uint8Array(f*s)),S=yM(new Uint8Array(f));let T=()=>{};if(d){const I=2*s*o,L=Math.max(Math.floor(I/1e4),1);let F=0;T=()=>{F++,d&&(!(F%L)||F===I)&&d(F/I)}}return{N:s,r:a,p:o,dkLen:l,blockSize32:x,V:C,B32:v,B:y,tmp:S,blockMixCb:T,asyncTick:c}}function oEt(t,e,n,r,s){const a=ace(SU,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}=aEt(t,e,n);iR||aR(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++)PW(c,C,c,C+=l,s),x();PW(c,(r-1)*l,u,y,s),x();for(let v=0;v<r;v++){const C=u[y+l-16]%r;for(let S=0;S<l;S++)f[S]=u[y+S]^c[C*l+S];PW(f,0,u,y,s),x()}}return iR||aR(u),oEt(t,o,d,c,f)}function _Le(t,e,n,r,s,a,o){return lR(t),lR(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 ELe=BigInt(0),jU=BigInt(1),cEt=BigInt(2);function d5(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function QT(t){if(!d5(t))throw new Error("Uint8Array expected")}const uEt=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function RS(t){QT(t);let e="";for(let n=0;n<t.length;n++)e+=uEt[t[n]];return e}function kLe(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function oce(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}const Jx={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function fbe(t){if(t>=Jx._0&&t<=Jx._9)return t-Jx._0;if(t>=Jx._A&&t<=Jx._F)return t-(Jx._A-10);if(t>=Jx._a&&t<=Jx._f)return t-(Jx._a-10)}function DS(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=fbe(t.charCodeAt(a)),l=fbe(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 j3(t){return oce(RS(t))}function lce(t){return QT(t),oce(RS(Uint8Array.from(t).reverse()))}function BS(t,e){return DS(t.toString(16).padStart(e*2,"0"))}function cce(t,e){return BS(t,e).reverse()}function dEt(t){return DS(kLe(t))}function Yp(t,e,n){let r;if(typeof e=="string")try{r=DS(e)}catch(a){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${a}`)}else if(d5(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 FE(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];QT(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 fEt(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 hEt(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function pEt(t){let e;for(e=0;t>ELe;t>>=jU,e+=1);return e}function mEt(t,e){return t>>BigInt(e)&jU}function xEt(t,e,n){return t|(n?jU:ELe)<<BigInt(e)}const uce=t=>(cEt<<BigInt(t-1))-jU,IW=t=>new Uint8Array(t),hbe=t=>Uint8Array.from(t);function TLe(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=IW(t),s=IW(t),a=0;const o=()=>{r.fill(1),s.fill(0),a=0},l=(...f)=>n(s,r,...f),c=(f=IW())=>{s=l(hbe([0]),f),r=l(),f.length!==0&&(s=l(hbe([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 FE(...x)};return(f,x)=>{o(),c(f);let g;for(;!(g=x(u()));)c();return o(),g}}const gEt={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"||d5(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 ZT(t,e,n={}){const r=(s,a,o)=>{const l=gEt[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 bEt=Object.freeze(Object.defineProperty({__proto__:null,abytes:QT,bitGet:mEt,bitLen:pEt,bitMask:uce,bitSet:xEt,bytesToHex:RS,bytesToNumberBE:j3,bytesToNumberLE:lce,concatBytes:FE,createHmacDrbg:TLe,ensureBytes:Yp,equalBytes:fEt,hexToBytes:DS,hexToNumber:oce,isBytes:d5,numberToBytesBE:BS,numberToBytesLE:cce,numberToHexUnpadded:kLe,numberToVarBytesBE:dEt,utf8ToBytes:hEt,validateObject:ZT},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mc=BigInt(0),Al=BigInt(1),ow=BigInt(2),yEt=BigInt(3),sne=BigInt(4),pbe=BigInt(5),mbe=BigInt(8);BigInt(9);BigInt(16);function Zd(t,e){const n=t%e;return n>=Mc?n:e+n}function vEt(t,e,n){if(n<=Mc||e<Mc)throw new Error("Expected power/modulo > 0");if(n===Al)return Mc;let r=Al;for(;e>Mc;)e&Al&&(r=r*t%n),t=t*t%n,e>>=Al;return r}function kh(t,e,n){let r=t;for(;e-- >Mc;)r*=r,r%=n;return r}function ine(t,e){if(t===Mc||e<=Mc)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Zd(t,e),r=e,s=Mc,a=Al;for(;n!==Mc;){const l=r/n,c=r%n,u=s-a*l;r=n,n=c,s=a,a=u}if(r!==Al)throw new Error("invert: does not exist");return Zd(s,e)}function wEt(t){const e=(t-Al)/ow;let n,r,s;for(n=t-Al,r=0;n%ow===Mc;n/=ow,r++);for(s=ow;s<t&&vEt(s,e,t)!==t-Al;s++);if(r===1){const o=(t+Al)/sne;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+Al)/ow;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,Al<<BigInt(u-g-1));d=l.sqr(y),f=l.mul(f,y),x=l.mul(x,d),u=g}return f}}function CEt(t){if(t%sne===yEt){const e=(t+Al)/sne;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%mbe===pbe){const e=(t-pbe)/mbe;return function(r,s){const a=r.mul(s,ow),o=r.pow(a,e),l=r.mul(s,o),c=r.mul(r.mul(l,ow),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 wEt(t)}const NEt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function SEt(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=NEt.reduce((r,s)=>(r[s]="function",r),e);return ZT(t,n)}function jEt(t,e,n){if(n<Mc)throw new Error("Expected power > 0");if(n===Mc)return t.ONE;if(n===Al)return e;let r=t.ONE,s=e;for(;n>Mc;)n&Al&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Al;return r}function AEt(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 PLe(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function _Et(t,e,n=!1,r={}){if(t<=Mc)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:a}=PLe(t,e);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=CEt(t),l=Object.freeze({ORDER:t,BITS:s,BYTES:a,MASK:uce(s),ZERO:Mc,ONE:Al,create:c=>Zd(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Mc<=c&&c<t},is0:c=>c===Mc,isOdd:c=>(c&Al)===Al,neg:c=>Zd(-c,t),eql:(c,u)=>c===u,sqr:c=>Zd(c*c,t),add:(c,u)=>Zd(c+u,t),sub:(c,u)=>Zd(c-u,t),mul:(c,u)=>Zd(c*u,t),pow:(c,u)=>jEt(l,c,u),div:(c,u)=>Zd(c*ine(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>ine(c,t),sqrt:r.sqrt||(c=>o(l,c)),invertBatch:c=>AEt(l,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?cce(c,a):BS(c,a),fromBytes:c=>{if(c.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${c.length}`);return n?lce(c):j3(c)}});return Object.freeze(l)}function ILe(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 FLe(t){const e=ILe(t);return e+Math.ceil(e/2)}function EEt(t,e,n=!1){const r=t.length,s=ILe(e),a=FLe(e);if(r<16||r<a||r>1024)throw new Error(`expected ${a}-1024 bytes of input, got ${r}`);const o=n?j3(t):lce(t),l=Zd(o,e-Al)+Al;return n?cce(l,s):BS(l,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const kEt=BigInt(0),FW=BigInt(1);function TEt(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>kEt;)a&FW&&(o=o.add(l)),l=l.double(),a>>=FW;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+=FW);const S=v,T=v+Math.abs(C)-1,I=y%2!==0,L=C<0;C===0?d=d.add(n(I,a[S])):u=u.add(n(L,a[T]))}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 OLe(t){return SEt(t.Fp),ZT(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...PLe(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function PEt(t){const e=OLe(t);ZT(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:IEt,hexToBytes:FEt}=bEt,ww={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=ww;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:IEt(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=ww,n=typeof t=="string"?FEt(t):t;QT(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}=ww._parseInt(n.subarray(2)),{d:o,l}=ww._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}`}},zg=BigInt(0),Jh=BigInt(1);BigInt(2);const xbe=BigInt(3);BigInt(4);function OEt(t){const e=PEt(t),{Fp:n}=e,r=e.toBytes||((y,v,C)=>{const S=v.toAffine();return FE(Uint8Array.from([4]),n.toBytes(S.x),n.toBytes(S.y))}),s=e.fromBytes||(y=>{const v=y.subarray(1),C=n.fromBytes(v.subarray(0,n.BYTES)),S=n.fromBytes(v.subarray(n.BYTES,2*n.BYTES));return{x:C,y:S}});function a(y){const{a:v,b:C}=e,S=n.sqr(y),T=n.mul(S,y);return n.add(n.add(T,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"&&zg<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:S,n:T}=e;if(v&&typeof y!="bigint"){if(d5(y)&&(y=RS(y)),typeof y!="string"||!v.includes(y.length))throw new Error("Invalid key");y=y.padStart(C*2,"0")}let I;try{I=typeof y=="bigint"?y:j3(Yp("private key",y,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof y}`)}return S&&(I=Zd(I,T)),l(I),I}const u=new Map;function d(y){if(!(y instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(v,C,S){if(this.px=v,this.py=C,this.pz=S,v==null||!n.isValid(v))throw new Error("x required");if(C==null||!n.isValid(C))throw new Error("y required");if(S==null||!n.isValid(S))throw new Error("z required")}static fromAffine(v){const{x:C,y:S}=v||{};if(!v||!n.isValid(C)||!n.isValid(S))throw new Error("invalid affine point");if(v instanceof f)throw new Error("projective point not allowed");const T=I=>n.eql(I,n.ZERO);return T(C)&&T(S)?f.ZERO:new f(C,S,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){const C=n.invertBatch(v.map(S=>S.pz));return v.map((S,T)=>S.toAffine(C[T])).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 S=n.sqr(C),T=a(v);if(!n.eql(S,T))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:S,pz:T}=this,{px:I,py:L,pz:F}=v,$=n.eql(n.mul(C,F),n.mul(I,T)),O=n.eql(n.mul(S,F),n.mul(L,T));return $&&O}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:v,b:C}=e,S=n.mul(C,xbe),{px:T,py:I,pz:L}=this;let F=n.ZERO,$=n.ZERO,O=n.ZERO,U=n.mul(T,T),Y=n.mul(I,I),re=n.mul(L,L),Q=n.mul(T,I);return Q=n.add(Q,Q),O=n.mul(T,L),O=n.add(O,O),F=n.mul(v,O),$=n.mul(S,re),$=n.add(F,$),F=n.sub(Y,$),$=n.add(Y,$),$=n.mul(F,$),F=n.mul(Q,F),O=n.mul(S,O),re=n.mul(v,re),Q=n.sub(U,re),Q=n.mul(v,Q),Q=n.add(Q,O),O=n.add(U,U),U=n.add(O,U),U=n.add(U,re),U=n.mul(U,Q),$=n.add($,U),re=n.mul(I,L),re=n.add(re,re),U=n.mul(re,Q),F=n.sub(F,U),O=n.mul(re,Y),O=n.add(O,O),O=n.add(O,O),new f(F,$,O)}add(v){d(v);const{px:C,py:S,pz:T}=this,{px:I,py:L,pz:F}=v;let $=n.ZERO,O=n.ZERO,U=n.ZERO;const Y=e.a,re=n.mul(e.b,xbe);let Q=n.mul(C,I),q=n.mul(S,L),te=n.mul(T,F),fe=n.add(C,S),G=n.add(I,L);fe=n.mul(fe,G),G=n.add(Q,q),fe=n.sub(fe,G),G=n.add(C,T);let ie=n.add(I,F);return G=n.mul(G,ie),ie=n.add(Q,te),G=n.sub(G,ie),ie=n.add(S,T),$=n.add(L,F),ie=n.mul(ie,$),$=n.add(q,te),ie=n.sub(ie,$),U=n.mul(Y,G),$=n.mul(re,te),U=n.add($,U),$=n.sub(q,U),U=n.add(q,U),O=n.mul($,U),q=n.add(Q,Q),q=n.add(q,Q),te=n.mul(Y,te),G=n.mul(re,G),q=n.add(q,te),te=n.sub(Q,te),te=n.mul(Y,te),G=n.add(G,te),Q=n.mul(q,G),O=n.add(O,Q),Q=n.mul(ie,G),$=n.mul(fe,$),$=n.sub($,Q),Q=n.mul(fe,q),U=n.mul(ie,U),U=n.add(U,Q),new f($,O,U)}subtract(v){return this.add(v.negate())}is0(){return this.equals(f.ZERO)}wNAF(v){return g.wNAFCached(this,u,v,C=>{const S=n.invertBatch(C.map(T=>T.pz));return C.map((T,I)=>T.toAffine(S[I])).map(f.fromAffine)})}multiplyUnsafe(v){const C=f.ZERO;if(v===zg)return C;if(l(v),v===Jh)return this;const{endo:S}=e;if(!S)return g.unsafeLadder(this,v);let{k1neg:T,k1:I,k2neg:L,k2:F}=S.splitScalar(v),$=C,O=C,U=this;for(;I>zg||F>zg;)I&Jh&&($=$.add(U)),F&Jh&&(O=O.add(U)),U=U.double(),I>>=Jh,F>>=Jh;return T&&($=$.negate()),L&&(O=O.negate()),O=new f(n.mul(O.px,S.beta),O.py,O.pz),$.add(O)}multiply(v){l(v);let C=v,S,T;const{endo:I}=e;if(I){const{k1neg:L,k1:F,k2neg:$,k2:O}=I.splitScalar(C);let{p:U,f:Y}=this.wNAF(F),{p:re,f:Q}=this.wNAF(O);U=g.constTimeNegate(L,U),re=g.constTimeNegate($,re),re=new f(n.mul(re.px,I.beta),re.py,re.pz),S=U.add(re),T=Y.add(Q)}else{const{p:L,f:F}=this.wNAF(C);S=L,T=F}return f.normalizeZ([S,T])[0]}multiplyAndAddUnsafe(v,C,S){const T=f.BASE,I=(F,$)=>$===zg||$===Jh||!F.equals(T)?F.multiplyUnsafe($):F.multiply($),L=I(this,C).add(I(v,S));return L.is0()?void 0:L}toAffine(v){const{px:C,py:S,pz:T}=this,I=this.is0();v==null&&(v=I?n.ONE:n.inv(T));const L=n.mul(C,v),F=n.mul(S,v),$=n.mul(T,v);if(I)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:L,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 RS(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=TEt(f,e.endo?Math.ceil(x/2):x);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:o}}function MEt(t){const e=OLe(t);return ZT(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function LEt(t){const e=MEt(t),{Fp:n,n:r}=e,s=n.BYTES+1,a=2*n.BYTES+1;function o(G){return zg<G&&G<n.ORDER}function l(G){return Zd(G,r)}function c(G){return ine(G,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:x}=OEt({...e,toBytes(G,ie,oe){const K=ie.toAffine(),H=n.toBytes(K.x),ee=FE;return oe?ee(Uint8Array.from([ie.hasEvenY()?2:3]),H):ee(Uint8Array.from([4]),H,n.toBytes(K.y))},fromBytes(G){const ie=G.length,oe=G[0],K=G.subarray(1);if(ie===s&&(oe===2||oe===3)){const H=j3(K);if(!o(H))throw new Error("Point is not on curve");const ee=f(H);let se;try{se=n.sqrt(ee)}catch(ge){const ve=ge instanceof Error?": "+ge.message:"";throw new Error("Point is not on curve"+ve)}const pe=(se&Jh)===Jh;return(oe&1)===1!==pe&&(se=n.neg(se)),{x:H,y:se}}else if(ie===a&&oe===4){const H=n.fromBytes(K.subarray(0,n.BYTES)),ee=n.fromBytes(K.subarray(n.BYTES,2*n.BYTES));return{x:H,y:ee}}else throw new Error(`Point of length ${ie} was invalid. Expected ${s} compressed bytes or ${a} uncompressed bytes`)}}),g=G=>RS(BS(G,e.nByteLength));function y(G){const ie=r>>Jh;return G>ie}function v(G){return y(G)?l(-G):G}const C=(G,ie,oe)=>j3(G.slice(ie,oe));class S{constructor(ie,oe,K){this.r=ie,this.s=oe,this.recovery=K,this.assertValidity()}static fromCompact(ie){const oe=e.nByteLength;return ie=Yp("compactSignature",ie,oe*2),new S(C(ie,0,oe),C(ie,oe,2*oe))}static fromDER(ie){const{r:oe,s:K}=ww.toSig(Yp("DER",ie));return new S(oe,K)}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(ie){return new S(this.r,this.s,ie)}recoverPublicKey(ie){const{r:oe,s:K,recovery:H}=this,ee=O(Yp("msgHash",ie));if(H==null||![0,1,2,3].includes(H))throw new Error("recovery id invalid");const se=H===2||H===3?oe+e.n:oe;if(se>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const pe=H&1?"03":"02",Se=u.fromHex(pe+g(se)),ge=c(se),ve=l(-ee*ge),be=l(K*ge),we=u.BASE.multiplyAndAddUnsafe(Se,ve,be);if(!we)throw new Error("point at infinify");return we.assertValidity(),we}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new S(this.r,l(-this.s),this.recovery):this}toDERRawBytes(){return DS(this.toDERHex())}toDERHex(){return ww.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return DS(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const T={isValidPrivateKey(G){try{return d(G),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const G=FLe(e.n);return EEt(e.randomBytes(G),e.n)},precompute(G=8,ie=u.BASE){return ie._setWindowSize(G),ie.multiply(BigInt(3)),ie}};function I(G,ie=!0){return u.fromPrivateKey(G).toRawBytes(ie)}function L(G){const ie=d5(G),oe=typeof G=="string",K=(ie||oe)&&G.length;return ie?K===s||K===a:oe?K===2*s||K===2*a:G instanceof u}function F(G,ie,oe=!0){if(L(G))throw new Error("first arg must be private key");if(!L(ie))throw new Error("second arg must be public key");return u.fromHex(ie).multiply(d(G)).toRawBytes(oe)}const $=e.bits2int||function(G){const ie=j3(G),oe=G.length*8-e.nBitLength;return oe>0?ie>>BigInt(oe):ie},O=e.bits2int_modN||function(G){return l($(G))},U=uce(e.nBitLength);function Y(G){if(typeof G!="bigint")throw new Error("bigint expected");if(!(zg<=G&&G<U))throw new Error(`bigint expected < 2^${e.nBitLength}`);return BS(G,e.nByteLength)}function re(G,ie,oe=Q){if(["recovered","canonical"].some(Fe=>Fe in oe))throw new Error("sign() legacy options not supported");const{hash:K,randomBytes:H}=e;let{lowS:ee,prehash:se,extraEntropy:pe}=oe;ee==null&&(ee=!0),G=Yp("msgHash",G),se&&(G=Yp("prehashed msgHash",K(G)));const Se=O(G),ge=d(ie),ve=[Y(ge),Y(Se)];if(pe!=null&&pe!==!1){const Fe=pe===!0?H(n.BYTES):pe;ve.push(Yp("extraEntropy",Fe))}const be=FE(...ve),we=Se;function je(Fe){const Re=$(Fe);if(!x(Re))return;const Qe=c(Re),Ye=u.BASE.multiply(Re).toAffine(),dt=l(Ye.x);if(dt===zg)return;const st=l(Qe*l(we+dt*ge));if(st===zg)return;let at=(Ye.x===dt?0:2)|Number(Ye.y&Jh),He=st;return ee&&y(st)&&(He=v(st),at^=1),new S(dt,He,at)}return{seed:be,k2sig:je}}const Q={lowS:e.lowS,prehash:!1},q={lowS:e.lowS,prehash:!1};function te(G,ie,oe=Q){const{seed:K,k2sig:H}=re(G,ie,oe),ee=e;return TLe(ee.hash.outputLen,ee.nByteLength,ee.hmac)(K,H)}u.BASE._setWindowSize(8);function fe(G,ie,oe,K=q){var Ye;const H=G;if(ie=Yp("msgHash",ie),oe=Yp("publicKey",oe),"strict"in K)throw new Error("options.strict was renamed to lowS");const{lowS:ee,prehash:se}=K;let pe,Se;try{if(typeof H=="string"||d5(H))try{pe=S.fromDER(H)}catch(dt){if(!(dt instanceof ww.Err))throw dt;pe=S.fromCompact(H)}else if(typeof H=="object"&&typeof H.r=="bigint"&&typeof H.s=="bigint"){const{r:dt,s:st}=H;pe=new S(dt,st)}else throw new Error("PARSE");Se=u.fromHex(oe)}catch(dt){if(dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ee&&pe.hasHighS())return!1;se&&(ie=e.hash(ie));const{r:ge,s:ve}=pe,be=O(ie),we=c(ve),je=l(be*we),Fe=l(ge*we),Re=(Ye=u.BASE.multiplyAndAddUnsafe(Se,je,Fe))==null?void 0:Ye.toAffine();return Re?l(Re.x)===ge:!1}return{CURVE:e,getPublicKey:I,getSharedSecret:F,sign:te,verify:fe,ProjectivePoint:u,Signature:S,utils:T}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function REt(t){return{hash:t,hmac:(e,...n)=>ice(t,e,oR(...n)),randomBytes:kMe}}function DEt(t,e){const n=r=>LEt({...t,...REt(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const MLe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),gbe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),BEt=BigInt(1),ane=BigInt(2),bbe=(t,e)=>(t+e/ane)/e;function $Et(t){const e=MLe,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,ane,e)*u%e,y=kh(g,s,e)*g%e,v=kh(y,a,e)*y%e,C=kh(v,l,e)*v%e,S=kh(C,c,e)*C%e,T=kh(S,l,e)*v%e,I=kh(T,n,e)*d%e,L=kh(I,o,e)*y%e,F=kh(L,r,e)*u%e,$=kh(F,ane,e);if(!one.eql(one.sqr($),t))throw new Error("Cannot find square root");return $}const one=_Et(MLe,void 0,void 0,{sqrt:$Et}),dce=DEt({a:BigInt(0),b:BigInt(7),Fp:one,n:gbe,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=gbe,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-BEt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,o=BigInt("0x100000000000000000000000000000000"),l=bbe(a*t,e),c=bbe(-r*t,e);let u=Zd(t-l*n-c*s,e),d=Zd(-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}}}},SU);BigInt(0);dce.ProjectivePoint;const UEt=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:dce},Symbol.toStringTag,{value:"Module"}));var OW;const $1=(OW=dce)!==null&&OW!==void 0?OW:UEt,ybe=BigInt("0xffffffffffffffff"),OE=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),zEt=$1.CURVE.n,HEt=zEt/BigInt(2),VEt={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 SR;(function(t){t[t.Mainnet=1]="Mainnet",t[t.Goerli=5]="Goerli",t[t.Sepolia=11155111]="Sepolia"})(SR||(SR={}));var ho;(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"})(ho||(ho={}));var vbe;(function(t){t.ProofOfStake="pos",t.ProofOfWork="pow",t.ProofOfAuthority="poa"})(vbe||(vbe={}));var wbe;(function(t){t.Ethash="ethash",t.Clique="clique",t.Casper="casper"})(wbe||(wbe={}));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 LLe=t=>{if(typeof t!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof t}`);return Vle(t)?t.slice(2):t};function WEt(t){return!t||t==="0x0"?"0x0000000000000000":Vle(t)?`0x${LLe(t).padStart(16,"0")}`:`0x${t.padStart(16,"0")}`}const RLe=function(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Received an invalid integer type: ${t}`);return`0x${t.toString(16)}`};function qEt(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"),Vle(x)||(x=RLe(parseInt(x))),g.length!==18&&(g=WEt(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:{}}},S={[ho.Homestead]:{name:"homesteadBlock"},[ho.Dao]:{name:"daoForkBlock"},[ho.TangerineWhistle]:{name:"eip150Block"},[ho.SpuriousDragon]:{name:"eip155Block"},[ho.Byzantium]:{name:"byzantiumBlock"},[ho.Constantinople]:{name:"constantinopleBlock"},[ho.Petersburg]:{name:"petersburgBlock"},[ho.Istanbul]:{name:"istanbulBlock"},[ho.MuirGlacier]:{name:"muirGlacierBlock"},[ho.Berlin]:{name:"berlinBlock"},[ho.London]:{name:"londonBlock"},[ho.MergeForkIdTransition]:{name:"mergeForkBlock",postMerge:e},[ho.Shanghai]:{name:"shanghaiTime",postMerge:!0,isTimestamp:!0},[ho.ShardingForkDev]:{name:"shardingForkTime",postMerge:!0,isTimestamp:!0}},T=Object.keys(S).reduce((F,$)=>(F[S[$].name]=$,F),{}),I=Object.keys(a).filter(F=>T[F]!==void 0&&a[F]!==void 0&&a[F]!==null);if(C.hardforks=I.map(F=>({name:T[F],block:S[T[F]].isTimestamp===!0||typeof a[F]!="number"?null:a[F],timestamp:S[T[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 O,U;return((O=F.block)!==null&&O!==void 0?O:1/0)-((U=$.block)!==null&&U!==void 0?U:1/0)}),C.hardforks.sort((F,$)=>{var O,U;return((O=F.timestamp)!==null&&O!==void 0?O:y)-((U=$.timestamp)!==null&&U!==void 0?U:y)}),a.terminalTotalDifficulty!==void 0){const F={name:ho.Merge,ttd:a.terminalTotalDifficulty,block:null},$=C.hardforks.findIndex(O=>{var U;return((U=S[O.name])===null||U===void 0?void 0:U.postMerge)===!0});$!==-1?C.hardforks.splice($,0,F):C.hardforks.push(F)}const L=C.hardforks.length>0?C.hardforks.slice(-1)[0]:void 0;return C.hardfork=L==null?void 0:L.name,C.hardforks.unshift({name:ho.Chainstart,block:0}),C}function GEt(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),qEt(t,n)}catch(r){throw new Error(`Error parsing parameters file: ${r.message}`)}}function DLe(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 KEt=function(t){const e=RLe(t);return xo(`0x${DLe(e.slice(2))}`)},Lo=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(!GMe(t))throw new Error(`Cannot convert string to Uint8Array. only supports 0x-prefixed hex strings and this string was given: ${t}`);return xo(DLe(LLe(t)))}if(typeof t=="number")return Lo(lc(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}`),Lo(`0x${n}`)}if(t.toArray)return Uint8Array.from(t.toArray());throw new Error("invalid type")};function eo(t){const e=Ki(t);return BigInt(e==="0x"?0:e)}function YEt(t){return Lo(`0x${t.toString(16)}`)}const BLe=function(t){return new Uint8Array(t).fill(0)},XEt=function(t,e,n){const r=BLe(e);return t.length<e?(r.set(t,e-t.length),r):t.subarray(-e)};function fce(t){if(!I2(t)){const e=`This method only supports Uint8Array but input was: ${t}`;throw new Error(e)}}const Cbe=function(t,e){return fce(t),XEt(t,e)};function QEt(t){let e=t[0];for(;t.length>0&&e.toString()==="0";)t=t.slice(1),e=t[0];return t}const jR=function(t){return fce(t),QEt(t)},Ro=t=>`0x${t.toString(16)}`;function ma(t){return jR(YEt(t))}function ZEt(t,e){return t===BigInt(0)||t===BigInt(1)?t:e===void 0?t-BigInt(27):t-(e*BigInt(2)+BigInt(35))}function JEt(t){return t===BigInt(0)||t===BigInt(1)}const hce=function(t,e,n,r,s){const a=ZEt(e,s);if(!JEt(a))throw new Error("Invalid signature v value");return new $1.Signature(eo(n),eo(r)).addRecoveryBit(Number(a)).recoverPublicKey(t).toRawBytes(!1).slice(1)};function pC(t,e){if(t===null)return null;if(t===void 0)return;if(typeof t=="string"&&!GMe(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=Lo(t);switch(e){case rp.Uint8Array:return n;case rp.BigInt:return eo(n);case rp.Number:{const r=eo(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 Ki(n);default:throw new Error("unknown outputType")}}var Bp={},Nbe;function ekt(){if(Nbe)return Bp;Nbe=1,Object.defineProperty(Bp,"__esModule",{value:!0}),Bp.RLP=Bp.utils=Bp.decode=Bp.encode=void 0;function t(S){if(Array.isArray(S)){const I=[];let L=0;for(let F=0;F<S.length;F++){const $=t(S[F]);I.push($),L+=$.length}return d(r(L,192),...I)}const T=C(S);return T.length===1&&T[0]<128?T:d(r(T.length,128),T)}Bp.encode=t;function e(S,T,I){if(I>S.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return S.slice(T,I)}function n(S){if(S[0]===0)throw new Error("invalid RLP: extra zeros");return c(l(S))}function r(S,T){if(S<56)return Uint8Array.from([S+T]);const I=x(S),L=I.length/2,F=x(T+55+L);return Uint8Array.from(u(F+I))}function s(S,T=!1){if(typeof S>"u"||S===null||S.length===0)return Uint8Array.from([]);const I=C(S),L=a(I);if(T)return L;if(L.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return L.data}Bp.decode=s;function a(S){let T,I,L,F,$;const O=[],U=S[0];if(U<=127)return{data:S.slice(0,1),remainder:S.slice(1)};if(U<=183){if(T=U-127,U===128?L=Uint8Array.from([]):L=e(S,1,T),T===2&&L[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:L,remainder:S.slice(T)}}else if(U<=191){if(I=U-182,S.length-1<I)throw new Error("invalid RLP: not enough bytes for string length");if(T=n(e(S,1,I)),T<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return L=e(S,I,T+I),{data:L,remainder:S.slice(T+I)}}else if(U<=247){for(T=U-191,F=e(S,1,T);F.length;)$=a(F),O.push($.data),F=$.remainder;return{data:O,remainder:S.slice(T)}}else{if(I=U-246,T=n(e(S,1,I)),T<56)throw new Error("invalid RLP: encoded list too short");const Y=I+T;if(Y>S.length)throw new Error("invalid RLP: total length is larger than the data");for(F=e(S,I,Y);F.length;)$=a(F),O.push($.data),F=$.remainder;return{data:O,remainder:S.slice(Y)}}}const o=Array.from({length:256},(S,T)=>T.toString(16).padStart(2,"0"));function l(S){let T="";for(let I=0;I<S.length;I++)T+=o[S[I]];return T}function c(S){const T=Number.parseInt(S,16);if(Number.isNaN(T))throw new Error("Invalid byte sequence");return T}function u(S){if(typeof S!="string")throw new TypeError("hexToBytes: expected string, got "+typeof S);if(S.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const T=new Uint8Array(S.length/2);for(let I=0;I<T.length;I++){const L=I*2;T[I]=c(S.slice(L,L+2))}return T}function d(...S){if(S.length===1)return S[0];const T=S.reduce((L,F)=>L+F.length,0),I=new Uint8Array(T);for(let L=0,F=0;L<S.length;L++){const $=S[L];I.set($,F),F+=$.length}return I}function f(S){return new TextEncoder().encode(S)}function x(S){if(S<0)throw new Error("Invalid integer as argument, must be unsigned!");const T=S.toString(16);return T.length%2?`0${T}`:T}function g(S){return S.length%2?`0${S}`:S}function y(S){return S.length>=2&&S[0]==="0"&&S[1]==="x"}function v(S){return typeof S!="string"?S:y(S)?S.slice(2):S}function C(S){if(S instanceof Uint8Array)return S;if(typeof S=="string")return y(S)?u(g(v(S))):f(S);if(typeof S=="number"||typeof S=="bigint")return S?u(x(S)):Uint8Array.from([]);if(S==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof S)}return Bp.utils={bytesToHex:l,concatBytes:d,hexToBytes:u,utf8ToBytes:f},Bp.RLP={encode:t,decode:s},Bp}var sp=ekt(),MW={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */var Sbe;function tkt(){return Sbe||(Sbe=1,function(t){(function(e){e(typeof DO_NOT_EXPORT_CRC>"u"?t:{})})(function(e){e.version="1.2.2";function n(){for(var U=0,Y=new Array(256),re=0;re!=256;++re)U=re,U=U&1?-306674912^U>>>1:U>>>1,U=U&1?-306674912^U>>>1:U>>>1,U=U&1?-306674912^U>>>1:U>>>1,U=U&1?-306674912^U>>>1:U>>>1,U=U&1?-306674912^U>>>1:U>>>1,U=U&1?-306674912^U>>>1:U>>>1,U=U&1?-306674912^U>>>1:U>>>1,U=U&1?-306674912^U>>>1:U>>>1,Y[re]=U;return typeof Int32Array<"u"?new Int32Array(Y):Y}var r=n();function s(U){var Y=0,re=0,Q=0,q=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(Q=0;Q!=256;++Q)q[Q]=U[Q];for(Q=0;Q!=256;++Q)for(re=U[Q],Y=256+Q;Y<4096;Y+=256)re=q[Y]=re>>>8^U[re&255];var te=[];for(Q=1;Q!=16;++Q)te[Q-1]=typeof Int32Array<"u"?q.subarray(Q*256,Q*256+256):q.slice(Q*256,Q*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],S=a[11],T=a[12],I=a[13],L=a[14];function F(U,Y){for(var re=Y^-1,Q=0,q=U.length;Q<q;)re=re>>>8^r[(re^U.charCodeAt(Q++))&255];return~re}function $(U,Y){for(var re=Y^-1,Q=U.length-15,q=0;q<Q;)re=L[U[q++]^re&255]^I[U[q++]^re>>8&255]^T[U[q++]^re>>16&255]^S[U[q++]^re>>>24]^C[U[q++]]^v[U[q++]]^y[U[q++]]^g[U[q++]]^x[U[q++]]^f[U[q++]]^d[U[q++]]^u[U[q++]]^c[U[q++]]^l[U[q++]]^o[U[q++]]^r[U[q++]];for(Q+=15;q<Q;)re=re>>>8^r[(re^U[q++])&255];return~re}function O(U,Y){for(var re=Y^-1,Q=0,q=U.length,te=0,fe=0;Q<q;)te=U.charCodeAt(Q++),te<128?re=re>>>8^r[(re^te)&255]:te<2048?(re=re>>>8^r[(re^(192|te>>6&31))&255],re=re>>>8^r[(re^(128|te&63))&255]):te>=55296&&te<57344?(te=(te&1023)+64,fe=U.charCodeAt(Q++)&1023,re=re>>>8^r[(re^(240|te>>8&7))&255],re=re>>>8^r[(re^(128|te>>2&63))&255],re=re>>>8^r[(re^(128|fe>>6&15|(te&3)<<4))&255],re=re>>>8^r[(re^(128|fe&63))&255]):(re=re>>>8^r[(re^(224|te>>12&15))&255],re=re>>>8^r[(re^(128|te>>6&63))&255],re=re>>>8^r[(re^(128|te&63))&255]);return~re}e.table=r,e.bstr=F,e.buf=$,e.str=O})}(MW)),MW}var nkt=tkt();const rkt=Pi(nkt),skt={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"]},ikt={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"]},akt={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"]},okt={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:{}},lkt={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:{}},ckt={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:{}},ukt={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:{}},dkt={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:{}},fkt={name:"EIP-2718",comment:"Typed Transaction Envelope",url:"https://eips.ethereum.org/EIPS/eip-2718",status:"Final",minimumHardfork:"chainstart",gasConfig:{},gasPrices:{},vm:{},pow:{}},hkt={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:{}},pkt={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:{}},mkt={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:{}},xkt={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:{}},gkt={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:{}},bkt={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:{}},ykt={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"}}},vkt={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:{}},wkt={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:{}},Ckt={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:{}},Nkt={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:{}},Skt={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:{}},jkt={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:{}},Akt={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"}}},_kt={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:{}},Ekt={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"}}},mC={1153:okt,1559:lkt,2315:ckt,2537:ukt,2565:dkt,2718:fkt,2929:hkt,2930:pkt,3198:mkt,3529:xkt,3540:gkt,3541:bkt,3554:ykt,3607:vkt,3651:wkt,3670:Ckt,3675:Nkt,3855:Skt,3860:jkt,4345:Akt,4399:_kt,5133:Ekt},kkt={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"}}},Tkt={name:"dao",comment:"DAO rescue hardfork",url:"https://eips.ethereum.org/EIPS/eip-779",status:"Final",gasConfig:{},gasPrices:{},vm:{},pow:{}},Pkt={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:{}},Ikt={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:{}},Fkt={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:{}},Okt={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"}}},Mkt={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"}}},Lkt={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:{}},Rkt={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:{}},Dkt={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"}}},Bkt={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]},$kt={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]},Ukt={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]},zkt={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:{}},Hkt={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:{}},Vkt={name:"mergeForkIdTransition",comment:"Pre-merge hardfork to fork off non-upgraded clients",url:"https://eips.ethereum.org/EIPS/eip-3675",status:"Draft",eips:[]},Wkt={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]},qkt={chainstart:kkt,homestead:Pkt,dao:Tkt,tangerineWhistle:Ikt,spuriousDragon:Fkt,byzantium:Okt,constantinople:Mkt,petersburg:Lkt,istanbul:Rkt,muirGlacier:Dkt,berlin:Bkt,london:$kt,shanghai:Ukt,arrowGlacier:zkt,grayGlacier:Hkt,mergeForkIdTransition:Vkt,merge:Wkt},{buf:Gkt}=rkt;class ic extends Yle{static custom(e,n={}){var r;const s=(r=n.baseChain)!==null&&r!==void 0?r:"mainnet",a=Object.assign({},ic._getChainParams(s));if(a.name="custom-chain",typeof e!="string")return new ic(Object.assign({chain:Object.assign(Object.assign({},a),e)},n));if(e===wu.PolygonMainnet)return ic.custom({name:wu.PolygonMainnet,chainId:137,networkId:137},n);if(e===wu.PolygonMumbai)return ic.custom({name:wu.PolygonMumbai,chainId:80001,networkId:80001},n);if(e===wu.ArbitrumRinkebyTestnet)return ic.custom({name:wu.ArbitrumRinkebyTestnet,chainId:421611,networkId:421611},n);if(e===wu.ArbitrumOne)return ic.custom({name:wu.ArbitrumOne,chainId:42161,networkId:42161},n);if(e===wu.xDaiChain)return ic.custom({name:wu.xDaiChain,chainId:100,networkId:100},n);if(e===wu.OptimisticKovan)return ic.custom({name:wu.OptimisticKovan,chainId:69,networkId:69},Object.assign({hardfork:ho.Berlin},n));if(e===wu.OptimisticEthereum)return ic.custom({name:wu.OptimisticEthereum,chainId:10,networkId:10},Object.assign({hardfork:ho.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=GEt(e,n,o),u=new ic({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:ho.Merge,this.HARDFORK_CHANGES=this.hardforks().map(s=>[s.name,qkt[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=ic._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=pC(e,rp.BigInt),a=pC(n,rp.BigInt),o=pC(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 S;return Math.max(Number((S=C.timestamp)!==null&&S!==void 0?S:"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 S;return Math.min(Number((S=C.timestamp)!==null&&S!==void 0?S: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 mC))throw new Error(`${n} not supported`);const r=this.gteHardfork(mC[n].minimumHardfork);if(!r)throw new Error(`${n} cannot be activated on hardfork ${this.hardfork()}, minimumHardfork: ${r}`);if(mC[n].requiredEIPs!==void 0){for(const s of mC[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 mC))throw new Error(`${r} not supported`);const s=mC[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=pC(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=pC(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===ho.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!==ho.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===ho.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=pC(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!==ho.Merge){const x=xo(f.toString(16).padStart(16,"0"));r=Ad(r,x),s=f}if(l.name===e)break}const a=Ad(n,r);return Ki(KEt(Gkt(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(SR))n[a]=s.toLowerCase();const r={mainnet:ikt,goerli:skt,sepolia:akt};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 O0;(function(t){t[t.EIP155ReplayProtection=155]="EIP155ReplayProtection",t[t.EIP1559FeeMarket=1559]="EIP1559FeeMarket",t[t.EIP2718TypedTransaction=2718]="EIP2718TypedTransaction",t[t.EIP2930AccessLists=2930]="EIP2930AccessLists"})(O0||(O0={}));function Kkt(t){if(t.length===0)return!0;const e=t[0];return!!Array.isArray(e)}function Ykt(t){return!Kkt(t)}class D4{constructor(e){if(e.length!==20)throw new Error("Invalid address length");this.buf=e}static zero(){return new D4(BLe(20))}equals(e){return xU(this.buf,e.buf)}isZero(){return this.equals(D4.zero())}toString(){return Ki(this.buf)}toArray(){return this.buf}static publicToAddress(e,n=!1){let r=e;if(fce(r),n&&r.length!==64&&(r=$1.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 Xkt=(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")}`)},$Le=t=>{let e,n;if(Ykt(t)){e=t;const r=[];for(let s=0;s<t.length;s+=1){const a=t[s],o=Lo(a.address),l=[];for(let c=0;c<a.storageKeys.length;c+=1)l.push(Lo(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=Ki(a[0]),l=[];for(let u=0;u<a[1].length;u+=1)l.push(Ki(a[1][u]));const c={address:o,storageKeys:l};r.push(c)}e=r}return{AccessListJSON:e,accessList:n}},ULe=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")}},zLe=t=>{const e=[];for(let n=0;n<t.length;n+=1){const r=t[n],s={address:Ki(Cbe(r[0],20)),storageKeys:[]},a=r&&r[1];for(let o=0;o<a.length;o+=1){const l=a[o];s.storageKeys.push(Ki(Cbe(l,32)))}e.push(s)}return e},HLe=(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 $S{constructor(e,n){var r,s;this.cache={hash:void 0,dataFee:void 0},this.activeCapabilities=[],this.DEFAULT_CHAIN=SR.Mainnet,this.DEFAULT_HARDFORK=ho.Merge;const{nonce:a,gasLimit:o,to:l,value:c,data:u,v:d,r:f,s:x,type:g}=e;this._type=Number(eo(Lo(g))),this.txOptions=n;const y=Lo(l===""?"0x":l),v=Lo(d===""?"0x":d),C=Lo(f===""?"0x":f),S=Lo(x===""?"0x":x);this.nonce=eo(Lo(a===""?"0x":a)),this.gasLimit=eo(Lo(o===""?"0x":o)),this.to=y.length>0?new D4(y):void 0,this.value=eo(Lo(c===""?"0x":c)),this.data=Lo(u===""?"0x":u),this.v=v.length>0?eo(v):void 0,this.r=C.length>0?eo(C):void 0,this.s=S.length>0?eo(S):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 T=this.to===void 0||this.to===null,I=(r=n.allowUnlimitedInitCodeSize)!==null&&r!==void 0?r:!1,L=(s=n.common)!==null&&s!==void 0?s:this._getCommon();T&&L.isActivatedEIP(3860)&&!I&&Xkt(L,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>HEt){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 jR(e).length!==0}catch{return!1}}getSenderAddress(){return new D4(D4.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(O0.EIP155ReplayProtection)&&(this.activeCapabilities.push(O0.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(O0.EIP155ReplayProtection);c>-1&&this.activeCapabilities.splice(c,1)}return l}_getCommon(e,n){var r,s,a,o;if(n!==void 0){const l=eo(Lo(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 ic.isSupportedChainId(l)?new ic({chain:l,hardfork:this.DEFAULT_HARDFORK}):ic.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 ic.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 ic({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>=ybe){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>ybe){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>=OE){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>OE){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()?Ki(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=$1.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 lne=2,LW=xo(lne.toString(16).padStart(2,"0"));class Cw extends $S{static fromTxData(e,n={}){return new Cw(e,n)}static fromSerializedTx(e,n={}){if(!xU(e.subarray(0,1),LW))throw new Error(`Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: ${lne}, received: ${Ki(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 Cw.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}),Wle({nonce:s,maxPriorityFeePerGas:a,maxFeePerGas:o,gasLimit:l,value:u,v:x,r:g,s:y}),new Cw({chainId:eo(r),nonce:s,maxPriorityFeePerGas:a,maxFeePerGas:o,gasLimit:l,to:c,value:u,data:d,accessList:f??[],v:x!==void 0?eo(x):void 0,r:g,s:y},n)}constructor(e,n={}){var r;super(Object.assign(Object.assign({},e),{type:lne}),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=$Le(a??[]);if(this.accessList=c.accessList,this.AccessListJSON=c.AccessListJSON,ULe(this.accessList),this.maxFeePerGas=eo(Lo(o===""?"0x":o)),this.maxPriorityFeePerGas=eo(Lo(l===""?"0x":l)),this._validateCannotExceedMaxInteger({maxFeePerGas:this.maxFeePerGas,maxPriorityFeePerGas:this.maxPriorityFeePerGas}),$S._validateNotArray(e),this.gasLimit*this.maxFeePerGas>OE){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(HLe(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[ma(this.chainId),ma(this.nonce),ma(this.maxPriorityFeePerGas),ma(this.maxFeePerGas),ma(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),ma(this.value),this.data,this.accessList,this.v!==void 0?ma(this.v):Uint8Array.from([]),this.r!==void 0?ma(this.r):Uint8Array.from([]),this.s!==void 0?ma(this.s):Uint8Array.from([])]}serialize(){const e=this.raw();return Ad(LW,sp.RLP.encode(e))}getMessageToSign(e=!0){const n=this.raw().slice(0,9),r=Ad(LW,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 hce(e,n+BigInt(27),ma(r),ma(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 Cw.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:eo(n),s:eo(r)},s)}toJSON(){const e=zLe(this.accessList);return{chainId:Ro(this.chainId),nonce:Ro(this.nonce),maxPriorityFeePerGas:Ro(this.maxPriorityFeePerGas),maxFeePerGas:Ro(this.maxFeePerGas),gasLimit:Ro(this.gasLimit),to:this.to!==void 0?this.to.toString():void 0,value:Ro(this.value),data:Ki(this.data),accessList:e,v:this.v!==void 0?Ro(this.v):void 0,r:this.r!==void 0?Ro(this.r):void 0,s:this.s!==void 0?Ro(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 cne=1,RW=xo(cne.toString(16).padStart(2,"0"));class Nw extends $S{static fromTxData(e,n={}){return new Nw(e,n)}static fromSerializedTx(e,n={}){if(!xU(e.subarray(0,1),RW))throw new Error(`Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: ${cne}, received: ${Ki(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 Nw.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}),Wle({nonce:s,gasPrice:a,gasLimit:o,value:c,v:f,r:x,s:g});const y=[];return new Nw({chainId:eo(r),nonce:s,gasPrice:a,gasLimit:o,to:l,value:c,data:u,accessList:d??y,v:f!==void 0?eo(f):void 0,r:x,s:g},n)}constructor(e,n={}){var r;super(Object.assign(Object.assign({},e),{type:cne}),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=$Le(a??[]);if(this.accessList=l.accessList,this.AccessListJSON=l.AccessListJSON,ULe(this.accessList),this.gasPrice=eo(Lo(o===""?"0x":o)),this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),$S._validateNotArray(e),this.gasPrice*this.gasLimit>OE){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(HLe(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[ma(this.chainId),ma(this.nonce),ma(this.gasPrice),ma(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),ma(this.value),this.data,this.accessList,this.v!==void 0?ma(this.v):Uint8Array.from([]),this.r!==void 0?ma(this.r):Uint8Array.from([]),this.s!==void 0?ma(this.s):Uint8Array.from([])]}serialize(){const e=this.raw();return Ad(RW,sp.RLP.encode(e))}getMessageToSign(e=!0){const n=this.raw().slice(0,8),r=Ad(RW,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 hce(e,n+BigInt(27),ma(r),ma(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 Nw.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:eo(n),s:eo(r)},s)}toJSON(){const e=zLe(this.accessList);return{chainId:Ro(this.chainId),nonce:Ro(this.nonce),gasPrice:Ro(this.gasPrice),gasLimit:Ro(this.gasLimit),to:this.to!==void 0?this.to.toString():void 0,value:Ro(this.value),data:Ki(this.data),accessList:e,v:this.v!==void 0?Ro(this.v):void 0,r:this.r!==void 0?Ro(this.r):void 0,s:this.s!==void 0?Ro(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 Qkt=0;function jbe(t,e){const n=Number(t),r=Number(e)*2;return n===r+35||n===r+36}class Py extends $S{static fromTxData(e,n={}){return new Py(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 Wle({nonce:r,gasPrice:s,gasLimit:a,value:l,v:u,r:d,s:f}),new Py({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:Qkt}),n),this.common=this._validateTxV(this.v,n.common),this.gasPrice=eo(Lo(e.gasPrice===""?"0x":e.gasPrice)),this.gasPrice*this.gasLimit>OE){const a=this._errorMsg("gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)");throw new Error(a)}this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),$S._validateNotArray(e),this.common.gteHardfork("spuriousDragon")&&(this.isSigned()?jbe(this.v,this.common.chainId())&&this.activeCapabilities.push(O0.EIP155ReplayProtection):this.activeCapabilities.push(O0.EIP155ReplayProtection)),((r=n==null?void 0:n.freeze)!==null&&r!==void 0?r:!0)&&Object.freeze(this)}raw(){return[ma(this.nonce),ma(this.gasPrice),ma(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),ma(this.value),this.data,this.v!==void 0?ma(this.v):Uint8Array.from([]),this.r!==void 0?ma(this.r):Uint8Array.from([]),this.s!==void 0?ma(this.s):Uint8Array.from([])]}serialize(){return sp.RLP.encode(this.raw())}_getMessageToSign(){const e=[ma(this.nonce),ma(this.gasPrice),ma(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),ma(this.value),this.data];return this.supports(O0.EIP155ReplayProtection)&&(e.push(Lo(this.common.chainId())),e.push(jR(Lo(0))),e.push(jR(Lo(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 hce(e,n,ma(r),ma(s),this.supports(O0.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(O0.EIP155ReplayProtection)&&(s+=this.common.chainId()*BigInt(2)+BigInt(8));const a=Object.assign(Object.assign({},this.txOptions),{common:this.common});return Py.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:s,r:eo(n),s:eo(r)},a)}toJSON(){return{nonce:Ro(this.nonce),gasPrice:Ro(this.gasPrice),gasLimit:Ro(this.gasLimit),to:this.to!==void 0?this.to.toString():void 0,value:Ro(this.value),data:Ki(this.data),v:this.v!==void 0?Ro(this.v):void 0,r:this.r!==void 0?Ro(this.r):void 0,s:this.s!==void 0?Ro(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(!jbe(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 DW=new Map;class f5{constructor(){}static typeToInt(e){return Number(eo(Lo(e)))}static registerTransactionType(e,n){const r=f5.typeToInt(e);DW.set(r,n)}static fromTxData(e,n={}){if(!("type"in e)||e.type===void 0)return Py.fromTxData(e,n);const r=f5.typeToInt(e.type);if(r===0)return Py.fromTxData(e,n);if(r===1)return Nw.fromTxData(e,n);if(r===2)return Cw.fromTxData(e,n);const s=DW.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 Nw.fromSerializedTx(e,n);case 2:return Cw.fromSerializedTx(e,n);default:{const r=DW.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 Py.fromSerializedTx(e,n)}static fromBlockBodyData(e,n={}){if(I2(e))return this.fromSerializedData(e,n);if(Array.isArray(e))return Py.fromValuesArray(e,n);throw new Error("Cannot decode transaction: unknown type input")}}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())})};const b8=(t,e)=>{let n;if(!e&&typeof t=="string"&&Ta(t)&&t.length!==66)throw new D1e;try{n=I2(t)?t:mx(t)}catch{throw new wAt}if(!e&&n.byteLength!==32)throw new D1e;return n},pce=(t,e=!1)=>{const n=Ta(t)?t:km(t),r=xo(n),s=xo(JMe(`Ethereum Signed Message:
${r.byteLength}`)),a=e?r:Ad(s,r);return ah(a)},Zkt=(t,e)=>{const n=b8(e),r=$1.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:lc(l),r:`0x${a}`,s:`0x${o}`,signature:`${Ki(s)}${l.toString(16)}`}},VLe=(t,e)=>{const n=pce(t),{messageHash:r,v:s,r:a,s:o,signature:l}=Zkt(n,e);return{message:t,messageHash:r,v:s,r:a,s:o,signature:l}},Jkt=(t,e)=>AU(void 0,void 0,void 0,function*(){const n=t.sign(xo(e));if(Nr(n.v)||Nr(n.r)||Nr(n.s))throw new Yte("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 Yte(o)}const s=Ki(n.serialize()),a=ah(s);return{messageHash:Ki(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:Ki(a)}}),eTt=t=>{if(Nr(t))throw new DAt;const e=f5.fromSerializedData(xo(t));return Nx(e.getSenderAddress().toString())},une=(t,e,n,r,s)=>{if(typeof t=="object"){const f=`${t.r}${t.s.slice(2)}${t.v.slice(2)}`;return une(t.messageHash,f,n)}if(typeof e=="string"&&typeof n=="string"&&!Nr(r)){const f=`${n}${r.slice(2)}${e.slice(2)}`;return une(t,f,s)}if(Nr(e))throw new CAt("signature string undefined");const a=130,o=n?t:pce(t);let l=parseInt(e.substring(a),16);l>26&&(l-=27);const c=$1.Signature.fromCompact(e.slice(2,a)).addRecoveryBit(l).recoverPublicKey(o.replace("0x","")).toRawBytes(!1),u=ah(c.subarray(1));return Nx(`0x${u.slice(-40)}`)},_U=t=>{const e=b8(t),n=$1.getPublicKey(e,!1),s=ah(n.slice(1)).slice(-40);return Nx(`0x${s}`)},tTt=(t,e)=>{const n=b8(t);return`0x${Ki($1.getPublicKey(n,e)).slice(4)}`},WLe=(t,e,n)=>AU(void 0,void 0,void 0,function*(){var r,s,a,o,l,c,u;const d=b8(t);let f;if(n!=null&&n.salt?f=typeof n.salt=="string"?xo(n.salt):n.salt:f=PE(32),!(Hle(e)||I2(e)))throw new jAt;const x=typeof e=="string"?xo(km(e)):e;let g;if(n!=null&&n.iv){if(g=typeof n.iv=="string"?xo(n.iv):n.iv,g.length!==16)throw new AAt}else g=PE(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:Ki(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 _At;v=ALe(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:Ki(f).replace("0x","")},v=_Le(x,f,C.n,C.p,C.r,C.dklen);else throw new hMe;const S=yield sce(d,v.slice(0,16),g,"aes-128-ctr"),T=Ki(S).slice(2),I=ah(Ad(v.slice(16,32),S)).replace("0x","");return{version:3,id:Jle(),address:_U(d).toLowerCase().replace("0x",""),crypto:{ciphertext:T,cipherparams:{iv:Ki(g).replace("0x","")},cipher:"aes-128-ctr",kdf:y,kdfparams:C,mac:I}}}),mce=(t,e)=>{const n=b8(t,e);return{address:_U(n),privateKey:Ki(n),signTransaction:r=>{throw new Yte("Do not have network access to sign the transaction")},sign:r=>VLe(typeof r=="string"?r:JSON.stringify(r),n),encrypt:(r,s)=>AU(void 0,void 0,void 0,function*(){return WLe(n,r,s)})}},nTt=()=>{const t=$1.utils.randomPrivateKey();return mce(`${Ki(t)}`)},rTt=(t,e,n)=>AU(void 0,void 0,void 0,function*(){const r=typeof t=="object"?t:JSON.parse(n?t.toLowerCase():t);if(Js.validateJSONSchema(VEt,r),r.version!==3)throw new SAt;const s=typeof e=="string"?xo(km(e)):e;Js.validate(["bytes"],[s]);let a;if(r.crypto.kdf==="scrypt"){const u=r.crypto.kdfparams,d=typeof u.salt=="string"?xo(u.salt):u.salt;a=_Le(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"?xo(u.salt):u.salt;a=ALe(s,d,u.c,u.dklen,"sha256")}else throw new hMe;const o=xo(r.crypto.ciphertext);if(ah(Ad(a.slice(16,32),o)).replace("0x","")!==r.crypto.mac)throw new NAt;const c=yield Q9t(xo(r.crypto.ciphertext),a.slice(0,16),xo(r.crypto.cipherparams.iv));return mce(c)});var Abe=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 sTt=1e3;class iTt{constructor(e){this._requestManager=e,this._requests=new Map}get requests(){return[...this._requests.values()].map(e=>e.payload)}add(e){const n=c5(e),r=new vR;return this._requests.set(n.id,{payload:n,promise:r}),r}execute(e){return Abe(this,void 0,void 0,function*(){var n;if(this.requests.length===0)return Promise.resolve([]);const r=new vR({timeout:(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:sTt,eagerStart:!0,timeoutMessage:"Batch request timeout"});return this._processBatchRequest(r).catch(s=>r.reject(s)),r.catch(s=>{s instanceof pMe&&this._abortAllRequests("Batch request timeout"),r.reject(s)}),r})}_processBatchRequest(e){return Abe(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 F0(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 F0(s,`Batch request mismatch the results. Requests: [${a.join()}], Responses: [${o.join()}]`);for(const l of s)zy(l)?(n=this._requests.get(l.id))===null||n===void 0||n.promise.resolve(l.result):Hy(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 OAt(e))}}var aTt=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 of extends H9t{constructor(e){var n;if(super(),this.providers=S3.providers,oi(e)||typeof e=="string"&&e.trim()!==""||wR(e)){this._requestManager=new S3(e),this._subscriptionManager=new CR(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 S3(s,(n=r==null?void 0:r.enableExperimentalFeatures)===null||n===void 0?void 0:n.useSubscriptionWhenCheckingBlockTimeout,d),o?this._subscriptionManager=o:this._subscriptionManager=new CR(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(u5.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(u5.CONFIG_CHANGE,n=>{this.setConfig({[n.name]:n.newValue})})}registerPlugin(e){if(this[e.pluginNamespace]!==void 0)throw new MAt(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 of.givenProvider}setProvider(e){return this.provider=e,!0}setRequestManagerMiddleware(e){this.requestManager.setMiddleware(e)}get BatchRequest(){return iTt.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)=>aTt(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}}of.providers=S3.providers;class Ul{constructor(e){if(this.toAddress=()=>{if(this.isDirect()){const n=this._iban.slice(4),r=Ul._parseInt(n,36),s=kE(r,40);return Nx(s)}throw new Error("Iban is indirect and cannot be converted. Must be length of 34 or 35")},Ul.isIndirect(e)||Ul.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 Ul.isDirect(this._iban)}static isIndirect(e){return e.length===20}isIndirect(){return Ul.isIndirect(this._iban)}static isValid(e){return/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(e)&&Ul._mod9710(Ul._iso13616Prepare(e))===1}isValid(){return Ul.isValid(this._iban)}static fromBban(e){const n="XE",s=`0${(98-this._mod9710(this._iso13616Prepare(`${n}00${e}`))).toString()}`.slice(-2);return new Ul(`${n}${s}${e}`)}static createIndirect(e){return Ul.fromBban(`ETH${e.institution}${e.identifier}`)}static fromAddress(e){if(!ih(e))throw new Lle(e);const r=BigInt(KT(e)).toString(36),s=kE(r,15);return Ul.fromBban(s.toUpperCase())}static toIban(e){return Ul.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}}Ul._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("")};Ul._parseInt=(t,e)=>[...t].reduce((n,r)=>BigInt(parseInt(r,e))+BigInt(e)*n,BigInt(0));Ul._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};Ul.toAddress=t=>new Ul(t).toAddress();var BW=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())})},qLe;class GLe extends CU{constructor(e){super(),this[qLe]="Promise",this._promise=new Promise(e)}then(e,n){return BW(this,void 0,void 0,function*(){return this._promise.then(e,n)})}catch(e){return BW(this,void 0,void 0,function*(){return this._promise.catch(e)})}finally(e){return BW(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}}qLe=Symbol.toStringTag;var $W={},_be;function oTt(){return _be||(_be=1,function(t,e){if(t.setImmediate)return;var n=1,r={},s=!1,a=t.document,o;function l(T){typeof T!="function"&&(T=new Function(""+T));for(var I=new Array(arguments.length-1),L=0;L<I.length;L++)I[L]=arguments[L+1];var F={callback:T,args:I};return r[n]=F,o(n),n++}function c(T){delete r[T]}function u(T){var I=T.callback,L=T.args;switch(L.length){case 0:I();break;case 1:I(L[0]);break;case 2:I(L[0],L[1]);break;case 3:I(L[0],L[1],L[2]);break;default:I.apply(e,L);break}}function d(T){if(s)setTimeout(d,0,T);else{var I=r[T];if(I){s=!0;try{u(I)}finally{c(T),s=!1}}}}function f(){o=function(T){process.nextTick(function(){d(T)})}}function x(){if(t.postMessage&&!t.importScripts){var T=!0,I=t.onmessage;return t.onmessage=function(){T=!1},t.postMessage("","*"),t.onmessage=I,T}}function g(){var T="setImmediate$"+Math.random()+"$",I=function(L){L.source===t&&typeof L.data=="string"&&L.data.indexOf(T)===0&&d(+L.data.slice(T.length))};t.addEventListener?t.addEventListener("message",I,!1):t.attachEvent("onmessage",I),o=function(L){t.postMessage(T+L,"*")}}function y(){var T=new MessageChannel;T.port1.onmessage=function(I){var L=I.data;d(L)},o=function(I){T.port2.postMessage(I)}}function v(){var T=a.documentElement;o=function(I){var L=a.createElement("script");L.onreadystatechange=function(){d(I),L.onreadystatechange=null,T.removeChild(L),L=null},T.appendChild(L)}}function C(){o=function(T){setTimeout(d,0,T)}}var S=Object.getPrototypeOf&&Object.getPrototypeOf(t);S=S&&S.setTimeout?S:t,{}.toString.call(t.process)==="[object process]"?f():x()?g():t.MessageChannel?y():a&&"onreadystatechange"in a.createElement("script")?v():C(),S.setImmediate=l,S.clearImmediate=c}(typeof self>"u"?typeof Lu>"u"?$W:Lu:self)),$W}oTt();var gi=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 lTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_protocolVersion",params:[]})})}function KLe(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_syncing",params:[]})})}function cTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_coinbase",params:[]})})}function uTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_mining",params:[]})})}function dTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_hashrate",params:[]})})}function fTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_gasPrice",params:[]})})}function hTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_maxPriorityFeePerGas",params:[]})})}function pTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_accounts",params:[]})})}function mTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_blockNumber",params:[]})})}function xTt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["address","blockNumberOrTag"],[e,n]),t.send({method:"eth_getBalance",params:[e,n]})})}function gTt(t,e,n,r){return gi(this,void 0,void 0,function*(){return Js.validate(["address","hex","blockNumberOrTag"],[e,n,r]),t.send({method:"eth_getStorageAt",params:[e,n,r]})})}function bTt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["address","blockNumberOrTag"],[e,n]),t.send({method:"eth_getTransactionCount",params:[e,n]})})}function yTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["bytes32"],[e]),t.send({method:"eth_getBlockTransactionCountByHash",params:[e]})})}function vTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["blockNumberOrTag"],[e]),t.send({method:"eth_getBlockTransactionCountByNumber",params:[e]})})}function wTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["bytes32"],[e]),t.send({method:"eth_getUncleCountByBlockHash",params:[e]})})}function CTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["blockNumberOrTag"],[e]),t.send({method:"eth_getUncleCountByBlockNumber",params:[e]})})}function NTt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["address","blockNumberOrTag"],[e,n]),t.send({method:"eth_getCode",params:[e,n]})})}function STt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["address","hex"],[e,n]),t.send({method:"eth_sign",params:[e,n]})})}function jTt(t,e){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_signTransaction",params:[e]})})}function ATt(t,e){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_sendTransaction",params:[e]})})}function YLe(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["hex"],[e]),t.send({method:"eth_sendRawTransaction",params:[e]})})}function _Tt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["blockNumberOrTag"],[n]),t.send({method:"eth_call",params:[e,n]})})}function ETt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["blockNumberOrTag"],[n]),t.send({method:"eth_estimateGas",params:[e,n]})})}function kTt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["bytes32","bool"],[e,n]),t.send({method:"eth_getBlockByHash",params:[e,n]})})}function XLe(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["blockNumberOrTag","bool"],[e,n]),t.send({method:"eth_getBlockByNumber",params:[e,n]})})}function TTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["bytes32"],[e]),t.send({method:"eth_getTransactionByHash",params:[e]})})}function PTt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["bytes32","hex"],[e,n]),t.send({method:"eth_getTransactionByBlockHashAndIndex",params:[e,n]})})}function ITt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["blockNumberOrTag","hex"],[e,n]),t.send({method:"eth_getTransactionByBlockNumberAndIndex",params:[e,n]})})}function FTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["bytes32"],[e]),t.send({method:"eth_getTransactionReceipt",params:[e]})})}function OTt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["bytes32","hex"],[e,n]),t.send({method:"eth_getUncleByBlockHashAndIndex",params:[e,n]})})}function MTt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["blockNumberOrTag","hex"],[e,n]),t.send({method:"eth_getUncleByBlockNumberAndIndex",params:[e,n]})})}function LTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["filter"],[e]),t.send({method:"eth_newFilter",params:[e]})})}function RTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_newBlockFilter",params:[]})})}function DTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_newPendingTransactionFilter",params:[]})})}function BTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["hex"],[e]),t.send({method:"eth_uninstallFilter",params:[e]})})}function $Tt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["hex"],[e]),t.send({method:"eth_getFilterChanges",params:[e]})})}function UTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["hex"],[e]),t.send({method:"eth_getFilterLogs",params:[e]})})}function zTt(t,e){return gi(this,void 0,void 0,function*(){return Js.validate(["filter"],[e]),t.send({method:"eth_getLogs",params:[e]})})}function HTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_getWork",params:[]})})}function VTt(t,e,n,r){return gi(this,void 0,void 0,function*(){return Js.validate(["bytes8","bytes32","bytes32"],[e,n,r]),t.send({method:"eth_submitWork",params:[e,n,r]})})}function WTt(t,e,n,r){return gi(this,void 0,void 0,function*(){Js.validate(["hex","blockNumberOrTag"],[e,n]);for(const s of r)Js.validate(["number"],[s]);return t.send({method:"eth_feeHistory",params:[e,n,r]})})}function qTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_pendingTransactions",params:[]})})}function GTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_requestAccounts",params:[]})})}function KTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_chainId",params:[]})})}function YTt(t,e,n,r){return gi(this,void 0,void 0,function*(){return Js.validate(["address","bytes32[]","blockNumberOrTag"],[e,n,r]),t.send({method:"eth_getProof",params:[e,n,r]})})}function XTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"web3_clientVersion",params:[]})})}function QTt(t,e,n){return gi(this,void 0,void 0,function*(){return Js.validate(["blockNumberOrTag"],[n]),t.send({method:"eth_createAccessList",params:[e,n]})})}function ZTt(t,e,n,r=!1){return gi(this,void 0,void 0,function*(){return Js.validate(["address"],[e]),t.send({method:`eth_signTypedData${r?"":"_v4"}`,params:[e,n]})})}var xce=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 JTt(t){return xce(this,void 0,void 0,function*(){return t.send({method:"net_version",params:[]})})}function ePt(t){return xce(this,void 0,void 0,function*(){return t.send({method:"net_peerCount",params:[]})})}function tPt(t){return xce(this,void 0,void 0,function*(){return t.send({method:"net_listening",params:[]})})}var U1=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 nPt=t=>U1(void 0,void 0,void 0,function*(){return t.send({method:"personal_listAccounts",params:[]})}),rPt=(t,e)=>U1(void 0,void 0,void 0,function*(){return t.send({method:"personal_newAccount",params:[e]})}),sPt=(t,e,n,r)=>U1(void 0,void 0,void 0,function*(){return t.send({method:"personal_unlockAccount",params:[e,n,r]})}),iPt=(t,e)=>U1(void 0,void 0,void 0,function*(){return t.send({method:"personal_lockAccount",params:[e]})}),aPt=(t,e,n)=>U1(void 0,void 0,void 0,function*(){return t.send({method:"personal_importRawKey",params:[e,n]})}),oPt=(t,e,n)=>U1(void 0,void 0,void 0,function*(){return t.send({method:"personal_sendTransaction",params:[e,n]})}),lPt=(t,e,n)=>U1(void 0,void 0,void 0,function*(){return t.send({method:"personal_signTransaction",params:[e,n]})}),cPt=(t,e,n,r)=>U1(void 0,void 0,void 0,function*(){return t.send({method:"personal_sign",params:[e,n,r]})}),uPt=(t,e,n)=>U1(void 0,void 0,void 0,function*(){return t.send({method:"personal_ecRecover",params:[e,n]})}),Ebe={type:"object",properties:{accessList:{type:"null"},maxFeePerGas:{type:"null"},maxPriorityFeePerGas:{type:"null"}}},kbe={type:"object",properties:{maxFeePerGas:{type:"null"},maxPriorityFeePerGas:{type:"null"}}},Tbe={type:"object",properties:{gasPrice:{type:"null"}}},oF=(t,e,n)=>{try{Js.validateJSONSchema(t,e)}catch(r){throw r instanceof IS?new l7t(r.errors,n):r}},dPt=t=>{var e,n;const r=t;if(!Nr(r.type)){let a;switch(r.type){case"0x0":a=Ebe;break;case"0x1":a=kbe;break;case"0x2":a=Tbe;break;default:return es({format:"uint"},r.type,yi)}return oF(a,r,r.type),es({format:"uint"},r.type,yi)}if(!Nr(r.maxFeePerGas)||!Nr(r.maxPriorityFeePerGas))return oF(Tbe,r,"0x2"),"0x2";if(!Nr(r.accessList))return oF(kbe,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(!Nr(s)){const a=Object.keys(R_).indexOf(s);if(a>=Object.keys(R_).indexOf("london"))return Nr(r.gasPrice)?"0x2":"0x0";if(a===Object.keys(R_).indexOf("berlin"))return"0x0"}if(!Nr(r.gasPrice))return oF(Ebe,r,"0x0"),"0x0"},fPt=(t,e)=>{var n;return((n=e==null?void 0:e.transactionTypeParser)!==null&&n!==void 0?n:dPt)(t)},hPt=t=>t[0]>127?"0x0":E1(t[0]),pPt={type:"object",properties:{address:{format:"address"},storageKeys:{type:"array",items:{format:"bytes32"}}}},gce={type:"array",items:Object.assign({},pPt)},mPt={type:"object",properties:{accessList:Object.assign({},gce),gasUsed:{type:"string"}}},Pbe={type:"string",enum:["goerli","kovan","mainnet","rinkeby","ropsten","sepolia"]},Ibe={type:"string",enum:["arrowGlacier","berlin","byzantium","chainstart","constantinople","dao","homestead","istanbul","london","merge","muirGlacier","petersburg","shanghai","spuriousDragon","tangerineWhistle"]},xPt={type:"object",properties:{name:{format:"string"},networkId:{format:"uint"},chainId:{format:"uint"}}},QLe={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({},gce),data:{format:"bytes"},input:{format:"bytes"},nonce:{format:"uint"},chain:Object.assign({},Pbe),hardfork:Object.assign({},Ibe),chainId:{format:"uint"},networkId:{format:"uint"},common:{type:"object",properties:{customChain:Object.assign({},xPt),baseChain:Object.assign({},Pbe),hardfork:Object.assign({},Ibe)}},gasLimit:{format:"uint"},v:{format:"uint"},r:{format:"bytes32"},s:{format:"bytes32"}}},dne={type:"object",properties:Object.assign(Object.assign({},QLe.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({},gce),data:{format:"bytes"},input:{format:"bytes"},nonce:{format:"uint"},gasLimit:{format:"uint"},v:{format:"uint"},r:{format:"bytes32"},s:{format:"bytes32"}})},ZLe={type:"object",properties:{index:{format:"uint"},validatorIndex:{format:"uint"},address:{format:"address"},amount:{format:"uint"}}},AR={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({},dne)},{type:"array",items:{format:"bytes32"}}]},transactionsRoot:{format:"bytes32"},uncles:{type:"array",items:{format:"bytes32"}},withdrawals:{type:"array",items:Object.assign({},ZLe)},withdrawalsRoot:{format:"bytes32"}}},gPt={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({},ZLe)},withdrawalsRoot:{format:"bytes32"}}},y8={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"}}}},bPt={type:"object",properties:{startingBlock:{format:"string"},currentBlock:{format:"string"},highestBlock:{format:"string"},knownStates:{format:"string"},pulledStates:{format:"string"}}},v8={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({},y8)},logsBloom:{format:"bytes"},root:{format:"bytes"},status:{format:"uint"},type:{format:"uint"}}},yPt={type:"object",properties:{messageHash:{format:"bytes"},r:{format:"bytes32"},s:{format:"bytes32"},v:{format:"bytes"},message:{format:"bytes"},signature:{format:"bytes"}}},vPt={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"}}}},wPt={type:"object",properties:{key:{format:"bytes32"},value:{format:"uint"},proof:{type:"array",items:{format:"bytes32"}}}},CPt={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({},wPt)}}};function bf(t,e=yd,n={transactionSchema:dne,fillInputAndData:!1}){var r,s;let a=F2({},t);if(Nr(t==null?void 0:t.common)||(a.common=Object.assign({},t.common),Nr((r=t.common)===null||r===void 0?void 0:r.customChain)||(a.common.customChain=Object.assign({},t.common.customChain))),a=es((s=n.transactionSchema)!==null&&s!==void 0?s:dne,a,e),!Nr(a.data)&&!Nr(a.input)&&E1(a.data)!==E1(a.input))throw new bMe({data:Ki(a.data),input:Ki(a.input)});return n.fillInputAndData&&(Nr(a.data)?Nr(a.input)||(a.data=a.input):a.input=a.data),Nr(a.gasLimit)||(a.gas=a.gasLimit,delete a.gasLimit),a}function NPt(t,e,n={fillInputAndData:!1}){return{raw:es({format:"bytes"},t,e),tx:bf(Object.assign(Object.assign({},f5.fromSerializedData(xo(t)).toJSON()),{hash:Ki(MS(xo(t))),type:hPt(xo(t))}),e,{fillInputAndData:n.fillInputAndData,transactionSchema:n.transactionSchema})}}var bce=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 yce(t,e){return bce(this,void 0,void 0,function*(){const n=yield JTt(t.requestManager);return es({format:"uint"},n,e)})}function SPt(t,e){return bce(this,void 0,void 0,function*(){const n=yield ePt(t.requestManager);return es({format:"uint"},n,e)})}const jPt=t=>bce(void 0,void 0,void 0,function*(){return tPt(t.requestManager)});var UW=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 JLe extends of{getId(e=this.defaultReturnFormat){return UW(this,void 0,void 0,function*(){return yce(this,e)})}getPeerCount(e=this.defaultReturnFormat){return UW(this,void 0,void 0,function*(){return SPt(this,e)})}isListening(){return UW(this,void 0,void 0,function*(){return jPt(this)})}}const US="ALLEVENTS",fne={name:US,signature:"",type:"event",inputs:[]},EU={bytes:j1.HEX,number:ap.NUMBER};var eRe=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 APt(t,e,n){return eRe(this,void 0,void 0,function*(){var r,s,a,o;const l=yield kRe(e,e.defaultBlock,!1,yi);if(Nr(l.baseFeePerGas))throw new s7t;let c;if(Nr(t.gasPrice)&&BigInt(l.baseFeePerGas)===BigInt(0)&&(c=yield Ece(e,n)),!Nr(t.gasPrice)||!Nr(c)){const u=es({format:"uint"},(r=t.gasPrice)!==null&&r!==void 0?r:c,n);return{maxPriorityFeePerGas:u,maxFeePerGas:u}}return{maxPriorityFeePerGas:es({format:"uint"},(s=t.maxPriorityFeePerGas)!==null&&s!==void 0?s:e.defaultMaxPriorityFeePerGas,n),maxFeePerGas:es({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 tRe(t,e,n){return eRe(this,void 0,void 0,function*(){const r=nRe(t,e);if(!Nr(r)){if(r.startsWith("-"))throw new z1e(r);if(Number(r)<0||Number(r)>127)throw new z1e(r);if(Nr(t.gasPrice)&&(r==="0x0"||r==="0x1"))return{gasPrice:yield Ece(e,n),maxPriorityFeePerGas:void 0,maxFeePerGas:void 0};if(r==="0x2")return Object.assign({gasPrice:void 0},yield APt(t,e,n))}})}var vce=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 hne=(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(!Ta(n[t])&&QMe(n[t])){if(e.wallet){const s=e.wallet.get(es({format:"uint"},n[t],EU));if(!Nr(s))return s.address;throw new H1e}throw new H1e}else throw t==="from"?new BAt(n.from):new $At(n.to)}if(t==="from"){if(!Nr(r))return _U(r);if(!Nr(e.defaultAccount))return e.defaultAccount}},_Pt=(t,e,...n)=>vce(void 0,[t,e,...n],void 0,function*(r,s,a=r.defaultReturnFormat){if(Nr(s))throw new r7t;return PRe(r,s,r.defaultBlock,a)}),nRe=(t,e)=>{const n=fPt(t,e);if(!Nr(n))return n;if(!Nr(e.defaultTransactionType))return es({format:"uint"},e.defaultTransactionType,yi)};function EPt(t){return vce(this,void 0,void 0,function*(){var e,n;let r=es(QLe,t.transaction,t.web3Context.defaultReturnFormat);if(Nr(r.from)&&(r.from=hne("from",t.web3Context,void 0,t.privateKey)),Nr(r.nonce)&&(r.nonce=yield _Pt(t.web3Context,r.from,yi)),Nr(r.value)&&(r.value="0x0"),Nr(r.data))Nr(r.input)?r.input="0x":r.input.startsWith("0x")||(r.input=`0x${r.input}`);else{if(!Nr(r.input)&&r.data!==r.input)throw new bMe({data:Ki(r.data),input:Ki(r.input)});r.data.startsWith("0x")||(r.data=`0x${r.data}`)}if(Nr(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}})}Nr(r.chain)&&(r.chain=t.web3Context.defaultChain),Nr(r.hardfork)&&(r.hardfork=t.web3Context.defaultHardfork)}if(Nr(r.chainId)&&Nr((e=r.common)===null||e===void 0?void 0:e.customChain.chainId)&&(r.chainId=yield FRe(t.web3Context,yi)),Nr(r.networkId)&&(r.networkId=(n=t.web3Context.defaultNetworkId)!==null&&n!==void 0?n:yield yce(t.web3Context,yi)),Nr(r.gasLimit)&&!Nr(r.gas)&&(r.gasLimit=r.gas),r.type=nRe(r,t.web3Context),Nr(r.accessList)&&(r.type==="0x1"||r.type==="0x2")&&(r.accessList=[]),t.fillGasPrice&&(r=Object.assign(Object.assign({},r),yield tRe(r,t.web3Context,yi))),Nr(r.gas)&&Nr(r.gasLimit)&&t.fillGasLimit){const s=yield Pce(t.web3Context,r,"latest",yi);r=Object.assign(Object.assign({},r),{gas:es({format:"uint"},s,yi)})}return r})}const kPt=t=>vce(void 0,void 0,void 0,function*(){var e;return((e=t.web3Context.transactionBuilder)!==null&&e!==void 0?e:EPt)(Object.assign(Object.assign({},t),{transaction:t.transaction}))});var wce=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 pne(t,e,n){const r=t.transactionPollingInterval,[s,a]=uLe(()=>wce(this,void 0,void 0,function*(){let l;try{l=yield kce(t,EU)}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 wMe({starterBlockNumber:e,numberOfBlocks:c,transactionHash:n})}),r);return[a,{clean:()=>{clearInterval(s)}}]}function TPt(t,e,n){return wce(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]=pne(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 pne(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 wMe({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 rRe(t,e){return wce(this,void 0,void 0,function*(){var n,r;const{provider:s}=t.requestManager;let a;const o=yield kce(t,EU);return!((r=(n=s).supportsSubscriptions)===null||r===void 0)&&r.call(n)&&t.enableExperimentalFeatures.useSubscriptionWhenCheckingBlockTimeout?a=yield TPt(t,o,e):a=pne(t,o,e),a})}var PPt=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 mne(t,e,n){return PPt(this,void 0,void 0,function*(){const[r,s]=Zle(t.transactionSendTimeout,new i7t({numberOfSeconds:t.transactionSendTimeout/1e3,transactionHash:n})),[a,o]=yield rRe(t,n);try{return yield Promise.race([e(),s,a])}finally{clearTimeout(r),o.clean()}})}var Fbe=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 sRe(t,e,n,r){return Fbe(this,void 0,void 0,function*(){var s;const a=(s=t.transactionReceiptPollingInterval)!==null&&s!==void 0?s:t.transactionPollingInterval,[o,l]=Qle(()=>Fbe(this,void 0,void 0,function*(){try{return(r??TRe)(t,e,n)}catch(x){console.warn("An error happen while trying to get the transaction receipt",x);return}}),a),[c,u]=Zle(t.transactionPollingTimeout,new vMe({numberOfSeconds:t.transactionPollingTimeout/1e3,transactionHash:e})),[d,f]=yield rRe(t,e);try{return yield Promise.race([o,u,d])}finally{c&&clearTimeout(c),l&&clearInterval(l),f.clean()}})}var IPt=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 NM=({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,customTransactionReceiptSchema:r,returnFormat:s})=>{var a;let o=1;const l=setInterval(()=>{IPt(void 0,void 0,void 0,function*(){if(o>=t.transactionConfirmationBlocks){clearInterval(l);return}const c=yield XLe(t.requestManager,lc(BigInt(e.blockNumber)+BigInt(o)),!1);c!=null&&c.hash&&(o+=1,n.emit("confirmation",{confirmations:es({format:"uint"},o,s),receipt:es(r??v8,e,s),latestBlockHash:es({format:"bytes32"},c.hash,s)}))})},(a=t.transactionReceiptPollingInterval)!==null&&a!==void 0?a:t.transactionPollingInterval)};var Obe=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 FPt=({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=>Obe(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:es({format:"uint"},f,s),receipt:es(r??v8,e,s),latestBlockHash:es({format:"bytes32"},u.parentHash,s)}),f>=t.transactionConfirmationBlocks&&(yield(d=t.subscriptionManager)===null||d===void 0?void 0:d.removeSubscription(c))})),c.on("error",()=>Obe(void 0,void 0,void 0,function*(){var u;yield(u=t.subscriptionManager)===null||u===void 0?void 0:u.removeSubscription(c),a=!1,NM({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,customTransactionReceiptSchema:r,returnFormat:s})}))}).catch(()=>{a=!1,NM({web3Context:t,transactionReceipt:e,customTransactionReceiptSchema:r,transactionPromiEvent:n,returnFormat:s})})}),setTimeout(()=>{a&&NM({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,returnFormat:s})},t.blockHeaderTimeout*1e3)};function OPt(t,e,n,r,s,a){if(Nr(n)||Nr(n.blockHash))throw new a7t({receipt:n,blockHash:es({format:"bytes32"},n==null?void 0:n.blockHash,s),transactionHash:es({format:"bytes32"},r,s)});if(!n.blockNumber)throw new o7t({receipt:n});e.emit("confirmation",{confirmations:es({format:"uint"},1,s),receipt:es(a??v8,n,s),latestBlockHash:es({format:"bytes32"},n.blockHash,s)});const o=t.requestManager.provider;o&&"supportsSubscriptions"in o&&o.supportsSubscriptions()?FPt({web3Context:t,transactionReceipt:n,transactionPromiEvent:e,customTransactionReceiptSchema:a,returnFormat:s}):NM({web3Context:t,transactionReceipt:n,transactionPromiEvent:e,customTransactionReceiptSchema:a,returnFormat:s})}const kU=t=>!oi(t)&&typeof t=="object"&&!oi(t.type)&&t.type==="error",Cce=t=>!oi(t)&&typeof t=="object"&&!oi(t.type)&&t.type==="event",TU=t=>!oi(t)&&typeof t=="object"&&!oi(t.type)&&t.type==="function",MPt=t=>!oi(t)&&typeof t=="object"&&!oi(t.type)&&t.type==="constructor",LPt=t=>typeof t=="object"&&typeof t.components>"u"&&typeof t.name>"u",iRe=t=>t.includes("[]")?{type:"tuple[]",name:t.slice(0,-2)}:{type:"tuple",name:t},aRe=t=>{const e=[];for(const n of Object.keys(t)){const r=t[n];typeof r=="object"?e.push(Object.assign(Object.assign({},iRe(n)),{components:aRe(r)})):e.push({name:n,type:t[n]})}return e},xne=(t,e)=>{const n=[];return e.forEach(r=>{if(typeof r.components=="object"){if(!r.type.startsWith("tuple"))throw new Qi(`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=xne(t,r.components);n.push(`(${o.join(",")})${a}`)}else n.push(r.type)}),n},a1=t=>{var e,n,r,s;return kU(t)||Cce(t)||TU(t)?!((e=t.name)===null||e===void 0)&&e.includes("(")?t.name:`${(n=t.name)!==null&&n!==void 0?n:""}(${xne(!1,(r=t.inputs)!==null&&r!==void 0?r:[]).join(",")})`:`(${xne(!1,(s=t.inputs)!==null&&s!==void 0?s:[]).join(",")})`},RPt=t=>{if(typeof t!="string"&&!kU(t))throw new Qi("Invalid parameter value in encodeErrorSignature");let e;return t&&(typeof t=="function"||typeof t=="object")?e=a1(t):e=t,ah(e)},Nce=t=>{if(typeof t!="string"&&!Cce(t))throw new Qi("Invalid parameter value in encodeEventSignature");let e;return t&&(typeof t=="function"||typeof t=="object")?e=a1(t):e=t,ah(e)};function Sce(t,e){const n=t.exec(e);return n==null?void 0:n.groups}var oRe=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,lRe=/^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)?$/,cRe=/^\(.+?\).*?$/,DPt=Object.defineProperty,BPt=(t,e,n)=>e in t?DPt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d7=(t,e,n)=>(BPt(t,typeof e!="symbol"?e+"":e,n),n),$Pt="abitype",UPt="0.7.1",rf=class extends Error{constructor(t,e={}){var a;const n=e.cause instanceof rf?e.cause.details:(a=e.cause)!=null&&a.message?e.cause.message:e.details,r=e.cause instanceof rf&&e.cause.docsPath||e.docsPath,s=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...n?[`Details: ${n}`]:[],`Version: ${$Pt}@${UPt}`].join(`
`);super(s),d7(this,"details"),d7(this,"docsPath"),d7(this,"metaMessages"),d7(this,"shortMessage"),d7(this,"name","AbiTypeError"),e.cause&&(this.cause=e.cause),this.details=n,this.docsPath=r,this.metaMessages=e.metaMessages,this.shortMessage=t}},uRe=/^struct (?<name>[a-zA-Z0-9_]+) \{(?<properties>.*?)\}$/;function dRe(t){return uRe.test(t)}function zPt(t){return Sce(uRe,t)}var Mbe=new Set(["memory","indexed","storage","calldata"]),HPt=new Set(["calldata","memory","storage"]);function VPt(t,e){return e?`${e}:${t}`:t}var zW=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}]]),WPt=/^(?<type>[a-zA-Z0-9_]+?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z0-9_]+))?$/,qPt=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z0-9_]+))?$/,GPt=/^u?int$/;function _R(t,e){var f,x;const n=VPt(t,e==null?void 0:e.type);if(zW.has(n))return zW.get(n);const r=cRe.test(t),s=Sce(r?qPt:WPt,t);if(!s)throw new rf("Invalid ABI parameter.",{details:t});if(s.name&&YPt(s.name))throw new rf("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=ZC(s.type),y=[],v=g.length;for(let C=0;C<v;C++)y.push(_R(g[C],{structs:l}));u={components:y}}else if(s.type in l)c="tuple",u={components:l[s.type]};else if(GPt.test(s.type))c=`${s.type}256`;else if(c=s.type,(e==null?void 0:e.type)!=="struct"&&!fRe(c))throw new rf("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 rf("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${s.modifier}" not allowed${e!=null&&e.type?` in "${e.type}" type`:""}.`]});if(HPt.has(s.modifier)&&!XPt(c,!!s.array))throw new rf("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 zW.set(n,d),d}function ZC(t,e=[],n="",r=0){if(t===""){if(n==="")return e;if(r!==0)throw new rf("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?ZC(l,[...e,n.trim()]):ZC(l,e,`${n}${o}`,r);case"(":return ZC(l,e,`${n}${o}`,r+1);case")":return ZC(l,e,`${n}${o}`,r-1);default:return ZC(l,e,`${n}${o}`,r)}}return[]}function fRe(t){return t==="address"||t==="bool"||t==="function"||t==="string"||oRe.test(t)||lRe.test(t)}var KPt=/^(?: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 YPt(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||oRe.test(t)||lRe.test(t)||KPt.test(t)}function XPt(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function QPt(t){const e={},n=t.length;for(let o=0;o<n;o++){const l=t[o];if(!dRe(l))continue;const c=zPt(l);if(!c)throw new rf("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=_R(y,{type:"struct"});d.push(v)}if(!d.length)throw new rf("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]=hRe(c,e)}return r}var ZPt=/^(?<type>[a-zA-Z0-9_]+?)(?<array>(?:\[\d*?\])+?)?$/;function hRe(t,e,n=new Set){const r=[],s=t.length;for(let a=0;a<s;a++){const o=t[a];if(cRe.test(o.type))r.push(o);else{const c=Sce(ZPt,o.type);if(!(c!=null&&c.type))throw new rf("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 rf("Circular reference detected.",{metaMessages:[`Struct "${d}" is a circular reference.`]});r.push({...o,type:`tuple${u??""}`,components:hRe(e[d]??[],e,new Set([...n,d]))})}else if(fRe(d))r.push(o);else throw new rf("Unknown type.",{metaMessages:[`Type "${d}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]})}}return r}function JPt(t){let e;if(typeof t=="string")e=_R(t,{modifiers:Mbe});else{const n=QPt(t),r=t.length;for(let s=0;s<r;s++){const a=t[s];if(!dRe(a)){e=_R(a,{modifiers:Mbe,structs:n});break}}}if(!e)throw new rf("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(t,null,2)})`,docsPath:"/api/human.html#parseabiparameter-1"});return e}const ll=32;function gne(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 pRe(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=>pRe(r))})}function eIt(t){return!oi(t)&&typeof t=="object"&&!oi(t.type)&&typeof t.type=="string"}function mRe(t){return t.map(e=>{var n;if(eIt(e))return e;if(typeof e=="string")return pRe(JPt(e.replace(/tuple/,"")));if(LPt(e)){const r=Object.keys(e)[0],s=iRe(r);return s.name=(n=s.name)!==null&&n!==void 0?n:"",Object.assign(Object.assign({},s),{components:aRe(e[r])})}throw new Qi("Invalid abi")})}function jce(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 Qi("Invalid fixed array size",{size:r});return{param:{type:n,name:"",components:t.components},size:s}}function ER(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(ER))!==null&&n!==void 0?n:!1:t.type.endsWith("]")?ER(jce(t).param):!1}const xRe=20,gRe=ll-xRe;function tIt(t,e){if(typeof e!="string")throw new Qi("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 Qi("provided input is not valid address",{value:e,name:t.name,type:t.type});const r=R5(n),s=gne(ll);return s.set(r,gRe),{dynamic:!1,encoded:s}}function nIt(t,e){const n=e.subarray(gRe,ll);if(n.length!==xRe)throw new Qi("Invalid decoding input, not enough bytes to decode address",{bytes:e});const r=B1(n);return{result:Nx(r),encoded:e.subarray(ll),consumed:ll}}const h2=new Map;let lF=BigInt(256);for(let t=8;t<=256;t+=8)h2.set(`uint${t}`,{min:BigInt(0),max:lF-BigInt(1)}),h2.set(`int${t}`,{min:-lF/BigInt(2),max:lF/BigInt(2)-BigInt(1)}),lF*=BigInt(256);h2.set("int",h2.get("int256"));h2.set("uint",h2.get("uint256"));const bRe=BigInt(1)<<BigInt(256);function rIt(t,e=ll){let n;return t<0?n=(bRe+t).toString(16):n=t.toString(16),n=OS(n,e*2),R5(n)}function sIt(t,e){const n=B1(t),r=BigInt(n);return r<=e?r:r-bRe}function JT(t,e){let n;try{n=vw(e)}catch{throw new Qi("provided input is not number value",{type:t.type,value:e,name:t.name})}const r=h2.get(t.type);if(!r)throw new Qi("provided abi contains invalid number datatype",{type:t.type});if(n<r.min)throw new Qi("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 Qi("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:rIt(n)}}function zS(t,e){if(e.length<ll)throw new Qi("Not enough bytes left to decode",{param:t,bytesLeft:e.length});const n=e.subarray(0,ll),r=h2.get(t.type);if(!r)throw new Qi("provided abi contains invalid number datatype",{type:t.type});const s=sIt(n,r.max);if(s<r.min)throw new Qi("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 Qi("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(ll),consumed:ll}}function iIt(t,e){let n;try{n=nLe(e)}catch(r){if(r instanceof Rle)throw new Qi("provided input is not valid boolean value",{type:t.type,value:e,name:t.name})}return JT({type:"uint8",name:""},Number(n))}function aIt(t,e){const n=zS({type:"uint8",name:""},e);if(n.result>1||n.result<0)throw new Qi("Invalid boolean value encoded",{boolBytes:e.subarray(0,ll),numberResult:n});return{result:n.result===BigInt(1),encoded:n.encoded,consumed:ll}}const oIt=32;function yRe(t,e){if(typeof e=="string"&&e.length%2!==0&&(e+="0"),!P2(e))throw new Qi("provided input is not valid bytes value",{type:t.type,value:e,name:t.name});const n=mx(e),[,r]=t.type.split("bytes");if(r){if(Number(r)>oIt||Number(r)<1)throw new Qi("invalid bytes type. Static byte type can have between 1 and 32 bytes",{type:t.type});if(Number(r)<n.length)throw new Qi("provided input size is different than type size",{type:t.type,value:e,name:t.name});const o=gne(ll);return o.set(n),{dynamic:!1,encoded:o}}const s=Math.ceil(n.length/ll),a=gne(ll+s*ll);return a.set(JT({type:"uint32",name:""},n.length).encoded),a.set(n,ll),{dynamic:!0,encoded:a}}function vRe(t,e){const[,n]=t.type.split("bytes");let r=Number(n),s=e,a=1,o=0;if(!r){const l=zS({type:"uint32",name:""},s);r=Number(l.result),o+=l.consumed,s=l.encoded,a=Math.ceil(r/ll)}if(r>e.length)throw new Qi("there is not enough data to decode",{type:t.type,encoded:e,size:r});return{result:Ki(s.subarray(0,r)),encoded:s.subarray(a*ll),consumed:o+a*ll}}function lIt(t,e){if(typeof e!="string")throw new Qi("invalid input, should be string",{input:e});const n=Kle(e);return yRe({type:"bytes",name:""},n)}function cIt(t,e){const n=vRe({type:"bytes",name:""},e);return{result:bU(n.result),encoded:n.encoded,consumed:n.consumed}}function wRe(t){let e=0,n=0;const r=[],s=[];for(const a of t)a.dynamic?e+=ll:e+=a.encoded.length;for(const a of t)a.dynamic?(r.push(JT({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 uIt(t,e){if(!Array.isArray(e))throw new Qi("Expected value to be array",{abi:t,values:e});const{size:n,param:r}=jce(t),s=e.map(l=>bne(r,l)),a=n===-1,o=s.length>0&&s[0].dynamic;if(!a&&e.length!==n)throw new Qi("Given arguments count doesn't match array length",{arrayLength:n,argumentsLength:e.length});if(a||o){const l=wRe(s);if(a){const c=JT({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 dIt(t,e){let{size:n,param:r}=jce(t);const s=n===-1;let a=0;const o=[];let l=e;if(s){const u=zS({type:"uint32",name:""},e);n=Number(u.result),a=u.consumed,l=u.encoded}if(ER(r)){for(let u=0;u<n;u+=1){const d=zS({type:"uint32",name:""},l.subarray(u*ll));a+=d.consumed;const f=kR(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=kR(r,e.subarray(a));a+=d.consumed,o.push(d.result)}return{result:o,encoded:e.subarray(a),consumed:a}}function bne(t,e){if(t.type==="string")return lIt(t,e);if(t.type==="bool")return iIt(t,e);if(t.type==="address")return tIt(t,e);if(t.type==="tuple")return Ace(t,e);if(t.type.endsWith("]"))return uIt(t,e);if(t.type.startsWith("bytes"))return yRe(t,e);if(t.type.startsWith("uint")||t.type.startsWith("int"))return JT(t,e);throw new Qi("Unsupported",{param:t,value:e})}function kR(t,e){if(t.type==="string")return cIt(t,e);if(t.type==="bool")return aIt(t,e);if(t.type==="address")return nIt(t,e);if(t.type==="tuple")return CRe(t,e);if(t.type.endsWith("]"))return dIt(t,e);if(t.type.startsWith("bytes"))return vRe(t,e);if(t.type.startsWith("uint")||t.type.startsWith("int"))return zS(t,e);throw new Qi("Unsupported",{param:t,bytes:e})}function Ace(t,e){var n,r,s;let a=!1;if(!Array.isArray(e)&&typeof e!="object")throw new Qi("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 Qi("input param length missmatch",{param:t,input:e});d=bne(u,o[c])}else{const f=o[(s=u.name)!==null&&s!==void 0?s:""];if(f==null)throw new Qi("missing input defined in abi",{param:t,input:e,paramName:u.name});d=bne(u,f)}d.dynamic&&(a=!0),l.push(d)}return a?{dynamic:!0,encoded:wRe(l)}:{dynamic:!1,encoded:Ad(...l.map(c=>c.encoded))}}function CRe(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(ER(o)){const c=zS({type:"uint32",name:""},e.subarray(r));l=kR(o,e.subarray(Number(c.result))),r+=c.consumed,s+=l.consumed}else l=kR(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 fIt(t,e,n){const r=mRe(t),s=R5(e);return CRe({type:"tuple",name:"",components:r},s).result}function NRe(t){const e=[];return t.forEach(n=>{if(Array.isArray(n)){const r=NRe(n);e.push({type:"tuple",components:r,name:""})}else e.push({type:E1(n,!0)})}),e}function PU(t,e){if((t==null?void 0:t.length)!==e.length)throw new Qi("Invalid number of values received for given ABI",{expected:t==null?void 0:t.length,received:e.length});const n=mRe(t);return B1(Ace({type:"tuple",name:"",components:n},e).encoded)}function hIt(t){try{const e=NRe(t);return B1(Ace({type:"tuple",name:"",components:e},t).encoded)}catch{throw new Qi("Could not infer types from given params",{params:t})}}const yne=(t,e)=>PU([t],[e]),SRe=(t,e,n)=>{try{if(t.length>0&&(!e||e==="0x"||e==="0X"))throw new Qi("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 fIt(t,`0x${e.replace(/0x/i,"")}`,n)}catch(r){throw new Qi(`Parameter decoding error: ${r.message}`,{internalErr:r})}},A3=(t,e)=>SRe(t,e,!1),jRe=(t,e)=>A3([t],e)[0],ME=t=>{if(typeof t!="string"&&!TU(t))throw new Qi("Invalid parameter value in encodeFunctionSignature");let e;return t&&(typeof t=="function"||typeof t=="object")?e=a1(t):e=t,ah(e).slice(0,10)},pIt=(t,e)=>{var n;if(!TU(t))throw new Qi("Invalid parameter value in encodeFunctionCall");return`${ME(t)}${PU((n=t.inputs)!==null&&n!==void 0?n:[],e??[]).replace("0x","")}`},vne=(t,e,n=!0)=>{const r=n&&e&&e.length>=10&&e.startsWith("0x")?e.slice(10):e;if(!t.inputs)throw new vd("No inputs found in the ABI");const s=A3([...t.inputs],r);return Object.assign(Object.assign({},s),{__method__:a1(t)})},mIt=(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=A3([...t.outputs],n);return r.__length__===1?r[0]:r},xIt=["bool","string","int","uint","address","fixed","ufixed"],gIt=(t,e)=>t==="string"?e:jRe(t,e),ARe=(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?SRe(Object.values(a),e,!0):{__length__:0},l=r.length-Object.keys(s).length,c=Object.values(s).map((x,g)=>xIt.some(y=>x.type.startsWith(y))?gIt(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},SM=(t,e)=>{if(e!=null&&e.data){let n,r,s;try{const a=e.data.slice(0,10),o=t.find(l=>RPt(l).startsWith(a));o!=null&&o.inputs?(n=o.name,r=a1(o),s=A3([...o.inputs],e.data.substring(10))):e.data.startsWith("0x08c379a0")?(n="Error",r="Error(string)",s=A3([{name:"message",type:"string"}],e.data.substring(10))):e.data.startsWith("0x4e487b71")?(n="Panic",r="Panic(uint256)",s=A3([{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 bIt=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 yIt=(t,e)=>{var n,r,s,a,o;if(t instanceof C3&&t.cause instanceof cU){if(e!==void 0){const l=e.filter(c=>kU(c));return SM(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 uU&&!Array.isArray((o=t.cause)===null||o===void 0?void 0:o.errors)&&t.cause!==void 0)return t.cause.message;throw t};function _Re(t,e,n){return bIt(this,arguments,void 0,function*(r,s,a,o=r.defaultReturnFormat){try{yield Tce(r,s,r.defaultBlock,o);return}catch(l){return yIt(l,a)}})}var vIt=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 HW(t,e,n,r,s,a){return vIt(this,void 0,void 0,function*(){let o=a;o===void 0&&t.handleRevert&&e!==void 0&&(o=yield _Re(t,e,s));let l;if(o===void 0)l=new xMe(n);else if(typeof o=="string")l=new sR(o,void 0,n);else if(o.customErrorName!==void 0&&o.customErrorDecodedSignature!==void 0&&o.customErrorArguments!==void 0){const c=o;l=new mMe(c.reason,c.customErrorName,c.customErrorDecodedSignature,c.customErrorArguments,c.signature,n,c.data)}else l=new sR(o.reason,o.signature,n,o.data);return l})}const _ce=(t,e,n,r=yd)=>{var s,a,o,l,c,u;let d=Object.assign({},t);const f=es(y8,e,r);if([US,"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:ARe([...(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 Tv=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 ERe{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=_ce(fne,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 Tv(this,void 0,void 0,function*(){if(this.options.checkRevertBeforeSending!==!1){let n=e;Nr(e.data)&&Nr(e.input)&&Nr(e.gas)&&(n=Object.assign(Object.assign({},e),{gas:21e3}));const r=yield _Re(this.web3Context,n,this.options.contractAbi);if(r!==void 0)throw yield HW(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 Tv(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)&&Nr(n.gasPrice)&&(Nr(r.maxPriorityFeePerGas)||Nr(r.maxFeePerGas))&&(a=Object.assign(Object.assign({},n),yield tRe(n,this.web3Context,yi))),a})}signAndSend(e){return Tv(this,arguments,void 0,function*({wallet:n,tx:r}){if(n){const s=yield n.signTransaction(r);return mne(this.web3Context,()=>Tv(this,void 0,void 0,function*(){return YLe(this.web3Context.requestManager,s.rawTransaction)}),s.transactionHash)}return mne(this.web3Context,()=>Tv(this,void 0,void 0,function*(){return ATt(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 Tv(this,arguments,void 0,function*({error:n,tx:r}){var s;let a=n;return a instanceof C3&&this.web3Context.handleRevert&&(a=yield HW(this.web3Context,r,void 0,void 0,(s=this.options)===null||s===void 0?void 0:s.contractAbi)),(a instanceof uU||a instanceof C3||a instanceof mMe||a instanceof xMe||a instanceof sR||a instanceof vMe)&&this.promiEvent.listenerCount("error")>0&&this.promiEvent.emit("error",a),a})}emitConfirmation({receipt:e,transactionHash:n,customTransactionReceiptSchema:r}){this.promiEvent.listenerCount("confirmation")>0&&OPt(this.web3Context,this.promiEvent,e,n,this.returnFormat,r)}handleResolve(e){return Tv(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 HW(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 Ua=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())})},wIt=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 CIt=t=>Ua(void 0,void 0,void 0,function*(){return KLe(t.requestManager)});function NIt(t,e){return Ua(this,void 0,void 0,function*(){const n=yield dTt(t.requestManager);return es({format:"uint"},n,e??t.defaultReturnFormat)})}function Ece(t,e){return Ua(this,void 0,void 0,function*(){const n=yield fTt(t.requestManager);return es({format:"uint"},n,e??t.defaultReturnFormat)})}function SIt(t,e){return Ua(this,void 0,void 0,function*(){const n=yield hTt(t.requestManager);return es({format:"uint"},n,e??t.defaultReturnFormat)})}function kce(t,e){return Ua(this,void 0,void 0,function*(){const n=yield mTt(t.requestManager);return es({format:"uint"},n,e??t.defaultReturnFormat)})}function jIt(t,e){return Ua(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Uc(s)?s:es({format:"uint"},s,yi),l=yield xTt(n.requestManager,r,o);return es({format:"uint"},l,a??n.defaultReturnFormat)})}function AIt(t,e,n){return Ua(this,arguments,void 0,function*(r,s,a,o=r.defaultBlock,l){const c=es({format:"uint"},a,yi),u=Uc(o)?o:es({format:"uint"},o,yi),d=yield gTt(r.requestManager,s,c,u);return es({format:"bytes"},d,l??r.defaultReturnFormat)})}function _It(t,e){return Ua(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Uc(s)?s:es({format:"uint"},s,yi),l=yield NTt(n.requestManager,r,o);return es({format:"bytes"},l,a??n.defaultReturnFormat)})}function kRe(t){return Ua(this,arguments,void 0,function*(e,n=e.defaultBlock,r=!1,s){var a;let o;if(P2(n)){const c=es({format:"bytes32"},n,yi);o=yield kTt(e.requestManager,c,r)}else{const c=Uc(n)?n:es({format:"uint"},n,yi);o=yield XLe(e.requestManager,c,r)}const l=es(AR,o,s??e.defaultReturnFormat);return Nr(l)?l:Object.assign(Object.assign({},l),{transactions:(a=l.transactions)!==null&&a!==void 0?a:[]})})}function EIt(t){return Ua(this,arguments,void 0,function*(e,n=e.defaultBlock,r){let s;if(P2(n)){const a=es({format:"bytes32"},n,yi);s=yield yTt(e.requestManager,a)}else{const a=Uc(n)?n:es({format:"uint"},n,yi);s=yield vTt(e.requestManager,a)}return es({format:"uint"},s,r??e.defaultReturnFormat)})}function kIt(t){return Ua(this,arguments,void 0,function*(e,n=e.defaultBlock,r){let s;if(P2(n)){const a=es({format:"bytes32"},n,yi);s=yield wTt(e.requestManager,a)}else{const a=Uc(n)?n:es({format:"uint"},n,yi);s=yield CTt(e.requestManager,a)}return es({format:"uint"},s,r??e.defaultReturnFormat)})}function TIt(t){return Ua(this,arguments,void 0,function*(e,n=e.defaultBlock,r,s){const a=es({format:"uint"},r,yi);let o;if(P2(n)){const l=es({format:"bytes32"},n,yi);o=yield OTt(e.requestManager,l,a)}else{const l=Uc(n)?n:es({format:"uint"},n,yi);o=yield MTt(e.requestManager,l,a)}return es(AR,o,s??e.defaultReturnFormat)})}function PIt(t,e){return Ua(this,arguments,void 0,function*(n,r,s=n.defaultReturnFormat){const a=es({format:"bytes32"},r,yd),o=yield TTt(n.requestManager,a);return Nr(o)?o:bf(o,s,{transactionSchema:n.config.customTransactionSchema,fillInputAndData:!0})})}function IIt(t,e){return Ua(this,void 0,void 0,function*(){return(yield qTt(t.requestManager)).map(r=>bf(r,e??t.defaultReturnFormat,{transactionSchema:t.config.customTransactionSchema,fillInputAndData:!0}))})}function FIt(t){return Ua(this,arguments,void 0,function*(e,n=e.defaultBlock,r,s){const a=es({format:"uint"},r,yi);let o;if(P2(n)){const l=es({format:"bytes32"},n,yi);o=yield PTt(e.requestManager,l,a)}else{const l=Uc(n)?n:es({format:"uint"},n,yi);o=yield ITt(e.requestManager,l,a)}return Nr(o)?o:bf(o,s??e.defaultReturnFormat,{transactionSchema:e.config.customTransactionSchema,fillInputAndData:!0})})}function TRe(t,e,n){return Ua(this,void 0,void 0,function*(){const r=es({format:"bytes32"},e,yd);let s;try{s=yield FTt(t.requestManager,r)}catch(a){if(typeof a=="object"&&!Nr(a)&&"message"in a&&a.message==="transaction indexing is in progress")console.warn("Transaction indexing is in progress.");else throw a}return Nr(s)?s:es(v8,s,n??t.defaultReturnFormat)})}function PRe(t,e){return Ua(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Uc(s)?s:es({format:"uint"},s,yi),l=yield bTt(n.requestManager,r,o);return es({format:"uint"},l,a??n.defaultReturnFormat)})}function LE(t,e,n,r={checkRevertBeforeSending:!0},s){const a=new GLe((o,l)=>{setImmediate(()=>{Ua(this,void 0,void 0,function*(){const c=new ERe({web3Context:t,promiEvent:a,options:r,returnFormat:n});let u=Object.assign({},e);Nr(s)||(u=yield s.processTransaction(u));let d=bf(Object.assign(Object.assign({},u),{from:hne("from",t,u),to:hne("to",t,u)}),yi,{transactionSchema:t.config.customTransactionSchema});try{d=yield c.populateGasPrice({transaction:u,transactionFormatted:d}),yield c.checkRevertBeforeSending(d),c.emitSending(d);let f;t.wallet&&!Nr(d.from)&&(f=t.wallet.get(d.from));const x=yield c.signAndSend({wallet:f,tx:d}),g=es({format:"bytes32"},x,n??t.defaultReturnFormat);c.emitSent(d),c.emitTransactionHash(g);const y=yield sRe(t,x,n??t.defaultReturnFormat),v=c.getReceiptWithEvents(es(v8,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 OIt(t,e,n,r={checkRevertBeforeSending:!0}){const s=new GLe((a,o)=>{setImmediate(()=>{Ua(this,void 0,void 0,function*(){const l=new ERe({web3Context:t,promiEvent:s,options:r,returnFormat:n}),c=es({format:"bytes"},e,yi),u=f5.fromSerializedData(mx(xo(c))),d=Object.assign(Object.assign({},u.toJSON()),{from:u.getSenderAddress().toString()});try{const{v:f,r:x,s:g}=d,y=wIt(d,["v","r","s"]);yield l.checkRevertBeforeSending(y),l.emitSending(c);const v=yield mne(t,()=>Ua(this,void 0,void 0,function*(){return YLe(t.requestManager,c)}));l.emitSent(c);const C=es({format:"bytes32"},v,n??t.defaultReturnFormat);l.emitTransactionHash(C);const S=yield sRe(t,v,n??t.defaultReturnFormat),T=l.getReceiptWithEvents(es(v8,S,n??t.defaultReturnFormat));l.emitReceipt(T),a(yield l.handleResolve({receipt:T,tx:d})),l.emitConfirmation({receipt:T,transactionHash:v})}catch(f){o(yield l.handleError({error:f,tx:d}))}})})});return s}function MIt(t,e,n){return Ua(this,arguments,void 0,function*(r,s,a,o=r.defaultReturnFormat){var l;const c=es({format:"bytes"},s,yd);if(!((l=r.wallet)===null||l===void 0)&&l.get(a)){const f=r.wallet.get(a).sign(c);return es(yPt,f,o)}if(typeof a=="number")throw new RAt(s,'RPC method "eth_sign" does not support index signatures');const u=yield STt(r.requestManager,a,c);return es({format:"bytes"},u,o)})}function LIt(t,e){return Ua(this,arguments,void 0,function*(n,r,s=n.defaultReturnFormat){const a=yield jTt(n.requestManager,bf(r,yi,{transactionSchema:n.config.customTransactionSchema}));return Hle(a)?NPt(a,s,{fillInputAndData:!0}):{raw:es({format:"bytes"},a.raw,s),tx:bf(a.tx,s,{transactionSchema:n.config.customTransactionSchema,fillInputAndData:!0})}})}function Tce(t,e){return Ua(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a=n.defaultReturnFormat){const o=Uc(s)?s:es({format:"uint"},s,yi),l=yield _Tt(n.requestManager,bf(r,yi,{transactionSchema:n.config.customTransactionSchema}),o);return es({format:"bytes"},l,a)})}function Pce(t,e){return Ua(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=bf(r,yi,{transactionSchema:n.config.customTransactionSchema}),l=Uc(s)?s:es({format:"uint"},s,yi),c=yield ETt(n.requestManager,o,l);return es({format:"uint"},c,a??n.defaultReturnFormat)})}function IRe(t,e,n){return Ua(this,void 0,void 0,function*(){let{toBlock:r,fromBlock:s}=e;Nr(r)||(typeof r=="number"||typeof r=="bigint")&&(r=lc(r)),Nr(s)||(typeof s=="number"||typeof s=="bigint")&&(s=lc(s));const a=Object.assign(Object.assign({},e),{fromBlock:s,toBlock:r});return(yield zTt(t.requestManager,a)).map(c=>typeof c=="string"?c:es(y8,c,n??t.defaultReturnFormat))})}function FRe(t,e){return Ua(this,void 0,void 0,function*(){const n=yield KTt(t.requestManager);return es({format:"uint"},n,e??t.defaultReturnFormat)})}function RIt(t,e,n){return Ua(this,arguments,void 0,function*(r,s,a,o=r.defaultBlock,l){const c=a.map(f=>es({format:"bytes"},f,yi)),u=Uc(o)?o:es({format:"uint"},o,yi),d=yield YTt(r.requestManager,s,c,u);return es(CPt,d,l??r.defaultReturnFormat)})}function DIt(t,e){return Ua(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a,o){const l=es({format:"uint"},r,yi),c=Uc(s)?s:es({format:"uint"},s,yi),u=es({type:"array",items:{format:"uint"}},a,EU),d=yield WTt(n.requestManager,l,c,u);return es(vPt,d,o??n.defaultReturnFormat)})}function ORe(t,e){return Ua(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Uc(s)?s:es({format:"uint"},s,yi),l=yield QTt(n.requestManager,bf(r,yi,{transactionSchema:n.config.customTransactionSchema}),o);return es(mPt,l,a??n.defaultReturnFormat)})}function BIt(t,e,n,r,s){return Ua(this,void 0,void 0,function*(){const a=yield ZTt(t.requestManager,e,n,r);return es({format:"bytes"},a,s??t.defaultReturnFormat)})}var w8=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 $It(t,e){return w8(this,void 0,void 0,function*(){const n=yield DTt(t.requestManager);return es({format:"uint"},n,e??t.defaultReturnFormat)})}function UIt(t,e,n){return w8(this,void 0,void 0,function*(){let{toBlock:r,fromBlock:s}=e;Nr(r)||(typeof r=="number"||typeof r=="bigint")&&(r=lc(r)),Nr(s)||(typeof s=="number"||typeof s=="bigint")&&(s=lc(s));const a=Object.assign(Object.assign({},e),{fromBlock:s,toBlock:r}),o=yield LTt(t.requestManager,a);return es({format:"uint"},o,n??t.defaultReturnFormat)})}function zIt(t,e){return w8(this,void 0,void 0,function*(){const n=yield RTt(t.requestManager);return es({format:"uint"},n,e??t.defaultReturnFormat)})}function HIt(t,e){return w8(this,void 0,void 0,function*(){return yield BTt(t.requestManager,lc(e))})}function VIt(t,e,n){return w8(this,void 0,void 0,function*(){return(yield $Tt(t.requestManager,lc(e))).map(a=>typeof a=="string"?a:es(y8,a,n??t.defaultReturnFormat))})}function WIt(t,e,n){return w8(this,void 0,void 0,function*(){return(yield UTt(t.requestManager,lc(e))).map(a=>typeof a=="string"?a:es(y8,a,n??t.defaultReturnFormat))})}class MRe extends XT{_buildSubscriptionParams(){return["logs",this.args]}formatSubscriptionResult(e){return es(y8,e,super.returnFormat)}}class Lbe extends XT{_buildSubscriptionParams(){return["newPendingTransactions"]}formatSubscriptionResult(e){return es({format:"string"},e,super.returnFormat)}}class TR extends XT{_buildSubscriptionParams(){return["newHeads"]}formatSubscriptionResult(e){return es(gPt,e,super.returnFormat)}}class LRe extends XT{_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",es(bPt,n,super.returnFormat))}}}var Ni=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 wne={logs:MRe,newPendingTransactions:Lbe,newHeads:TR,syncing:LRe,pendingTransactions:Lbe,newBlockHeaders:TR};class IU extends of{constructor(e){if(typeof e=="string"||wR(e)){super({provider:e,registeredSubscriptions:wne});return}if(e.registeredSubscriptions){super(e);return}super(Object.assign(Object.assign({},e),{registeredSubscriptions:wne})),this.getFeeData=this.calculateFeeData}setTransactionMiddleware(e){this.transactionMiddleware=e}getTransactionMiddleware(){return this.transactionMiddleware}getProtocolVersion(){return Ni(this,void 0,void 0,function*(){return lTt(this.requestManager)})}isSyncing(){return Ni(this,void 0,void 0,function*(){return KLe(this.requestManager)})}getCoinbase(){return Ni(this,void 0,void 0,function*(){return cTt(this.requestManager)})}isMining(){return Ni(this,void 0,void 0,function*(){return uTt(this.requestManager)})}getHashrate(e){return Ni(this,void 0,void 0,function*(){var n;return e===void 0&&(e=(n=this.defaultReturnFormat)!==null&&n!==void 0?n:yd),this.getHashRate(e)})}getHashRate(){return Ni(this,arguments,void 0,function*(e=this.defaultReturnFormat){return NIt(this,e)})}getGasPrice(){return Ni(this,arguments,void 0,function*(e=this.defaultReturnFormat){return Ece(this,e)})}getMaxPriorityFeePerGas(){return Ni(this,arguments,void 0,function*(e=this.defaultReturnFormat){return SIt(this,e)})}calculateFeeData(){return Ni(this,arguments,void 0,function*(e=BigInt(2),n=gU.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 Ni(this,void 0,void 0,function*(){var e;return((e=yield pTt(this.requestManager))!==null&&e!==void 0?e:[]).map(r=>Nx(r))})}getBlockNumber(){return Ni(this,arguments,void 0,function*(e=this.defaultReturnFormat){return kce(this,e)})}getBalance(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return jIt(this,n,r,s)})}getStorageAt(e,n){return Ni(this,arguments,void 0,function*(r,s,a=this.defaultBlock,o=this.defaultReturnFormat){return AIt(this,r,s,a,o)})}getCode(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return _It(this,n,r,s)})}getBlock(){return Ni(this,arguments,void 0,function*(e=this.defaultBlock,n=!1,r=this.defaultReturnFormat){return kRe(this,e,n,r)})}getBlockTransactionCount(){return Ni(this,arguments,void 0,function*(e=this.defaultBlock,n=this.defaultReturnFormat){return EIt(this,e,n)})}getBlockUncleCount(){return Ni(this,arguments,void 0,function*(e=this.defaultBlock,n=this.defaultReturnFormat){return kIt(this,e,n)})}getUncle(){return Ni(this,arguments,void 0,function*(e=this.defaultBlock,n,r=this.defaultReturnFormat){return TIt(this,e,n,r)})}getTransaction(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){const s=yield PIt(this,n,r);if(!s)throw new U1e;return s})}getPendingTransactions(){return Ni(this,arguments,void 0,function*(e=this.defaultReturnFormat){return IIt(this,e)})}getTransactionFromBlock(){return Ni(this,arguments,void 0,function*(e=this.defaultBlock,n,r=this.defaultReturnFormat){return FIt(this,e,n,r)})}getTransactionReceipt(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){const s=yield TRe(this,n,r);if(!s)throw new U1e;return s})}getTransactionCount(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return PRe(this,n,r,s)})}sendTransaction(e,n=this.defaultReturnFormat,r){return LE(this,e,n,r,this.transactionMiddleware)}sendSignedTransaction(e,n=this.defaultReturnFormat,r){return OIt(this,e,n,r)}sign(e,n){return Ni(this,arguments,void 0,function*(r,s,a=this.defaultReturnFormat){return MIt(this,r,s,a)})}signTransaction(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return LIt(this,n,r)})}call(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return Tce(this,n,r,s)})}estimateGas(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return Pce(this,n,r,s)})}getPastLogs(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return IRe(this,n,r)})}getWork(){return Ni(this,void 0,void 0,function*(){return HTt(this.requestManager)})}submitWork(e,n,r){return Ni(this,void 0,void 0,function*(){return VTt(this.requestManager,e,n,r)})}requestAccounts(){return Ni(this,void 0,void 0,function*(){return GTt(this.requestManager)})}getChainId(){return Ni(this,arguments,void 0,function*(e=this.defaultReturnFormat){return FRe(this,e)})}getNodeInfo(){return Ni(this,void 0,void 0,function*(){return XTt(this.requestManager)})}getProof(e,n){return Ni(this,arguments,void 0,function*(r,s,a=this.defaultBlock,o=this.defaultReturnFormat){return RIt(this,r,s,a,o)})}getFeeHistory(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultBlock,s,a=this.defaultReturnFormat){return DIt(this,n,r,s,a)})}createAccessList(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return ORe(this,n,r,s)})}signTypedData(e,n,r,s){return Ni(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:yd),BIt(this,e,n,r,s)})}subscribe(e,n,r){return Ni(this,void 0,void 0,function*(){var s,a;r===void 0&&(r=(s=this.defaultReturnFormat)!==null&&s!==void 0?s:yd);const o=yield(a=this.subscriptionManager)===null||a===void 0?void 0:a.subscribe(e,n,r);return o instanceof MRe&&e==="logs"&&typeof n=="object"&&!oi(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 LRe)}clearSubscriptions(e=!1){var n;return(n=this.subscriptionManager)===null||n===void 0?void 0:n.unsubscribe(e?IU.shouldClearSubscription:void 0)}createNewPendingTransactionFilter(){return Ni(this,arguments,void 0,function*(e=this.defaultReturnFormat){return $It(this,e)})}createNewFilter(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return UIt(this,n,r)})}createNewBlockFilter(){return Ni(this,arguments,void 0,function*(e=this.defaultReturnFormat){return zIt(this,e)})}uninstallFilter(e){return Ni(this,void 0,void 0,function*(){return HIt(this,e)})}getFilterChanges(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return VIt(this,n,r)})}getFilterLogs(e){return Ni(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return WIt(this,n,r)})}}const qIt=t=>{if(!Nr(t.common)){if(Nr(t.common.customChain))throw new UAt;if(Nr(t.common.customChain.chainId))throw new zAt;if(!Nr(t.chainId)&&t.chainId!==t.common.customChain.chainId)throw new HAt({txChainId:t.chainId,customChainId:t.common.customChain.chainId})}},GIt=t=>{if(!Nr(t.common)&&!Nr(t.chain)&&!Nr(t.hardfork))throw new qAt;if(!Nr(t.chain)&&Nr(t.hardfork)||!Nr(t.hardfork)&&Nr(t.chain))throw new GAt({chain:t.chain,hardfork:t.hardfork})},KIt=t=>{if(!Nr(t.common)&&!Nr(t.common.baseChain)&&!Nr(t.chain)&&t.chain!==t.common.baseChain)throw new VAt({txChain:t.chain,baseChain:t.common.baseChain})},YIt=t=>{if(!Nr(t.common)&&!Nr(t.common.hardfork)&&!Nr(t.hardfork)&&t.hardfork!==t.common.hardfork)throw new WAt({txHardfork:t.hardfork,commonHardfork:t.common.hardfork})},Rbe=t=>{if(Nr(t.gas)||!_1(t.gas)||Nr(t.gasPrice)||!_1(t.gasPrice))throw new ZAt({gas:t.gas,gasPrice:t.gasPrice});if(!Nr(t.maxFeePerGas)||!Nr(t.maxPriorityFeePerGas))throw new gMe({maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas})},Dbe=t=>{if(!Nr(t.gasPrice)&&t.type==="0x2")throw new e7t(t.gasPrice);if(t.type==="0x0"||t.type==="0x1")throw new gMe({maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas});if(Nr(t.maxFeePerGas)||!_1(t.maxFeePerGas)||Nr(t.maxPriorityFeePerGas)||!_1(t.maxPriorityFeePerGas))throw new JAt({maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas})},XIt=t=>{const e=!Nr(t.gas)||!Nr(t.gasLimit),n=e&&!Nr(t.gasPrice),r=e&&!Nr(t.maxPriorityFeePerGas)&&!Nr(t.maxFeePerGas);if(!n&&!r)throw new YAt({gas:t.gas,gasPrice:t.gasPrice,maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas});if(n&&r)throw new QAt({gas:t.gas,gasPrice:t.gasPrice,maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas});(n?Rbe:Dbe)(t),(!Nr(t.type)&&t.type>"0x1"?Dbe:Rbe)(t)},QIt=(t,e,n={transactionSchema:void 0})=>{if(!Nr(e)){e(t);return}if(typeof t!="object"||Nr(t))throw new t7t(t);qIt(t),GIt(t),KIt(t),YIt(t);const r=bf(t,yi,{transactionSchema:n.transactionSchema});if(XIt(r),Nr(r.nonce)||Nr(r.chainId)||r.nonce.startsWith("-")||r.chainId.startsWith("-"))throw new n7t({nonce:t.nonce,chainId:t.chainId})};var ZIt=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 JIt=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})},eFt=(t,e)=>{var n,r,s,a,o,l,c,u,d,f,x,g,y,v,C,S,T,I;const L=!Nr(t.chain)&&!Nr(t.hardfork)||!Nr(t.common);let F;if(!L)e.defaultCommon?(F=Object.assign({},e.defaultCommon),Nr(F.hardfork)&&(F.hardfork=(n=t.hardfork)!==null&&n!==void 0?n:e.defaultHardfork),Nr(F.baseChain)&&(F.baseChain=e.defaultChain)):F=ic.custom({name:"custom-network",chainId:af(t.chainId),networkId:Nr(t.networkId)?void 0:af(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",O=af((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),U=af((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),Y=(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,re=(I=(T=(S=t.common)===null||S===void 0?void 0:S.baseChain)!==null&&T!==void 0?T:t.chain)!==null&&I!==void 0?I:e.defaultChain;O&&U&&$&&(F=ic.custom({name:$,chainId:O,networkId:U,defaultHardfork:Y},{baseChain:re}))}return{common:F}},tFt=(t,e,n,...r)=>ZIt(void 0,[t,e,n,...r],void 0,function*(s,a,o,l=!1,c=!0){const u=yield kPt({transaction:s,web3Context:a,privateKey:o,fillGasPrice:l,fillGasLimit:c}),d=bf(u,yi,{transactionSchema:a.config.customTransactionSchema});return QIt(d,void 0,{transactionSchema:a.config.customTransactionSchema}),f5.fromTxData(JIt(d),eFt(d,a))}),Bbe=({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(oi(n==null?void 0:n.fromBlock)||(l.fromBlock=es(AR.properties.number,n==null?void 0:n.fromBlock,{number:ap.HEX,bytes:j1.HEX})),oi(n==null?void 0:n.toBlock)||(l.toBlock=es(AR.properties.number,n==null?void 0:n.toBlock,{number:ap.HEX,bytes:j1.HEX})),a&&Array.isArray(a))l.topics=[...a];else if(l.topics=[],e&&!e.anonymous&&![US,"allEvents"].includes(e.name)&&l.topics.push((s=e.signature)!==null&&s!==void 0?s:Nce(a1(e))),![US,"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=>yne(c.type,d))):c.type==="string"?l.topics.push(MS(u)):l.topics.push(yne(c.type,u))}return l.topics.length||delete l.topics,t&&(l.address=t.toLowerCase()),l},$_=(t,e,n)=>{const r=Array.isArray(t.inputs)?t.inputs.length:0;if(t.inputs&&r!==e.length)throw new vd(`The number of arguments is not matching the methods required number. You need to pass ${r} arguments.`);let s;if(t.inputs?s=PU(Array.isArray(t.inputs)?t.inputs:[],e).replace("0x",""):s=hIt(e).replace("0x",""),MPt(t)){if(!n)throw new vd("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`${ME(t)}${s}`};class RRe extends XT{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 _ce(this.abi,e,this.jsonInterface,super.returnFormat)}}Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));const FU=(t,e,n,r)=>{var s,a;const o={};return(!oi(t.data)||r==="both")&&(o.data=$_(e,n,(s=t.data)!==null&&s!==void 0?s:t.input)),(!oi(t.input)||r==="both")&&(o.input=$_(e,n,(a=t.input)!==null&&a!==void 0?a:t.data)),oi(o.input)&&oi(o.data)&&(o[r]=$_(e,n)),{data:o.data,input:o.input}},Cne=({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 vd("Contract address not specified");if(!(n!=null&&n.from)&&!r.from)throw new vd('Contract "from" address not specified');let c=F2({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=FU(c,t,e,n==null?void 0:n.dataInputFill);return c=Object.assign(Object.assign({},c),{data:u.data,input:u.input}),c},nFt=({abi:t,params:e,options:n,contractOptions:r})=>{if(!(n!=null&&n.to)&&!r.address)throw new vd("Contract address not specified");let s=F2({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=FU(s,t,e,n==null?void 0:n.dataInputFill);return s=Object.assign(Object.assign({},s),{data:a.data,input:a.input}),s},rFt=({abi:t,params:e,options:n,contractOptions:r})=>{let s=F2({to:r.address,gas:r.gas,gasPrice:r.gasPrice,from:r.from,input:r.input,data:r.data},n);const a=FU(s,t,e,n==null?void 0:n.dataInputFill);return s=Object.assign(Object.assign({},s),{data:a.data,input:a.input}),s},$be=t=>typeof t=="object"&&!oi(t)&&Object.keys(t).length!==0&&!Ty(t),sFt=({abi:t,params:e,options:n,contractOptions:r})=>{if(!(n!=null&&n.to)&&!r.address)throw new vd("Contract address not specified");if(!(n!=null&&n.from)&&!r.from)throw new vd('Contract "from" address not specified');let s=F2({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=FU(s,t,e,n==null?void 0:n.dataInputFill);return s=Object.assign(Object.assign({},s),{data:a.data,input:a.input}),s};var iFt=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{_contractMethodDeploySend(e){const n={transactionResolver:r=>{if(r.status===BigInt(0))throw new vd("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 Nr(this.parent.getTransactionMiddleware())?LE(this.parent,e,this.parent.defaultReturnFormat,n):LE(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=Cne({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=es({format:"bytes"},(n=(e=this.deployOptions)===null||e===void 0?void 0:e.input)!==null&&n!==void 0?n:this.parent.options.input,yd),u=es({format:"bytes"},(s=(r=this.deployOptions)===null||r===void 0?void 0:r.data)!==null&&s!==void 0?s:this.parent.options.data,yd);if((!c||c.trim()==="0x")&&(!u||u.trim()==="0x"))throw new vd("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 iFt(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 $_(this.constructorAbi,this.args,es({format:"bytes"},this.deployData,this.parent.defaultReturnFormat))}decodeData(e){return Object.assign(Object.assign({},vne(this.constructorAbi,e.replace(this.deployData,""),!1)),{__method__:this.constructorAbi.type})}}var oFt=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 lFt extends CR{constructor(e,n){super(e.requestManager,e.registeredSubscriptions),this.parentContract=n}subscribe(e,n){const r=Object.create(null,{subscribe:{get:()=>super.subscribe}});return oFt(this,arguments,void 0,function*(s,a,o=yd){return r.subscribe.call(this,s,a??this.parentContract.options,o)})}}var Pv=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 cFt={logs:RRe,newHeads:TR,newBlockHeaders:TR};class _3 extends of{get subscriptionManager(){return this._subscriptionManager}constructor(e,n,r,s,a){var o,l,c;const u=Ty(n)?n:Ty(r)?r:void 0;let d;$be(n)?d=n:$be(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=_3.givenProvider,super(Object.assign(Object.assign({},d),{provider:f,registeredSubscriptions:cFt})),this.syncWithContext=!1,this._functions={},this._subscriptionManager=new lFt(super.subscriptionManager,this),d!=null&&d.wallet&&(this._wallet=d.wallet),d!=null&&d.accountProvider&&(this._accountProvider=d.accountProvider),!Nr(u)&&!Nr(u.data)&&!Nr(u.input)&&this.config.contractDataInputFill!=="both")throw new PAt({data:u.data,input:u.input});this._overloadedMethodAbis=new Map;const x=Sg(s)?s:Sg(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),Nr(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 of&&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 of&&d.on(u5.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 _3([...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 _3([...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 aFt(this,e)}getPastEvents(e,n,r){return Pv(this,void 0,void 0,function*(){var s;const a=typeof e=="string"?e:US,o=typeof e!="string"&&!Sg(e)?e:Sg(n)?{}:n,l=Sg(e)?e:Sg(n)?n:r??this.defaultReturnFormat,c=a==="allEvents"||a===US?fne:this._jsonInterface.find(S=>"name"in S&&S.name===a);if(!c)throw new vd(`Event ${String(a)} not found.`);const{fromBlock:u,toBlock:d,topics:f,address:x}=Bbe(this.options,c,o??{}),g=yield IRe(this,{fromBlock:u,toBlock:d,topics:f,address:x},l),y=g?g.map(S=>typeof S=="string"?S:_ce(c,S,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(S=>typeof S=="string"?!0:C.every(T=>{var I;if(Array.isArray(v[T]))return v[T].some(F=>String(S.returnValues[T]).toUpperCase()===String(F).toUpperCase());const L=(I=c.inputs)===null||I===void 0?void 0:I.filter(F=>F.name===T)[0];return L!=null&&L.indexed&&L.type==="string"&&MS(v[T])===String(S.returnValues[T])?!0:String(S.returnValues[T]).toUpperCase()===String(v[T]).toUpperCase()})):y})}_parseAndSetAddress(e,n=this.defaultReturnFormat){this._address=e&&Nx(es({format:"address"},e,n))}decodeMethodData(e){const n=e.slice(0,10),s=this._jsonInterface.filter(a=>a.type!=="error").find(a=>n===ME(a1(a)));if(!s)throw new vd(`The ABI for the provided method signature ${n} was not found.`);return vne(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=>kU(c));for(const c of o){const u=Object.assign(Object.assign({},c),{signature:""});if(TU(u)){const d=a1(u),f=ME(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(Cce(u)){const d=a1(u),f=Nce(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(fne,n),this._jsonInterface=[...a],this._errorsInterface=l}_getAbiParams(e,n){var r;try{return B_((r=e.inputs)!==null&&r!==void 0?r:[],n)}catch(s){throw new vd(`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),Js.validate((c=s.inputs)!==null&&c!==void 0?c:[],u);else{const v=[],C=[];for(const S of g)try{u=this._getAbiParams(S,a),Js.validate(S.inputs,u),C.push(S)}catch(T){v.push(T)}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(S=>`${S.methodNameWithInputs} (signature: ${S.signature})`))}
The first one will be used: ${f.methodNameWithInputs}`)),v.length===g.length)throw new IS(v)}const y={arguments:u,call:(v,C)=>Pv(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 S,T;let I=C??this.options;I=Object.assign(Object.assign({},I),{input:void 0,from:(T=(S=I==null?void 0:I.from)!==null&&S!==void 0?S:this.defaultAccount)!==null&&T!==void 0?T:void 0});const L=Cne({abi:s,params:a,options:Object.assign(Object.assign({},v),{dataInputFill:this.config.contractDataInputFill}),contractOptions:I});return L.dataInputFill&&delete L.dataInputFill,L},estimateGas:(v,...C)=>Pv(this,[v,...C],void 0,function*(S,T=this.defaultReturnFormat){return this.contractMethodEstimateGas({abi:f,params:u,returnFormat:T,options:S})}),encodeABI:()=>$_(f,u),decodeData:v=>vne(f,v),createAccessList:(v,C)=>Pv(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 Pv(this,void 0,void 0,function*(){var o;const l=nFt({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 Tce(this,l,a,this.defaultReturnFormat);return mIt(e,c)}catch(c){throw c instanceof C3&&SM(r,c.cause),c}})}_contractMethodCreateAccessList(e,n,r,s,a){return Pv(this,void 0,void 0,function*(){var o;const l=sFt({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 ORe(this,l,a,this.defaultReturnFormat)}catch(c){throw c instanceof C3&&SM(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=Cne({abi:e,params:n,options:Object.assign(Object.assign({},s),{dataInputFill:this.config.contractDataInputFill}),contractOptions:c}),d=Nr(this.transactionMiddleware)?LE(this,u,this.defaultReturnFormat,{checkRevertBeforeSending:!1,contractAbi:this._jsonInterface}):LE(this,u,this.defaultReturnFormat,{checkRevertBeforeSending:!1,contractAbi:this._jsonInterface},this.transactionMiddleware);return d.on("error",f=>{f instanceof C3&&SM(r,f.cause)}),d}contractMethodEstimateGas(e){return Pv(this,arguments,void 0,function*({abi:n,params:r,returnFormat:s,options:a,contractOptions:o}){const l=rFt({abi:n,params:r,options:Object.assign(Object.assign({},a),{dataInputFill:this.config.contractDataInputFill}),contractOptions:o??this.options});return Pce(this,l,Ug.LATEST,s??this.defaultReturnFormat)})}_createContractEvent(e,n=this.defaultReturnFormat){return(...r)=>{var s;const{topics:a,fromBlock:o}=Bbe(this.options,e,r[0]),l=new RRe({address:this.options.address,topics:a,abi:e,jsonInterface:this._jsonInterface},{subscriptionManager:this.subscriptionManager,returnFormat:n});return Nr(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 yg("Failed to get past events.",c))}),(s=this.subscriptionManager)===null||s===void 0||s.addSubscription(l).catch(c=>{l.emit("error",new yg("Failed to subscribe.",c))}),l}}subscribeToContextEvents(e){const n=this;this.context=e,n.syncWithContext&&e.on(u5.CONFIG_CHANGE,r=>{n.setConfig({[r.name]:r.newValue})})}}const Ube={addr:"0x3b3b57de",name:"0x691f3431",abi:"0x2203ab56",pubkey:"0xc8690233",text:"0x59d1d43c",contenthash:"0xbc1c58d1"},xC={setAddr:"addr",addr:"addr",setPubkey:"pubkey",pubkey:"pubkey",setContenthash:"contenthash",contenthash:"contenthash",text:"text",name:"name"},PR={main:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",goerli:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},uFt={"0x1":"main","0x5":"goerli"},dFt=[{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"}],fFt=[{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 hFt="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 zbe=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Hbe=4;function pFt(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 S=[],T=0,I=x;for(;;){let F=Math.floor(((C-T+1)*s-1)/I),$=0,O=r;for(;O-$>1;){let re=$+O>>>1;F<a[re]?O=re:$=re}if($==0)break;S.push($);let U=T+Math.floor(I*a[$]/s),Y=T+Math.floor(I*a[$+1]/s)-1;for(;!((U^Y)&g);)C=C<<1&v|d(),U=U<<1&v,Y=Y<<1&v|1;for(;U&~Y&y;)C=C&g|C<<1&v>>>1|d(),U=U<<1^g,Y=(Y^g)<<1|g|1;T=U,I=1+Y-U}let L=r-4;return S.map(F=>{switch(F-L){case 3:return L+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return L+256+(t[l++]<<8|t[l++]);case 1:return L+t[l++];default:return F-1}})}function mFt(t){let e=0;return()=>t[e++]}function DRe(t){return mFt(pFt(xFt(t)))}function xFt(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 gFt(t){return t&1?~t>>1:t>>1}function bFt(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=gFt(e());return n}function RE(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 BRe(t){return DE(()=>{let e=RE(t);if(e.length)return e})}function $Re(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(yFt(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(vFt(n,t))}return e.flat()}function DE(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function URe(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)bFt(t,n).forEach((a,o)=>r[o].push(a));return r}function yFt(t,e){let n=1+e(),r=e(),s=DE(e);return URe(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 vFt(t,e){let n=1+e();return URe(n,1+t,e).map(s=>[s[0],s.slice(1)])}function wFt(t){let e=[],n=RE(t);return s(r([]),[]),e;function r(a){let o=t(),l=DE(()=>{let c=RE(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 CFt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function zRe(t){return`{${CFt(t)}}`}function NFt(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 HS(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 SFt(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 jFt="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 BE=44032,IR=4352,FR=4449,OR=4519,HRe=19,VRe=21,VS=28,MR=VRe*VS,AFt=HRe*MR,_Ft=BE+AFt,EFt=IR+HRe,kFt=FR+VRe,TFt=OR+VS;function c_(t){return t>>24&255}function WRe(t){return t&16777215}let Nne,Vbe,Sne,jM;function PFt(){let t=DRe(jFt);Nne=new Map(BRe(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),Vbe=new Set(RE(t)),Sne=new Map,jM=new Map;for(let[e,n]of $Re(t)){if(!Vbe.has(e)&&n.length==2){let[r,s]=n,a=jM.get(r);a||(a=new Map,jM.set(r,a)),a.set(s,e)}Sne.set(e,n.reverse())}}function qRe(t){return t>=BE&&t<_Ft}function IFt(t,e){if(t>=IR&&t<EFt&&e>=FR&&e<kFt)return BE+(t-IR)*MR+(e-FR)*VS;if(qRe(t)&&e>OR&&e<TFt&&(t-BE)%VS==0)return t+(e-OR);{let n=jM.get(t);return n&&(n=n.get(e),n)?n:-1}}function GRe(t){Nne||PFt();let e=[],n=[],r=!1;function s(a){let o=Nne.get(a);o&&(r=!0,a|=o),e.push(a)}for(let a of t)for(;;){if(a<128)e.push(a);else if(qRe(a)){let o=a-BE,l=o/MR|0,c=o%MR/VS|0,u=o%VS;s(IR+l),s(FR+c),u>0&&s(OR+u)}else{let o=Sne.get(a);o?n.push(...o):s(a)}if(!n.length)break;a=n.pop()}if(r&&e.length>1){let a=c_(e[0]);for(let o=1;o<e.length;o++){let l=c_(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=c_(e[--c]),a<=l))break}a=c_(e[o])}}return e}function FFt(t){let e=[],n=[],r=-1,s=0;for(let a of t){let o=c_(a),l=WRe(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=IFt(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 KRe(t){return GRe(t).map(WRe)}function OFt(t){return FFt(GRe(t))}const Wbe=45,YRe=".",XRe=65039,QRe=1,LR=t=>Array.from(t);function $E(t,e){return t.P.has(e)||t.Q.has(e)}let MFt=class extends Array{get is_emoji(){return!0}},jne,ZRe,Sw,Ane,JRe,B4,VW,JC,Qv,qbe,_ne;function Ice(){if(jne)return;let t=DRe(hFt);const e=()=>RE(t),n=()=>new Set(e()),r=(d,f)=>f.forEach(x=>d.add(x));jne=new Map($Re(t)),ZRe=n(),Sw=e(),Ane=new Set(e().map(d=>Sw[d])),Sw=new Set(Sw),JRe=n(),n();let s=BRe(t),a=t();const o=()=>{let d=new Set;return e().forEach(f=>r(d,s[f])),r(d,e()),d};B4=DE(d=>{let f=DE(t).map(x=>x+96);if(f.length){let x=d>=a;f[0]-=32,f=HS(f),x&&(f=`Restricted[${f}]`);let g=o(),y=o(),v=!t();return{N:f,P:g,Q:y,M:v,R:x}}}),VW=n(),JC=new Map;let l=e().concat(LR(VW)).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),VW.has(d)||JC.set(d,g)});for(let{V:d,M:f}of new Set(JC.values())){let x=[];for(let y of d){let v=B4.filter(S=>$E(S,y)),C=x.find(({G:S})=>v.some(T=>S.has(T)));C||(C={G:new Set,V:[]},x.push(C)),C.V.push(y),r(C.G,v)}let g=x.flatMap(y=>LR(y.G));for(let{G:y,V:v}of x){let C=new Set(g.filter(S=>!y.has(S)));for(let S of v)f.set(S,C)}}Qv=new Set;let c=new Set;const u=d=>Qv.has(d)?c.add(d):Qv.add(d);for(let d of B4){for(let f of d.P)u(f);for(let f of d.Q)u(f)}for(let d of Qv)!JC.has(d)&&!c.has(d)&&JC.set(d,QRe);r(Qv,KRe(Qv)),qbe=wFt(t).map(d=>MFt.from(d)).sort(SFt),_ne=new Map;for(let d of qbe){let f=[_ne];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===XRe?f.push(...g):f=g}for(let x of f)x.V=d}}function Fce(t){return(eDe(t)?"":`${Oce(OU([t]))} `)+zRe(t)}function Oce(t){return`"${t}"`}function LFt(t){if(t.length>=4&&t[2]==Wbe&&t[3]==Wbe)throw new Error(`invalid label extension: "${HS(t.slice(0,4))}"`)}function RFt(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function DFt(t){let e=t[0],n=zbe.get(e);if(n)throw U_(`leading ${n}`);let r=t.length,s=-1;for(let a=1;a<r;a++){e=t[a];let o=zbe.get(e);if(o){if(s==a)throw U_(`${n} + ${o}`);s=a+1,n=o}}if(s==r)throw U_(`trailing ${n}`)}function OU(t,e=1/0,n=zRe){let r=[];BFt(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];eDe(l)&&(r.push(HS(t.slice(s,o))),r.push(n(l)),s=o+1)}return r.push(HS(t.slice(s,a))),r.join("")}function BFt(t,e){return Ice(),Sw.has(t)}function eDe(t){return Ice(),JRe.has(t)}function $Ft(t){return VFt(UFt(t,OFt,GFt))}function UFt(t,e,n){if(!t)return[];Ice();let r=0;return t.split(YRe).map(s=>{let a=NFt(s),o={input:a,offset:r};r+=a.length+1;try{let l=o.tokens=qFt(a,e,n),c=l.length,u;if(!c)throw new Error("empty label");let d=o.output=l.flat();if(RFt(d),!(o.emoji=c>1||l[0].is_emoji)&&d.every(x=>x<128))LFt(d),u="ASCII";else{let x=l.flatMap(g=>g.is_emoji?[]:g);if(!x.length)u="Emoji";else{if(Sw.has(d[0]))throw U_("leading combining mark");for(let v=1;v<c;v++){let C=l[v];if(!C.is_emoji&&Sw.has(C[0]))throw U_(`emoji + combining mark: "${HS(l[v-1])} + ${OU([C[0]])}"`)}DFt(d);let g=LR(new Set(x)),[y]=HFt(g);WFt(y,x),zFt(y,g),u=y.N}}o.type=u}catch(l){o.error=l}return o})}function zFt(t,e){let n,r=[];for(let s of e){let a=JC.get(s);if(a===QRe)return;if(a){let o=a.M.get(s);if(n=n?n.filter(l=>o.has(l)):LR(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(a=>$E(s,a)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function HFt(t){let e=B4;for(let n of t){let r=e.filter(s=>$E(s,n));if(!r.length)throw B4.some(s=>$E(s,n))?nDe(e[0],n):tDe(n);if(e=r,r.length==1)break}return e}function VFt(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 ${Oce(OU(e,63))}: ${s}`)}return HS(r)}).join(YRe)}function tDe(t){return new Error(`disallowed character: ${Fce(t)}`)}function nDe(t,e){let n=Fce(e),r=B4.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function U_(t){return new Error(`illegal placement: ${t}`)}function WFt(t,e){for(let n of e)if(!$E(t,n))throw nDe(t,n);if(t.M){let n=KRe(e);for(let r=1,s=n.length;r<s;r++)if(Ane.has(n[r])){let a=r+1;for(let o;a<s&&Ane.has(o=n[a]);a++)for(let l=r;l<a;l++)if(n[l]==o)throw new Error(`duplicate non-spacing marks: ${Fce(o)}`);if(a-r>Hbe)throw new Error(`excessive non-spacing marks: ${Oce(OU(n.slice(r-1,a)))} (${a-r}/${Hbe})`);r=a}}}function qFt(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let a=KFt(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=jne.get(o);if(l)s.push(...l);else if(!ZRe.has(o))throw tDe(o)}}}return s.length&&r.push(e(s)),r}function GFt(t){return t.filter(e=>e!=XRe)}function KFt(t,e){let n=_ne,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 YFt=t=>$Ft(t),k0=t=>{let e="";for(let n=0;n<32;n+=1)e+="00";if(t){const r=YFt(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 cF=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 XFt{constructor(e,n){this.contract=new _3(dFt,n??PR.main,e),this.context=e}getOwner(e){return cF(this,void 0,void 0,function*(){try{return this.contract.methods.owner(k0(e)).call()}catch{throw new Error}})}getTTL(e){return cF(this,void 0,void 0,function*(){try{return this.contract.methods.ttl(k0(e)).call()}catch{throw new Error}})}recordExists(e){return cF(this,void 0,void 0,function*(){try{return this.contract.methods.recordExists(k0(e)).call()}catch{throw new Error}})}getResolver(e){return cF(this,void 0,void 0,function*(){try{return this.contract.methods.resolver(k0(e)).call().then(n=>{if(typeof n=="string")return new _3(fFt,n,this.context);throw new Error})}catch{throw new Error}})}get events(){return this.contract.events}}var eg=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 QFt{constructor(e){this.registry=e}getResolverContractAdapter(e){return eg(this,void 0,void 0,function*(){return this.registry.getResolver(e)})}checkInterfaceSupport(e,n){var r,s;return eg(this,void 0,void 0,function*(){if(oi(Ube[n]))throw new B1e((r=e.options.address)!==null&&r!==void 0?r:"",n);if(!(yield e.methods.supportsInterface(Ube[n]).call()))throw new B1e((s=e.options.address)!==null&&s!==void 0?s:"",n)})}supportsInterface(e,n){var r;return eg(this,void 0,void 0,function*(){const s=yield this.getResolverContractAdapter(e);let a=n;if(!Ta(a)){if(a=(r=YT(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 eg(this,void 0,void 0,function*(){const r=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(r,xC.addr),r.methods.addr(k0(e),n).call()})}getPubkey(e){return eg(this,void 0,void 0,function*(){const n=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(n,xC.pubkey),n.methods.pubkey(k0(e)).call()})}getContenthash(e){return eg(this,void 0,void 0,function*(){const n=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(n,xC.contenthash),n.methods.contenthash(k0(e)).call()})}setAddress(e,n,r){return eg(this,void 0,void 0,function*(){const s=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(s,xC.setAddr),s.methods.setAddr(k0(e),n).send(r)})}getText(e,n){return eg(this,void 0,void 0,function*(){const r=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(r,xC.text),r.methods.text(k0(e),n).call()})}getName(e,n=!0){return eg(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,xC.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 rDe extends of{constructor(e,n){super(n??""),this.registryAddress=e??PR.main,this._registry=new XFt(this.getContextObject(),e),this._resolver=new QFt(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 CIt(this);if(!(typeof s=="boolean"&&!s))throw new FAt;this._lastSyncCheck=e}if(this._detectedAddress)return this._detectedAddress;const n=yield yce(this,Object.assign(Object.assign({},this.defaultReturnFormat),{number:ap.HEX})),r=PR[uFt[n]];if(typeof r>"u")throw new IAt(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 z1=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 ZFt=t=>z1(void 0,void 0,void 0,function*(){return(yield nPt(t)).map(Nx)}),JFt=(t,e)=>z1(void 0,void 0,void 0,function*(){Js.validate(["string"],[e]);const n=yield rPt(t,e);return Nx(n)}),eOt=(t,e,n,r)=>z1(void 0,void 0,void 0,function*(){return Js.validate(["address","string","uint"],[e,n,r]),sPt(t,e,n,r)}),tOt=(t,e)=>z1(void 0,void 0,void 0,function*(){return Js.validate(["address"],[e]),iPt(t,e)}),nOt=(t,e,n)=>z1(void 0,void 0,void 0,function*(){return Js.validate(["string","string"],[e,n]),aPt(t,e,n)}),rOt=(t,e,n,r)=>z1(void 0,void 0,void 0,function*(){const s=bf(e,yi,{transactionSchema:r==null?void 0:r.customTransactionSchema});return oPt(t,s,n)}),sOt=(t,e,n,r)=>z1(void 0,void 0,void 0,function*(){const s=bf(e,yi,{transactionSchema:r==null?void 0:r.customTransactionSchema});return lPt(t,s,n)}),iOt=(t,e,n,r)=>z1(void 0,void 0,void 0,function*(){Js.validate(["string","address","string"],[e,n,r]);const s=Ta(e)?e:km(e);return cPt(t,s,n,r)}),aOt=(t,e,n)=>z1(void 0,void 0,void 0,function*(){Js.validate(["string","string"],[e,n]);const r=Ta(e)?e:km(e);return uPt(t,r,n)});var tg=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 sDe extends of{getAccounts(){return tg(this,void 0,void 0,function*(){return ZFt(this.requestManager)})}newAccount(e){return tg(this,void 0,void 0,function*(){return JFt(this.requestManager,e)})}unlockAccount(e,n,r){return tg(this,void 0,void 0,function*(){return eOt(this.requestManager,e,n,r)})}lockAccount(e){return tg(this,void 0,void 0,function*(){return tOt(this.requestManager,e)})}importRawKey(e,n){return tg(this,void 0,void 0,function*(){return nOt(this.requestManager,e,n)})}sendTransaction(e,n){return tg(this,void 0,void 0,function*(){return rOt(this.requestManager,e,n,this.config)})}signTransaction(e,n){return tg(this,void 0,void 0,function*(){return sOt(this.requestManager,e,n,this.config)})}sign(e,n,r){return tg(this,void 0,void 0,function*(){return iOt(this.requestManager,e,n,r)})}ecRecover(e,n){return tg(this,void 0,void 0,function*(){return aOt(this.requestManager,e,n)})}}var M0;(function(t){t.HTTPS="https",t.WebSocket="wss"})(M0||(M0={}));var Es;(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"})(Es||(Es={}));const oOt=1300;class lOt extends xi{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=oOt}}const cOt=1301;class Gbe extends xi{constructor(e){super(`Invalid provider config options given for ${e}`),this.code=cOt}}var uOt=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 iDe extends rce{constructor(e,n,r,s,a){if(super(),a!==void 0&&n===M0.HTTPS&&!("providerOptions"in a))throw new Gbe("HTTP Provider");if(a!==void 0&&n===M0.WebSocket&&!("socketOptions"in a||"reconnectOptions"in a))throw new Gbe("Websocket Provider");this.transport=n,n===M0.HTTPS?this.provider=new NU(this.getRPCURL(e,n,r,s),a):n===M0.WebSocket&&(this.provider=new gLe(this.getRPCURL(e,n,r,s),a==null?void 0:a.socketOptions,a==null?void 0:a.reconnectOptions))}request(e,n){return uOt(this,void 0,void 0,function*(){return this.transport===M0.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 dOt=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 jc=t=>t!==void 0&&t.trim().length>0;class fOt extends iDe{constructor(e=Es.ETH_MAINNET,n=M0.HTTPS,r="",s="",a){super(e,n,r,s,a)}request(e,n){const r=Object.create(null,{request:{get:()=>super.request}});return dOt(this,void 0,void 0,function*(){try{return yield r.request.call(this,e,n)}catch(s){throw s instanceof F0&&s.statusCode===429?new lOt(s):s}})}getRPCURL(e,n,r,s){let a="",o="";switch(e){case Es.ETH_MAINNET:a=jc(s)?s:"powerful-holy-bush.quiknode.pro",o=jc(r)?r:"3240624a343867035925ff7561eb60dfdba2a668";break;case Es.ETH_SEPOLIA:a=jc(s)?s:"dimensional-fabled-glitter.ethereum-sepolia.quiknode.pro",o=jc(r)?r:"382a3b5a4b938f2d6e8686c19af4b22921fde2cd";break;case Es.ETH_HOLESKY:a=jc(s)?s:"yolo-morning-card.ethereum-holesky.quiknode.pro",o=jc(r)?r:"481ebe70638c4dcf176af617a16d02ab866b9af9";break;case Es.ARBITRUM_MAINNET:a=jc(s)?s:"autumn-divine-dinghy.arbitrum-mainnet.quiknode.pro",o=jc(r)?r:"a5d7bfbf60b5ae9ce3628e53d69ef50d529e9a8c";break;case Es.ARBITRUM_SEPOLIA:a=jc(s)?s:"few-patient-pond.arbitrum-sepolia.quiknode.pro",o=jc(r)?r:"3be985450970628c860b959c65cd2642dcafe53c";break;case Es.BNB_MAINNET:a=jc(s)?s:"purple-empty-reel.bsc.quiknode.pro",o=jc(r)?r:"ebf6c532961e21f092ff2facce1ec4c89c540158";break;case Es.BNB_TESTNET:a=jc(s)?s:"floral-rough-scion.bsc-testnet.quiknode.pro",o=jc(r)?r:"5b297e5acff5f81f4c37ebf6f235f7299b6f9d28";break;case Es.POLYGON_MAINNET:a=jc(s)?s:"small-chaotic-moon.matic.quiknode.pro",o=jc(r)?r:"847569f8a017e84d985e10d0f44365d965a951f1";break;case Es.POLYGON_AMOY:a=jc(s)?s:"prettiest-side-shape.matic-amoy.quiknode.pro",o=jc(r)?r:"79a9476eea661d4f82de614db1d8a895b14b881c";break;default:throw new Error("Network info not avalible.")}return`${n}://${a}/${o}`}}const hOt=t=>t!==void 0&&t.trim().length>0,pOt=[Es.DYMENSION_MAINNET,Es.DYMENSION_TESTNET,Es.KAVA_MAINNET,Es.CRONOS_MAINNET,Es.POLYGON_MAINNET];class RR extends iDe{constructor(e=Es.ETH_MAINNET,n=M0.HTTPS,r="",s){super(e,n,"",r,s)}getRPCURL(e,n,r,s){if(!RR.networkHostMap[e])throw new Error("Network info not avalible.");const a=`${RR.networkHostMap[e]}.publicnode.com`,o=hOt(s)?s:a;return pOt.includes(e)&&n===M0.WebSocket?`${n}://${o}/websocket`:`${n}://${o}`}}RR.networkHostMap={[Es.POLYGON_AMOY]:"polygon-amoy-bor-rpc",[Es.DYMENSION_MAINNET]:"dymension-evm-rpc",[Es.DYMENSION_TESTNET]:"dymension-testnet-evm-rpc",[Es.BLAST_MAINNET]:"blast-rpc",[Es.GNOSIS_MAINNET]:"gnosis-rpc",[Es.PULSECHAIN_MAINNET]:"pulsechain-rpc",[Es.PULSECHAIN_TESTNET]:"pulsechain-testnet-rpc",[Es.KAVA_MAINNET]:"kava-evm-rpc",[Es.CRONOS_MAINNET]:"cronos-evm-rpc",[Es.MANTLE_MAINNET]:"mantle-rpc",[Es.TAIKO_MAINNET]:"taiko-rpc",[Es.TAIKO_HEKLA]:"taiko-hekla-rpc",[Es.LINEA_MAINNET]:"linea-rpc",[Es.LINEA_SEPOLIA]:"linea-sepolia-rpc",[Es.SCROLL_MAINNET]:"scroll-rpc",[Es.SCROLL_SEPOLIA]:"scroll-sepolia-rpc",[Es.SYSCOIN_MAINNET]:"syscoin-evm-rpc",[Es.SYSCOIN_TANENBAUM]:"syscoin-tanenbaum-evm-rpc",[Es.HAQQ_MAINNET]:"haqq-evm-rpc",[Es.EVMOS_MAINNET]:"evmos-evm-rpc",[Es.EVMOS_TESTNET]:"evmos-testnet-evm-rpc",[Es.BERACHAIN_TESTNET]:"berachain-testnet-evm-rpc",[Es.ETH_MAINNET]:"ethereum-rpc",[Es.ETH_SEPOLIA]:"ethereum-sepolia-rpc",[Es.ETH_HOLESKY]:"ethereum-holesky-rpc",[Es.BSC_MAINNET]:"bsc-rpc",[Es.BSC_TESTNET]:"bsc-testnet-rpc",[Es.POLYGON_MAINNET]:"polygon-bor-rpc",[Es.BASE_MAINNET]:"base-rpc",[Es.BASE_SEPOLIA]:"base-sepolia-rpc",[Es.ARBITRUM_ONE]:"arbitrum-one-rpc",[Es.ARBITRUM_NOVA]:"arbitrum-nova-rpc",[Es.ARBITRUM_SEPOLIA]:"arbitrum-sepolia-rpc",[Es.AVALANCHE_C_MAINNET]:"avalanche-c-chain-rpc",[Es.AVALANCHE_P_MAINNET]:"avalanche-p-chain-rpc",[Es.AVALANCHE_X_MAINNET]:"avalanche-x-chain-rpc",[Es.AVALANCHE_FUJI_C]:"avalanche-fuji-c-chain-rpc",[Es.AVALANCHE_FUJI_P]:"avalanche-fuji-p-chain-rpc",[Es.AVALANCHE_FUJI_X]:"avalanche-fuji-x-chain-rpc",[Es.OPTIMISM_MAINNET]:"optimism-rpc",[Es.OPTIMISM_SEPOLIA]:"optimism-sepolia-rpc",[Es.FANTOM_MAINNET]:"fantom-rpc",[Es.FANTOM_TESTNET]:"fantom-testnet-rpc",[Es.OPBNB_MAINNET]:"opbnb-rpc",[Es.OPBNB_TESTNET]:"opbnb-testnet-rpc",[Es.GNOSIS_CHIADO]:"gnosis-chiado-rpc",[Es.CHILIZ_MAINNET]:"chiliz-rpc",[Es.CHILIZ_SPICY]:"chiliz-spicy-rpc",[Es.MOONBEAM_MAINNET]:"moonbeam-rpc",[Es.BAHAMUT_MAINNET]:"bahamut-rpc",[Es.TRON_MAINNET]:"tron-evm-rpc",[Es.MOONRIVER_MAINNET]:"moonriver-rpc"};const mOt=new fOt,xOt={encodeEventSignature:Nce,encodeFunctionCall:pIt,encodeFunctionSignature:ME,encodeParameter:yne,encodeParameters:PU,decodeParameter:jRe,decodeParameters:A3,decodeLog:ARe};var f7=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 gOt=t=>{const e=(o,l)=>f7(void 0,void 0,void 0,function*(){const c=yield tFt(o,t),u=es({format:"bytes"},l,yi);return Jkt(c,u)}),n=o=>{const l=mce(o);return Object.assign(Object.assign({},l),{signTransaction:c=>f7(void 0,void 0,void 0,function*(){return e(c,l.privateKey)})})},r=(o,l,c)=>f7(void 0,void 0,void 0,function*(){var u;const d=yield rTt(o,l,(u=c==null?void 0:c.nonStrict)!==null&&u!==void 0?u:!0);return Object.assign(Object.assign({},d),{signTransaction:f=>f7(void 0,void 0,void 0,function*(){return e(f,d.privateKey)})})}),s=()=>{const o=nTt();return Object.assign(Object.assign({},o),{signTransaction:l=>f7(void 0,void 0,void 0,function*(){return e(l,o.privateKey)})})},a=new NR({create:s,privateKeyToAccount:n,decrypt:r});return{signTransaction:e,create:s,privateKeyToAccount:n,decrypt:r,recoverTransaction:eTt,hashMessage:pce,sign:VLe,recover:une,encrypt:WLe,wallet:a,privateKeyToAddress:_U,parseAndValidatePrivateKey:b8,privateKeyToPublicKey:tTt}},bOt={version:"4.16.0"};var yOt=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())})},DR;(function(t){t.eip6963announceProvider="eip6963:announceProvider",t.eip6963requestProvider="eip6963:requestProvider"})(DR||(DR={}));const WW=new Map,aDe="web3:providersMapUpdated",vOt=()=>yOt(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(DR.eip6963announceProvider,n=>{WW.set(n.detail.info.uuid,n.detail);const r=new CustomEvent(aDe,{detail:WW});window.dispatchEvent(r),t(WW)}),window.dispatchEvent(new Event(DR.eip6963requestProvider))})}),wOt=t=>{if(typeof window>"u")throw new Error("window object not available, EIP-6963 is intended to be used within a browser");window.addEventListener(aDe,t)};class Tl extends of{constructor(e=mOt){var n;(oi(e)||typeof e=="string"&&e.trim()===""||typeof e!="string"&&!wR(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"||wR(e)?r.provider=e:e?r=e:r={},r.registeredSubscriptions=Object.assign(Object.assign({},wne),(n=r.registeredSubscriptions)!==null&&n!==void 0?n:{}),super(r);const s=gOt(this);this._wallet=s.wallet,this._accountProvider=s,this.utils=xLe;const a=this;class o extends _3{constructor(u,d,f,x,g){if(Ty(d)&&Ty(f))throw new $1e("Should not provide options at both 2nd and 3rd parameters");let y,v={},C,S;if(!oi(d)&&typeof d!="object"&&typeof d!="string")throw new $1e;if(typeof d=="string"&&(y=d),Ty(d)?v=d:Ty(f)?v=f:v={},d instanceof of?C=d:f instanceof of?C=f:x instanceof of?C=x:C=a.getContextObject(),g?S=g:Sg(f)?S=f:Sg(x)&&(S=x),super(u,y,v,C,S),super.subscribeToContextEvents(a),!oi(l)){const T=l.getTransactionMiddleware();oi(T)||super.setTransactionMiddleware(T)}}}const l=a.use(IU);this.eth=Object.assign(l,{ens:a.use(rDe,PR.main),Iban:Ul,net:a.use(JLe),personal:a.use(sDe),Contract:o,abi:xOt,accounts:s})}}Tl.version=bOt.version;Tl.utils=xLe;Tl.requestEIP6963Providers=vOt;Tl.onNewProviderDiscovered=wOt;Tl.modules={Web3Eth:IU,Iban:Ul,Net:JLe,ENS:rDe,Personal:sDe};const _d=({open:t,setOpen:e,transactionHash:n,transactionLoading:r,paymentPresaleRole:s,errorFunds:a,activeMethod:o})=>{const[l,c]=h.useState(!1);h.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),fn.success("TX Hash copied to clipboard!")}catch(f){console.error("Failed to copy: ",f),fn.error("Failed to copy TX Hash")}};return h.useEffect(()=>{let d;return t&&r?d=setTimeout(()=>c(!0),24e4):(c(!1),d&&clearTimeout(d)),()=>d&&clearTimeout(d)},[t,r]),i.jsxs(ha,{open:t,onClose:()=>{r||e(!1)},className:"relative z-[9001] font-inter",children:[i.jsx(fa,{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(Ji,{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(ka,{})}),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:Wo,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:U9e,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:Wo,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(CS,{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(qrt,{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(ka,{})}),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."})})]})]})})})})]})},oDe=[{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"}],COt=oDe.reduce((t,e)=>(t[e.hash]=e.id,t),{}),O2=({current:t="",onCloseCurrent:e})=>{const n=Pl(),r=yo(),s=t||COt[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:oDe.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(Wj,{className:`w-3.5 h-3.5 ${l?"text-[#5ce0a5]":""}`}):o.id==="basedapp"?i.jsx("img",{src:Pct,alt:"BasedApp",className:"w-3.5 h-3.5"}):o.id==="lighter"?i.jsx(L0,{className:`w-3.5 h-3.5 ${l?"text-[#5ce0a5]":"text-white"}`}):o.id==="apex"?i.jsx("img",{src:Oae,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:bT,alt:"Variational",className:"w-3.5 h-3.5"}):o.id==="paradex"?i.jsx("img",{src:yT,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 Mce({open:t=!1,setOpen:e=()=>{}}){const[n,r]=h.useState([]),[s,a]=h.useState(""),[o,l]=h.useState(""),[c,u]=h.useState("11"),[d,f]=h.useState(""),[x,g]=h.useState(""),[y,v]=h.useState(""),[C,S]=h.useState(""),[T,I]=h.useState(2),[L,F]=h.useState(!1),[$,O]=h.useState(!1),[U,Y]=h.useState(!1),[re,Q]=h.useState(!1),[q,te]=h.useState(!1),[fe,G]=h.useState(""),[ie,oe]=h.useState(""),[K,H]=h.useState(!1),[ee,se]=h.useState(!1),[pe,Se]=h.useState(null),[ge,ve]=h.useState(""),[be,we]=h.useState(!1),[je,Fe]=h.useState(!1),[Re,Qe]=h.useState(null),[Ye,dt]=h.useState(!1),[st,at]=h.useState([]),[He,qe]=h.useState(!1),[vt,yt]=h.useState(!1),[Kt,jt]=h.useState(""),[un,vn]=h.useState(!0),{setSignModalOpen:Hn,setTelegramChatId:ln,setSubscriberRole:Nn,setSubsExpireDay:dn,setMushboomerETH:rt,setMushboomerSOL:nt,setIsReferralCode:Ut,setIsReferralCodeName:wn,setIsWhitelist:Jt,setHyperToken:Vt,setHyperAddress:xt}=h.useContext(Qr),We="https://dextrabothypev2.nftinit.io",Pt="https://api.hyperliquid.xyz/info",Ke="0x1924b8561eef20e70ede628a296175d358be80e5",ct=["HYPE","ETH","BTC","SOL","USDT0","PUP"],Nt="0.01",Ht=Ce=>{switch(Ce){case"BTC":return"UBTC";case"ETH":return"UETH";case"SOL":return"USOL";case"USDT0":return"USDT0";case"HYPE":default:return Ce}},Rt=Ce=>{if(Ce==null||Ce==="")return"0.00";const m=Number(Ce);return Number.isNaN(m)?"0.00":m.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})},hn=Ce=>/^\d*\.?\d{0,6}$/.test(Ce),yn=Ce=>/^\d*$/.test(Ce),Cn=Ce=>{["e","E","+","-"].includes(Ce.key)&&Ce.preventDefault()},En=h.useMemo(()=>{if(c==="")return!1;const Ce=Number(c);return!Number.isNaN(Ce)&&Ce>=11},[c]);h.useMemo(()=>{if(d==="")return!1;const Ce=Number(d);return!Number.isNaN(Ce)&&Ce>0},[d]);const Rn=h.useMemo(()=>{if(x==="")return!1;const Ce=Number(x);return!Number.isNaN(Ce)&&Ce>=0&&Ce<=100},[x]),Mn=h.useMemo(()=>{if(y==="")return!1;const Ce=Number(y);return!Number.isNaN(Ce)&&Ce>=0&&Ce<=100},[y]),Yn=h.useMemo(()=>{if(C==="")return!1;const Ce=Number(C);return Number.isInteger(Ce)&&Ce>0&&Ce<=180},[C]),Zn=h.useMemo(()=>n.map(Ce=>{const m=(Ce==null?void 0:Ce.wallet_name)??(Ce==null?void 0:Ce.name)??(Ce==null?void 0:Ce.label)??String(Ce==null?void 0:Ce.wallet_id),p=(Ce==null?void 0:Ce.version)===3?`${m} - (API-AGENT) Wallet`:m;return{value:(Ce==null?void 0:Ce.wallet_id)??(Ce==null?void 0:Ce.id)??(Ce==null?void 0:Ce.value)??"",label:p,raw:Ce}}),[n]),Vn=h.useMemo(()=>{var Ce;return(Ce=Zn.find(m=>String(m.value)===String(s)))==null?void 0:Ce.raw},[Zn,s]),tr=h.useMemo(()=>{const Ce=Vn||{};return Ce.address||Ce.evm_address||Ce.wallet_address||Ce.public_address||Ce.eth_address||Ce.addr||null},[Vn]),Sn=(Vn==null?void 0:Vn.version)===3,ze=!Sn||Re>0,xe=h.useMemo(()=>{if(!o)return{coin:Ht(o),total:"0",entryNtl:"0"};const Ce=Ht(o);return(st||[]).find(p=>(p==null?void 0:p.coin)===Ce)??{coin:Ce,total:"0",entryNtl:"0"}},[o,st]),Ge=s!==""&&o!==""&&(T===1?Yn&&Mn:En&&Rn)&&be&&ze&&un;h.useEffect(()=>{if(!t)return;const Ce=localStorage.getItem("hyperToken"),m=localStorage.getItem("hyperAddress");we(!!(Ce&&m));const p=setInterval(()=>{const N=localStorage.getItem("hyperToken"),A=localStorage.getItem("hyperAddress");we(!!(N&&A))},800);return()=>clearInterval(p)},[t]),h.useEffect(()=>{t&&(G(""),be&&mt())},[t,be]),h.useEffect(()=>{t&&(tr?qt(tr):(Se(null),ve(""),at([])))},[t,tr]),h.useEffect(()=>{!t||!be||(Be(),jn())},[t,be]),h.useEffect(()=>{t&&T===1&&!y&&v(Nt)},[t,T]),h.useEffect(()=>{if(!t||!be)return;const Ce=Vn||{},m=Ce.address||Ce.evm_address||Ce.wallet_address||Ce.public_address||Ce.eth_address||Ce.addr||null;(Ce==null?void 0:Ce.version)===3&&m&&_e(m)},[t,be,s,Vn]);async function _e(Ce){try{Fe(!0),Qe(null);const p=await(await fetch(Pt,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"maxBuilderFee",user:Ce,builder:Ke})})).json();Qe(Number(p))}catch{Qe(null)}finally{Fe(!1)}}async function Be(){var Ce,m,p;try{O(!0);const N=window.localStorage.getItem("hyperToken"),A=window.localStorage.getItem("hyperAddress");if(!N||!A){H(!1);return}const P=await(await fetch(`${We}/api/hyper/farming/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:A.toLowerCase(),token:N})})).json();if(P!=null&&P.success&&((Ce=P==null?void 0:P.data)!=null&&Ce.farming_params)){H(!0),((m=P==null?void 0:P.data)==null?void 0:m.wallet_id)!==void 0&&((p=P==null?void 0:P.data)==null?void 0:p.wallet_id)!==null&&a(String(P.data.wallet_id));const D=P.data.farming_params||{};D.coin&&l(D.coin),D.margin!==void 0&&D.margin!==null&&u(String(D.margin)),D.budget!==void 0&&D.budget!==null&&f(String(D.budget));const V=Number(D.methodType);V===1?(I(2),D.spread!==void 0&&D.spread!==null&&g(String(D.spread))):V===2?(I(1),D.spread!==void 0&&D.spread!==null?v(String(D.spread)):v(Nt),D.orderPerHour!==void 0&&D.orderPerHour!==null&&S(String(D.orderPerHour))):I(2)}else H(!1)}catch{H(!1)}finally{O(!1)}}async function qt(Ce){try{ve(""),se(!0),Se(null);const p=await(await fetch(Pt,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"spotClearinghouseState",user:Ce})})).json(),N=Array.isArray(p==null?void 0:p.balances)?p.balances:[];at(N);const A=N.find(k=>(k==null?void 0:k.coin)==="USDC");Se(A?A.total:"0")}catch(m){ve(m.message||"Failed to load USDC balance.")}finally{se(!1)}}function It(){const Ce=tr||window.localStorage.getItem("hyperAddress");Ce&&qt(Ce)}async function mt(){try{F(!0);const Ce=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!Ce||!m){we(!1),Hn(!0);return}const N=await(await fetch(`${We}/api/wallet/confirmed-list`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:m.toLowerCase(),token:Ce})})).json();N!=null&&N.success?r((N==null?void 0:N.data)||[]):G((N==null?void 0:N.error_message)||"Failed to load wallets.")}catch(Ce){G(Ce.message||"Wallet list error.")}finally{F(!1)}}async function Ft(){if(!be){Hn(!0);return}if(Ge)try{Q(!0),G("");const Ce=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!Ce||!m){we(!1),Hn(!0);return}const N=T===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},A={address:m.toLowerCase(),token:Ce,wallet_id:Number(s),farming_params:N},P=await(await fetch(`${We}/api/hyper/farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})).json();P!=null&&P.success?H(!0):G((P==null?void 0:P.message)||"Start failed.")}catch(Ce){G(Ce.message||"An error occurred while saving.")}finally{Q(!1)}}async function Tn(){if(!be)return Hn(!0);if(s)try{te(!0),G("");const Ce=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!Ce||!m){we(!1),Hn(!0);return}const N=await(await fetch(`${We}/api/hyper/farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:m.toLowerCase(),token:Ce,wallet_id:Number(s)})})).json();N!=null&&N.success?H(!1):G((N==null?void 0:N.error_message)||"Stop failed.")}catch(Ce){G(Ce.message||"An error occurred while stopping.")}finally{te(!1)}}const kn=32,Gt={control:(Ce,m)=>({...Ce,backgroundColor:"#242424",borderColor:m.isFocused?"#67FFBD":"#353535",minHeight:kn,height:kn,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:Ce=>({...Ce,height:kn,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:Ce=>({...Ce,height:kn}),input:Ce=>({...Ce,color:"#FFFFFF",margin:0,padding:0}),singleValue:Ce=>({...Ce,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:Ce=>({...Ce,color:"#7F7F7F",fontSize:"12px"}),menu:Ce=>({...Ce,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:Ce=>({...Ce,paddingTop:0,paddingBottom:0}),option:(Ce,m)=>({...Ce,backgroundColor:m.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:kn,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:Ce=>({...Ce,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:Ce=>({...Ce,backgroundColor:"#353535"})},mn=Ce=>{var m;return i.jsx(ba.Option,{...Ce,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[((m=Ce.data)==null?void 0:m.icon)&&i.jsx("img",{src:Ce.data.icon,alt:Ce.data.label,className:"w-4 h-4",onError:p=>{p.currentTarget.style.display="none"}}),i.jsx("span",{className:"text-white text-[13px]",children:Ce.data.label})]})})},gt=Ce=>{var m;return i.jsx(ba.SingleValue,{...Ce,children:i.jsxs("div",{className:"flex items-center gap-2",children:[((m=Ce.data)==null?void 0:m.icon)&&i.jsx("img",{src:Ce.data.icon,alt:Ce.data.label,className:"w-4 h-4",onError:p=>{p.currentTarget.style.display="none"}}),i.jsx("span",{className:"text-white text-[13px]",children:Ce.data.label})]})})},Wt=h.useMemo(()=>ct.map(Ce=>{let p=`https://app.hyperliquid.xyz/coins/${Ce==="USDT0"?"USDT":Ce}.svg`;return Ce==="PUP"&&(p="https://www.basedapp.io/_next/image?url=%2Ftokens%2Fpng%2FPUP_USDC.png&w=32&q=75"),{value:Ce,label:Ce,icon:p}}),[]),jn=async()=>{var p,N;const Ce=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!(!Ce||!m))try{Y(!0);const A=await bi(m.toLowerCase(),Ce);A!=null&&A.success?(ln(A==null?void 0:A.telegram_chat_id),Nn(A==null?void 0:A.subscriber_role),dn(A==null?void 0:A.subs_expire_day),rt((p=A==null?void 0:A.mushboomer_counts)==null?void 0:p.eth),nt((N=A==null?void 0:A.mushboomer_counts)==null?void 0:N.sol),Ut(A==null?void 0:A.referral_code),wn(A==null?void 0:A.refcode),Jt(A==null?void 0:A.whitelist),Vt(Ce),xt(m),vn(!0),Y(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),Vt(""),xt(""),Y(!1))}catch(A){console.error("Token verification error:",A),console.error(A.message||"An unknown error occurred."),Y(!1)}},kt=L||$||re||q||U,cn=K&&!q;return t?i.jsxs(i.Fragment,{children:[Ye&&Ea.createPortal(i.jsx("div",{className:"fixed inset-0 z-[999999999]",children:i.jsx(M5,{open:Ye,setOpen:dt,handleListRequest:mt,handlePageChange:()=>{}})}),document.body),i.jsx(_d,{open:vt,setOpen:yt,transactionHash:Kt,transactionLoading:He,paymentPresaleRole:un,errorFunds:ie,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:()=>!kt&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(O2,{current:"basedapp",onCloseCurrent:()=>!kt&&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:W9e,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:Ce=>{window.localStorage.getItem("hyperToken")?dt(!0):Hn(!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(zT,{})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"YouTube"})]})]}),K&&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"})]})}),T===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."})}),be&&Sn&&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..."}):ze?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 ${T===2?"bg-[#242424] text-white shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]":"text-[#B3B3B3]"} ${cn?"opacity-60 cursor-not-allowed":""}`,onClick:()=>!cn&&I(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 ${T===1?"bg-[#242424] text-white shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]":"text-[#B3B3B3]"} ${cn?"opacity-60 cursor-not-allowed":""}`,onClick:()=>!cn&&I(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(pl,{styles:Gt,isDisabled:kt||L||cn,isLoading:L,options:Zn,value:Zn.find(Ce=>String(Ce.value)===String(s))||null,onChange:Ce=>{if(cn)return;a((Ce==null?void 0:Ce.value)??""),Qe(null);const m=(Ce==null?void 0:Ce.raw)||{},p=m.address||m.evm_address||m.wallet_address||m.public_address||m.eth_address||m.addr||null;be&&(m==null?void 0:m.version)===3&&p&&_e(p)},placeholder:be?L?"Loading...":"Select":"Connect to select",isSearchable:!0,onMenuOpen:()=>{be||Hn(!0)},menuIsOpen:be?void 0:!1}),!be&&i.jsx("button",{type:"button",onClick:()=>Hn(!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(pl,{styles:Gt,components:{Option:mn,SingleValue:gt},isDisabled:kt||cn,options:Wt,value:Wt.find(Ce=>Ce.value===o)||null,onChange:Ce=>{cn||l((Ce==null?void 0:Ce.value)??"")},placeholder:"Select",isSearchable:!0})]})]}),T===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:Ce=>{const m=Ce.target.value.trim();if(m==="")return S("");yn(m)&&S(m)},onKeyDown:Cn,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]":Yn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:kt||cn}),C!==""&&!Yn&&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:Ce=>{const m=Ce.target.value.trim();if(m==="")return v("");hn(m)&&v(m)},onKeyDown:Cn,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]":Mn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:kt||cn})]}),y!==""&&!Mn&&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(as,{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:Ce=>{const m=Ce.target.value.trim();if(m==="")return u("");hn(m)&&u(m)},onKeyDown:Cn,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]":En?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:kt||cn}),c!==""&&!En&&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:Ce=>{const m=Ce.target.value.trim();if(m==="")return g("");hn(m)&&g(m)},onKeyDown:Cn,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]":Rn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:kt||cn})]}),x!==""&&!Rn&&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:[be&&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...":ge?"—":Rt(pe??"0")}),i.jsx("div",{onClick:It,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(t1,{className:`w-4 h-4 ${ee?"animate-spin":""}`})})]}),be&&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:Rt(xe==null?void 0:xe.total)}),i.jsxs("span",{className:"text-[#9B9B9B]",children:["(~",Rt(xe==null?void 0:xe.entryNtl)," USDC)"]}),i.jsx("div",{onClick:It,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(t1,{className:`w-4 h-4 ${ee?"animate-spin":""}`})})]})]}),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] font-inter hover:border-white disabled:opacity-60",disabled:kt,children:"Cancel"}),be?K?i.jsx("button",{onClick:Tn,disabled:!s||kt,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:q?"Stopping...":"Stop"}):i.jsx("button",{onClick:Ft,disabled:!Ge||kt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] font-inter border ${!Ge||kt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:re?"Starting...":"Start"}):i.jsx("button",{onClick:()=>Hn(!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"})]})]}),(L||$)&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]}):null}const Lce=({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}=h.useContext(Qr);ds();const[y,v]=h.useState(!1),[C,S]=h.useState(!1),[T,I]=h.useState(""),[L,F]=h.useState(""),[$,O]=h.useState(""),[U,Y]=h.useState(""),[re,Q]=h.useState(""),[q,te]=h.useState("OFF"),[fe,G]=h.useState(""),[ie,oe]=h.useState(""),[K,H]=h.useState("LONG"),[ee,se]=h.useState("MARKET"),[pe,Se]=h.useState(""),[ge,ve]=h.useState(""),[be,we]=h.useState(""),[je,Fe]=h.useState(!1),[Re,Qe]=h.useState(!1),[Ye,dt]=h.useState(!1),[st,at]=h.useState(!1),[He,qe]=h.useState(""),[vt,yt]=h.useState(""),[Kt,jt]=h.useState(!0),[un,vn]=h.useState(!1),[Hn,ln]=h.useState(!1),[Nn,dn]=h.useState(!1),[rt,nt]=h.useState(!1),[Ut,wn]=h.useState(!1),[Jt,Vt]=h.useState(!1),[xt,We]=h.useState(""),[Pt,Ke]=h.useState(!0),[ct,Nt]=h.useState(2),Ht="https://dextrabothypev2.nftinit.io",Rt="",hn={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]]},yn={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"}},Cn=k=>{if(k==null||isNaN(k))return"";const P=Math.abs(k),D=V=>V.toFixed(1).replace(/\.0$/,"");return P>=1e9?`${D(k/1e9)}B`:P>=1e6?`${D(k/1e6)}M`:P>=1e3?`${D(k/1e3)}K`:`${k}`},En=(k,P)=>{const D=hn[k]||[];if(!D.length||!P)return null;let V=null;for(const[Z,ce,ue]of D)P<=Z&&(!V||Z<V.maxLev)&&(V={min:ce,max:ue,maxLev:Z});return V},Rn=h.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}],[]),Mn=k=>{var P;return((P=Rn.find(D=>D.value===k))==null?void 0:P.maxLeverage)??100},Yn=k=>{["e","E","+","-"].includes(k.key)&&k.preventDefault()},Zn=k=>/^\d*\.?\d{0,6}$/.test(k),Vn=k=>/^\d*$/.test(k),tr=h.useMemo(()=>{if(fe==="")return!1;const k=Number(fe);return Number.isInteger(k)&&k>=1&&k<=180},[fe]),Sn=h.useMemo(()=>{if(ie==="")return!1;const k=Number(ie),P=Mn(re);return Number.isInteger(k)&&k>=1&&k<=P},[ie,re]),ze=h.useMemo(()=>{if(pe==="")return!1;const k=Number(pe);return!Number.isNaN(k)&&k>=0&&k<=100},[pe]),xe=h.useMemo(()=>{if(ge==="")return!1;const k=Number(ge);return!Number.isNaN(k)&&k>=0&&k<=100},[ge]),Ge=h.useMemo(()=>{if(be==="")return!1;const k=Number(be);return!Number.isNaN(k)&&k>=0&&k<=100},[be]),_e=Number(ie||0),Be=Sn&&re?En(re,_e):null,qt=y&&T.trim()!==""&&L.trim()!==""&&(q!=="ON"||$.trim()!==""&&U.trim()!=="")&&re!==""&&tr&&Sn&&(K==="LONG"||K==="SHORT")&&(ee==="LIMIT"||ee==="MARKET")&&Pt,It=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),mt=()=>`asterCreds:${It()}`,Ft=()=>{try{const k=localStorage.getItem(mt());if(!k)return;const P=JSON.parse(k);P.apiKey&&I(P.apiKey),P.apiSecret&&F(P.apiSecret),P.apiKeyTwo&&O(P.apiKeyTwo),P.apiSecretTwo&&Y(P.apiSecretTwo),typeof P.remember=="boolean"&&jt(P.remember)}catch{}},Tn=()=>{if(Kt)try{localStorage.setItem(mt(),JSON.stringify({apiKey:T,apiSecret:L,apiKeyTwo:$,apiSecretTwo:U,remember:!0}))}catch{}},kn=()=>{try{localStorage.removeItem(mt())}catch{}};h.useEffect(()=>{if(!t)return;const k=localStorage.getItem("hyperToken"),P=localStorage.getItem("hyperAddress");v(!!(k&&P));const D=setInterval(()=>{const V=localStorage.getItem("hyperToken"),Z=localStorage.getItem("hyperAddress");v(!!(V&&Z))},800);return()=>clearInterval(D)},[t]),h.useEffect(()=>{!t||!y||(Gt(),Ce())},[t,y]),h.useEffect(()=>{t&&(ge===""&&ve(Rt),pe===""&&Se(Rt),be===""&&we(Rt))},[t]),h.useEffect(()=>{if(!re)return;const k=Mn(re),P=Number(ie);!Number.isNaN(P)&&P>k&&oe(String(k)),!Number.isNaN(P)&&P<1&&ie!==""&&oe("1")},[re]),h.useEffect(()=>{t&&(Kt&&Tn(),Kt||kn())},[T,L,$,U,Kt,t]);async function Gt(){var k,P,D,V,Z;try{Qe(!0),qe("");const ce=window.localStorage.getItem("hyperToken"),ue=window.localStorage.getItem("hyperAddress");if(!ce||!ue){S(!1),Ft();return}const Ne=await(await fetch(`${Ht}/api/hyper/ast_farming/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ue.toLowerCase(),token:ce})})).json(),Ie=(k=Ne==null?void 0:Ne.data)==null?void 0:k.farming_params;if(Ne!=null&&Ne.success&&Ie){S(!0);const Le=((P=Ne==null?void 0:Ne.data)==null?void 0:P.aster_apikey)??"",Xe=((D=Ne==null?void 0:Ne.data)==null?void 0:D.aster_apisecret)??"",Oe=(Ie==null?void 0:Ie.api_key_2)??"",$e=(Ie==null?void 0:Ie.api_secret_2)??"";Le&&I(String(Le)),Xe&&F(String(Xe)),Oe&&O(String(Oe)),$e&&Y(String($e)),((V=Ne==null?void 0:Ne.data)==null?void 0:V.delta_neutral)!==void 0&&te((Z=Ne==null?void 0:Ne.data)!=null&&Z.delta_neutral?"ON":"OFF"),Ie!=null&&Ie.coin&&Q(String(Ie.coin)),(Ie==null?void 0:Ie.orderPerHour)!=null&&G(String(Ie.orderPerHour)),(Ie==null?void 0:Ie.leverage)!=null&&oe(String(Ie.leverage)),Ie!=null&&Ie.direction&&H(String(Ie.direction).toUpperCase()==="SHORT"?"SHORT":"LONG"),Ie!=null&&Ie.order_type&&se(String(Ie.order_type)==="limit"?"LIMIT":"MARKET"),(Ie==null?void 0:Ie.upspread)!=null&&Se(String(Ie.upspread)),(Ie==null?void 0:Ie.downspread)!=null&&ve(String(Ie.downspread)),(Ie==null?void 0:Ie.upspread)!=null&&we(String(Ie.upspread))}else S(!1),te("OFF");(!T&&!L||q==="ON"&&!$&&!U)&&Ft()}catch{S(!1),Ft(),te("OFF")}finally{Qe(!1)}}async function mn(){if(!y){r(!0);return}if(qt)try{dt(!0),qe("");const k=window.localStorage.getItem("hyperToken"),P=window.localStorage.getItem("hyperAddress");if(!k||!P){r(!0);return}const D={methodType:q==="ON"?2:1,coin:re,orderPerHour:Number(fe),leverage:Number(ie),...q==="ON"?{api_key_2:$,api_secret_2:U}:ee==="LIMIT"?{upspread:Number(be),direction:K,order_type:ee==="LIMIT"?"limit":"market"}:{upspread:Number(pe),downspread:Number(ge),direction:K,order_type:ee==="LIMIT"?"limit":"market"}},V={address:P.toLowerCase(),token:k,apikey:T,apisecret:L,farming_params:D,delta_neutral:q==="ON"},ce=await(await fetch(`${Ht}/api/hyper/ast_farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)})).json();ce!=null&&ce.success?(S(!0),Kt&&Tn()):qe((ce==null?void 0:ce.error_message)||"Start failed.")}catch(k){qe(k.message||"An error occurred while saving.")}finally{dt(!1)}}async function gt(){if(!y){r(!0);return}try{at(!0),qe("");const k=window.localStorage.getItem("hyperToken"),P=window.localStorage.getItem("hyperAddress");if(!k||!P){r(!0);return}const V=await(await fetch(`${Ht}/api/hyper/ast_farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:P.toLowerCase(),token:k})})).json();V!=null&&V.success?S(!1):qe((V==null?void 0:V.error_message)||"Stop failed.")}catch(k){qe(k.message||"An error occurred while stopping.")}finally{at(!1)}}const Wt={control:(k,P)=>({...k,backgroundColor:"#242424",borderColor:P.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,P)=>({...k,backgroundColor:P.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"})},jn=({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"]}),kt=k=>{var P;return i.jsx(ba.Option,{...k,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[((P=k.data)==null?void 0:P.icon)&&i.jsx("img",{src:k.data.icon,alt:k.data.label,className:"w-4 h-4 rounded-[4px]",onError:D=>D.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:k.data.label}),i.jsx(jn,{max:k.data.maxLeverage})]})})},cn=k=>{var P;return i.jsx(ba.SingleValue,{...k,children:i.jsxs("div",{className:"flex items-center gap-2",children:[((P=k.data)==null?void 0:P.icon)&&i.jsx("img",{src:k.data.icon,alt:k.data.label,className:"w-4 h-4 rounded-[4px]",onError:D=>D.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:k.data.label}),i.jsx(jn,{max:k.data.maxLeverage})]})})},Ce=async()=>{var D,V;const k=window.localStorage.getItem("hyperToken"),P=window.localStorage.getItem("hyperAddress");if(!(!k||!P))try{Fe(!0);const Z=await bi(P.toLowerCase(),k);Z!=null&&Z.success?(s(Z==null?void 0:Z.telegram_chat_id),a(Z==null?void 0:Z.subscriber_role),o(Z==null?void 0:Z.subs_expire_day),l((D=Z==null?void 0:Z.mushboomer_counts)==null?void 0:D.eth),c((V=Z==null?void 0:Z.mushboomer_counts)==null?void 0:V.sol),u(Z==null?void 0:Z.referral_code),d(Z==null?void 0:Z.refcode),f(Z==null?void 0:Z.whitelist),x(k),g(P),Ke(!0),Fe(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),x(""),g(""),Fe(!1))}catch(Z){console.error("Token verification error:",Z),console.error(Z.message||"An unknown error occurred."),Fe(!1)}},m=Rn;if(!t)return null;const p=Re||Ye||st||je,N=C&&!st,A=Mn(re);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:Jt,setOpen:Vt,transactionHash:xt,transactionLoading:Ut,paymentPresaleRole:Pt,errorFunds:vt,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(O2,{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:`${q==="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(zT,{})}),i.jsx("div",{className:"text-white text-[13px] font-medium leading-[8px]",children:"YouTube"})]})})]}),C&&ct===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:`${q==="ON"?"space-y-3 pt-3.5 pb-3":"space-y-2 pt-2 pb-2"} px-5`,children:[He&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:He}),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(Wj,{className:"w-4 h-4"}),"Stage 3"]})})})})})}),y&&!C&&ct===2&&Pt&&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"})]})]}),ct===2&&i.jsxs("div",{className:`${q==="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:[q==="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:T,onChange:k=>I(k.target.value),autoComplete:"off",placeholder:"ASTER_API_KEY",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] ${T===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||N}),i.jsx("button",{type:"button",onClick:()=>vn(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||N,children:un?i.jsx(la,{size:14}):i.jsx(ca,{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:L,onChange:k=>F(k.target.value),autoComplete:"off",placeholder:"ASTER_API_SECRET",type:Hn?"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:p||N}),i.jsx("button",{type:"button",onClick:()=>ln(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||N,children:Hn?i.jsx(la,{size:14}):i.jsx(ca,{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:T,onChange:k=>I(k.target.value),autoComplete:"off",placeholder:"ASTER_API_KEY",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] ${T===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||N}),i.jsx("button",{type:"button",onClick:()=>vn(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||N,children:un?i.jsx(la,{size:14}):i.jsx(ca,{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:L,onChange:k=>F(k.target.value),autoComplete:"off",placeholder:"ASTER_API_SECRET",type:Hn?"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:p||N}),i.jsx("button",{type:"button",onClick:()=>ln(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||N,children:Hn?i.jsx(la,{size:14}):i.jsx(ca,{size:14})})]})]})]}),q==="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=>O(k.target.value),autoComplete:"off",placeholder:"ASTER_API_KEY_2",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] ${$===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||N}),i.jsx("button",{type:"button",onClick:()=>dn(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||N,children:Nn?i.jsx(la,{size:14}):i.jsx(ca,{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:U,onChange:k=>Y(k.target.value),autoComplete:"off",placeholder:"ASTER_API_SECRET_2",type:rt?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${U===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||N}),i.jsx("button",{type:"button",onClick:()=>nt(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||N,children:rt?i.jsx(la,{size:14}):i.jsx(ca,{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(pl,{styles:Wt,components:{Option:kt,SingleValue:cn},isDisabled:p||N,options:m,value:m.find(k=>k.value===re)||null,onChange:k=>Q((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 P=k.target.value.trim();if(P==="")return G("");Vn(P)&&G(P)},onKeyDown:Yn,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]":tr?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||N}),fe!==""&&!tr&&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:q==="ON"?"On":"Off"}),i.jsx(Oo,{checked:q==="ON",onChange:k=>te(k?"ON":"OFF"),disabled:p||N,className:`${q==="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||N?"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 ${q==="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:ie,onChange:k=>{const P=k.target.value.trim();if(P==="")return oe("");Vn(P)&&oe(P)},onKeyDown:Yn,inputMode:"numeric",autoComplete:"off",placeholder:re?`1–${A}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${ie===""?"border-[#353535]":Sn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||N}),ie!==""&&!Sn&&i.jsxs("div",{className:"text-[#FF797C] text-[12px]",children:["Allowed: 1–",A,"x"]}),Be&&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:[_e,"x"]}),":"," ",i.jsxs("b",{children:[Cn(Be.min)," – ",Cn(Be.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"})]}),yn[re]&&i.jsxs("div",{children:["Trading Limit is"," ",i.jsxs("b",{children:[Cn(yn[re].market)," ",yn[re].unit]})," ","for ",i.jsx("b",{children:re})," ",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:`${q==="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:()=>!N&&se("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||N?"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:()=>!N&&se("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||N?"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:`${q==="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":K==="LONG",onClick:()=>!N&&H("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||N?"opacity-60 cursor-not-allowed":"cursor-pointer",K==="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",ie?` - ${ie}x`:""]})}),i.jsx("div",{"aria-pressed":K==="SHORT",onClick:()=>!N&&H("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||N?"opacity-60 cursor-not-allowed":"cursor-pointer",K==="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",ie?` - ${ie}x`:""]})})]})]})]}),i.jsxs("div",{className:`${q==="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:pe,onChange:k=>{const P=k.target.value.trim();if(P==="")return Se("");Zn(P)&&Se(P)},onKeyDown:Yn,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] ${pe===""?"border-[#353535]":ze?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||N})]}),pe!==""&&!ze&&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:ge,onChange:k=>{const P=k.target.value.trim();if(P==="")return ve("");Zn(P)&&ve(P)},onKeyDown:Yn,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] ${ge===""?"border-[#353535]":xe?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||N})]}),ge!==""&&!xe&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter a percentage between 0 and 100."})]})]}),i.jsx("div",{className:`${q==="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:be,onChange:k=>{const P=k.target.value.trim();if(P==="")return we("");Zn(P)&&we(P)},onKeyDown:Yn,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] ${be===""?"border-[#353535]":Ge?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||N})]}),be!==""&&!Ge&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter a percentage between 0 and 100."})]})})]}),ct===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:gt,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:st?"Stopping...":"Stop"}):i.jsx("button",{onClick:mn,disabled:!qt||p,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!qt||p?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Ye?"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&&ct===2&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},NOt=({linkTo:t,title:e,icon:n,activePaths:r=[]})=>{const{pathname:s}=Pl(),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})]})})},yf=({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"})]}),fo=({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"})})]}),us=({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"})]}),D5=({open:t=!1,setOpen:e=()=>{},oldSlotCount:n,checkAccountLighter:r,tradeMarket:s,product:a})=>{const{address:o}=ds(),{setSignModalOpen:l,setTelegramChatId:c,setSubscriberRole:u,setSubsExpireDay:d,setMushboomerETH:f,setMushboomerSOL:x,setIsReferralCode:g,setIsReferralCodeName:y,setIsWhitelist:v,setHyperToken:C,setHyperAddress:S}=h.useContext(Qr),[T,I]=h.useState(1),[L,F]=h.useState(!1),[$,O]=h.useState(!1),[U,Y]=h.useState(""),[re,Q]=h.useState(""),[q,te]=h.useState(""),fe=pe=>/^\d*$/.test(pe),G=pe=>{["e","E","+","-"].includes(pe.key)&&pe.preventDefault()};h.useEffect(()=>{t||I(1)},[t]);const ie=h.useRef(q);h.useEffect(()=>{ie.current=q},[q]);const oe=h.useMemo(()=>{if(T==="")return!1;const pe=Number(T);return Number.isInteger(pe)&&pe>=1},[T]),K=async()=>{var ge,ve,be,we;const pe=window.localStorage.getItem("hyperToken"),Se=window.localStorage.getItem("hyperAddress");if(!(!pe||!Se))try{const je=await bi(Se.toLowerCase(),pe);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((ge=je==null?void 0:je.mushboomer_counts)==null?void 0:ge.eth),x((ve=je==null?void 0:je.mushboomer_counts)==null?void 0:ve.sol),g(je==null?void 0:je.referral_code),y(je==null?void 0:je.refcode),v(je==null?void 0:je.whitelist),C(pe),S(Se),te((we=(be=je==null?void 0:je.slots_info)==null?void 0:be[s])==null?void 0:we.total_qty)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),C(""),S(""))}catch(je){console.error("Token verification error:",je),console.error(je.message||"An unknown error occurred.")}},H=async()=>new Tl(window.ethereum).eth.getAccounts(Se=>Se),ee=async(pe="slot",Se=24,ge=5e3)=>{Se<=0||(await new Promise(ve=>setTimeout(ve,ge)),await K(),pe==="slot"&&ie.current<=n?ee(pe,Se-1,ge):r())},se=async pe=>{Q("");const Se=window.localStorage.getItem("hyperToken"),ge=window.localStorage.getItem("hyperAddress");if(!Se||!o){l(!0);return}O(!0),F(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(we){console.error("Failed to switch network",we),F(!1);return}const ve=new Tl(window.ethereum);var be=await H();if(be.length>0?be=be[0]:be=void 0,be){const je=pe*.012,Fe=ve.utils.toWei(je.toString(),"ether"),Re={from:be,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:Fe};await ve.eth.sendTransaction(Re).then(Qe=>{console.log("txHash :>> ",Qe),F(!1),Y(Qe.transactionHash);const Ye=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():ge,token:Se,payment_tx:Qe.transactionHash,slot_role:Ye,slot_qty:Number(T)})}),K(),ee("slot")}).catch(Qe=>{console.log(Qe),Qe.code===-32003||Qe.message.includes("insufficient funds")?Q("Insufficient funds."):Qe.message==="MetaMask Tx Signature: User denied transaction signature."&&O(!1)})}else await ve.eth.requestAccounts()};return t?i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:$,setOpen:O,transactionHash:U,transactionLoading:L,paymentPresaleRole:!(q<=n),errorFunds:re,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:()=>I(pe=>{const Se=Number(pe||0);return Se>1?String(Se-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:T,onChange:pe=>{const Se=pe.target.value.trim();if(Se==="")return I("");fe(Se)&&I(Se)},onKeyDown:G,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:()=>I(pe=>{const Se=Number(pe||0);return String(Se+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:"+"})]}),T!==""&&!oe&&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:[(T*.012).toFixed(3)," ETH"]})]}),i.jsx("div",{onClick:pe=>{pe.preventDefault(),oe&&se(T)},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 ${oe?"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy"})]})})]})]}):null},Rce=({open:t=!1,setOpen:e=()=>{}})=>{var rs,gs,ms,At;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=h.useContext(Qr);ds();const[g,y]=h.useState(1),[v,C]=h.useState(0),[S,T]=h.useState(0),[I,L]=h.useState(0),[F,$]=h.useState(0),[O,U]=h.useState({}),[Y,re]=h.useState(null),[Q,q]=h.useState(!1),[te,fe]=h.useState(!1),[G,ie]=h.useState(!1),[oe,K]=h.useState("OFF"),[H,ee]=h.useState(""),[se,pe]=h.useState(""),[Se,ge]=h.useState(""),[ve,be]=h.useState(""),[we,je]=h.useState(""),[Fe,Re]=h.useState(""),[Qe,Ye]=h.useState(""),[dt,st]=h.useState(""),[at,He]=h.useState([]),[qe,vt]=h.useState(""),[yt,Kt]=h.useState(""),[jt,un]=h.useState(""),[vn,Hn]=h.useState("LONG"),[ln,Nn]=h.useState("STANDARD"),[dn,rt]=h.useState("STANDARD"),[nt,Ut]=h.useState("MARKET"),[wn,Jt]=h.useState(""),[Vt,xt]=h.useState(""),[We,Pt]=h.useState(""),[Ke,ct]=h.useState(!1),[Nt,Ht]=h.useState(!1),[Rt,hn]=h.useState(!1),[yn,Cn]=h.useState(!1),[En,Rn]=h.useState(""),[Mn,Yn]=h.useState(""),[Zn,Vn]=h.useState(!0),[tr,Sn]=h.useState(!1),[ze,xe]=h.useState(!1),[Ge,_e]=h.useState(!1),[Be,qt]=h.useState(!1),[It,mt]=h.useState(""),[Ft,Tn]=h.useState(!0),[kn,Gt]=h.useState(!1),[mn,gt]=h.useState("Hour"),[Wt,jn]=h.useState(1),[kt,cn]=h.useState("lighter"),[Ce,m]=h.useState(!1),p=h.useRef(null),[N,A]=h.useState(""),[k,P]=h.useState(null),[D,V]=h.useState(""),[Z,ce]=h.useState(!1),ue=k?(k==null?void 0:k.getTime())<=Date.now():!1,me="https://dextrabothypev2.nftinit.io",Ne="",Ie={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI"},Le=["BTC","ETH","SOL"];h.useEffect(()=>{async function pt(){if(t)try{const Me=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_lighter_coins/")).json();if(Me!=null&&Me.coins){let ft=Me.coins.map(ut=>{const on=(ut==null?void 0:ut.label)||"",bn=Ie[on]||on,Gn=bn==="XMR"?"https://app.lighter.xyz/assets/xmr-CV8khZ54.png":bn==="NMR"?"https://app.lighter.xyz/assets/nmr-2YIHMk6g.png":bn==="USELESS"?"https://app.lighter.xyz/assets/useless-BTmgr78l.png":bn==="DOLO"?"https://app.lighter.xyz/assets/dolo-DuOVl-Vo.png":bn==="CRO"?"https://app.lighter.xyz/assets/cro-C7lstwu3.png":bn==="FF"?"https://app.lighter.xyz/assets/ff-CvnDhHny.png":bn==="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=":bn==="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=":bn==="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==":bn==="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=":bn==="CC"?"https://app.lighter.xyz/assets/cc-D4WHZ-w6.png":`https://app.hyperliquid.xyz/coins/${bn}.svg`;return{...ut,icon:Gn}});kt==="variational"&&oe==="ON"&&(ft=ft.filter(ut=>Le.includes(ut.label))),He(ft)}}catch(le){console.error("Failed to fetch coin list:",le)}}pt()},[t,kt,oe]);const Xe=pt=>{var le;return((le=at==null?void 0:at.find(Me=>Me.value===pt))==null?void 0:le.maxLeverage)??100},Oe=pt=>{["e","E","+","-"].includes(pt.key)&&pt.preventDefault()},$e=pt=>/^\d*\.?\d{0,6}$/.test(pt),ae=pt=>/^\d*$/.test(pt),he=h.useMemo(()=>{if(yt==="")return!1;const pt=Number(yt);return Number.isInteger(pt)&&pt>=1&&pt<=180},[yt]),Pe=h.useMemo(()=>{if(jt==="")return!1;const pt=Number(jt),le=Xe(dt);return Number.isInteger(pt)&&pt>=1&&pt<=le},[jt,dt,at]),Ve=h.useMemo(()=>{if(wn==="")return!1;const pt=Number(wn);return Number.isNaN(pt)?!1:pt===0?!0:pt>=1&&pt<=1e7},[wn]),Te=h.useMemo(()=>{if(Vt==="")return!1;const pt=Number(Vt);if(Number.isNaN(pt))return!1;const le=jt===""?null:Number(jt),Me=le?le*100-1:4999;return pt===0?!0:pt>0&&pt<1?!1:pt>=1&&pt<=Me},[Vt,jt]);h.useMemo(()=>{if(We==="")return!1;const pt=Number(We);return!Number.isNaN(pt)&&pt>0&&pt<=100},[We]);const Ze=te&&we.trim()!==""&&H.trim()!==""&&Se.trim()!==""&&dt!==""&&he&&Pe&&qe&&(!wn||Ve)&&(!Vt||Te)&&(vn==="LONG"||vn==="SHORT"||vn==="RANDOM")&&(nt==="LIMIT"||nt==="MARKET"||nt==="RANDOM")&&Ft,it=te&&H.trim()!==""&&Se.trim()!==""&&we.trim()!==""&&(kt!=="lighter"||se.trim()!=="")&&(kt!=="lighter"||ve.trim()!=="")&&(kt!=="lighter"||Fe.trim()!=="")&&(kt!=="lighter"||H.trim()!==se.trim())&&(kt!=="lighter"||Se.trim()!==ve.trim())&&(kt!=="lighter"||we.trim().toLowerCase()!==Fe.trim().toLowerCase())&&dt!==""&&he&&Pe&&qe&&(kt!=="variational"||N.trim()!=="")&&(kt!=="variational"||!D)&&(kt!=="variational"||!ue)&&Ft;h.useEffect(()=>{if(oe==="ON"&&kt==="lighter"){if(Se&&ve&&Se.trim()===ve.trim()){Rn("Make sure the wallet API indexes are unique for each Slot.");return}if(we&&Fe&&we.trim().toLowerCase()===Fe.trim().toLowerCase()){Rn("Make sure both the Lighter wallet addresses are unique for each Slot.");return}if(H&&se&&H.trim()===se.trim()){Rn("Please create an API key for each wallet.");return}Rn("")}else Rn("")},[oe,Se,ve,H,se,we,Fe]);const wt=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),Dt=()=>`lighterCreds:${wt()}`,Qt=()=>{try{const pt=localStorage.getItem(Dt());if(!pt)return;const le=JSON.parse(pt);le.apiKey&&ee(le.apiKey),le.apiKeyTwo&&pe(le.apiKeyTwo),le.apiKeyIndex&&ge(le.apiKeyIndex),le.apiKeyIndexTwo&&be(le.apiKeyIndexTwo),le.lighterLoginAddress&&je(le.lighterLoginAddress),le.lighterLoginAddressTwo&&Re(le.lighterLoginAddressTwo),typeof le.remember=="boolean"&&Vn(le.remember)}catch{}},xn=()=>{if(Zn)try{localStorage.setItem(Dt(),JSON.stringify({apiKey:H,apiKeyIndex:Se,lighterLoginAddress:we,remember:!0}))}catch{}},pn=()=>{try{localStorage.removeItem(Dt())}catch{}};h.useEffect(()=>{if(!t)return;const pt=localStorage.getItem("hyperToken"),le=localStorage.getItem("hyperAddress");fe(!!(pt&&le));const Me=setInterval(()=>{const ft=localStorage.getItem("hyperToken"),ut=localStorage.getItem("hyperAddress");fe(!!(ft&&ut))},800);return()=>clearInterval(Me)},[t]),h.useEffect(()=>{!t||!te||(An(),_r())},[t,te]),h.useEffect(()=>{t&&(Vt===""&&xt(Ne),wn===""&&Jt(Ne),We===""&&Pt(Ne))},[t]),h.useEffect(()=>{if(!dt)return;const pt=Xe(dt),le=Number(jt);!Number.isNaN(le)&&le>pt&&un(String(pt)),!Number.isNaN(le)&&le<1&&jt!==""&&un("1")},[dt]),h.useEffect(()=>{t&&(Zn&&xn(),Zn||pn())},[H,Se,we,Qe,Zn,t]);async function An(){var pt,le,Me,ft,ut,on,bn,Gn,rr,Jn,Xn,Zr,$r,wr,pr,ar;try{Ht(!0),Rn("");const Vr=window.localStorage.getItem("hyperToken"),Ur=window.localStorage.getItem("hyperAddress");if(!Vr||!Ur){ie(!1),Qt();return}const Sr=await(await fetch(`${me}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Ur.toLowerCase(),token:Vr})})).json();if(!(Sr!=null&&Sr.success)){if(console.warn("INFO API RESPONSE:",Sr==null?void 0:Sr.error_message),(Sr==null?void 0:Sr.error_message)==="You have not a running process"){const Pn=qe?qe.toLowerCase().replace("-","_"):null,Ln=O==null?void 0:O[Pn];if(Pn&&Ln){const ht={...O,[Pn]:{...Ln,isStop:!0}};U(ht);const lr=Object.keys(ht).filter(sr=>sr.startsWith("lighter"));if(lr.length>0&&!qe){const Lr=lr.sort((ss,ys)=>{var er,qr;const Bt=parseInt(((er=ss.match(/\d+/))==null?void 0:er[0])||0,10),mr=parseInt(((qr=ys.match(/\d+/))==null?void 0:qr[0])||0,10);return Bt-mr})[0].match(/\d+/);Lr&&vt(`Lighter-${Lr[0]}`)}}else vt("Lighter-1")}Sr!=null&&Sr.slots_info&&(T((le=(pt=Sr==null?void 0:Sr.slots_info)==null?void 0:pt.lighter)==null?void 0:le.total_qty),C((ft=(Me=Sr==null?void 0:Sr.slots_info)==null?void 0:Me.lighter)==null?void 0:ft.active_qty),$((on=(ut=Sr==null?void 0:Sr.slots_info)==null?void 0:ut.variational)==null?void 0:on.total_qty),L((Gn=(bn=Sr==null?void 0:Sr.slots_info)==null?void 0:bn.variational)==null?void 0:Gn.active_qty));return}if(Sr!=null&&Sr.success&&(Sr!=null&&Sr.data)){const Pn=qe?qe.toLowerCase().replace("-","_"):null,Ln=O==null?void 0:O[Pn],ht=Sr.data||{};Pn&&!ht[Pn]&&Ln&&(ht[Pn]={...Ln,isStop:!0}),U(ht);const lr=Object.keys(ht).filter(sr=>sr.startsWith("lighter"));if(lr.length>0&&!qe){const Lr=lr.sort((ss,ys)=>{var er,qr;const Bt=parseInt(((er=ss.match(/\d+/))==null?void 0:er[0])||0,10),mr=parseInt(((qr=ys.match(/\d+/))==null?void 0:qr[0])||0,10);return Bt-mr})[0].match(/\d+/);Lr&&vt(`Lighter-${Lr[0]}`)}Sr!=null&&Sr.slots_info&&(T((Jn=(rr=Sr==null?void 0:Sr.slots_info)==null?void 0:rr.lighter)==null?void 0:Jn.total_qty),C((Zr=(Xn=Sr==null?void 0:Sr.slots_info)==null?void 0:Xn.lighter)==null?void 0:Zr.active_qty),$((wr=($r=Sr==null?void 0:Sr.slots_info)==null?void 0:$r.variational)==null?void 0:wr.total_qty),L((ar=(pr=Sr==null?void 0:Sr.slots_info)==null?void 0:pr.variational)==null?void 0:ar.active_qty))}}catch{ie(!1),Qt(),K("OFF"),q(!1)}finally{Ht(!1)}}const or=h.useMemo(()=>qe?qe.toLowerCase().replace("-","_"):"",[qe]),$t=!!((rs=O==null?void 0:O[or])!=null&&rs.delta)&&!!((gs=O==null?void 0:O[or])!=null&&gs.from_slot),bt=$t?`lighter_${(ms=O==null?void 0:O[or])==null?void 0:ms.from_slot}`:or;h.useEffect(()=>{var Me,ft,ut,on,bn,Gn,rr,Jn,Xn,Zr,$r,wr,pr,ar,Vr,Ur,bs,Sr,Pn,Ln;if(!qe||!O)return;const pt=bt,le=O==null?void 0:O[pt];if(!le){ee(""),pe(""),ge(""),be(""),je(""),Re(""),st(""),Kt(""),un(""),Hn("LONG"),Ut("MARKET"),ie(!1),K("OFF"),q(!1),gt("Hour"),Jt(""),xt(""),A(""),cn("lighter"),P(null);return}if(le!=null&&le.farming_params){le!=null&&le.isStop?ie(!1):ie(!0),K("OFF"),q(!1);const ht=le.farming_params,Yt=(le==null?void 0:le.lighter_api_pkey)??"",lr=(le==null?void 0:le.lighter_login_address)??"",sr=(le==null?void 0:le.lighter_api_index)??"",Mr=(le==null?void 0:le.slot_number)??"";Yt&&ee(String(Yt)),lr&&je(String(lr)),sr&&ge(String(sr)),Mr&&!$t&&vt(`Lighter-${Mr}`),ht!=null&&ht.cycleSeconds&>((ht==null?void 0:ht.cycleSeconds)===86400?"Day":"Hour"),ht!=null&&ht.coin&&st(String(ht.coin)),(ht==null?void 0:ht.orderPerHour)!=null&&Kt(String(ht.orderPerHour)),(ht==null?void 0:ht.leverage)!=null&&un(String(ht.leverage)),ht!=null&&ht.direction&&Hn(String(ht.direction).toUpperCase()==="SHORT"?"SHORT":String(ht.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),ht!=null&&ht.orderType&&Ut(String(ht.orderType).toUpperCase()==="MARKET"?"MARKET":String(ht.orderType).toUpperCase()==="LIMIT"?"LIMIT":"RANDOM"),ht!=null&&ht.accountType&&jn(ht.accountType==="standart"?1:2),ht!=null&&ht.accountType&&Nn(ht.accountType==="standart"?"STANDARD":"PREMIUM"),(ht==null?void 0:ht.tp)!=null&&Jt(String(ht.tp)),(ht==null?void 0:ht.sl)!=null&&xt(String(ht.sl)),(ht==null?void 0:ht.spread)!=null&&Pt(String(ht.spread))}else if(le!=null&&le.source_params){le!=null&&le.isStop?ie(!1):ie(!0),K("ON"),q(!1);const ht=((Me=le==null?void 0:le.source_params)==null?void 0:Me.api_pkey)??"",Yt=((ft=le==null?void 0:le.source_params)==null?void 0:ft.login_wallet)??"",lr=((ut=le==null?void 0:le.source_params)==null?void 0:ut.api_index)??"",sr=((on=le==null?void 0:le.target_params)==null?void 0:on.api_pkey)??"",Mr=((bn=le==null?void 0:le.target_params)==null?void 0:bn.login_wallet)??"",Lr=((Gn=le==null?void 0:le.target_params)==null?void 0:Gn.api_index)??"",ss=(le==null?void 0:le.slot_number)??"";ss&&!$t&&vt(`Lighter-${ss}`),ht&&ee(String(ht)),sr&&pe(String(sr)),Yt&&je(String(Yt)),Mr&&Re(String(Mr)),lr&&ge(String(lr)),Lr&&be(String(Lr)),(rr=le==null?void 0:le.source_params)!=null&&rr.coin&&st(String((Jn=le==null?void 0:le.source_params)==null?void 0:Jn.coin)),((Xn=le==null?void 0:le.source_params)==null?void 0:Xn.orderPerHour)!=null&&Kt(String((Zr=le==null?void 0:le.source_params)==null?void 0:Zr.orderPerHour)),(($r=le==null?void 0:le.source_params)==null?void 0:$r.leverage)!=null&&un(String((wr=le==null?void 0:le.source_params)==null?void 0:wr.leverage)),(pr=le==null?void 0:le.source_params)!=null&&pr.accountType&&jn(((ar=le==null?void 0:le.source_params)==null?void 0:ar.accountType)==="standart"?1:2),(Vr=le==null?void 0:le.source_params)!=null&&Vr.accountType&&Nn(((Ur=le==null?void 0:le.source_params)==null?void 0:Ur.accountType)==="standart"?"STANDARD":"PREMIUM"),(bs=le==null?void 0:le.target_params)!=null&&bs.accountType&&rt(((Sr=le==null?void 0:le.target_params)==null?void 0:Sr.accountType)==="standart"?"STANDARD":"PREMIUM"),le!=null&&le.target_app&&cn((le==null?void 0:le.target_app)==="lighter"?"lighter":"variational"),(Pn=le==null?void 0:le.target_params)!=null&&Pn.vr_token&&A((Ln=le==null?void 0:le.target_params)==null?void 0:Ln.vr_token)}else ie(!1),K("OFF"),q(!1)},[qe,O,$t,bt]);const rn=pt=>{var le;return Number(((le=String(pt||"").match(/\d+/))==null?void 0:le[0])||0)},ur=pt=>(pt||"").toLowerCase().replace("-","_"),gr=h.useMemo(()=>{const pt=O==null?void 0:O[ur(qe)];if(pt!=null&&pt.delta&&(pt!=null&&pt.from_slot))return Number(pt.from_slot);const le=Number(pt==null?void 0:pt.slot_number);return Number.isFinite(le)?le:rn(qe)},[qe,O]),br=h.useMemo(()=>{const pt=Number(g)||0,le=Array.from({length:pt},()=>({used:!1,kind:null})),Me=O||{};for(const[ft,ut]of Object.entries(Me)){if(!ft.startsWith("lighter_"))continue;const on=rn(ft)-1;on<0||on>=pt||((ut==null?void 0:ut.isStop)===!0?le[on]={used:!1,kind:null}:ut!=null&&ut.source_params?le[on]={used:!0,kind:"delta-src"}:ut!=null&&ut.target_params||ut!=null&&ut.delta?le[on]={used:!0,kind:"delta-shadow"}:ut!=null&&ut.farming_params?le[on]={used:!0,kind:"single"}:le[on]={used:!0,kind:"unknown"})}return le},[O,g]),Br=h.useMemo(()=>br.map((pt,le)=>pt.used&&pt.kind!=="delta-src-inferred"?`Lighter-${le+1}`:null).filter(Boolean),[br]);h.useMemo(()=>br.filter(pt=>!pt.used).length,[br]);async function Gr(){if(!te){n(!0);return}if(Ze)try{hn(!0),Rn("");const pt=window.localStorage.getItem("hyperToken"),le=window.localStorage.getItem("hyperAddress");if(!pt||!le){n(!0);return}const Me={coin:dt,orderPerHour:Number(yt),leverage:Number(jt),direction:vn,orderType:nt,tp:Number(wn),sl:Number(Vt),cycleSeconds:mn==="Hour"?3600:86400},ft={address:le.toLowerCase(),token:pt,api_pkey:H,api_index:Number(Se),login_wallet:we,slot_number:Number(qe==null?void 0:qe.replace("Lighter-","")),farming_params:Me},on=await(await fetch(`${me}/api/hyper/lighter_farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ft)})).json();on!=null&&on.success?(ie(!0),An(),Zn&&xn()):Rn((on==null?void 0:on.error_message)||"Start failed.")}catch(pt){Rn(pt.message||"An error occurred while saving.")}finally{hn(!1)}}async function Or(){var le;const pt=rn(qe)-1;if(pt<0){Rn("Please select a slot."),hn(!1);return}if((le=br[pt])!=null&&le.used){Rn("Selected slot is already in use."),hn(!1);return}if(!te){n(!0);return}if(it)try{hn(!0),Rn("");const Me=window.localStorage.getItem("hyperToken"),ft=window.localStorage.getItem("hyperAddress");if(!Me||!ft){n(!0);return}const ut={api_pkey:H,api_index:Se,login_wallet:we,coin:dt,orderPerHour:Number(yt),leverage:Number(jt)},on={...kt==="lighter"&&{api_pkey:se,api_index:ve,login_wallet:Fe},coin:dt==null?void 0:dt.replace("USDT",""),orderPerHour:Number(yt),leverage:Number(jt),...kt==="variational"&&{vr_token:N}},bn={address:ft.toLowerCase(),token:Me,slot_number:Number(qe==null?void 0:qe.replace("Lighter-","")),source_app:"lighter",source_params:ut,target_app:kt==="lighter"?"lighter":"variational_delta",target_params:on},rr=await(await fetch(`${me}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(bn)})).json();rr!=null&&rr.success?(ie(!0),An(),Zn&&xn()):Rn((rr==null?void 0:rr.error_message)||fallback)}catch(Me){Rn(Me.message||"An error occurred while saving.")}finally{hn(!1)}}async function Lt(){if(!te){n(!0);return}try{Cn(!0),Rn("");const pt=window.localStorage.getItem("hyperToken"),le=window.localStorage.getItem("hyperAddress");if(!pt||!le){n(!0);return}const ft=await(await fetch(`${me}/api/hyper/lighter_farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:le.toLowerCase(),token:pt,slot_number:gr})})).json();ft!=null&&ft.success?(ie(!1),An()):Rn((ft==null?void 0:ft.error_message)||"Stop failed.")}catch(pt){Rn(pt.message||"An error occurred while stopping.")}finally{Cn(!1)}}async function nn(){if(!te){n(!0);return}try{Cn(!0),Rn("");const pt=window.localStorage.getItem("hyperToken"),le=window.localStorage.getItem("hyperAddress");if(!pt||!le){n(!0);return}const ft=await(await fetch(`${me}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:le.toLowerCase(),token:pt,source_app:"lighter",target_app:kt==="lighter"?"lighter":"variational_delta",slot_number:gr})})).json();ft!=null&&ft.success?(ie(!1),An()):Rn((ft==null?void 0:ft.error_message)||"Stop failed.")}catch(pt){Rn(pt.message||"An error occurred while stopping.")}finally{Cn(!1)}}const Ot=pt=>{cn(pt??"lighter"),m(!1)},en=[{value:"lighter",label:"Lighter"},{value:"variational",label:"Variational"}];function Fn(pt){try{const le=pt.split(".");if(le.length!==3)throw new Error("Invalid JWT format");const ft=le[1].replace(/-/g,"+").replace(/_/g,"/"),ut=decodeURIComponent(atob(ft).split("").map(on=>"%"+("00"+on.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(ut)}catch{return null}}const yr={control:(pt,le)=>({...pt,backgroundColor:"#242424",borderColor:le.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center",minWidth:"max-content"}),valueContainer:pt=>({...pt,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:pt=>({...pt,height:32}),input:pt=>({...pt,color:"#FFFFFF",margin:0,padding:0}),singleValue:pt=>({...pt,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:pt=>({...pt,color:"#7F7F7F",fontSize:"12px"}),menu:pt=>({...pt,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:pt=>({...pt,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(pt,le)=>({...pt,backgroundColor:le.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:pt=>({...pt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:pt=>({...pt,backgroundColor:"#353535"})},hr=({max:pt})=>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:[pt,"x"]}),lt=pt=>{var le,Me,ft;return i.jsx(ba.Option,{...pt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(le=pt.data)!=null&&le.icon?i.jsx("img",{src:pt.data.icon,alt:pt.data.label,className:`${((Me=pt.data)==null?void 0:Me.label)==="XRP"||((ft=pt.data)==null?void 0:ft.label)==="MEGA"?"bg-[#4F4F4F] rounded-full":""} w-4 h-4 rounded-[4px]`,onError:ut=>ut.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:pt.data.label}),i.jsx(hr,{max:pt.data.maxLeverage})]})})},Ct=pt=>{var le,Me,ft;return i.jsx(ba.SingleValue,{...pt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(le=pt.data)!=null&&le.icon?i.jsx("img",{src:pt.data.icon,alt:pt.data.label,className:`${((Me=pt.data)==null?void 0:Me.label)==="XRP"||((ft=pt.data)==null?void 0:ft.label)==="MEGA"?"bg-[#4F4F4F] rounded-full":""} w-4 h-4 rounded-[4px]`,onError:ut=>ut.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:pt.data.label}),i.jsx(hr,{max:pt.data.maxLeverage})]})})},On=pt=>{const le=Br.includes(pt.data.value);return i.jsx(ba.Option,{...pt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:pt.data.label}),le&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},qn=pt=>i.jsx(ba.SingleValue,{...pt,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:pt.data.label})})}),_r=async()=>{var Me,ft,ut,on,bn,Gn,rr,Jn;const pt=window.localStorage.getItem("hyperToken"),le=window.localStorage.getItem("hyperAddress");if(!(!pt||!le))try{ct(!0);const Xn=await bi(le.toLowerCase(),pt);Xn!=null&&Xn.success?(r(Xn==null?void 0:Xn.telegram_chat_id),s(Xn==null?void 0:Xn.subscriber_role),a(Xn==null?void 0:Xn.subs_expire_day),o((Me=Xn==null?void 0:Xn.mushboomer_counts)==null?void 0:Me.eth),l((ft=Xn==null?void 0:Xn.mushboomer_counts)==null?void 0:ft.sol),c(Xn==null?void 0:Xn.referral_code),u(Xn==null?void 0:Xn.refcode),d(Xn==null?void 0:Xn.whitelist),f(pt),x(le),Tn(!0),y((on=(ut=Xn==null?void 0:Xn.slots_info)==null?void 0:ut.lighter)==null?void 0:on.total_qty),T((Gn=(bn=Xn==null?void 0:Xn.slots_info)==null?void 0:bn.lighter)==null?void 0:Gn.total_qty),C((Jn=(rr=Xn==null?void 0:Xn.slots_info)==null?void 0:rr.lighter)==null?void 0:Jn.active_qty),ct(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),ct(!1))}catch(Xn){console.error("Token verification error:",Xn),console.error(Xn.message||"An unknown error occurred."),ct(!1)}},jr=at,Fr=h.useMemo(()=>Array.from({length:g},(pt,le)=>({value:`Lighter-${le+1}`,label:`Lighter-${le+1}`})),[g]);if(!t)return null;const nr=Nt||Rt||yn||Ke,vr=G&&!yn,Yr=Xe(dt),dr=I===F;return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:Be,setOpen:qt,transactionHash:It,transactionLoading:Ge,paymentPresaleRole:Ft,errorFunds:Mn,activeMethod:2}),i.jsx(D5,{open:kn,setOpen:Gt,paymentLighterRole:Ft,oldSlotCount:Y,checkAccountLighter:_r,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:()=>!nr&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(O2,{current:"lighter",onCloseCurrent:()=>!nr&&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(yf,{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:j2,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(zT,{})}),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:[En&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:En==="Get more slots to run Delta Neutral with Variational"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:En}),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:En})}),te&&Ft&&S===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 ${(Fr==null?void 0:Fr.length)||S} in use.`}),te&&dr&&kt==="variational"&&!G&&oe==="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"})]})}),Q&&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&&Ft&&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(E5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[v||0,"/",Fr.length]})]})]}),i.jsx(pl,{styles:yr,components:{Option:On,SingleValue:qn},options:Fr,value:Fr.find(pt=>pt.value===qe)||null,onChange:pt=>vt((pt==null?void 0:pt.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.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:we,onChange:pt=>je(pt.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] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr})})]}),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:H,onChange:pt=>ee(pt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",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] ${H===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr}),i.jsx("button",{type:"button",onClick:()=>Sn(pt=>!pt),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:nr||vr,children:tr?i.jsx(la,{size:14}):i.jsx(ca,{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:Se,onChange:pt=>{const le=pt.target.value.trim();if(le==="")return ge("");ae(le)&&ge(le)},onKeyDown:Oe,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] ${Se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr})})]})]}):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:we,onChange:pt=>je(pt.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] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr})})]}),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:H,onChange:pt=>ee(pt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",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] ${H===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr}),i.jsx("button",{type:"button",onClick:()=>Sn(pt=>!pt),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:nr||vr,children:tr?i.jsx(la,{size:14}):i.jsx(ca,{size:14})})]})]})]}),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.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:`${nr||vr?"cursor-not-allowed":"cursor-pointer"} rounded-md bg-[#353535] text-white px-2 h-6 flex items-center justify-between`,onClick:pt=>{pt.preventDefault(),nr||vr||m(!Ce)},children:[i.jsx("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px]",children:(At=en==null?void 0:en.find(pt=>(pt==null?void 0:pt.value)===kt))==null?void 0:At.label}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${Ce?"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"})})]}),Ce&&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:en==null?void 0:en.map((pt,le)=>i.jsxs("div",{onClick:Me=>{Me.preventDefault(),nr||vr||Ot(pt==null?void 0:pt.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 ${(pt==null?void 0:pt.value)===kt?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white ${nr||vr?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsx("span",{className:"text-white",children:pt==null?void 0:pt.label}),(pt==null?void 0:pt.value)===kt&&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"})})]},le))})})]})})]}),kt==="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:Fe,onChange:pt=>Re(pt.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] ${Fe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr})})]}),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:se,onChange:pt=>pe(pt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:ze?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr}),i.jsx("button",{type:"button",onClick:()=>xe(pt=>!pt),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:nr||vr,children:ze?i.jsx(la,{size:14}):i.jsx(ca,{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:ve,onChange:pt=>{const le=pt.target.value.trim();if(le==="")return be("");ae(le)&&be(le)},onKeyDown:Oe,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] ${ve===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr})})]})]}),kt==="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:N,onChange:pt=>{const le=pt.target.value;if(A(le),!le.trim()){P(null),V("");return}const Me=Fn(le);if(Me&&(Me!=null&&Me.exp)){const ft=new Date((Me==null?void 0:Me.exp)*1e3);P(ft),V("")}else Me?(P(null),V("The token's expiration date could not be found.")):(P(null),V("Invalid token format."))},type:Z?"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] ${N===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr}),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:Wo,alt:"",className:"w-3.5 h-3.5"})})]}),D&&i.jsx("div",{className:"text-[10px] text-[#FF797C] mt-[2px] pl-[3px]",children:D}),i.jsx("button",{type:"button",onClick:()=>ce(pt=>!pt),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:nr||vr,children:Z?i.jsx(la,{size:14}):i.jsx(ca,{size:14})})]})]})]})]}),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.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Se,onChange:pt=>{const le=pt.target.value.trim();if(le==="")return ge("");ae(le)&&ge(le)},onKeyDown:Oe,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] ${Se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:nr||vr})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Pair"}),i.jsx(pl,{styles:yr,components:{Option:lt,SingleValue:Ct},isDisabled:nr||vr,options:jr,value:jr.find(pt=>pt.value===dt)||null,onChange:pt=>st((pt==null?void 0:pt.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:yt,onChange:pt=>{const le=pt.target.value.trim();if(le==="")return Kt("");ae(le)&&Kt(le)},onKeyDown:Oe,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] ${yt===""?"border-[#353535]":he?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:nr||vr}),yt!==""&&!he&&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:`${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:mn,onChange:pt=>gt(pt.target.value),className:`${nr||vr?"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:nr||vr,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:yt,onChange:pt=>{const le=pt.target.value.trim();if(le==="")return Kt("");ae(le)&&Kt(le)},onKeyDown:Oe,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] ${yt===""?"border-[#353535]":he?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:nr||vr}),yt!==""&&!he&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]}),i.jsxs("div",{className:`${oe==="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:oe==="ON"?"On":"Off"}),i.jsx(Oo,{checked:oe==="ON",onChange:pt=>K(pt?"ON":"OFF"),disabled:nr||vr,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 ${nr||vr?"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:pt=>{const le=pt.target.value.trim();if(le==="")return un("");ae(le)&&un(le)},onKeyDown:Oe,inputMode:"numeric",autoComplete:"off",placeholder:dt?`1–${Yr}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]":Pe?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:nr||vr})]})]}),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.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":vn==="LONG",onClick:()=>!vr&&Hn("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",nr||vr?"cursor-not-allowed":"cursor-pointer",vn==="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":vn==="SHORT",onClick:()=>!vr&&Hn("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",nr||vr?"cursor-not-allowed":"cursor-pointer",vn==="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":vn==="RANDOM",onClick:()=>!vr&&Hn("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",nr||vr?"cursor-not-allowed":"cursor-pointer",vn==="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:`${oe==="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":nt==="MARKET",onClick:()=>!vr&&Ut("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",nr||vr?"cursor-not-allowed":"cursor-pointer",nt==="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 ",nt==="MARKET"?" ✓":""]})}),i.jsx("button",{"aria-pressed":nt==="LIMIT",onClick:()=>!vr&&Ut("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",nr||vr?"cursor-not-allowed":"cursor-pointer",nt==="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 ",nt==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":nt==="RANDOM",onClick:()=>!vr&&Ut("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",nr||vr?"cursor-not-allowed":"cursor-pointer",nt==="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 ",nt==="RANDOM"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:`${oe==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${oe==="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:wn,onChange:pt=>{const le=pt.target.value.trim();if(le==="")return Jt("");$e(le)&&Jt(le)},onKeyDown:Oe,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] ${wn===""?"border-[#353535]":Ve?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:nr||vr})]}),wn!==""&&!Ve&&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:`${oe==="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:Vt,onChange:pt=>{const le=pt.target.value.trim();if(le==="")return xt("");$e(le)&&xt(le)},onKeyDown:Oe,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] ${Vt===""?"border-[#353535]":Te?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:nr||vr})]}),Vt!==""&&!Te&&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"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children: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(Oo,{checked:oe==="ON",onChange:pt=>K(pt?"ON":"OFF"),disabled:nr||vr,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 ${nr||vr?"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"}`})})]})]})}),!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:()=>!nr&&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:nr,children:"Cancel"}),te?oe==="ON"?G?i.jsx("button",{onClick:nn,disabled:nr,className:`${Q?"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:yn?"Stopping...":"Stop"}):i.jsx("button",{onClick:Or,disabled:!it||nr||kt==="variational"&&dr&&oe==="ON",className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!it||nr||kt==="variational"&&dr&&oe==="ON"?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"} ${Q?"hidden":""}`,children:Rt?"Starting...":"Start"}):G?i.jsx("button",{onClick:Lt,disabled:nr,className:`${Q?"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:yn?"Stopping...":"Stop"}):i.jsx("button",{onClick:Gr,disabled:!Ze||nr,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Ze||nr?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"} ${Q?"hidden":""}`,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"})]})}),Nt&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},Dce=({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}=h.useContext(Qr);ds();const[g,y]=h.useState(!1),[v,C]=h.useState(!1),[S,T]=h.useState(""),[I,L]=h.useState(""),[F,$]=h.useState(""),[O,U]=h.useState(""),[Y,re]=h.useState(""),[Q,q]=h.useState(""),[te,fe]=h.useState(""),[G,ie]=h.useState("LONG"),[oe,K]=h.useState(!1),[H,ee]=h.useState(!1),[se,pe]=h.useState(!1),[Se,ge]=h.useState(!1),[ve,be]=h.useState(""),[we,je]=h.useState(""),[Fe,Re]=h.useState(!0),[Qe,Ye]=h.useState(!1),[dt,st]=h.useState(!1),[at,He]=h.useState(!1),[qe,vt]=h.useState(!1),[yt,Kt]=h.useState(!1),[jt,un]=h.useState(!1),[vn,Hn]=h.useState(""),[ln,Nn]=h.useState(!0);h.useState(1);const dn="https://dextrabothypev2.nftinit.io",rt=h.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}],[]),nt=Sn=>{var ze;return((ze=rt.find(xe=>xe.value===Sn))==null?void 0:ze.maxLeverage)??100},Ut=Sn=>{["e","E","+","-"].includes(Sn.key)&&Sn.preventDefault()},wn=Sn=>/^\d*$/.test(Sn),Jt=h.useMemo(()=>{if(Q==="")return!1;const Sn=Number(Q);return Number.isInteger(Sn)&&Sn>=1&&Sn<=100},[Q]),Vt=h.useMemo(()=>{if(te==="")return!1;const Sn=Number(te),ze=nt(Y);return Number.isInteger(Sn)&&Sn>=1&&Sn<=ze},[te,Y]),xt=g&&S.trim()!==""&&F.trim()!==""&&I.trim()!==""&&O.trim()!==""&&Y!==""&&Jt&&Vt&&(G==="LONG"||G==="SHORT"||G==="RANDOM"),We=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),Pt=()=>`apexCreds:${We()}`,Ke=()=>{try{const Sn=localStorage.getItem(Pt());if(!Sn)return;const ze=JSON.parse(Sn);ze.apiKey&&T(ze.apiKey),ze.apiKeySecret&&L(ze.apiKeySecret),ze.omniKeySeed&&U(ze.omniKeySeed),ze.apiKeyPass&&$(ze.apiKeyPass),typeof ze.remember=="boolean"&&Re(ze.remember)}catch{}},ct=()=>{if(Fe)try{localStorage.setItem(Pt(),JSON.stringify({apiKey:S,apiKeyPass:F,apiKeySecret:I,omniKeySeed:O,remember:!0}))}catch{}},Nt=()=>{try{localStorage.removeItem(Pt())}catch{}};h.useEffect(()=>{if(!t)return;const Sn=localStorage.getItem("hyperToken"),ze=localStorage.getItem("hyperAddress");y(!!(Sn&&ze));const xe=setInterval(()=>{const Ge=localStorage.getItem("hyperToken"),_e=localStorage.getItem("hyperAddress");y(!!(Ge&&_e))},800);return()=>clearInterval(xe)},[t]),h.useEffect(()=>{!t||!g||(Ht(),Mn())},[t,g]),h.useEffect(()=>{if(!Y)return;const Sn=nt(Y),ze=Number(te);!Number.isNaN(ze)&&ze>Sn&&fe(String(Sn)),!Number.isNaN(ze)&&ze<1&&te!==""&&fe("1")},[Y]),h.useEffect(()=>{t&&(Fe&&ct(),Fe||Nt())},[S,F,I,O,Fe,t]);async function Ht(){var Sn,ze,xe,Ge,_e;try{ee(!0),be("");const Be=window.localStorage.getItem("hyperToken"),qt=window.localStorage.getItem("hyperAddress");if(!Be||!qt){C(!1),Ke();return}const mt=await(await fetch(`${dn}/api/hyper/apex_farming/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:qt.toLowerCase(),token:Be})})).json(),Ft=(Sn=mt==null?void 0:mt.data)==null?void 0:Sn.farming_params;if(mt!=null&&mt.success&&Ft){C(!0);const Tn=((ze=mt==null?void 0:mt.data)==null?void 0:ze.apex_api_pkey)??"",kn=((xe=mt==null?void 0:mt.data)==null?void 0:xe.apex_api_pass)??"",Gt=((Ge=mt==null?void 0:mt.data)==null?void 0:Ge.apex_api_secret)??"",mn=((_e=mt==null?void 0:mt.data)==null?void 0:_e.apex_key_seed)??"";Tn&&T(String(Tn)),kn&&$(String(kn)),Gt&&L(String(Gt)),mn&&U(String(mn)),Ft!=null&&Ft.symbol&&re(String(Ft.symbol)),(Ft==null?void 0:Ft.orderPerHour)!=null&&q(String(Ft.orderPerHour)),(Ft==null?void 0:Ft.leverage)!=null&&fe(String(Ft.leverage)),Ft!=null&&Ft.direction&&ie(String(Ft.direction).toUpperCase()==="SHORT"?"SHORT":String(Ft.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG")}else C(!1);!S&&!F&&!I&&!O&&Ke()}catch{C(!1),Ke()}finally{ee(!1)}}async function Rt(){if(!g){n(!0);return}if(xt)try{pe(!0),be("");const Sn=window.localStorage.getItem("hyperToken"),ze=window.localStorage.getItem("hyperAddress");if(!Sn||!ze){n(!0);return}const xe={symbol:Y,orderPerHour:Number(Q),leverage:Number(te),direction:G},Ge={address:ze.toLowerCase(),token:Sn,apex_api_pkey:S,apex_api_secret:I,apex_api_pass:F,apex_key_seed:O,farming_params:xe},Be=await(await fetch(`${dn}/api/hyper/apex_farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ge)})).json();Be!=null&&Be.success?(C(!0),Fe&&ct()):be((Be==null?void 0:Be.error_message)||"Start failed.")}catch(Sn){be(Sn.message||"An error occurred while saving.")}finally{pe(!1)}}async function hn(){if(!g){n(!0);return}try{ge(!0),be("");const Sn=window.localStorage.getItem("hyperToken"),ze=window.localStorage.getItem("hyperAddress");if(!Sn||!ze){n(!0);return}const Ge=await(await fetch(`${dn}/api/hyper/apex_farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ze.toLowerCase(),token:Sn})})).json();Ge!=null&&Ge.success?C(!1):be((Ge==null?void 0:Ge.error_message)||"Stop failed.")}catch(Sn){be(Sn.message||"An error occurred while stopping.")}finally{ge(!1)}}const yn={control:(Sn,ze)=>({...Sn,backgroundColor:"#242424",borderColor:ze.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:Sn=>({...Sn,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:Sn=>({...Sn,height:32}),input:Sn=>({...Sn,color:"#FFFFFF",margin:0,padding:0}),singleValue:Sn=>({...Sn,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:Sn=>({...Sn,color:"#7F7F7F",fontSize:"12px"}),menu:Sn=>({...Sn,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:Sn=>({...Sn,paddingTop:0,paddingBottom:0}),option:(Sn,ze)=>({...Sn,backgroundColor:ze.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:Sn=>({...Sn,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:Sn=>({...Sn,backgroundColor:"#353535"})},Cn=({max:Sn})=>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:[Sn,"x"]}),En=Sn=>{var ze;return i.jsx(ba.Option,{...Sn,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[((ze=Sn.data)==null?void 0:ze.icon)&&i.jsx("img",{src:Sn.data.icon,alt:Sn.data.label,className:"w-4 h-4 rounded-[4px]",onError:xe=>xe.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:Sn.data.label}),i.jsx(Cn,{max:Sn.data.maxLeverage})]})})},Rn=Sn=>{var ze;return i.jsx(ba.SingleValue,{...Sn,children:i.jsxs("div",{className:"flex items-center gap-2",children:[((ze=Sn.data)==null?void 0:ze.icon)&&i.jsx("img",{src:Sn.data.icon,alt:Sn.data.label,className:"w-4 h-4 rounded-[4px]",onError:xe=>xe.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:Sn.data.label}),i.jsx(Cn,{max:Sn.data.maxLeverage})]})})},Mn=async()=>{var xe,Ge;const Sn=window.localStorage.getItem("hyperToken"),ze=window.localStorage.getItem("hyperAddress");if(!(!Sn||!ze))try{K(!0);const _e=await bi(ze.toLowerCase(),Sn);_e!=null&&_e.success?(r(_e==null?void 0:_e.telegram_chat_id),s(_e==null?void 0:_e.subscriber_role),a(_e==null?void 0:_e.subs_expire_day),o((xe=_e==null?void 0:_e.mushboomer_counts)==null?void 0:xe.eth),l((Ge=_e==null?void 0:_e.mushboomer_counts)==null?void 0:Ge.sol),c(_e==null?void 0:_e.referral_code),u(_e==null?void 0:_e.refcode),d(_e==null?void 0:_e.whitelist),f(Sn),x(ze),Nn(!0),K(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),K(!1))}catch(_e){console.error("Token verification error:",_e),console.error(_e.message||"An unknown error occurred."),K(!1)}},Yn=rt;if(!t)return null;const Zn=H||se||Se||oe,Vn=v&&!Se,tr=nt(Y);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:jt,setOpen:un,transactionHash:vn,transactionLoading:yt,paymentPresaleRole:ln,errorFunds:we,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:()=>!Zn&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(O2,{current:"apex",onCloseCurrent:()=>!Zn&&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(zT,{})}),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:[ve&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:ve}),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:S,onChange:Sn=>T(Sn.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] ${S===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Zn||Vn}),i.jsx("button",{type:"button",onClick:()=>Ye(Sn=>!Sn),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:Zn||Vn,children:Qe?i.jsx(la,{size:14}):i.jsx(ca,{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:Sn=>$(Sn.target.value),autoComplete:"off",placeholder:"API_KEY_PAASSPHRASE",type:at?"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:Zn||Vn}),i.jsx("button",{type:"button",onClick:()=>He(Sn=>!Sn),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:Zn||Vn,children:at?i.jsx(la,{size:14}):i.jsx(ca,{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:I,onChange:Sn=>L(Sn.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] ${I===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Zn||Vn}),i.jsx("button",{type:"button",onClick:()=>st(Sn=>!Sn),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:Zn||Vn,children:dt?i.jsx(la,{size:14}):i.jsx(ca,{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:O,onChange:Sn=>U(Sn.target.value),autoComplete:"off",placeholder:"OMNI_KEY_SEED",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] ${O===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Zn||Vn}),i.jsx("button",{type:"button",onClick:()=>vt(Sn=>!Sn),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:Zn||Vn,children:qe?i.jsx(la,{size:14}):i.jsx(ca,{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(pl,{styles:yn,components:{Option:En,SingleValue:Rn},isDisabled:Zn||Vn,options:Yn,value:Yn.find(Sn=>Sn.value===Y)||null,onChange:Sn=>re((Sn==null?void 0:Sn.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:Q,onChange:Sn=>{const ze=Sn.target.value.trim();if(ze==="")return q("");wn(ze)&&q(ze)},onKeyDown:Ut,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] ${Q===""?"border-[#353535]":Jt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Zn||Vn}),Q!==""&&!Jt&&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:Sn=>{const ze=Sn.target.value.trim();if(ze==="")return fe("");wn(ze)&&fe(ze)},onKeyDown:Ut,inputMode:"numeric",autoComplete:"off",placeholder:Y?`1–${tr}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]":Vt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Zn||Vn})]}),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":G==="LONG",onClick:()=>!Vn&&ie("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",Zn||Vn?"opacity-60 cursor-not-allowed":"cursor-pointer",G==="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":G==="SHORT",onClick:()=>!Vn&&ie("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",Zn||Vn?"opacity-60 cursor-not-allowed":"cursor-pointer",G==="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":G==="RANDOM",onClick:()=>!Vn&&ie("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",Zn||Vn?"opacity-60 cursor-not-allowed":"cursor-pointer",G==="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:()=>!Zn&&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:Zn,children:"Cancel"}),g?v?i.jsx("button",{onClick:hn,disabled:Zn,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:Se?"Stopping...":"Stop"}):i.jsx("button",{onClick:Rt,disabled:!xt||Zn,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!xt||Zn?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:se?"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"})]})]}),H&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},Bce=({open:t=!1,setOpen:e=()=>{}})=>{var yr,hr;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=h.useContext(Qr);ds();const[g,y]=h.useState(!1),[v,C]=h.useState(!1),[S,T]=h.useState(1),[I,L]=h.useState(0),[F,$]=h.useState(0),[O,U]=h.useState({}),[Y,re]=h.useState(null),[Q,q]=h.useState(!1),[te,fe]=h.useState("variational");h.useState(!1),h.useRef(null);const[G,ie]=h.useState(!1),[oe,K]=h.useState(!1),[H,ee]=h.useState(0),[se,pe]=h.useState("OFF"),[Se,ge]=h.useState(""),[ve,be]=h.useState(""),[we,je]=h.useState(""),[Fe,Re]=h.useState(""),[Qe,Ye]=h.useState(null),[dt,st]=h.useState(""),[at,He]=h.useState(""),[qe,vt]=h.useState(""),[yt,Kt]=h.useState("");h.useState("");const[jt,un]=h.useState("");h.useState([]);const[vn,Hn]=h.useState(""),[ln,Nn]=h.useState(""),[dn,rt]=h.useState(""),[nt,Ut]=h.useState("LONG"),[wn,Jt]=h.useState("STANDARD"),[Vt,xt]=h.useState("STANDARD"),[We,Pt]=h.useState("MARKET"),[Ke,ct]=h.useState(""),[Nt,Ht]=h.useState(""),[Rt,hn]=h.useState(""),[yn,Cn]=h.useState("Hour"),[En,Rn]=h.useState(!1),[Mn,Yn]=h.useState(!1),[Zn,Vn]=h.useState(!1),[tr,Sn]=h.useState(!1),[ze,xe]=h.useState(""),[Ge,_e]=h.useState(""),[Be,qt]=h.useState(!0),[It,mt]=h.useState(!1),[Ft,Tn]=h.useState(!1),[kn,Gt]=h.useState(!1),[mn,gt]=h.useState(!1),[Wt,jn]=h.useState(!1),[kt,cn]=h.useState(""),[Ce,m]=h.useState(!0),[p,N]=h.useState(""),A=Qe?(Qe==null?void 0:Qe.getTime())<=Date.now():!1;h.useState(1);const k="https://dextrabothypev2.nftinit.io",P="",D=h.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}],[]),V=lt=>{var Ct;return((Ct=D.find(On=>On.value===lt))==null?void 0:Ct.maxLeverage)??100},Z=lt=>{["e","E","+","-"].includes(lt.key)&<.preventDefault()},ce=lt=>/^\d*\.?\d{0,6}$/.test(lt),ue=lt=>/^\d*$/.test(lt),me=h.useMemo(()=>{if(ln==="")return!1;const lt=Number(ln);return Number.isInteger(lt)&<>=1&<<=120},[ln]),Ne=h.useMemo(()=>{if(dn==="")return!1;const lt=Number(dn),Ct=V(jt);return Number.isInteger(lt)&<>=1&<<=Ct},[dn,jt]),Ie=h.useMemo(()=>{if(Ke==="")return!1;const lt=Number(Ke);return Number.isNaN(lt)?!1:lt===0?!0:lt>=1&<<=1e7},[Ke]),Le=h.useMemo(()=>{if(Nt==="")return!1;const lt=Number(Nt);if(Number.isNaN(lt))return!1;const Ct=dn===""?null:Number(dn),On=Ct?Ct*100-1:4999;return lt===0?!0:lt>0&<<1?!1:lt>=1&<<=On},[Nt,dn]);h.useMemo(()=>{if(Rt==="")return!1;const lt=Number(Rt);return!Number.isNaN(lt)&<>0&<<=100},[Rt]);const Xe=g&&Fe.trim()!==""&&jt!==""&&me&&Ne&&(!Ke||Ie)&&(!Nt||Le)&&!A&&!dt&&vn&&(nt==="LONG"||nt==="SHORT"||nt==="RANDOM")&&(We==="LIMIT"||We==="MARKET"||We==="RANDOM")&&Ce,Oe=g&&Fe.trim()!==""&&jt!==""&&me&&vn&&Ne&&vn&&Ce,$e=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),ae=()=>`variationalCreds:${$e()}`,he=()=>{try{const lt=localStorage.getItem(ae());if(!lt)return;const Ct=JSON.parse(lt);Ct.variationalToken&&Re(Ct.variationalToken),typeof Ct.remember=="boolean"&&qt(Ct.remember)}catch{}},Pe=()=>{if(Be)try{localStorage.setItem(ae(),JSON.stringify({variationalToken:Fe,remember:!0}))}catch{}},Ve=()=>{try{localStorage.removeItem(ae())}catch{}};h.useEffect(()=>{if(!t)return;const lt=localStorage.getItem("hyperToken"),Ct=localStorage.getItem("hyperAddress");y(!!(lt&&Ct));const On=setInterval(()=>{const qn=localStorage.getItem("hyperToken"),_r=localStorage.getItem("hyperAddress");y(!!(qn&&_r))},800);return()=>clearInterval(On)},[t]),h.useEffect(()=>{!t||!g||(Te(),Gr())},[t,g]),h.useEffect(()=>{t&&(Nt===""&&Ht(P),Ke===""&&ct(P),Rt===""&&hn(P))},[t]),h.useEffect(()=>{if(!jt)return;const lt=V(jt),Ct=Number(dn);!Number.isNaN(Ct)&&Ct>lt&&rt(String(lt)),!Number.isNaN(Ct)&&Ct<1&&dn!==""&&rt("1")},[jt]),h.useEffect(()=>{t&&(Be&&Pe(),Be||Ve())},[Fe,Be,t]);async function Te(){var lt,Ct,On,qn,_r,jr,Fr,nr;try{Yn(!0),xe("");const vr=window.localStorage.getItem("hyperToken"),Yr=window.localStorage.getItem("hyperAddress");if(!vr||!Yr){C(!1),he();return}const rs=await(await fetch(`${k}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Yr.toLowerCase(),token:vr})})).json();if(!(rs!=null&&rs.success)){if(console.warn("INFO API RESPONSE:",rs==null?void 0:rs.error_message),(rs==null?void 0:rs.error_message)==="You have not a running process"){const gs=vn?vn.toLowerCase().replace("-","_farming_"):null,ms=O==null?void 0:O[gs];if(gs&&ms){const At={...O,[gs]:{...ms,isStop:!0}};U(At);const le=Object.keys(At).filter(Me=>Me.startsWith("variational"));if(le.length>0&&!vn){const ut=le.sort((on,bn)=>{var Jn,Xn;const Gn=parseInt(((Jn=on.match(/\d+/))==null?void 0:Jn[0])||0,10),rr=parseInt(((Xn=bn.match(/\d+/))==null?void 0:Xn[0])||0,10);return Gn-rr})[0].match(/\d+/);ut&&Hn(`Variational-${ut[0]}`)}}else Hn("Variational-1")}rs!=null&&rs.slots_info&&($((Ct=(lt=rs==null?void 0:rs.slots_info)==null?void 0:lt.variational)==null?void 0:Ct.total_qty),L((qn=(On=rs==null?void 0:rs.slots_info)==null?void 0:On.variational)==null?void 0:qn.active_qty));return}if(rs!=null&&rs.success&&(rs!=null&&rs.data)){const gs=vn?vn.toLowerCase().replace("-","_farming_"):null,ms=O==null?void 0:O[gs],At=rs.data||{};gs&&!At[gs]&&ms&&(At[gs]={...ms,isStop:!0}),U(At);const le=Object.keys(At).filter(Me=>Me.startsWith("variational"));if(le.length>0&&!vn){const ut=le.sort((on,bn)=>{var Jn,Xn;const Gn=parseInt(((Jn=on.match(/\d+/))==null?void 0:Jn[0])||0,10),rr=parseInt(((Xn=bn.match(/\d+/))==null?void 0:Xn[0])||0,10);return Gn-rr})[0].match(/\d+/);ut&&Hn(`Variational-${ut[0]}`)}rs!=null&&rs.slots_info&&($((jr=(_r=rs==null?void 0:rs.slots_info)==null?void 0:_r.variational)==null?void 0:jr.total_qty),L((nr=(Fr=rs==null?void 0:rs.slots_info)==null?void 0:Fr.variational)==null?void 0:nr.active_qty))}}catch{C(!1),he(),pe("OFF"),q(!1)}finally{Yn(!1)}}const Ze=h.useMemo(()=>vn?vn.toLowerCase().replace("-","_farming_"):"",[vn]),it=!!((yr=O==null?void 0:O[Ze])!=null&&yr.delta)&&!!((hr=O==null?void 0:O[Ze])!=null&&hr.from_slot),wt=Ze;h.useEffect(()=>{var On,qn,_r,jr,Fr,nr,vr,Yr,dr,rs,gs,ms,At,pt,le,Me;if(!vn||!O)return;const lt=wt,Ct=O==null?void 0:O[lt];if(!Ct){ge(""),be(""),je(""),He(""),vt(""),Kt(""),un(""),Nn(""),N(""),rt(""),Ut("LONG"),Pt("MARKET"),C(!1),pe("OFF"),q(!1),Cn("Hour"),ct(""),Ht(""),Re(""),Ye(null),fe("variational"),K(!1),ee(0);return}if((Ct==null?void 0:Ct.target_params)==null&&Ct.source_params){Ct!=null&&Ct.isStop?C(!1):C(!0),pe("OFF"),q(!1),K(!1);const ft=Ct.source_params,ut=(Ct==null?void 0:Ct.slot_number)??"";ut&&!it&&Hn(`Variational-${ut}`),ft!=null&&ft.cycleSeconds&&Cn((ft==null?void 0:ft.cycleSeconds)===86400?"Day":"Hour"),ft!=null&&ft.vr_token&&Re(String(ft.vr_token)),ft!=null&&ft.coin&&un(String(ft.coin)),(ft==null?void 0:ft.orderPerHour)!=null&&Nn(String(ft.orderPerHour)),(ft==null?void 0:ft.leverage)!=null&&rt(String(ft.leverage)),ft!=null&&ft.direction&&Ut(String(ft.direction).toUpperCase()==="SHORT"?"SHORT":String(ft.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),ft!=null&&ft.orderType&&Pt(String(ft.orderType).toUpperCase()==="MARKET"?"MARKET":String(ft.orderType).toUpperCase()==="LIMIT"?"LIMIT":"RANDOM"),(ft==null?void 0:ft.tp)!=null&&ct(String(ft.tp)),(ft==null?void 0:ft.sl)!=null&&Ht(String(ft.sl))}else if((Ct==null?void 0:Ct.target_params)!==null){Ct!=null&&Ct.isStop?(C(!1),K(!1)):(C(!0),K(!0)),pe("OFF"),q(!1);const ft=(Ct==null?void 0:Ct.slot_number)??"";ee(ft),ft&&!it&&Hn(`Variational-${ft}`),(On=Ct==null?void 0:Ct.source_params)!=null&&On.vr_token&&Re(String((qn=Ct==null?void 0:Ct.source_params)==null?void 0:qn.vr_token)),(_r=Ct==null?void 0:Ct.target_params)!=null&&_r.coin&&un(String((jr=Ct==null?void 0:Ct.target_params)==null?void 0:jr.coin)),((Fr=Ct==null?void 0:Ct.source_params)==null?void 0:Fr.orderPerHour)!=null&&Nn(String((nr=Ct==null?void 0:Ct.source_params)==null?void 0:nr.orderPerHour)),Ct!=null&&Ct.source_app&&N(Ct==null?void 0:Ct.source_app),((vr=Ct==null?void 0:Ct.source_params)==null?void 0:vr.leverage)!=null&&rt(String((Yr=Ct==null?void 0:Ct.source_params)==null?void 0:Yr.leverage)),(dr=Ct==null?void 0:Ct.source_params)!=null&&dr.accountType&&Jt(((rs=Ct==null?void 0:Ct.source_params)==null?void 0:rs.accountType)==="standart"?"STANDARD":"PREMIUM"),(gs=Ct==null?void 0:Ct.target_params)!=null&&gs.accountType&&xt(((ms=Ct==null?void 0:Ct.target_params)==null?void 0:ms.accountType)==="standart"?"STANDARD":"PREMIUM"),Ct!=null&&Ct.target_app&&fe(((Ct==null?void 0:Ct.target_app)==="variational","variational")),(At=Ct==null?void 0:Ct.target_params)!=null&&At.vr_token&&Re((pt=Ct==null?void 0:Ct.target_params)==null?void 0:pt.vr_token),(le=Ct==null?void 0:Ct.target_params)!=null&&le.cycleSeconds&&Cn(((Me=Ct==null?void 0:Ct.target_params)==null?void 0:Me.cycleSeconds)===86400?"Day":"Hour")}else C(!1),pe("OFF"),q(!1)},[vn,O,it,wt]);const Dt=lt=>{var Ct;return Number(((Ct=String(lt||"").match(/\d+/))==null?void 0:Ct[0])||0)},Qt=lt=>(lt||"").toLowerCase().replace("-","_"),xn=h.useMemo(()=>{const lt=O==null?void 0:O[Qt(vn)];if(lt!=null&<.delta&&(lt!=null&<.from_slot))return Number(lt.from_slot);const Ct=Number(lt==null?void 0:lt.slot_number);return Number.isFinite(Ct)?Ct:Dt(vn)},[vn,O]),pn=h.useMemo(()=>{const lt=Number(S)||0,Ct=Array.from({length:lt},()=>({used:!1,kind:null})),On=O||{};for(const[qn,_r]of Object.entries(On)){if(!qn.startsWith("variational_farming"))continue;const jr=Dt(qn)-1;jr<0||jr>=lt||((_r==null?void 0:_r.isStop)===!0?Ct[jr]={used:!1,kind:null}:_r!=null&&_r.source_params?Ct[jr]={used:!0,kind:"delta-src"}:_r!=null&&_r.target_params||_r!=null&&_r.delta?Ct[jr]={used:!0,kind:"delta-shadow"}:_r!=null&&_r.farming_params?Ct[jr]={used:!0,kind:"single"}:Ct[jr]={used:!0,kind:"unknown"})}return Ct},[O,S]),An=h.useMemo(()=>pn.map((lt,Ct)=>lt.used&<.kind!=="delta-src-inferred"?`Variational-${Ct+1}`:null).filter(Boolean),[pn]);h.useMemo(()=>pn.filter(lt=>!lt.used).length,[pn]);async function or(){if(!g){n(!0);return}if(Xe)try{Vn(!0),xe("");const lt=window.localStorage.getItem("hyperToken"),Ct=window.localStorage.getItem("hyperAddress");if(!lt||!Ct){n(!0);return}const On={vr_token:Fe,coin:jt,orderPerHour:Number(ln),leverage:Number(dn),direction:nt,orderType:"MARKET",tp:Number(Ke),sl:Number(Nt),cycleSeconds:yn==="Hour"?3600:86400},qn={api_pkey:ve,api_index:at,login_wallet:yt,coin:jt==null?void 0:jt.replace("USDT",""),orderPerHour:Number(ln),leverage:Number(dn)},_r={address:Ct.toLowerCase(),token:lt,source_app:"variational_farming",source_params:On,slot_number:Number(vn==null?void 0:vn.replace("Variational-",""))},Fr=await(await fetch(`${k}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_r)})).json();Fr!=null&&Fr.success?(C(!0),Te(),Be&&Pe()):xe((Fr==null?void 0:Fr.error_message)||"Start failed.")}catch(lt){xe(lt.message||"An error occurred while saving.")}finally{Vn(!1)}}async function $t(){if(!g){n(!0);return}try{Sn(!0),xe("");const lt=window.localStorage.getItem("hyperToken"),Ct=window.localStorage.getItem("hyperAddress");if(!lt||!Ct){n(!0);return}const qn=await(await fetch(`${k}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Ct.toLowerCase(),token:lt,...oe?{slot_number:H,target_app:"variational_delta",source_app:p}:{source_app:"variational_farming",slot_number:xn}})})).json();qn!=null&&qn.success?(C(!1),Te()):xe((qn==null?void 0:qn.error_message)||"Stop failed.")}catch(lt){xe(lt.message||"An error occurred while stopping.")}finally{Sn(!1)}}const bt={control:(lt,Ct)=>({...lt,backgroundColor:"#242424",borderColor:Ct.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,Ct)=>({...lt,backgroundColor:Ct.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"})};h.useEffect(()=>{if(!Fe){Ye(null),st("");return}const lt=Or(Fe);if(lt&&(lt!=null&<.exp)){const Ct=new Date(lt.exp*1e3);Ye(Ct),st("")}else lt?(Ye(null),st("The token's expiration date could not be found.")):(Ye(null),st("Invalid token format."))},[Fe]);const rn=({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"]}),ur=lt=>{var Ct,On;return i.jsx(ba.Option,{...lt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Ct=lt.data)!=null&&Ct.icon?i.jsx("img",{src:lt.data.icon,alt:lt.data.label,className:`w-4 h-4 ${((On=lt==null?void 0:lt.data)==null?void 0:On.label)==="XRP"?"bg-gray-600 rounded-full":"rounded-[4px]"}`,onError:qn=>qn.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(rn,{max:lt.data.maxLeverage})]})})},gr=lt=>{var Ct,On;return i.jsx(ba.SingleValue,{...lt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Ct=lt.data)!=null&&Ct.icon?i.jsx("img",{src:lt.data.icon,alt:lt.data.label,className:`w-4 h-4 ${((On=lt==null?void 0:lt.data)==null?void 0:On.label)==="XRP"?"bg-gray-600 rounded-full":"rounded-[4px]"}`,onError:qn=>qn.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(rn,{max:lt.data.maxLeverage})]})})},br=lt=>{const Ct=An.includes(lt.data.value);return i.jsx(ba.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}),Ct&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},Br=lt=>i.jsx(ba.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})})}),Gr=async()=>{var On,qn,_r,jr,Fr,nr,vr,Yr;const lt=window.localStorage.getItem("hyperToken"),Ct=window.localStorage.getItem("hyperAddress");if(!(!lt||!Ct))try{Rn(!0);const dr=await bi(Ct.toLowerCase(),lt);dr!=null&&dr.success?(r(dr==null?void 0:dr.telegram_chat_id),s(dr==null?void 0:dr.subscriber_role),a(dr==null?void 0:dr.subs_expire_day),o((On=dr==null?void 0:dr.mushboomer_counts)==null?void 0:On.eth),l((qn=dr==null?void 0:dr.mushboomer_counts)==null?void 0:qn.sol),c(dr==null?void 0:dr.referral_code),u(dr==null?void 0:dr.refcode),d(dr==null?void 0:dr.whitelist),f(lt),x(Ct),m(!0),T((jr=(_r=dr==null?void 0:dr.slots_info)==null?void 0:_r.variational)==null?void 0:jr.total_qty),$((nr=(Fr=dr==null?void 0:dr.slots_info)==null?void 0:Fr.variational)==null?void 0:nr.total_qty),L((Yr=(vr=dr==null?void 0:dr.slots_info)==null?void 0:vr.variational)==null?void 0:Yr.active_qty),Rn(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),Rn(!1))}catch(dr){console.error("Token verification error:",dr),console.error(dr.message||"An unknown error occurred."),Rn(!1)}};function Or(lt){try{const Ct=lt.split(".");if(Ct.length!==3)throw new Error("Invalid JWT format");const qn=Ct[1].replace(/-/g,"+").replace(/_/g,"/"),_r=decodeURIComponent(atob(qn).split("").map(jr=>"%"+("00"+jr.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(_r)}catch{return null}}const Lt=D,nn=h.useMemo(()=>Array.from({length:S},(lt,Ct)=>({value:`Variational-${Ct+1}`,label:`Variational-${Ct+1}`})),[S]);if(!t)return null;const Ot=Mn||Zn||tr||En,en=v&&!tr,Fn=V(jt);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:Wt,setOpen:jn,transactionHash:kt,transactionLoading:mn,paymentPresaleRole:Ce,errorFunds:Ge,activeMethod:2}),i.jsx(D5,{open:G,setOpen:ie,paymentLighterRole:Ce,oldSlotCount:Y,checkAccountLighter:Gr,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:()=>!Ot&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(O2,{current:"variational",onCloseCurrent:()=>!Ot&&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:j2,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&&Ce&&F===I&&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&&oe&&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-${H})`}),g&&Ce&&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(E5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[I||0,"/",nn.length]})]})]}),i.jsx(pl,{styles:bt,components:{Option:br,SingleValue:Br},options:nn,value:nn.find(lt=>lt.value===vn)||null,onChange:lt=>Hn((lt==null?void 0:lt.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:[se==="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:qe,onChange:lt=>vt(lt.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] ${qe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Ot||en})})]}),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:Se,onChange:lt=>ge(lt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",type:It?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Ot||en}),i.jsx("button",{type:"button",onClick:()=>mt(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:Ot||en,children:It?i.jsx(la,{size:14}):i.jsx(ca,{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:we,onChange:lt=>{const Ct=lt.target.value.trim();if(Ct==="")return je("");ue(Ct)&&je(Ct)},onKeyDown:Z,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] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Ot||en})})]})]}):i.jsx(i.Fragment,{}),se==="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:yt,onChange:lt=>Kt(lt.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] ${yt===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Ot||en})})]}),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:ve,onChange:lt=>be(lt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:kn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${ve===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Ot||en}),i.jsx("button",{type:"button",onClick:()=>Gt(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:Ot||en,children:kn?i.jsx(la,{size:14}):i.jsx(ca,{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:at,onChange:lt=>{const Ct=lt.target.value.trim();if(Ct==="")return He("");ue(Ct)&&He(Ct)},onKeyDown:Z,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] ${at===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Ot||en})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${se==="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:Fe,onChange:lt=>{const Ct=lt.target.value;if(Re(Ct),!Ct.trim()){Ye(null),st("");return}const On=Or(Ct);if(On&&(On!=null&&On.exp)){const qn=new Date((On==null?void 0:On.exp)*1e3);Ye(qn),st("")}else On?(Ye(null),st("The token's expiration date could not be found.")):(Ye(null),st("Invalid token format."))},type:Ft?"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] ${Fe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Ot||en}),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 "+(A?"text-[#FF797C]":"text-[#F8D4AB]"),children:Qe==null?void 0:Qe.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),A&&i.jsx("span",{children:i.jsx("img",{src:Wo,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:()=>Tn(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:Ot||en,children:Ft?i.jsx(la,{size:14}):i.jsx(ca,{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(pl,{styles:bt,components:{Option:ur,SingleValue:gr},isDisabled:Ot||en,options:Lt,value:Lt.find(lt=>lt.value===jt)||null,onChange:lt=>un((lt==null?void 0:lt.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:`${se==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:ln,onChange:lt=>{const Ct=lt.target.value.trim();if(Ct==="")return Nn("");ue(Ct)&&Nn(Ct)},onKeyDown:Z,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] ${ln===""?"border-[#353535]":me?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Ot||en}),ln!==""&&!me&&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:`${se==="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:yn,onChange:lt=>Cn(lt.target.value),className:`${Ot||en?"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:Ot||en,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:ln,onChange:lt=>{const Ct=lt.target.value.trim();if(Ct==="")return Nn("");ue(Ct)&&Nn(Ct)},onKeyDown:Z,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] ${ln===""?"border-[#353535]":me?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Ot||en}),ln!==""&&!me&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 120."})]}),i.jsxs("div",{className:`${se==="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:se==="ON"?"On":"Off"}),i.jsx(Oo,{checked:se==="ON",onChange:lt=>pe(lt?"ON":"OFF"),disabled:Ot||en,className:`${se==="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 ${Ot||en?"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 ${se==="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:dn,onChange:lt=>{const Ct=lt.target.value.trim();if(Ct==="")return rt("");ue(Ct)&&rt(Ct)},onKeyDown:Z,inputMode:"numeric",autoComplete:"off",placeholder:jt?`1–${Fn}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${dn===""?"border-[#353535]":Ne?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Ot||en})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${oe?"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":nt==="LONG",onClick:()=>!en&&Ut("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",Ot||en?"cursor-not-allowed":"cursor-pointer",nt==="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",dn?` - ${dn}x`:""]})}),i.jsx("div",{"aria-pressed":nt==="SHORT",onClick:()=>!en&&Ut("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",Ot||en?"cursor-not-allowed":"cursor-pointer",nt==="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",dn?` - ${dn}x`:""]})}),i.jsx("div",{"aria-pressed":nt==="RANDOM",onClick:()=>!en&&Ut("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",Ot||en?"cursor-not-allowed":"cursor-pointer",nt==="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",dn?` - ${dn}x`:""]})})]})]}),i.jsxs("div",{className:`${oe?"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":We==="MARKET",onClick:()=>!en&&Pt("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",Ot||en?"cursor-not-allowed":"cursor-pointer",We==="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 ",We==="MARKET"?" ✓":""]})}),i.jsxs("button",{"aria-pressed":We==="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",We==="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 ",We==="LIMIT"?" ✓":""]}),i.jsx("span",{className:"min-w-max text-[6px] -mt-[1px] text-[#FF9A3C]",children:"Coming Soon"})]}),i.jsxs("button",{"aria-pressed":We==="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",We==="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 ",We==="RANDOM"?" ✓":""]}),i.jsx("span",{className:"min-w-max text-[6px] -mt-[1px] text-[#FF9A3C]",children:"Coming Soon"})]})]})]})]}),!1,i.jsxs("div",{className:`${oe?"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:Ke,onChange:lt=>{const Ct=lt.target.value.trim();if(Ct==="")return ct("");ce(Ct)&&ct(Ct)},onKeyDown:Z,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] ${Ke===""?"border-[#353535]":Ie?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Ot||en})]}),Ke!==""&&!Ie&&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:Nt,onChange:lt=>{const Ct=lt.target.value.trim();if(Ct==="")return Ht("");ce(Ct)&&Ht(Ct)},onKeyDown:Z,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] ${Nt===""?"border-[#353535]":Le?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Ot||en})]}),Nt!==""&&!Le&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",dn?Math.max(dn*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]})]}),i.jsx("div",{className:`${se==="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:()=>!Ot&&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:Ot,children:"Cancel"}),g?se==="ON"?v?i.jsx("button",{onClick:stopLighterFarming,disabled:Ot,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:tr?"Stopping...":"Stop"}):i.jsx("button",{onClick:saveLighterFarming,disabled:!Oe||Ot,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Oe||Ot?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Zn?"Starting...":"Start"}):v?i.jsx("button",{onClick:$t,disabled:Ot,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:tr?"Stopping...":"Stop"}):i.jsx("button",{onClick:or,disabled:!Xe||Ot,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Xe||Ot?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Zn?"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"})]})}),Mn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},MU=({open:t=!1,setOpen:e=()=>{}})=>{var bs,Sr,Pn,Ln;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=h.useContext(Qr),{address:g}=ds(),[y,v]=h.useState(!1),[C,S]=h.useState(!1),[T,I]=h.useState(1),[L,F]=h.useState(0),[$,O]=h.useState(0),[U,Y]=h.useState(0),[re,Q]=h.useState(0),[q,te]=h.useState({}),[fe,G]=h.useState(null),[ie,oe]=h.useState("variational"),[K,H]=h.useState(!1),ee=h.useRef(null),[se,pe]=h.useState(!1),[Se,ge]=h.useState("Extended-1"),[ve,be]=h.useState("ON"),[we,je]=h.useState(""),[Fe,Re]=h.useState(""),[Qe,Ye]=h.useState(""),[dt,st]=h.useState(""),[at,He]=h.useState(""),[qe,vt]=h.useState(""),[yt,Kt]=h.useState(""),[jt,un]=h.useState(""),[vn,Hn]=h.useState([]),[ln,Nn]=h.useState(""),[dn,rt]=h.useState(""),[nt,Ut]=h.useState("LONG"),[wn,Jt]=h.useState("STANDARD"),[Vt,xt]=h.useState("STANDARD"),[We,Pt]=h.useState("LIMIT"),[Ke,ct]=h.useState("LIMIT"),[Nt,Ht]=h.useState("MARKET"),[Rt,hn]=h.useState(""),[yn,Cn]=h.useState(""),[En,Rn]=h.useState(""),[Mn,Yn]=h.useState(!1),[Zn,Vn]=h.useState(!1),[tr,Sn]=h.useState(!1),[ze,xe]=h.useState(!1),[Ge,_e]=h.useState(""),[Be,qt]=h.useState(""),[It,mt]=h.useState(!0),[Ft,Tn]=h.useState(!1),[kn,Gt]=h.useState(!1),[mn,gt]=h.useState(!1),[Wt,jn]=h.useState(!1),[kt,cn]=h.useState(!1),[Ce,m]=h.useState(!1),[p,N]=h.useState(!1),[A,k]=h.useState(""),[P,D]=h.useState(!0),[V,Z]=h.useState(""),[ce,ue]=h.useState(null),[me,Ne]=h.useState(""),[Ie,Le]=h.useState(!1),Xe=ce?(ce==null?void 0:ce.getTime())<=Date.now():!1,[Oe,$e]=h.useState("Hour"),[ae,he]=h.useState([]),[Pe,Ve]=h.useState(""),[Te,Ze]=h.useState(!1),[it,wt]=h.useState(!1);h.useState(1);const Dt="https://dextrabothypev2.nftinit.io",Qt="",xn=h.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}],[]),pn=h.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}],[]),An={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI"};h.useEffect(()=>{async function ht(){if(t)try{const lr=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=extended")).json();if(lr!=null&&lr.coins){let sr=lr.coins.map(Mr=>{const Lr=(Mr==null?void 0:Mr.label)||"",ss=An[Lr]||Lr,ys=ss==="XMR"?"https://app.lighter.xyz/assets/xmr-CV8khZ54.png":ss==="NMR"?"https://app.lighter.xyz/assets/nmr-2YIHMk6g.png":ss==="USELESS"?"https://app.lighter.xyz/assets/useless-BTmgr78l.png":ss==="DOLO"?"https://app.lighter.xyz/assets/dolo-DuOVl-Vo.png":ss==="CRO"?"https://app.lighter.xyz/assets/cro-C7lstwu3.png":ss==="FF"?"https://app.lighter.xyz/assets/ff-CvnDhHny.png":ss==="4"||ss=="EUR"||ss=="EDEN"||ss=="XAU"?"":`https://app.hyperliquid.xyz/coins/${ss}.svg`;return{...Mr,icon:ys}});Hn(sr)}}catch(Yt){console.error("Failed to fetch coin list:",Yt)}}ht()},[t]);async function or(){try{Ze(!0);const ht=window.localStorage.getItem("hyperToken"),Yt=window.localStorage.getItem("hyperAddress");if(!ht||!Yt){n(!0);return}const lr=`${Dt}/api/wallet/list-extended`,Mr=await(await fetch(`${lr}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Yt.toLowerCase(),token:ht})})).json();Mr!=null&&Mr.success?he((Mr==null?void 0:Mr.data)||[]):_e((Mr==null?void 0:Mr.error_message)||"Failed to load wallets.")}catch(ht){_e(ht.message||"Wallet list error.")}finally{Ze(!1)}}const $t=ht=>{var Yt;return((Yt=(ve==="ON"?pn:xn).find(lr=>lr.value===ht))==null?void 0:Yt.maxLeverage)??100},bt=ht=>{["e","E","+","-"].includes(ht.key)&&ht.preventDefault()},rn=ht=>/^\d*\.?\d{0,6}$/.test(ht),ur=ht=>/^\d*$/.test(ht),gr=h.useMemo(()=>{if(ln==="")return!1;const ht=Number(ln);return Number.isInteger(ht)&&ht>=1&&ht<=120},[ln]),br=h.useMemo(()=>{if(dn==="")return!1;const ht=Number(dn),Yt=$t(jt);return Number.isInteger(ht)&&ht>=1&&ht<=Yt},[dn,jt]),Br=h.useMemo(()=>{if(Rt==="")return!1;const ht=Number(Rt);return Number.isNaN(ht)?!1:ht===0?!0:ht>=1&&ht<=1e7},[Rt]),Gr=h.useMemo(()=>{if(yn==="")return!1;const ht=Number(yn);if(Number.isNaN(ht))return!1;const Yt=dn===""?null:Number(dn),lr=Yt?Yt*100-1:4999;return ht===0?!0:ht>0&&ht<1?!1:ht>=1&&ht<=lr},[yn,dn]);h.useMemo(()=>{if(En==="")return!1;const ht=Number(En);return!Number.isNaN(ht)&&ht>0&&ht<=100},[En]);const Or=ve=="ON"?pn:xn,Lt=h.useMemo(()=>jt?Or.some(ht=>ht.value===jt):!1,[jt,Or]),nn=y&&we.trim()!==""&&qe.trim()!==""&&Qe.trim()!==""&&dt.trim()!==""&&jt!==""&&gr&&br&&Se&&(!Rt||Br)&&(!yn||Gr)&&(nt==="LONG"||nt==="SHORT"||nt==="RANDOM")&&(We==="LIMIT"||We==="MARKET"||We==="RANDOM")&&P,Ot=y&&Pe&&Se&&jt!==""&&Lt&&gr&&br&&(ie!=="variational"||V.trim()!=="")&&(ie!=="variational"||!me)&&(ie!=="variational"||!Xe)&&P,en=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),Fn=()=>`extendedCreds:${en()}`,yr=()=>{try{const ht=localStorage.getItem(Fn());if(!ht)return;const Yt=JSON.parse(ht);Yt.apiKey&&je(Yt.apiKey),Yt.apiPrivateKey&&Ye(Yt.apiPrivateKey),Yt.vaultNumber&&st(Yt.vaultNumber),Yt.apiPublicKey&&vt(Yt.apiPublicKey),typeof Yt.remember=="boolean"&&mt(Yt.remember)}catch{}},hr=()=>{if(It)try{localStorage.setItem(Fn(),JSON.stringify({apiKey:we,apiPrivateKey:Qe,apiPublicKey:qe,vaultNumber:dt,remember:!0}))}catch{}},lt=()=>{try{localStorage.removeItem(Fn())}catch{}};h.useEffect(()=>{if(!t)return;const ht=localStorage.getItem("hyperToken"),Yt=localStorage.getItem("hyperAddress");v(!!(ht&&Yt));const lr=setInterval(()=>{const sr=localStorage.getItem("hyperToken"),Mr=localStorage.getItem("hyperAddress");v(!!(sr&&Mr))},800);return()=>clearInterval(lr)},[t]),h.useEffect(()=>{!t||!y||(Ct(),or(),Jn())},[t,y]),h.useEffect(()=>{t&&(yn===""&&Cn(Qt),Rt===""&&hn(Qt),En===""&&Rn(Qt))},[t]),h.useEffect(()=>{if(!jt)return;const ht=$t(jt),Yt=Number(dn);!Number.isNaN(Yt)&&Yt>ht&&rt(String(ht)),!Number.isNaN(Yt)&&Yt<1&&dn!==""&&rt("1")},[jt]),h.useEffect(()=>{t&&(It&&hr(),It||lt())},[we,Qe,dt,qe,It,t]);async function Ct(){var ht,Yt,lr,sr,Mr,Lr,ss,ys,Bt,mr,er,qr,xs,ls,hs,vs;try{Vn(!0),_e("");const vi=window.localStorage.getItem("hyperToken"),Ps=window.localStorage.getItem("hyperAddress");if(!vi||!Ps){S(!1),yr();return}const Ts=await(await fetch(`${Dt}/api/test_app/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Ps.toLowerCase(),token:vi})})).json();if(!(Ts!=null&&Ts.success)){if(console.warn("INFO API RESPONSE:",Ts==null?void 0:Ts.error_message),(Ts==null?void 0:Ts.error_message)==="You have not a running process"){const mc=Se?Se.toLowerCase().replace("-","_"):null,Ls=q==null?void 0:q[mc];if(mc&&Ls){const Pa={...q,[mc]:{...Ls,isStop:!0}};te(Pa);const Sa=Object.keys(Pa).filter(Xo=>Xo.startsWith("extended"));if(Sa.length>0&&!Se){const Ql=Sa.sort((Ci,Ed)=>{var E,M;const St=parseInt(((E=Ci.match(/\d+/))==null?void 0:E[0])||0,10),w=parseInt(((M=Ed.match(/\d+/))==null?void 0:M[0])||0,10);return St-w})[0].match(/\d+/);Ql&&ge(`Extended-${Ql[0]}`)}}else ge("Extended-1")}Ts!=null&&Ts.slots_info&&(O((Yt=(ht=Ts==null?void 0:Ts.slots_info)==null?void 0:ht.extended)==null?void 0:Yt.total_qty),F((sr=(lr=Ts==null?void 0:Ts.slots_info)==null?void 0:lr.extended)==null?void 0:sr.active_qty),Q((Lr=(Mr=Ts==null?void 0:Ts.slots_info)==null?void 0:Mr.variational)==null?void 0:Lr.total_qty),Y((ys=(ss=Ts==null?void 0:Ts.slots_info)==null?void 0:ss.variational)==null?void 0:ys.active_qty));return}if(Ts!=null&&Ts.success&&(Ts!=null&&Ts.data)){const mc=Se?Se.toLowerCase().replace("-","_"):null,Ls=q==null?void 0:q[mc],Pa=Ts.data||{};mc&&!Pa[mc]&&Ls&&(Pa[mc]={...Ls,isStop:!0}),te(Pa);const Sa=Object.keys(Pa).filter(Xo=>Xo.startsWith("extended"));if(Sa.length>0&&!Se){const Ql=Sa.sort((Ci,Ed)=>{var E,M;const St=parseInt(((E=Ci.match(/\d+/))==null?void 0:E[0])||0,10),w=parseInt(((M=Ed.match(/\d+/))==null?void 0:M[0])||0,10);return St-w})[0].match(/\d+/);Ql&&ge(`Extended-${Ql[0]}`)}Ts!=null&&Ts.slots_info&&(O((mr=(Bt=Ts==null?void 0:Ts.slots_info)==null?void 0:Bt.extended)==null?void 0:mr.total_qty),F((qr=(er=Ts==null?void 0:Ts.slots_info)==null?void 0:er.extended)==null?void 0:qr.active_qty),Q((ls=(xs=Ts==null?void 0:Ts.slots_info)==null?void 0:xs.variational)==null?void 0:ls.total_qty),Y((vs=(hs=Ts==null?void 0:Ts.slots_info)==null?void 0:hs.variational)==null?void 0:vs.active_qty))}}catch{S(!1),yr(),be("ON")}finally{Vn(!1)}}const On=h.useMemo(()=>Se?Se.toLowerCase().replace("-","_"):"",[Se]),qn=!!((bs=q==null?void 0:q[On])!=null&&bs.delta)&&!!((Sr=q==null?void 0:q[On])!=null&&Sr.from_slot),_r=qn?`extended_${(Pn=q==null?void 0:q[On])==null?void 0:Pn.from_slot}`:On;h.useEffect(()=>{var lr,sr,Mr,Lr,ss,ys,Bt,mr,er,qr,xs,ls,hs,vs,vi,Ps,As,Ts,mc;if(!Se||!q)return;const ht=_r,Yt=q==null?void 0:q[ht];if(!Yt){je(""),Ye(""),vt(""),He(""),st(""),un(""),Nn(""),rt(""),Ut("LONG"),Pt("LIMIT"),S(!1),be("ON"),$e("Hour"),hn(""),Cn(""),Z(""),ct("LIMIT"),Ht("MARKET"),oe("variational"),ue(null);return}if((Yt==null?void 0:Yt.target_params)==null&&Yt.source_params){Yt!=null&&Yt.isStop?S(!1):S(!0),be("OFF");const Ls=Yt.source_params,Pa=(Yt==null?void 0:Yt.slot_number)??"";Pa&&!qn&&ge(`Extended-${Pa}`),Ls!=null&&Ls.cycleSeconds&&$e((Ls==null?void 0:Ls.cycleSeconds)===86400?"Day":"Hour");const Wu=(Ls==null?void 0:Ls.extendedapikey)??"",Sa=(Ls==null?void 0:Ls.x10privatekey)??"",Xo=(Ls==null?void 0:Ls.x10publickey)??"",qu=(Ls==null?void 0:Ls.x10vault)??"";if(Wu&&je(String(Wu)),Sa&&Ye(String(Sa)),Xo&&vt(String(Xo)),qu&&st(String(qu)),Ls!=null&&Ls.coin){const Ql=String(Ls.coin).replace(/-USD$/,"");un(Ql)}(Ls==null?void 0:Ls.orderPerHour)!=null&&Nn(String(Ls.orderPerHour)),(Ls==null?void 0:Ls.leverage)!=null&&rt(String(Ls.leverage)),Ls!=null&&Ls.direction&&Ut(String(Ls.direction).toUpperCase()==="SHORT"?"SHORT":String(Ls.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),Ls!=null&&Ls.orderType&&Pt(String(Ls.orderType).toUpperCase()==="MARKET"?"MARKET":String(Ls.orderType).toUpperCase()==="LIMIT"?"LIMIT":"RANDOM"),(Ls==null?void 0:Ls.tp)!=null&&hn(String(Ls.tp)),(Ls==null?void 0:Ls.sl)!=null&&Cn(String(Ls.sl))}else if((Yt==null?void 0:Yt.target_params)!==null){Yt!=null&&Yt.isStop?S(!1):S(!0),be("ON");const Ls=(Yt==null?void 0:Yt.slot_number)??"";Ls&&!qn&&ge(`Extended-${Ls}`);const Pa=Yt.source_params,Wu=(Pa==null?void 0:Pa.extendedapikey)??"",Sa=(Pa==null?void 0:Pa.x10privatekey)??"",Xo=(Pa==null?void 0:Pa.x10publickey)??"",qu=(Pa==null?void 0:Pa.x10vault)??"";if(Wu&&je(String(Wu)),Sa&&Ye(String(Sa)),Xo&&vt(String(Xo)),qu&&st(String(qu)),(lr=Yt==null?void 0:Yt.source_params)!=null&&lr.wallet_id&&Ve(String((sr=Yt==null?void 0:Yt.source_params)==null?void 0:sr.wallet_id)),(Mr=Yt==null?void 0:Yt.source_params)!=null&&Mr.coin){const Ql=String((Lr=Yt==null?void 0:Yt.source_params)==null?void 0:Lr.coin).replace(/-USD$/,"");un(Ql)}((ss=Yt==null?void 0:Yt.source_params)==null?void 0:ss.orderPerHour)!=null&&Nn(String((ys=Yt==null?void 0:Yt.source_params)==null?void 0:ys.orderPerHour)),((Bt=Yt==null?void 0:Yt.source_params)==null?void 0:Bt.leverage)!=null&&rt(String((mr=Yt==null?void 0:Yt.source_params)==null?void 0:mr.leverage)),(er=Yt==null?void 0:Yt.source_params)!=null&&er.accountType&&Jt(((qr=Yt==null?void 0:Yt.source_params)==null?void 0:qr.accountType)==="standart"?"STANDARD":"PREMIUM"),(xs=Yt==null?void 0:Yt.target_params)!=null&&xs.accountType&&xt(((ls=Yt==null?void 0:Yt.target_params)==null?void 0:ls.accountType)==="standart"?"STANDARD":"PREMIUM"),Yt!=null&&Yt.target_app&&oe(((Yt==null?void 0:Yt.target_app)==="variational","variational")),(hs=Yt==null?void 0:Yt.target_params)!=null&&hs.vr_token&&Z((vs=Yt==null?void 0:Yt.target_params)==null?void 0:vs.vr_token),(vi=Yt==null?void 0:Yt.source_params)!=null&&vi.source_orderType&&ct(String((Ps=Yt==null?void 0:Yt.source_params)==null?void 0:Ps.source_orderType).toUpperCase()==="MARKET"?"MARKET":String((As=Yt==null?void 0:Yt.source_params)==null?void 0:As.source_orderType).toUpperCase()==="LIMIT"?"LIMIT":"HYBRID"),(Ts=Yt==null?void 0:Yt.source_params)!=null&&Ts.cycleSeconds&&$e(((mc=Yt==null?void 0:Yt.source_params)==null?void 0:mc.cycleSeconds)===86400?"Day":"Hour")}else S(!1),be("OFF")},[Se,q,qn,_r]);const jr=ht=>{var Yt;return Number(((Yt=String(ht||"").match(/\d+/))==null?void 0:Yt[0])||0)},Fr=ht=>(ht||"").toLowerCase().replace("-","_"),nr=h.useMemo(()=>{const ht=q==null?void 0:q[Fr(Se)];if(ht!=null&&ht.delta&&(ht!=null&&ht.from_slot))return Number(ht.from_slot);const Yt=Number(ht==null?void 0:ht.slot_number);return Number.isFinite(Yt)?Yt:jr(Se)},[Se,q]),vr=h.useMemo(()=>{const ht=Number(T)||0,Yt=Array.from({length:ht},()=>({used:!1,kind:null})),lr=q||{};for(const[sr,Mr]of Object.entries(lr)){if(!sr.startsWith("extended"))continue;const Lr=jr(sr)-1;Lr<0||Lr>=ht||((Mr==null?void 0:Mr.isStop)===!0?Yt[Lr]={used:!1,kind:null}:Mr!=null&&Mr.source_params?Yt[Lr]={used:!0,kind:"delta-src"}:Mr!=null&&Mr.target_params||Mr!=null&&Mr.delta?Yt[Lr]={used:!0,kind:"delta-shadow"}:Mr!=null&&Mr.farming_params?Yt[Lr]={used:!0,kind:"single"}:Yt[Lr]={used:!0,kind:"unknown"})}return Yt},[q,T]),Yr=h.useMemo(()=>vr.map((ht,Yt)=>ht.used&&ht.kind!=="delta-src-inferred"?`Extended-${Yt+1}`:null).filter(Boolean),[vr]);h.useMemo(()=>vr.filter(ht=>!ht.used).length,[vr]);async function dr(){var Yt;const ht=jr(Se)-1;if(ht<0){_e("Please select a slot."),Sn(!1);return}if((Yt=vr[ht])!=null&&Yt.used){_e("Selected slot is already in use."),Sn(!1);return}if(!y){n(!0);return}if(ve==="OFF"){if(!nn)return}else if(!Ot)return;try{Sn(!0),_e("");const lr=window.localStorage.getItem("hyperToken"),sr=window.localStorage.getItem("hyperAddress");if(!lr||!sr){n(!0);return}const Mr={coin:`${jt}-USD`,leverage:Number(dn),orderPerHour:Number(ln),cycleSeconds:Oe==="Hour"?3600:86400,...ve==="ON"?{source_orderType:Ke,wallet_id:Pe}:{extendedapikey:we,x10publickey:qe,x10privatekey:Qe,x10vault:dt,orderType:We,tp:Number(Rt),sl:Number(yn),direction:nt}},Lr={...ie==="variational"&&{vr_token:V},coin:`${jt}`,orderPerHour:Number(ln),leverage:Number(dn),target_orderType:Nt,cycleSeconds:Oe==="Hour"?3600:86400},ss={address:sr.toLowerCase(),token:lr,slot_number:Number(Se==null?void 0:Se.replace("Extended-","")),source_app:"extended",source_params:Mr,...ve==="ON"?{target_app:ie==="extended"?"extended":"variational_delta",target_params:Lr}:{}},Bt=await(await fetch(`${Dt}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ss)})).json();Bt!=null&&Bt.success?(S(!0),Ct(),It&&hr()):_e((Bt==null?void 0:Bt.error_message)||"Start failed.")}catch(lr){_e(lr.message||"An error occurred while saving.")}finally{Sn(!1)}}async function rs(){if(!y){n(!0);return}try{xe(!0),_e("");const ht=window.localStorage.getItem("hyperToken"),Yt=window.localStorage.getItem("hyperAddress");if(!ht||!Yt){n(!0);return}const sr=await(await fetch(`${Dt}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Yt.toLowerCase(),token:ht,source_app:"extended",slot_number:nr,...ve==="ON"?{target_app:ie==="extended"?"extended":"variational_delta"}:{}})})).json();sr!=null&&sr.success?(S(!1),Ct()):_e((sr==null?void 0:sr.error_message)||"Stop failed.")}catch(ht){_e(ht.message||"An error occurred while stopping.")}finally{xe(!1)}}const gs=ht=>{oe(ht??"variational"),H(!1)},ms=[{value:"variational",label:"Variational"}];function At(ht){try{const Yt=ht.split(".");if(Yt.length!==3)throw new Error("Invalid JWT format");const sr=Yt[1].replace(/-/g,"+").replace(/_/g,"/"),Mr=decodeURIComponent(atob(sr).split("").map(Lr=>"%"+("00"+Lr.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(Mr)}catch{return null}}const pt={control:(ht,Yt)=>({...ht,backgroundColor:"#242424",borderColor:Yt.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:ht=>({...ht,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:ht=>({...ht,height:32}),input:ht=>({...ht,color:"#FFFFFF",margin:0,padding:0}),singleValue:ht=>({...ht,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:ht=>({...ht,color:"#7F7F7F",fontSize:"12px"}),menu:ht=>({...ht,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:ht=>({...ht,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(ht,Yt)=>({...ht,backgroundColor:Yt.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:ht=>({...ht,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:ht=>({...ht,backgroundColor:"#353535"})},le=({max:ht})=>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:[ht,"x"]}),Me=ht=>{var Yt;return i.jsx(ba.Option,{...ht,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Yt=ht.data)!=null&&Yt.icon?i.jsx("img",{src:ht.data.icon,alt:ht.data.label,className:"w-4 h-4 rounded-[4px]",onError:lr=>lr.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:ht.data.label}),i.jsx(le,{max:ht.data.maxLeverage})]})})},ft=ht=>{var Yt;return i.jsx(ba.SingleValue,{...ht,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Yt=ht.data)!=null&&Yt.icon?i.jsx("img",{src:ht.data.icon,alt:ht.data.label,className:"w-4 h-4 rounded-[4px]",onError:lr=>lr.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:ht.data.label}),i.jsx(le,{max:ht.data.maxLeverage})]})})},ut=ht=>{const Yt=Yr.includes(ht.data.value);return i.jsx(ba.Option,{...ht,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:ht.data.label}),Yt&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},on=ht=>i.jsx(ba.SingleValue,{...ht,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:ht.data.label})})}),bn=h.useMemo(()=>ae.map(ht=>{const Yt=(ht==null?void 0:ht.wallet_name)??(ht==null?void 0:ht.name)??(ht==null?void 0:ht.label)??String(ht==null?void 0:ht.wallet_id),lr=(ht==null?void 0:ht.version)===3?`${Yt} - (API-AGENT) Wallet`:Yt;return{value:(ht==null?void 0:ht.wallet_id)??(ht==null?void 0:ht.id)??(ht==null?void 0:ht.value)??"",label:lr,raw:ht}}),[ae]),Gn=h.useMemo(()=>{var ht;return(ht=bn.find(Yt=>String(Yt.value)===String(Pe)))==null?void 0:ht.raw},[bn,Pe]);h.useMemo(()=>{const ht=Gn||{};return ht.address||ht.evm_address||ht.wallet_address||ht.public_address||ht.eth_address||ht.addr||null},[Gn]);const rr=ht=>i.jsxs(ba.MenuList,{...ht,children:[i.jsxs("div",{onClick:()=>{ht.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"}),ht.children]}),Jn=async()=>{var lr,sr,Mr,Lr,ss,ys,Bt,mr;const ht=window.localStorage.getItem("hyperToken"),Yt=window.localStorage.getItem("hyperAddress");if(!(!ht||!Yt))try{Yn(!0);const er=await bi(Yt.toLowerCase(),ht);er!=null&&er.success?(r(er==null?void 0:er.telegram_chat_id),s(er==null?void 0:er.subscriber_role),a(er==null?void 0:er.subs_expire_day),o((lr=er==null?void 0:er.mushboomer_counts)==null?void 0:lr.eth),l((sr=er==null?void 0:er.mushboomer_counts)==null?void 0:sr.sol),c(er==null?void 0:er.referral_code),u(er==null?void 0:er.refcode),d(er==null?void 0:er.whitelist),f(ht),x(Yt),D(!0),I((Lr=(Mr=er==null?void 0:er.slots_info)==null?void 0:Mr.extended)==null?void 0:Lr.total_qty),O((ys=(ss=er==null?void 0:er.slots_info)==null?void 0:ss.extended)==null?void 0:ys.total_qty),F((mr=(Bt=er==null?void 0:er.slots_info)==null?void 0:Bt.extended)==null?void 0:mr.active_qty),Yn(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),Yn(!1))}catch(er){console.error("Token verification error:",er),console.error(er.message||"An unknown error occurred."),Yn(!1)}},Xn=async()=>new Tl(window.ethereum).eth.getAccounts(Yt=>Yt),Zr=async(ht="extended",Yt=24,lr=5e3)=>{Yt<=0||(await new Promise(sr=>setTimeout(sr,lr)),await Jn(),ht==="extended"&&!P&&Zr(ht,Yt-1,lr))},$r=async()=>{qt("");const ht=window.localStorage.getItem("hyperToken"),Yt=window.localStorage.getItem("hyperAddress");if(!ht||!g){n(!0);return}N(!0),m(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(Mr){console.error("Failed to switch network",Mr),m(!1);return}const lr=new Tl(window.ethereum);var sr=await Xn();if(sr.length>0?sr=sr[0]:sr=void 0,sr){const Lr={from:sr,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:"120000000000000000"};await lr.eth.sendTransaction(Lr).then(ss=>{console.log("txHash :>> ",ss),m(!1),k(ss.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():Yt,token:ht,payment_tx:ss.transactionHash,payment_role:"farming_tools"})}),Jn(),Zr("extended")}).catch(ss=>{console.log(ss),ss.code===-32003||ss.message.includes("insufficient funds")?qt("Insufficient funds."):ss.message==="MetaMask Tx Signature: User denied transaction signature."&&N(!1)})}else await lr.eth.requestAccounts()},wr=h.useMemo(()=>Array.from({length:T},(ht,Yt)=>({value:`Extended-${Yt+1}`,label:`Extended-${Yt+1}`})),[T]);if(!t)return null;const pr=Zn||tr||ze||Mn,ar=C&&!ze,Vr=$t(jt),Ur=U===re;return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:p,setOpen:N,transactionHash:A,transactionLoading:Ce,paymentPresaleRole:P,errorFunds:Be,activeMethod:2}),i.jsx(D5,{open:se,setOpen:pe,paymentLighterRole:P,oldSlotCount:fe,checkAccountLighter:Jn,tradeMarket:"extended"}),it&&Ea.createPortal(i.jsx("div",{className:"fixed inset-0 z-[999999999]",children:i.jsx(M5,{open:it,setOpen:wt,handleListRequest:or,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:()=>!pr&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(O2,{current:"extended",onCloseCurrent:()=>!pr&&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:j2,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:[Ge&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:Ge==="Get more slots to run Delta Neutral with Variational"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:Ge}),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:Ge})}),y&&P&&$===L&&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 ${(wr==null?void 0:wr.length)||$} in use.`}),y&&Ur&&ie==="variational"&&!C&&ve==="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&&!P&&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:Wo,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:()=>{$r()},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&&P&&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(E5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[L||0,"/",wr.length]})]})]}),i.jsx(pl,{styles:pt,components:{Option:ut,SingleValue:on},options:wr,value:wr.find(ht=>ht.value===Se)||null,onChange:ht=>ge((ht==null?void 0:ht.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsx("div",{className:"flex justify-end items-end w-full ",children:i.jsxs("div",{onClick:ht=>{ht.preventDefault(),y?wt(!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:[ve==="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(pl,{styles:pt,isDisabled:pr||Te||ar,isLoading:Te,options:bn,components:{MenuList:rr},setIsGenWalletModal:wt,value:bn.find(ht=>String(ht.value)===String(Pe))||null,onChange:ht=>{ar||Ve((ht==null?void 0:ht.value)??"")},placeholder:y?Te?"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":Ke==="LIMIT",onClick:()=>!ar&&ct("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",pr||ar?"cursor-not-allowed":"cursor-pointer",Ke==="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 ",Ke==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":Ke==="HYBRID",onClick:()=>!ar&&ct("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",pr||ar?"cursor-not-allowed":"cursor-pointer",Ke==="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 ",Ke==="HYBRID"?" ✓":""]})}),i.jsx("button",{"aria-pressed":Ke==="MARKET",onClick:()=>!ar&&ct("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",pr||ar?"cursor-not-allowed":"cursor-pointer",Ke==="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 ",Ke==="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:we,onChange:ht=>je(ht.target.value),autoComplete:"off",placeholder:"API_KEY",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] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:pr||ar}),i.jsx("button",{type:"button",onClick:()=>Tn(ht=>!ht),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:pr||ar,children:Ft?i.jsx(la,{size:14}):i.jsx(ca,{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:qe,onChange:ht=>vt(ht.target.value),autoComplete:"off",placeholder:"STARK_KEY_PUBLIC",type:kn?"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:pr||ar}),i.jsx("button",{type:"button",onClick:()=>Gt(ht=>!ht),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:pr||ar,children:kn?i.jsx(la,{size:14}):i.jsx(ca,{size:14})})]})]})]}),ve==="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:`${pr||ar?"cursor-not-allowed":"cursor-pointer"} rounded-md bg-[#353535] text-white px-2 h-6 flex items-center justify-between`,onClick:ht=>{ht.preventDefault(),pr||ar||H(!K)},children:[i.jsx("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px]",children:(Ln=ms==null?void 0:ms.find(ht=>(ht==null?void 0:ht.value)===ie))==null?void 0:Ln.label}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${K?"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"})})]}),K&&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:ms==null?void 0:ms.map((ht,Yt)=>i.jsxs("div",{onClick:lr=>{lr.preventDefault(),pr||ar||gs(ht==null?void 0:ht.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 ${(ht==null?void 0:ht.value)===ie?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white ${pr||ar?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsx("span",{className:"text-white",children:ht==null?void 0:ht.label}),(ht==null?void 0:ht.value)===ie&&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"})})]},Yt))})})]})})]}),ie==="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:yt,onChange:ht=>Kt(ht.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] ${yt===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:pr||ar})})]}),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:Fe,onChange:ht=>Re(ht.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:kt?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Fe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:pr||ar}),i.jsx("button",{type:"button",onClick:()=>cn(ht=>!ht),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:pr||ar,children:kt?i.jsx(la,{size:14}):i.jsx(ca,{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:at,onChange:ht=>{const Yt=ht.target.value.trim();if(Yt==="")return He("");ur(Yt)&&He(Yt)},onKeyDown:bt,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] ${at===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:pr||ar})})]})]}),ie==="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:V,onChange:ht=>{const Yt=ht.target.value;if(Z(Yt),!Yt.trim()){ue(null),Ne("");return}const lr=At(Yt);if(lr&&(lr!=null&&lr.exp)){const sr=new Date((lr==null?void 0:lr.exp)*1e3);ue(sr),Ne("")}else lr?(ue(null),Ne("The token's expiration date could not be found.")):(ue(null),Ne("Invalid token format."))},type:Ie?"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] ${V===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:pr||ar}),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 "+(Xe?"text-[#FF797C]":"text-[#F8D4AB]"),children:ce==null?void 0:ce.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),Xe&&i.jsx("span",{children:i.jsx("img",{src:Wo,alt:"",className:"w-3.5 h-3.5"})})]}),me&&i.jsx("div",{className:"text-[10px] text-[#FF797C] mt-[2px] pl-[3px]",children:me}),i.jsx("button",{type:"button",onClick:()=>Le(ht=>!ht),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:pr||ar,children:Ie?i.jsx(la,{size:14}):i.jsx(ca,{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":Nt==="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",Nt==="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 ",Nt==="MARKET"?" ✓":""]})})})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ve==="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:ht=>Ye(ht.target.value),autoComplete:"off",placeholder:"STARK_KEY_PRIVATE",type:mn?"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:pr||ar}),i.jsx("button",{type:"button",onClick:()=>gt(ht=>!ht),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:pr||ar,children:mn?i.jsx(la,{size:14}):i.jsx(ca,{size:14})})]})]}),i.jsxs("div",{className:`${ve==="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:ht=>{const Yt=ht.target.value.trim();if(Yt==="")return st("");ur(Yt)&&st(Yt)},onKeyDown:bt,inputMode:"numeric",autoComplete:"off",placeholder:"VAULT_NUMBER",type:Wt?"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:pr||ar}),i.jsx("button",{type:"button",onClick:()=>jn(ht=>!ht),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:pr||ar,children:Wt?i.jsx(la,{size:14}):i.jsx(ca,{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(pl,{styles:pt,components:{Option:Me,SingleValue:ft},isDisabled:pr||ar,options:Or,value:Or.find(ht=>ht.value===jt)||null,onChange:ht=>un((ht==null?void 0:ht.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:Oe,onChange:ht=>$e(ht.target.value),className:`${pr||ar?"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:pr||ar,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:ln,onChange:ht=>{const Yt=ht.target.value.trim();if(Yt==="")return Nn("");ur(Yt)&&Nn(Yt)},onKeyDown:bt,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] ${ln===""?"border-[#353535]":gr?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:pr||ar}),ln!==""&&!gr&&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:`${ve==="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:ve==="ON"?"On":"Off"}),i.jsx(Oo,{checked:ve==="ON",onChange:ht=>be(ht?"ON":"OFF"),disabled:pr||ar,className:`${ve==="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 ${pr||ar?"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 ${ve==="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:dn,onChange:ht=>{const Yt=ht.target.value.trim();if(Yt==="")return rt("");ur(Yt)&&rt(Yt)},onKeyDown:bt,inputMode:"numeric",autoComplete:"off",placeholder:jt?`1–${Vr}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${dn===""?"border-[#353535]":br?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:pr||ar})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ve==="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":nt==="LONG",onClick:()=>!ar&&Ut("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",pr||ar?"cursor-not-allowed":"cursor-pointer",nt==="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",dn?` - ${dn}x`:""]})}),i.jsx("div",{"aria-pressed":nt==="SHORT",onClick:()=>!ar&&Ut("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",pr||ar?"cursor-not-allowed":"cursor-pointer",nt==="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",dn?` - ${dn}x`:""]})}),i.jsx("div",{"aria-pressed":nt==="RANDOM",onClick:()=>!ar&&Ut("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",pr||ar?"cursor-not-allowed":"cursor-pointer",nt==="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",dn?` - ${dn}x`:""]})})]})]}),i.jsxs("div",{className:`${ve==="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":We==="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",We==="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 ",We==="MARKET"?" ✓":""]}),i.jsx("span",{className:"min-w-max text-[6px] -mt-[1px] text-[#FF9A3C]",children:"Coming Soon"})]}),i.jsx("button",{"aria-pressed":We==="LIMIT",onClick:()=>!ar&&Pt("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",pr||ar?"cursor-not-allowed":"cursor-pointer",We==="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 ",We==="LIMIT"?" ✓":""]})}),i.jsxs("button",{"aria-pressed":We==="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",We==="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 ",We==="RANDOM"?" ✓":""]}),i.jsx("span",{className:"min-w-max text-[6px] -mt-[1px] text-[#FF9A3C]",children:"Coming Soon"})]})]})]})]}),i.jsxs("div",{className:`${ve==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${ve==="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:Rt,onChange:ht=>{const Yt=ht.target.value.trim();if(Yt==="")return hn("");rn(Yt)&&hn(Yt)},onKeyDown:bt,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]":Br?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:pr||ar})]}),Rt!==""&&!Br&&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:`${ve==="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:yn,onChange:ht=>{const Yt=ht.target.value.trim();if(Yt==="")return Cn("");rn(Yt)&&Cn(Yt)},onKeyDown:bt,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] ${yn===""?"border-[#353535]":Gr?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:pr||ar})]}),yn!==""&&!Gr&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",dn?Math.max(dn*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),i.jsx("div",{className:`${ve==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:i.jsxs("div",{className:`${ve==="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:ve==="ON"?"On":"Off"}),i.jsx(Oo,{checked:ve==="ON",onChange:ht=>be(ht?"ON":"OFF"),disabled:pr||ar,className:`${ve==="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 ${pr||ar?"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 ${ve==="ON"?"translate-x-3":"translate-x-0"}`})})]})]})})]}),i.jsx("div",{className:`${ve==="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:()=>!pr&&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:pr,children:"Cancel"}),y?ve==="ON"?C?i.jsx("button",{onClick:rs,disabled:pr,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:ze?"Stopping...":"Stop"}):i.jsx("button",{onClick:dr,disabled:!Ot||pr||ie==="variational"&&Ur&&ve==="ON",className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Ot||pr||ie==="variational"&&Ur&&ve==="ON"?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:tr?"Starting...":"Start"}):C?i.jsx("button",{onClick:rs,disabled:pr,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:ze?"Stopping...":"Stop"}):i.jsx("button",{onClick:dr,disabled:!nn||pr,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!nn||pr?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:tr?"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"})]})}),Zn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},lDe=({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"})]})})})}),$ce=({open:t=!1,setOpen:e=()=>{}})=>{var An,or,$t;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=h.useContext(Qr);ds();const[g,y]=h.useState(!1),[v,C]=h.useState(!1),[S,T]=h.useState(1),[I,L]=h.useState(0),[F,$]=h.useState(0),[O,U]=h.useState({}),[Y,re]=h.useState(null),[Q,q]=h.useState("paradex");h.useState(!1),h.useRef(null);const[te,fe]=h.useState(!1),[G,ie]=h.useState(""),[oe,K]=h.useState("OFF"),[H,ee]=h.useState(""),[se,pe]=h.useState(""),[Se,ge]=h.useState("");h.useState("");const[ve,be]=h.useState(""),[we,je]=h.useState(""),[Fe,Re]=h.useState(""),[Qe,Ye]=h.useState(""),[dt,st]=h.useState([]),[at,He]=h.useState(""),[qe,vt]=h.useState(""),[yt,Kt]=h.useState("LONG"),[jt,un]=h.useState("MARKET"),[vn,Hn]=h.useState(""),[ln,Nn]=h.useState(""),[dn,rt]=h.useState(""),[nt,Ut]=h.useState(!1),[wn,Jt]=h.useState(!1),[Vt,xt]=h.useState(!1),[We,Pt]=h.useState(!1),[Ke,ct]=h.useState(""),[Nt,Ht]=h.useState(""),[Rt,hn]=h.useState(!0),[yn,Cn]=h.useState(!1),[En,Rn]=h.useState(!1),[Mn,Yn]=h.useState(!1),[Zn,Vn]=h.useState(!1),[tr,Sn]=h.useState(!1),[ze,xe]=h.useState(""),[Ge,_e]=h.useState(!0),[Be,qt]=h.useState("Hour"),[It,mt]=h.useState("Limit"),[Ft,Tn]=h.useState("Limit"),kn="https://dextrabothypev2.nftinit.io",Gt="";h.useEffect(()=>{async function bt(){if(t)try{const ur=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=paradex")).json();if(ur!=null&&ur.coins){const gr=[...ur.coins].sort((Br,Gr)=>(Gr.maxLeverage||0)-(Br.maxLeverage||0)),br=gr==null?void 0:gr.map(Br=>{const Lt=`https://app.paradex.trade/static/market/${(Br==null?void 0:Br.label)||""}.svg`;return{...Br,icon:Lt}});st(br)}}catch(rn){console.error("Failed to fetch coin list:",rn)}}bt()},[t]);const mn=bt=>{var rn;return((rn=dt.find(ur=>ur.value===bt))==null?void 0:rn.maxLeverage)??100},gt=bt=>{["e","E","+","-"].includes(bt.key)&&bt.preventDefault()},Wt=bt=>/^\d*\.?\d{0,6}$/.test(bt),jn=bt=>/^\d*$/.test(bt),kt=h.useMemo(()=>{if(at==="")return!1;const bt=Number(at);return Number.isInteger(bt)&&bt>=1&&bt<=180},[at]),cn=h.useMemo(()=>{if(qe==="")return!1;const bt=Number(qe),rn=mn(Qe);return Number.isInteger(bt)&&bt>=1&&bt<=rn},[qe,Qe,dt]),Ce=h.useMemo(()=>{if(vn==="")return!1;const bt=Number(vn);return Number.isNaN(bt)?!1:bt===0?!0:bt>=1&&bt<=1e7},[vn]),m=h.useMemo(()=>{if(ln==="")return!1;const bt=Number(ln);if(Number.isNaN(bt))return!1;const rn=qe===""?null:Number(qe),ur=rn?rn*100-1:4999;return bt===0?!0:bt>0&&bt<1?!1:bt>=1&&bt<=ur},[ln,qe]);h.useMemo(()=>{if(dn==="")return!1;const bt=Number(dn);return!Number.isNaN(bt)&&bt>0&&bt<=100},[dn]);const p=g&&H.trim()!==""&&we.trim()!==""&&Qe!==""&&kt&&cn&&(!vn||Ce)&&(!ln||m)&&(yt==="LONG"||yt==="SHORT"||yt==="RANDOM")&&(jt==="LIMIT"||jt==="MARKET"||jt==="HYBRID")&&Ge,N=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),A=()=>`paradexCreds:${N()}`,k=()=>{try{const bt=localStorage.getItem(A());if(!bt)return;const rn=JSON.parse(bt);rn.privateKey&&ee(rn.privateKey),rn.paradexAddress&&je(rn.paradexAddress),typeof rn.remember=="boolean"&&hn(rn.remember)}catch{}},P=()=>{if(Rt)try{localStorage.setItem(A(),JSON.stringify({privateKey:H,paradexAddress:we,remember:!0}))}catch{}},D=()=>{try{localStorage.removeItem(A())}catch{}};h.useEffect(()=>{if(!t)return;const bt=localStorage.getItem("hyperToken"),rn=localStorage.getItem("hyperAddress");y(!!(bt&&rn));const ur=setInterval(()=>{const gr=localStorage.getItem("hyperToken"),br=localStorage.getItem("hyperAddress");y(!!(gr&&br))},800);return()=>clearInterval(ur)},[t]),h.useEffect(()=>{!t||!g||(V(),it())},[t,g]),h.useEffect(()=>{t&&(ln===""&&Nn(Gt),vn===""&&Hn(Gt),dn===""&&rt(Gt))},[t]),h.useEffect(()=>{if(!Qe)return;const bt=mn(Qe),rn=Number(qe);!Number.isNaN(rn)&&rn>bt&&vt(String(bt)),!Number.isNaN(rn)&&rn<1&&qe!==""&&vt("1")},[Qe]),h.useEffect(()=>{t&&(Rt&&P(),Rt||D())},[H,we,Rt,t]);async function V(){var bt,rn,ur,gr,br,Br,Gr,Or;try{Jt(!0),ct("");const Lt=window.localStorage.getItem("hyperToken"),nn=window.localStorage.getItem("hyperAddress");if(!Lt||!nn){C(!1),k();return}const en=await(await fetch(`${kn}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:nn.toLowerCase(),token:Lt})})).json();if(!(en!=null&&en.success)){if(console.warn("INFO API RESPONSE:",en==null?void 0:en.error_message),(en==null?void 0:en.error_message)==="You have not a running process"){const Fn=G?G.toLowerCase().replace("-","_"):null,yr=O==null?void 0:O[Fn];if(Fn&&yr){const hr={...O,[Fn]:{...yr,isStop:!0}};U(hr);const Ct=Object.keys(hr).filter(On=>On.startsWith("paradex"));if(Ct.length>0&&!G){const _r=Ct.sort((jr,Fr)=>{var Yr,dr;const nr=parseInt(((Yr=jr.match(/\d+/))==null?void 0:Yr[0])||0,10),vr=parseInt(((dr=Fr.match(/\d+/))==null?void 0:dr[0])||0,10);return nr-vr})[0].match(/\d+/);_r&&ie(`Paradex-${_r[0]}`)}}else ie("Paradex-1")}en!=null&&en.slots_info&&($((rn=(bt=en==null?void 0:en.slots_info)==null?void 0:bt.paradex)==null?void 0:rn.total_qty),L((gr=(ur=en==null?void 0:en.slots_info)==null?void 0:ur.paradex)==null?void 0:gr.active_qty));return}if(en!=null&&en.success&&(en!=null&&en.data)){const Fn=G?G.toLowerCase().replace("-","_"):null,yr=O==null?void 0:O[Fn],hr=en.data||{};Fn&&!hr[Fn]&&yr&&(hr[Fn]={...yr,isStop:!0}),U(hr);const Ct=Object.keys(hr).filter(On=>On.startsWith("paradex"));if(Ct.length>0&&!G){const _r=Ct.sort((jr,Fr)=>{var Yr,dr;const nr=parseInt(((Yr=jr.match(/\d+/))==null?void 0:Yr[0])||0,10),vr=parseInt(((dr=Fr.match(/\d+/))==null?void 0:dr[0])||0,10);return nr-vr})[0].match(/\d+/);_r&&ie(`Paradex-${_r[0]}`)}en!=null&&en.slots_info&&($((Br=(br=en==null?void 0:en.slots_info)==null?void 0:br.paradex)==null?void 0:Br.total_qty),L((Or=(Gr=en==null?void 0:en.slots_info)==null?void 0:Gr.paradex)==null?void 0:Or.active_qty))}}catch{C(!1),k(),K("OFF")}finally{Jt(!1)}}const Z=h.useMemo(()=>G?G.toLowerCase().replace("-","_"):"",[G]),ce=!!((An=O==null?void 0:O[Z])!=null&&An.delta)&&!!((or=O==null?void 0:O[Z])!=null&&or.from_slot),ue=ce?`paradex_${($t=O==null?void 0:O[Z])==null?void 0:$t.from_slot}`:Z;h.useEffect(()=>{var ur,gr,br,Br,Gr,Or,Lt,nn,Ot,en;if(!G||!O)return;const bt=ue,rn=O==null?void 0:O[bt];if(!rn){ee(""),je(""),Ye(""),He(""),vt(""),Kt("LONG"),un("LIMIT"),mt("Limit"),Tn("Limit"),C(!1),K("OFF"),qt("Hour"),Hn(""),Nn(""),q("paradex");return}if((rn==null?void 0:rn.target_params)==null&&rn.source_params){rn!=null&&rn.isStop?C(!1):C(!0),K("OFF");const Fn=rn.source_params,yr=(rn==null?void 0:rn.slot_number)??"";yr&&!ce&&ie(`Paradex-${yr}`),Fn!=null&&Fn.cycleSeconds&&qt((Fn==null?void 0:Fn.cycleSeconds)===86400?"Day":"Hour"),Fn!=null&&Fn.tp_type&&mt(String(Fn==null?void 0:Fn.tp_type).toUpperCase()==="MARKET"?"Market":"Limit"),Fn!=null&&Fn.sl_type&&Tn(String(Fn==null?void 0:Fn.sl_type).toUpperCase()==="MARKET"?"Market":"Limit");const hr=(Fn==null?void 0:Fn.paradex_pkey)??"",lt=(Fn==null?void 0:Fn.paradex_address)??"";if(hr&&ee(String(hr)),lt&&je(String(lt)),Fn!=null&&Fn.coin){const Ct=String(Fn.coin).replace(/-USD$/,"");Ye(Ct)}(Fn==null?void 0:Fn.orderPerHour)!=null&&He(String(Fn.orderPerHour)),(Fn==null?void 0:Fn.leverage)!=null&&vt(String(Fn.leverage)),Fn!=null&&Fn.direction&&Kt(String(Fn.direction).toUpperCase()==="SHORT"?"SHORT":String(Fn.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),Fn!=null&&Fn.orderType&&un(String(Fn.orderType).toUpperCase()==="MARKET"?"MARKET":String(Fn.orderType).toUpperCase()==="LIMIT"?"LIMIT":"HYBRID"),(Fn==null?void 0:Fn.tp)!=null&&Hn(String(Fn.tp)),(Fn==null?void 0:Fn.sl)!=null&&Nn(String(Fn.sl))}else if((rn==null?void 0:rn.target_params)!==null){rn!=null&&rn.isStop?C(!1):C(!0),K("OFF");const Fn=(rn==null?void 0:rn.slot_number)??"";Fn&&!ce&&ie(`Paradex-${Fn}`),(ur=rn==null?void 0:rn.source_params)!=null&&ur.coin&&Ye(String((gr=rn==null?void 0:rn.source_params)==null?void 0:gr.coin)),((br=rn==null?void 0:rn.source_params)==null?void 0:br.orderPerHour)!=null&&He(String((Br=rn==null?void 0:rn.source_params)==null?void 0:Br.orderPerHour)),((Gr=rn==null?void 0:rn.source_params)==null?void 0:Gr.leverage)!=null&&vt(String((Or=rn==null?void 0:rn.source_params)==null?void 0:Or.leverage)),(Lt=rn==null?void 0:rn.source_params)!=null&&Lt.accountType&&setStatusType(((nn=rn==null?void 0:rn.source_params)==null?void 0:nn.accountType)==="standart"?"STANDARD":"PREMIUM"),(Ot=rn==null?void 0:rn.target_params)!=null&&Ot.accountType&&setStatusTypeTwo(((en=rn==null?void 0:rn.target_params)==null?void 0:en.accountType)==="standart"?"STANDARD":"PREMIUM"),rn!=null&&rn.target_app&&q(((rn==null?void 0:rn.target_app)==="paradex","paradex"))}else C(!1),K("OFF")},[G,O,ce,ue]);const me=bt=>{var rn;return Number(((rn=String(bt||"").match(/\d+/))==null?void 0:rn[0])||0)},Ne=bt=>(bt||"").toLowerCase().replace("-","_"),Ie=h.useMemo(()=>{const bt=O==null?void 0:O[Ne(G)];if(bt!=null&&bt.delta&&(bt!=null&&bt.from_slot))return Number(bt.from_slot);const rn=Number(bt==null?void 0:bt.slot_number);return Number.isFinite(rn)?rn:me(G)},[G,O]),Le=h.useMemo(()=>{const bt=Number(S)||0,rn=Array.from({length:bt},()=>({used:!1,kind:null})),ur=O||{};for(const[gr,br]of Object.entries(ur)){if(!gr.startsWith("paradex"))continue;const Br=me(gr)-1;Br<0||Br>=bt||((br==null?void 0:br.isStop)===!0?rn[Br]={used:!1,kind:null}:br!=null&&br.source_params?rn[Br]={used:!0,kind:"delta-src"}:br!=null&&br.target_params||br!=null&&br.delta?rn[Br]={used:!0,kind:"delta-shadow"}:br!=null&&br.farming_params?rn[Br]={used:!0,kind:"single"}:rn[Br]={used:!0,kind:"unknown"})}return rn},[O,S]),Xe=h.useMemo(()=>Le.map((bt,rn)=>bt.used&&bt.kind!=="delta-src-inferred"?`Paradex-${rn+1}`:null).filter(Boolean),[Le]);h.useMemo(()=>Le.filter(bt=>!bt.used).length,[Le]);async function Oe(){if(!g){n(!0);return}if(p)try{xt(!0),ct("");const bt=window.localStorage.getItem("hyperToken"),rn=window.localStorage.getItem("hyperAddress");if(!bt||!rn){n(!0);return}const ur={paradex_address:we,paradex_pkey:H,cycleSeconds:Be==="Hour"?3600:86400,tp_type:It.toUpperCase(),sl_type:Ft.toUpperCase(),tp:Number(vn),sl:Number(ln),coin:`${Qe}`,orderPerHour:Number(at),leverage:Number(qe),direction:yt,orderType:jt},gr={api_pkey:se,login_wallet:Fe,coin:Qe==null?void 0:Qe.replace("USDT",""),orderPerHour:Number(at),leverage:Number(qe)},br={address:rn.toLowerCase(),token:bt,slot_number:Number(G==null?void 0:G.replace("Paradex-","")),source_app:"paradex",source_params:ur},Gr=await(await fetch(`${kn}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(br)})).json();Gr!=null&&Gr.success?(C(!0),V(),Rt&&P()):ct((Gr==null?void 0:Gr.error_message)||"Start failed.")}catch(bt){ct(bt.message||"An error occurred while saving.")}finally{xt(!1)}}async function $e(){if(!g){n(!0);return}try{Pt(!0),ct("");const bt=window.localStorage.getItem("hyperToken"),rn=window.localStorage.getItem("hyperAddress");if(!bt||!rn){n(!0);return}const gr=await(await fetch(`${kn}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:rn.toLowerCase(),token:bt,source_app:"paradex",slot_number:Ie})})).json();gr!=null&&gr.success?(C(!1),V()):ct((gr==null?void 0:gr.error_message)||"Stop failed.")}catch(bt){ct(bt.message||"An error occurred while stopping.")}finally{Pt(!1)}}const ae={control:(bt,rn)=>({...bt,backgroundColor:"#242424",borderColor:rn.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:bt=>({...bt,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:bt=>({...bt,height:32}),input:bt=>({...bt,color:"#FFFFFF",margin:0,padding:0}),singleValue:bt=>({...bt,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:bt=>({...bt,color:"#7F7F7F",fontSize:"12px"}),menu:bt=>({...bt,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:bt=>({...bt,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(bt,rn)=>({...bt,backgroundColor:rn.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:bt=>({...bt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:bt=>({...bt,backgroundColor:"#353535"})},he=({max:bt})=>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:[bt,"x"]}),Pe=bt=>{var rn;return i.jsx(ba.Option,{...bt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(rn=bt.data)!=null&&rn.icon?i.jsx("img",{src:bt.data.icon,alt:bt.data.label,className:"w-4 h-4 rounded-[4px]",onError:ur=>ur.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:bt.data.label}),i.jsx(he,{max:bt.data.maxLeverage})]})})},Ve=bt=>{var rn;return i.jsx(ba.SingleValue,{...bt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(rn=bt.data)!=null&&rn.icon?i.jsx("img",{src:bt.data.icon,alt:bt.data.label,className:"w-4 h-4 rounded-[4px]",onError:ur=>ur.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:bt.data.label}),i.jsx(he,{max:bt.data.maxLeverage})]})})},Te=bt=>{const rn=Xe.includes(bt.data.value);return i.jsx(ba.Option,{...bt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:bt.data.label}),rn&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},Ze=bt=>i.jsx(ba.SingleValue,{...bt,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:bt.data.label})})}),it=async()=>{var ur,gr,br,Br,Gr,Or,Lt,nn;const bt=window.localStorage.getItem("hyperToken"),rn=window.localStorage.getItem("hyperAddress");if(!(!bt||!rn))try{Ut(!0);const Ot=await bi(rn.toLowerCase(),bt);Ot!=null&&Ot.success?(r(Ot==null?void 0:Ot.telegram_chat_id),s(Ot==null?void 0:Ot.subscriber_role),a(Ot==null?void 0:Ot.subs_expire_day),o((ur=Ot==null?void 0:Ot.mushboomer_counts)==null?void 0:ur.eth),l((gr=Ot==null?void 0:Ot.mushboomer_counts)==null?void 0:gr.sol),c(Ot==null?void 0:Ot.referral_code),u(Ot==null?void 0:Ot.refcode),d(Ot==null?void 0:Ot.whitelist),f(bt),x(rn),_e(!0),T((Br=(br=Ot==null?void 0:Ot.slots_info)==null?void 0:br.paradex)==null?void 0:Br.total_qty),$((Or=(Gr=Ot==null?void 0:Ot.slots_info)==null?void 0:Gr.paradex)==null?void 0:Or.total_qty),L((nn=(Lt=Ot==null?void 0:Ot.slots_info)==null?void 0:Lt.paradex)==null?void 0:nn.active_qty),Ut(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),Ut(!1))}catch(Ot){console.error("Token verification error:",Ot),console.error(Ot.message||"An unknown error occurred."),Ut(!1)}},wt=dt,Dt=h.useMemo(()=>Array.from({length:S},(bt,rn)=>({value:`Paradex-${rn+1}`,label:`Paradex-${rn+1}`})),[S]);if(!t)return null;const Qt=wn||Vt||We||nt,xn=v&&!We,pn=mn(Qe);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:tr,setOpen:Sn,transactionHash:ze,transactionLoading:Zn,paymentPresaleRole:Ge,errorFunds:Nt,activeMethod:2}),i.jsx(D5,{open:te,setOpen:fe,paymentLighterRole:Ge,oldSlotCount:Y,checkAccountLighter:it,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:()=>!Qt&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(O2,{current:"paradex",onCloseCurrent:()=>!Qt&&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(lDe,{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:j2,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:[Ke&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:Ke}),g&&Ge&&F===I&&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&&Ge&&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(E5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[I||0,"/",Dt.length]})]})]}),i.jsx(pl,{styles:ae,components:{Option:Te,SingleValue:Ze},options:Dt,value:Dt.find(bt=>bt.value===G)||null,onChange:bt=>ie((bt==null?void 0:bt.value)??""),placeholder:"Select",isSearchable:!0})]})}),i.jsxs("div",{className:`${oe==="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:[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 Stark Key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:we,onChange:bt=>je(bt.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] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Qt||xn})})]}),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:H,onChange:bt=>ee(bt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",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] ${H===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Qt||xn}),i.jsx("button",{type:"button",onClick:()=>Cn(bt=>!bt),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:Qt||xn,children:yn?i.jsx(la,{size:14}):i.jsx(ca,{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:Se,onChange:bt=>{const rn=bt.target.value.trim();if(rn==="")return ge("");jn(rn)&&ge(rn)},onKeyDown:gt,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] ${Se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Qt||xn})})]})]}):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:we,onChange:bt=>je(bt.target.value),autoComplete:"off",placeholder:"PARADEX_ADDRESS",type:En?"text":"password",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:Qt||xn}),i.jsx("button",{type:"button",onClick:()=>Rn(bt=>!bt),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:Qt||xn,children:En?i.jsx(la,{size:14}):i.jsx(ca,{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(HOe,{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:H,onChange:bt=>ee(bt.target.value),autoComplete:"off",placeholder:"PARADEX_PRIVATE_KEY",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] ${H===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Qt||xn}),i.jsx("button",{type:"button",onClick:()=>Cn(bt=>!bt),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:Qt||xn,children:yn?i.jsx(la,{size:14}):i.jsx(ca,{size:14})})]})]})]}),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 Stark key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Fe,onChange:bt=>Re(bt.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] ${Fe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Qt||xn})})]}),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:se,onChange:bt=>pe(bt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:Mn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Qt||xn}),i.jsx("button",{type:"button",onClick:()=>Yn(bt=>!bt),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:Qt||xn,children:Mn?i.jsx(la,{size:14}):i.jsx(ca,{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:ve,onChange:bt=>{const rn=bt.target.value.trim();if(rn==="")return be("");jn(rn)&&be(rn)},onKeyDown:gt,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] ${ve===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Qt||xn})})]})]})]}),i.jsx("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.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:at,onChange:bt=>{const rn=bt.target.value.trim();if(rn==="")return He("");jn(rn)&&He(rn)},onKeyDown:gt,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] ${at===""?"border-[#353535]":kt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Qt||xn}),at!==""&&!kt&&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(pl,{styles:ae,components:{Option:Pe,SingleValue:Ve},isDisabled:Qt||xn,options:wt,value:wt.find(bt=>bt.value===Qe)||null,onChange:bt=>Ye((bt==null?void 0:bt.value)??""),placeholder:"Select",isSearchable:!0})]}),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:Be,onChange:bt=>qt(bt.target.value),className:`${Qt||xn?"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:Qt||xn,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:at,onChange:bt=>{const rn=bt.target.value.trim();if(rn==="")return He("");jn(rn)&&He(rn)},onKeyDown:gt,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] ${at===""?"border-[#353535]":kt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Qt||xn}),at!==""&&!kt&&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:`${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(Oo,{checked:oe==="ON",onChange:bt=>K(bt?"ON":"OFF"),disabled:Qt||xn,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 ${Qt||xn?"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:qe,onChange:bt=>{const rn=bt.target.value.trim();if(rn==="")return vt("");jn(rn)&&vt(rn)},onKeyDown:gt,inputMode:"numeric",autoComplete:"off",placeholder:Qe?`1–${pn}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${qe===""?"border-[#353535]":cn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Qt||xn})]})]}),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.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":yt==="LONG",onClick:()=>!xn&&Kt("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",Qt||xn?"cursor-not-allowed":"cursor-pointer",yt==="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",qe?` - ${qe}x`:""]})}),i.jsx("div",{"aria-pressed":yt==="SHORT",onClick:()=>!xn&&Kt("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",Qt||xn?"cursor-not-allowed":"cursor-pointer",yt==="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",qe?` - ${qe}x`:""]})}),i.jsx("div",{"aria-pressed":yt==="RANDOM",onClick:()=>!xn&&Kt("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",Qt||xn?"cursor-not-allowed":"cursor-pointer",yt==="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",qe?` - ${qe}x`:""]})})]})]}),i.jsxs("div",{className:`${oe==="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":jt==="LIMIT",onClick:()=>!xn&&un("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",Qt||xn?"cursor-not-allowed":"cursor-pointer",jt==="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 ",jt==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":jt==="HYBRID",onClick:()=>!xn&&un("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",Qt||xn?"cursor-not-allowed":"cursor-pointer",jt==="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 ",jt==="HYBRID"?" ✓":""]})}),i.jsx("button",{"aria-pressed":jt==="MARKET",onClick:()=>!xn&&un("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",Qt||xn?"cursor-not-allowed":"cursor-pointer",jt==="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 ",jt==="MARKET"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:`${oe==="ON"?"hidden":""} 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 justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("select",{value:It,onChange:bt=>mt(bt.target.value),className:`${Qt||xn?"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:Qt||xn,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:vn,onChange:bt=>{const rn=bt.target.value.trim();if(rn==="")return Hn("");Wt(rn)&&Hn(rn)},onKeyDown:gt,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] ${vn===""?"border-[#353535]":Ce?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Qt||xn})]}),vn!==""&&!Ce&&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:`${oe==="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:Ft,onChange:bt=>Tn(bt.target.value),className:`${Qt||xn?"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:Qt||xn,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:ln,onChange:bt=>{const rn=bt.target.value.trim();if(rn==="")return Nn("");Wt(rn)&&Nn(rn)},onKeyDown:gt,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] ${ln===""?"border-[#353535]":m?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Qt||xn})]}),ln!==""&&!m&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",qe?Math.max(qe*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),!1]}),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:()=>!Qt&&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:Qt,children:"Cancel"}),g?oe==="ON"?v?i.jsx("button",{onClick:$e,disabled:Qt,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:We?"Stopping...":"Stop"}):i.jsx("button",{onClick:Oe,disabled:!p||Qt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!p||Qt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Vt?"Starting...":"Start"}):v?i.jsx("button",{onClick:$e,disabled:Qt,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:We?"Stopping...":"Stop"}):i.jsx("button",{onClick:Oe,disabled:!p||Qt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!p||Qt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Vt?"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"})]})}),wn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},Uce=({open:t=!1,setOpen:e=()=>{}})=>{var pn,An,or;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=h.useContext(Qr);ds();const[g,y]=h.useState(!1),[v,C]=h.useState(!1),[S,T]=h.useState(1),[I,L]=h.useState(0),[F,$]=h.useState(0),[O,U]=h.useState({}),[Y,re]=h.useState(null),[Q,q]=h.useState("pacifica");h.useState(!1),h.useRef(null);const[te,fe]=h.useState(!1),[G,ie]=h.useState(""),[oe,K]=h.useState("OFF"),[H,ee]=h.useState(""),[se,pe]=h.useState(""),[Se,ge]=h.useState("");h.useState("");const[ve,be]=h.useState(""),[we,je]=h.useState(""),[Fe,Re]=h.useState(""),[Qe,Ye]=h.useState(""),[dt,st]=h.useState([]),[at,He]=h.useState(""),[qe,vt]=h.useState(""),[yt,Kt]=h.useState("LONG"),[jt,un]=h.useState("LIMIT"),[vn,Hn]=h.useState(""),[ln,Nn]=h.useState(""),[dn,rt]=h.useState(""),[nt,Ut]=h.useState(!1),[wn,Jt]=h.useState(!1),[Vt,xt]=h.useState(!1),[We,Pt]=h.useState(!1),[Ke,ct]=h.useState(""),[Nt,Ht]=h.useState(""),[Rt,hn]=h.useState(!0),[yn,Cn]=h.useState(!1),[En,Rn]=h.useState(!1),[Mn,Yn]=h.useState(!1),[Zn,Vn]=h.useState(!1),[tr,Sn]=h.useState(""),[ze,xe]=h.useState(!0),[Ge,_e]=h.useState("Hour"),[Be,qt]=h.useState("Limit"),[It,mt]=h.useState("Limit"),Ft="https://dextrabothypev2.nftinit.io",Tn="";h.useEffect(()=>{async function $t(){if(t)try{const rn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=pacifica")).json();if(rn!=null&&rn.coins){let ur=rn.coins.map(gr=>{const Gr=`https://app.pacifica.fi/imgs/tokens/${(gr==null?void 0:gr.label)||""}.svg`;return{...gr,icon:Gr}});st(ur)}}catch(bt){console.error("Failed to fetch coin list:",bt)}}$t()},[t]);const kn=$t=>{var bt;return((bt=dt.find(rn=>rn.value===$t))==null?void 0:bt.maxLeverage)??100},Gt=$t=>{["e","E","+","-"].includes($t.key)&&$t.preventDefault()},mn=$t=>/^\d*\.?\d{0,6}$/.test($t),gt=$t=>/^\d*$/.test($t),Wt=h.useMemo(()=>{if(at==="")return!1;const $t=Number(at);return Number.isInteger($t)&&$t>=1&&$t<=180},[at]),jn=h.useMemo(()=>{if(qe==="")return!1;const $t=Number(qe),bt=kn(Qe);return Number.isInteger($t)&&$t>=1&&$t<=bt},[qe,Qe,dt]),kt=h.useMemo(()=>{const $t=H.trim();return $t?$t.length>86:!1},[H]),cn=h.useMemo(()=>{if(vn==="")return!1;const $t=Number(vn);return Number.isNaN($t)?!1:$t===0?!0:$t>=1&&$t<=1e7},[vn]),Ce=h.useMemo(()=>{if(ln==="")return!1;const $t=Number(ln);if(Number.isNaN($t))return!1;const bt=qe===""?null:Number(qe),rn=bt?bt*100-1:4999;return $t===0?!0:$t>0&&$t<1?!1:$t>=1&&$t<=rn},[ln,qe]);h.useMemo(()=>{if(dn==="")return!1;const $t=Number(dn);return!Number.isNaN($t)&&$t>0&&$t<=100},[dn]);const m=g&&H.trim()!==""&&we.trim()!==""&&Qe!==""&&Wt&&jn&&G&&(!vn||cn)&&(!ln||Ce)&&(yt==="LONG"||yt==="SHORT"||yt==="RANDOM")&&(jt==="LIMIT"||jt==="MARKET"||jt==="HYBRID")&&kt&&ze,p=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),N=()=>`pacificaCreds:${p()}`,A=()=>{try{const $t=localStorage.getItem(N());if(!$t)return;const bt=JSON.parse($t);bt.privateKey&&ee(bt.privateKey),bt.loginAddress&&je(bt.loginAddress),typeof bt.remember=="boolean"&&hn(bt.remember)}catch{}},k=()=>{if(Rt)try{localStorage.setItem(N(),JSON.stringify({privateKey:H,loginAddress:we,remember:!0}))}catch{}},P=()=>{try{localStorage.removeItem(N())}catch{}};h.useEffect(()=>{if(!t)return;const $t=localStorage.getItem("hyperToken"),bt=localStorage.getItem("hyperAddress");y(!!($t&&bt));const rn=setInterval(()=>{const ur=localStorage.getItem("hyperToken"),gr=localStorage.getItem("hyperAddress");y(!!(ur&&gr))},800);return()=>clearInterval(rn)},[t]),h.useEffect(()=>{!t||!g||(D(),Ze())},[t,g]),h.useEffect(()=>{t&&(ln===""&&Nn(Tn),vn===""&&Hn(Tn),dn===""&&rt(Tn))},[t]),h.useEffect(()=>{if(!Qe)return;const $t=kn(Qe),bt=Number(qe);!Number.isNaN(bt)&&bt>$t&&vt(String($t)),!Number.isNaN(bt)&&bt<1&&qe!==""&&vt("1")},[Qe]),h.useEffect(()=>{t&&(Rt&&k(),Rt||P())},[H,we,Rt,t]);async function D(){var $t,bt,rn,ur,gr,br,Br,Gr;try{Jt(!0),ct("");const Or=window.localStorage.getItem("hyperToken"),Lt=window.localStorage.getItem("hyperAddress");if(!Or||!Lt){C(!1),A();return}const Ot=await(await fetch(`${Ft}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Lt.toLowerCase(),token:Or})})).json();if(!(Ot!=null&&Ot.success)){if(console.warn("INFO API RESPONSE:",Ot==null?void 0:Ot.error_message),(Ot==null?void 0:Ot.error_message)==="You have not a running process"){const en=G?G.toLowerCase().replace("-","_"):null,Fn=O==null?void 0:O[en];if(en&&Fn){const yr={...O,[en]:{...Fn,isStop:!0}};U(yr);const lt=Object.keys(yr).filter(Ct=>Ct.startsWith("pacifica"));if(lt.length>0&&!G){const qn=lt.sort((_r,jr)=>{var vr,Yr;const Fr=parseInt(((vr=_r.match(/\d+/))==null?void 0:vr[0])||0,10),nr=parseInt(((Yr=jr.match(/\d+/))==null?void 0:Yr[0])||0,10);return Fr-nr})[0].match(/\d+/);qn&&ie(`Pacifica-${qn[0]}`)}}else ie("Pacifica-1")}Ot!=null&&Ot.slots_info&&($((bt=($t=Ot==null?void 0:Ot.slots_info)==null?void 0:$t.pacifica)==null?void 0:bt.total_qty),L((ur=(rn=Ot==null?void 0:Ot.slots_info)==null?void 0:rn.pacifica)==null?void 0:ur.active_qty));return}if(Ot!=null&&Ot.success&&(Ot!=null&&Ot.data)){const en=G?G.toLowerCase().replace("-","_"):null,Fn=O==null?void 0:O[en],yr=Ot.data||{};en&&!yr[en]&&Fn&&(yr[en]={...Fn,isStop:!0}),U(yr);const lt=Object.keys(yr).filter(Ct=>Ct.startsWith("pacifica"));if(lt.length>0&&!G){const qn=lt.sort((_r,jr)=>{var vr,Yr;const Fr=parseInt(((vr=_r.match(/\d+/))==null?void 0:vr[0])||0,10),nr=parseInt(((Yr=jr.match(/\d+/))==null?void 0:Yr[0])||0,10);return Fr-nr})[0].match(/\d+/);qn&&ie(`Pacifica-${qn[0]}`)}Ot!=null&&Ot.slots_info&&($((br=(gr=Ot==null?void 0:Ot.slots_info)==null?void 0:gr.pacifica)==null?void 0:br.total_qty),L((Gr=(Br=Ot==null?void 0:Ot.slots_info)==null?void 0:Br.pacifica)==null?void 0:Gr.active_qty))}}catch{C(!1),A(),K("OFF")}finally{Jt(!1)}}const V=h.useMemo(()=>G?G.toLowerCase().replace("-","_"):"",[G]),Z=!!((pn=O==null?void 0:O[V])!=null&&pn.delta)&&!!((An=O==null?void 0:O[V])!=null&&An.from_slot),ce=Z?`pacifica_${(or=O==null?void 0:O[V])==null?void 0:or.from_slot}`:V;h.useEffect(()=>{var rn,ur,gr,br,Br,Gr,Or,Lt,nn,Ot;if(!G||!O)return;const $t=ce,bt=O==null?void 0:O[$t];if(!bt){ee(""),je(""),Ye(""),He(""),vt(""),Kt("LONG"),un("LIMIT"),C(!1),K("OFF"),_e("Hour"),qt("Limit"),mt("Limit"),Hn(""),Nn(""),q("pacifica");return}if((bt==null?void 0:bt.target_params)==null&&bt.source_params){bt!=null&&bt.isStop?C(!1):C(!0),K("OFF");const en=bt.source_params,Fn=(bt==null?void 0:bt.slot_number)??"";Fn&&!Z&&ie(`Pacifica-${Fn}`),en!=null&&en.cycleSeconds&&_e((en==null?void 0:en.cycleSeconds)===86400?"Day":"Hour"),en!=null&&en.tp_type&&qt(String(en==null?void 0:en.tp_type).toUpperCase()==="MARKET"?"Market":"Limit"),en!=null&&en.sl_type&&mt(String(en==null?void 0:en.sl_type).toUpperCase()==="MARKET"?"Market":"Limit");const yr=(en==null?void 0:en.agent_pkey)??"",hr=(en==null?void 0:en.login_address)??"";if(yr&&ee(String(yr)),hr&&je(String(hr)),en!=null&&en.coin){const lt=String(en.coin);Ye(lt)}(en==null?void 0:en.orderPerHour)!=null&&He(String(en.orderPerHour)),(en==null?void 0:en.leverage)!=null&&vt(String(en.leverage)),en!=null&&en.direction&&Kt(String(en.direction).toUpperCase()==="SHORT"?"SHORT":String(en.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),en!=null&&en.orderType&&un(String(en.orderType).toUpperCase()==="MARKET"?"MARKET":String(en.orderType).toUpperCase()==="LIMIT"?"LIMIT":"HYBRID"),(en==null?void 0:en.tp)!=null&&Hn(String(en.tp)),(en==null?void 0:en.sl)!=null&&Nn(String(en.sl))}else if((bt==null?void 0:bt.target_params)!==null){bt!=null&&bt.isStop?C(!1):C(!0),K("OFF");const en=(bt==null?void 0:bt.slot_number)??"";en&&!Z&&ie(`Pacifica-${en}`),(rn=bt==null?void 0:bt.source_params)!=null&&rn.coin&&Ye(String((ur=bt==null?void 0:bt.source_params)==null?void 0:ur.coin)),((gr=bt==null?void 0:bt.source_params)==null?void 0:gr.orderPerHour)!=null&&He(String((br=bt==null?void 0:bt.source_params)==null?void 0:br.orderPerHour)),((Br=bt==null?void 0:bt.source_params)==null?void 0:Br.leverage)!=null&&vt(String((Gr=bt==null?void 0:bt.source_params)==null?void 0:Gr.leverage)),(Or=bt==null?void 0:bt.source_params)!=null&&Or.accountType&&setStatusType(((Lt=bt==null?void 0:bt.source_params)==null?void 0:Lt.accountType)==="standart"?"STANDARD":"PREMIUM"),(nn=bt==null?void 0:bt.target_params)!=null&&nn.accountType&&setStatusTypeTwo(((Ot=bt==null?void 0:bt.target_params)==null?void 0:Ot.accountType)==="standart"?"STANDARD":"PREMIUM"),bt!=null&&bt.target_app&&q(((bt==null?void 0:bt.target_app)==="pacifica","pacifica"))}else C(!1),K("OFF")},[G,O,Z,ce]);const ue=$t=>{var bt;return Number(((bt=String($t||"").match(/\d+/))==null?void 0:bt[0])||0)},me=$t=>($t||"").toLowerCase().replace("-","_"),Ne=h.useMemo(()=>{const $t=O==null?void 0:O[me(G)];if($t!=null&&$t.delta&&($t!=null&&$t.from_slot))return Number($t.from_slot);const bt=Number($t==null?void 0:$t.slot_number);return Number.isFinite(bt)?bt:ue(G)},[G,O]),Ie=h.useMemo(()=>{const $t=Number(S)||0,bt=Array.from({length:$t},()=>({used:!1,kind:null})),rn=O||{};for(const[ur,gr]of Object.entries(rn)){if(!ur.startsWith("pacifica"))continue;const br=ue(ur)-1;br<0||br>=$t||((gr==null?void 0:gr.isStop)===!0?bt[br]={used:!1,kind:null}:gr!=null&&gr.source_params?bt[br]={used:!0,kind:"delta-src"}:gr!=null&&gr.target_params||gr!=null&&gr.delta?bt[br]={used:!0,kind:"delta-shadow"}:gr!=null&&gr.farming_params?bt[br]={used:!0,kind:"single"}:bt[br]={used:!0,kind:"unknown"})}return bt},[O,S]),Le=h.useMemo(()=>Ie.map(($t,bt)=>$t.used&&$t.kind!=="delta-src-inferred"?`Pacifica-${bt+1}`:null).filter(Boolean),[Ie]);h.useMemo(()=>Ie.filter($t=>!$t.used).length,[Ie]);async function Xe(){if(!g){n(!0);return}if(m)try{xt(!0),ct("");const $t=window.localStorage.getItem("hyperToken"),bt=window.localStorage.getItem("hyperAddress");if(!$t||!bt){n(!0);return}const rn={login_address:we,agent_pkey:H,cycleSeconds:Ge==="Hour"?3600:86400,tp_type:Be.toUpperCase(),sl_type:It.toUpperCase(),tp:Number(vn),sl:Number(ln),coin:`${Qe}`,orderPerHour:Number(at),leverage:Number(qe),direction:yt,orderType:jt},ur={api_pkey:se,login_wallet:Fe,coin:Qe==null?void 0:Qe.replace("USDT",""),orderPerHour:Number(at),leverage:Number(qe)},gr={address:bt.toLowerCase(),token:$t,slot_number:Number(G==null?void 0:G.replace("Pacifica-","")),source_app:"pacifica",source_params:rn},Br=await(await fetch(`${Ft}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(gr)})).json();Br!=null&&Br.success?(C(!0),D(),Rt&&k()):ct((Br==null?void 0:Br.error_message)||"Start failed.")}catch($t){ct($t.message||"An error occurred while saving.")}finally{xt(!1)}}async function Oe(){if(!g){n(!0);return}try{Pt(!0),ct("");const $t=window.localStorage.getItem("hyperToken"),bt=window.localStorage.getItem("hyperAddress");if(!$t||!bt){n(!0);return}const ur=await(await fetch(`${Ft}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:bt.toLowerCase(),token:$t,source_app:"pacifica",slot_number:Ne})})).json();ur!=null&&ur.success?(C(!1),D()):ct((ur==null?void 0:ur.error_message)||"Stop failed.")}catch($t){ct($t.message||"An error occurred while stopping.")}finally{Pt(!1)}}const $e={control:($t,bt)=>({...$t,backgroundColor:"#242424",borderColor:bt.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:$t=>({...$t,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:$t=>({...$t,height:32}),input:$t=>({...$t,color:"#FFFFFF",margin:0,padding:0}),singleValue:$t=>({...$t,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:$t=>({...$t,color:"#7F7F7F",fontSize:"12px"}),menu:$t=>({...$t,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:$t=>({...$t,paddingTop:0,paddingBottom:0,maxHeight:200}),option:($t,bt)=>({...$t,backgroundColor:bt.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:$t=>({...$t,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:$t=>({...$t,backgroundColor:"#353535"})},ae=({max:$t})=>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:[$t,"x"]}),he=$t=>{var bt;return i.jsx(ba.Option,{...$t,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(bt=$t.data)!=null&&bt.icon?i.jsx("img",{src:$t.data.icon,alt:$t.data.label,className:"w-4 h-4 rounded-[4px]",onError:rn=>rn.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:$t.data.label}),i.jsx(ae,{max:$t.data.maxLeverage})]})})},Pe=$t=>{var bt;return i.jsx(ba.SingleValue,{...$t,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(bt=$t.data)!=null&&bt.icon?i.jsx("img",{src:$t.data.icon,alt:$t.data.label,className:"w-4 h-4 rounded-[4px]",onError:rn=>rn.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:$t.data.label}),i.jsx(ae,{max:$t.data.maxLeverage})]})})},Ve=$t=>{const bt=Le.includes($t.data.value);return i.jsx(ba.Option,{...$t,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:$t.data.label}),bt&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},Te=$t=>i.jsx(ba.SingleValue,{...$t,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:$t.data.label})})}),Ze=async()=>{var rn,ur,gr,br,Br,Gr,Or,Lt;const $t=window.localStorage.getItem("hyperToken"),bt=window.localStorage.getItem("hyperAddress");if(!(!$t||!bt))try{Ut(!0);const nn=await bi(bt.toLowerCase(),$t);nn!=null&&nn.success?(r(nn==null?void 0:nn.telegram_chat_id),s(nn==null?void 0:nn.subscriber_role),a(nn==null?void 0:nn.subs_expire_day),o((rn=nn==null?void 0:nn.mushboomer_counts)==null?void 0:rn.eth),l((ur=nn==null?void 0:nn.mushboomer_counts)==null?void 0:ur.sol),c(nn==null?void 0:nn.referral_code),u(nn==null?void 0:nn.refcode),d(nn==null?void 0:nn.whitelist),f($t),x(bt),xe(!0),T((br=(gr=nn==null?void 0:nn.slots_info)==null?void 0:gr.pacifica)==null?void 0:br.total_qty),$((Gr=(Br=nn==null?void 0:nn.slots_info)==null?void 0:Br.pacifica)==null?void 0:Gr.total_qty),L((Lt=(Or=nn==null?void 0:nn.slots_info)==null?void 0:Or.pacifica)==null?void 0:Lt.active_qty),Ut(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),Ut(!1))}catch(nn){console.error("Token verification error:",nn),console.error(nn.message||"An unknown error occurred."),Ut(!1)}},it=dt,wt=h.useMemo(()=>Array.from({length:S},($t,bt)=>({value:`Pacifica-${bt+1}`,label:`Pacifica-${bt+1}`})),[S]);if(!t)return null;const Dt=wn||Vt||We||nt,Qt=v&&!We,xn=kn(Qe);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:Zn,setOpen:Vn,transactionHash:tr,transactionLoading:Mn,paymentPresaleRole:ze,errorFunds:Nt,activeMethod:2}),i.jsx(D5,{open:te,setOpen:fe,paymentLighterRole:ze,oldSlotCount:Y,checkAccountLighter:Ze,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:()=>!Dt&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(O2,{current:"pacifica",onCloseCurrent:()=>!Dt&&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:j2,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:[Ke&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:Ke}),g&&ze&&F===I&&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&&ze&&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(E5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[I||0,"/",wt.length]})]})]}),i.jsx(pl,{styles:$e,components:{Option:Ve,SingleValue:Te},options:wt,value:wt.find($t=>$t.value===G)||null,onChange:$t=>ie(($t==null?void 0:$t.value)??""),placeholder:"Select",isSearchable:!0})]})}),i.jsxs("div",{className:`${oe==="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:[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 Stark Key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:we,onChange:$t=>je($t.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] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Dt||Qt})})]}),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:H,onChange:$t=>ee($t.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",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] ${H===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Dt||Qt}),i.jsx("button",{type:"button",onClick:()=>Cn($t=>!$t),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:Dt||Qt,children:yn?i.jsx(la,{size:14}):i.jsx(ca,{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:Se,onChange:$t=>{const bt=$t.target.value.trim();if(bt==="")return ge("");gt(bt)&&ge(bt)},onKeyDown:Gt,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] ${Se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Dt||Qt})})]})]}):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:we,onChange:$t=>je($t.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] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Dt||Qt})})]}),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:H,onChange:$t=>ee($t.target.value),autoComplete:"off",placeholder:"PACIFICA_PRIVATE_KEY",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] ${H===""?"border-[#353535]":kt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Dt||Qt}),i.jsx("button",{type:"button",onClick:()=>Cn($t=>!$t),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:Dt||Qt,children:yn?i.jsx(la,{size:14}):i.jsx(ca,{size:14})})]}),H!==""&&!kt&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Please enter a valid private key."})]})]}),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 Stark key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Fe,onChange:$t=>Re($t.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] ${Fe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Dt||Qt})})]}),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:se,onChange:$t=>pe($t.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",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] ${se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Dt||Qt}),i.jsx("button",{type:"button",onClick:()=>Rn($t=>!$t),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:Dt||Qt,children:En?i.jsx(la,{size:14}):i.jsx(ca,{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:ve,onChange:$t=>{const bt=$t.target.value.trim();if(bt==="")return be("");gt(bt)&&be(bt)},onKeyDown:Gt,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] ${ve===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Dt||Qt})})]})]})]}),H!==""&&!kt&&i.jsx("div",{children:i.jsx("img",{src:Ict,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:`${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:at,onChange:$t=>{const bt=$t.target.value.trim();if(bt==="")return He("");gt(bt)&&He(bt)},onKeyDown:Gt,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] ${at===""?"border-[#353535]":Wt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Dt||Qt}),at!==""&&!Wt&&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(pl,{styles:$e,components:{Option:he,SingleValue:Pe},isDisabled:Dt||Qt,options:it,value:it.find($t=>$t.value===Qe)||null,onChange:$t=>Ye(($t==null?void 0:$t.value)??""),placeholder:"Select",isSearchable:!0})]}),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:Ge,onChange:$t=>_e($t.target.value),className:`${Dt||Qt?"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:Dt||Qt,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:at,onChange:$t=>{const bt=$t.target.value.trim();if(bt==="")return He("");gt(bt)&&He(bt)},onKeyDown:Gt,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] ${at===""?"border-[#353535]":Wt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Dt||Qt}),at!==""&&!Wt&&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:`${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(Oo,{checked:oe==="ON",onChange:$t=>K($t?"ON":"OFF"),disabled:Dt||Qt,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 ${Dt||Qt?"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:qe,onChange:$t=>{const bt=$t.target.value.trim();if(bt==="")return vt("");gt(bt)&&vt(bt)},onKeyDown:Gt,inputMode:"numeric",autoComplete:"off",placeholder:Qe?`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] ${qe===""?"border-[#353535]":jn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Dt||Qt})]})]}),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.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":yt==="LONG",onClick:()=>!Qt&&Kt("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",Dt||Qt?"cursor-not-allowed":"cursor-pointer",yt==="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",qe?` - ${qe}x`:""]})}),i.jsx("div",{"aria-pressed":yt==="SHORT",onClick:()=>!Qt&&Kt("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",Dt||Qt?"cursor-not-allowed":"cursor-pointer",yt==="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",qe?` - ${qe}x`:""]})}),i.jsx("div",{"aria-pressed":yt==="RANDOM",onClick:()=>!Qt&&Kt("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",Dt||Qt?"cursor-not-allowed":"cursor-pointer",yt==="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",qe?` - ${qe}x`:""]})})]})]}),i.jsxs("div",{className:`${oe==="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":jt==="LIMIT",onClick:()=>!Qt&&un("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",Dt||Qt?"cursor-not-allowed":"cursor-pointer",jt==="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 ",jt==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":jt==="HYBRID",onClick:()=>!Qt&&un("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",Dt||Qt?"cursor-not-allowed":"cursor-pointer",jt==="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 ",jt==="HYBRID"?" ✓":""]})}),i.jsx("button",{"aria-pressed":jt==="MARKET",onClick:()=>!Qt&&un("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",Dt||Qt?"cursor-not-allowed":"cursor-pointer",jt==="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 ",jt==="MARKET"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:`${oe==="ON"?"hidden":""} 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:"Take Profit %"}),i.jsxs("select",{value:Be,onChange:$t=>qt($t.target.value),className:`${Dt||Qt?"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:Dt||Qt,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:vn,onChange:$t=>{const bt=$t.target.value.trim();if(bt==="")return Hn("");mn(bt)&&Hn(bt)},onKeyDown:Gt,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] ${vn===""?"border-[#353535]":cn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Dt||Qt})]}),vn!==""&&!cn&&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:`${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:"Stop Loss %"}),i.jsxs("select",{value:It,onChange:$t=>mt($t.target.value),className:`${Dt||Qt?"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:Dt||Qt,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:ln,onChange:$t=>{const bt=$t.target.value.trim();if(bt==="")return Nn("");mn(bt)&&Nn(bt)},onKeyDown:Gt,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] ${ln===""?"border-[#353535]":Ce?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Dt||Qt})]}),ln!==""&&!Ce&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",qe?Math.max(qe*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),!1]}),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:()=>!Dt&&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:Dt,children:"Cancel"}),g?oe==="ON"?v?i.jsx("button",{onClick:Oe,disabled:Dt,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:We?"Stopping...":"Stop"}):i.jsx("button",{onClick:Xe,disabled:!m||Dt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!m||Dt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Vt?"Starting...":"Start"}):v?i.jsx("button",{onClick:Oe,disabled:Dt,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:We?"Stopping...":"Stop"}):i.jsx("button",{onClick:Xe,disabled:!m||Dt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!m||Dt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Vt?"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"})]})}),wn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},SOt=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState(!1),[s,a]=h.useState(2),[o,l]=h.useState(!1),[c,u]=h.useState(!1),[d,f]=h.useState(!1),[x,g]=h.useState(!1),[y,v]=h.useState(!1),[C,S]=h.useState(!1),T=(I=[])=>I==null?void 0:I.map(L=>L.submenu?{...L,submenu:T(L.submenu)}:L.action==="openAster"?{...L,onClick:()=>{a(2),r(!0)}}:L.action==="openFarm"?{...L,onClick:()=>e(!0)}:L.action==="openLighter"?{...L,onClick:()=>l(!0)}:L.action==="openApex"?{...L,onClick:()=>u(!0)}:L.action==="openVariational"?{...L,onClick:()=>f(!0)}:L.action==="openExtended"?{...L,onClick:()=>g(!0)}:L.action==="openParadex"?{...L,onClick:()=>v(!0)}:L.action==="openPacifica"?{...L,onClick:()=>S(!0)}:L);return i.jsxs(i.Fragment,{children:[i.jsx(Ga,{to:"https://dextrabot.com/",className:"cursor-pointer",children:i.jsx("div",{className:"flex items-center gap-2 font-manrope",children:i.jsx("img",{src:Xj,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:Mct.map(I=>I.type==="link"?i.jsx(NOt,{linkTo:I.to,title:I.label,activePaths:I.activePaths},I.to):I.type==="dropdown"?i.jsx(Mlt,{label:I.label,items:T(I.items),activePaths:I.activePaths,badgeLabel:I.badgeLabel,badgeTone:I.badgeTone,border_color:I.border_color},I.label):null)}),i.jsx(Mce,{open:t,setOpen:e}),i.jsx(Lce,{open:n,setOpen:r,defaultMethod:s}),i.jsx(Rce,{open:o,setOpen:l}),i.jsx(Dce,{open:c,setOpen:u}),i.jsx(Bce,{open:d,setOpen:f}),i.jsx(MU,{open:x,setOpen:g}),i.jsx($ce,{open:y,setOpen:v}),i.jsx(Uce,{open:C,setOpen:S})]})},Vy=({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=rV:e&&t.target.src!==e?t.target.src=e:t.target.src!==rV&&(t.target.src=rV)},jOt=h.forwardRef(({setOpen:t},e)=>{const{searchTerminalCoin:n,isSearchTerminalError:r}=h.useContext(Qr),[s,a]=h.useState(""),[o,l]=h.useState([]),[c,u]=h.useState([]),[d,f]=h.useState([]),x={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};h.useEffect(()=>{const C=JSON.parse(localStorage.getItem("recentWallets")||"[]");l(C);const S=JSON.parse(localStorage.getItem("recentCoins")||"[]");u(S)},[]);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(),S=[C,...o.filter(T=>(T==null?void 0:T.toLowerCase())!==C)];S.length>12&&S.pop(),l(S),localStorage.setItem("recentWallets",JSON.stringify(S)),window.open(`/wallet-details/${s}`,"_blank"),t(!1)}else fn.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 h.useEffect(()=>{if(s.length>0){const C=s==null?void 0:s.toLowerCase(),S=n.filter(T=>Array.isArray(T)&&T.some(I=>{var L;return(L=I==null?void 0:I.toLowerCase())==null?void 0:L.includes(C)})).map(T=>T[0]);f(S)}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(Vy,{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:Na,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,S)=>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 T=JSON.parse(localStorage.getItem("recentCoins")||"[]");T!=null&&T.includes(C)||(T.unshift(C),T.length>14&&T.pop(),localStorage.setItem("recentCoins",JSON.stringify(T)))},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:T=>wm(T)}),C]})})})},S))})]}),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,S)=>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:T=>wm(T)}),C]})})})},S)))})]}),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,S)=>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:Blt,alt:"",className:"w-4 h-4"}),C&&C.slice(0,6)+"..."+C.slice(-4)]})})})},S))})]})]})}),AOt=({open:t,setOpen:e})=>{const n=h.useRef(null);return h.useEffect(()=>{t&&setTimeout(()=>{var r;(r=n.current)==null||r.focus()},0)},[t]),i.jsxs(ha,{open:t,onClose:e,className:"relative z-50",children:[i.jsx(fa,{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(Ji,{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(jOt,{ref:n,setOpen:e})})})})})]})},cDe=()=>{const[t,e]=h.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(AOt,{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(Vy,{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 Kbe='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',_Ot={rounded:`SFRounded, ui-rounded, "SF Pro Rounded", ${Kbe}`,system:Kbe},h7={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"}},EOt={large:{modalOverlay:"blur(20px)"},none:{modalOverlay:"blur(0px)"},small:{modalOverlay:"blur(4px)"}},uDe=({borderRadius:t="large",fontStack:e="rounded",overlayBlur:n="none"})=>({blurs:{modalOverlay:EOt[n].modalOverlay},fonts:{body:_Ot[e]},radii:{actionButton:h7[t].actionButton,connectButton:h7[t].connectButton,menuButton:h7[t].connectButton,modal:h7[t].modal,modalMobile:h7[t].modalMobile}}),dDe={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"}},Ybe=dDe.blue,fDe=({accentColor:t=Ybe.accentColor,accentColorForeground:e=Ybe.accentColorForeground,...n}={})=>({...uDe(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)"}});fDe.accentColors=dDe;var AM="#1A1B1F",hDe={blue:{accentColor:"#3898FF",accentColorForeground:"#FFF"},green:{accentColor:"#4BD166",accentColorForeground:AM},orange:{accentColor:"#FF983D",accentColorForeground:AM},pink:{accentColor:"#FF7AB8",accentColorForeground:AM},purple:{accentColor:"#7A70FF",accentColorForeground:"#FFF"},red:{accentColor:"#FF6257",accentColorForeground:"#FFF"}},Xbe=hDe.blue,pDe=({accentColor:t=Xbe.accentColor,accentColorForeground:e=Xbe.accentColorForeground,...n}={})=>({...uDe(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:AM,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)"}});pDe.accentColors=hDe;var Ene=`{
"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 kOt(t,e){return Object.defineProperty(t,"__recipe__",{value:e,writable:!1}),t}var mDe=kOt;function xDe(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 mDe(n,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createNormalizeValueFn",args:[{conditions:t.conditions}]})}function TOt(t){var{conditions:e}=t;if(!e)throw new Error("Styles have no conditions");var n=xDe(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 mDe(r,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createMapValueFn",args:[{conditions:t.conditions}]})}function POt(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 IOt(t){var e=POt(t,"string");return typeof e=="symbol"?e:String(e)}function FOt(t,e,n){return e=IOt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qbe(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 qW(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Qbe(Object(n),!0).forEach(function(r){FOt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qbe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var OOt=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=qW({},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 S=x?qW(qW({},d),f):c,T=function(){var F=S[I],$=s[I];try{if($.mappings)return 1;if(typeof F=="string"||typeof F=="number")u.push($.values[F].defaultClass);else if(Array.isArray(F))for(var O=0;O<F.length;O++){var U=F[O];if(U!=null){var Y=$.responsiveArray[O];u.push($.values[U].conditions[Y])}}else for(var re in F){var Q=F[re];Q!=null&&u.push($.values[Q].conditions[re])}}catch(q){throw q}};for(var I in S)T();return t(u.join(" "))};return Object.assign(l,{properties:new Set(a)})},MOt=t=>t,LOt=function(){return OOt(MOt)(...arguments)};function gDe(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=gDe(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function bDe(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=gDe(t))&&(r&&(r+=" "),r+=e);return r}var ROt="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 Zbe=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Jbe=4;function DOt(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 S=[],T=0,I=x;for(;;){let F=Math.floor(((C-T+1)*s-1)/I),$=0,O=r;for(;O-$>1;){let re=$+O>>>1;F<a[re]?O=re:$=re}if($==0)break;S.push($);let U=T+Math.floor(I*a[$]/s),Y=T+Math.floor(I*a[$+1]/s)-1;for(;!((U^Y)&g);)C=C<<1&v|d(),U=U<<1&v,Y=Y<<1&v|1;for(;U&~Y&y;)C=C&g|C<<1&v>>>1|d(),U=U<<1^g,Y=(Y^g)<<1|g|1;T=U,I=1+Y-U}let L=r-4;return S.map(F=>{switch(F-L){case 3:return L+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return L+256+(t[l++]<<8|t[l++]);case 1:return L+t[l++];default:return F-1}})}function BOt(t){let e=0;return()=>t[e++]}function yDe(t){return BOt(DOt($Ot(t)))}function $Ot(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 UOt(t){return t&1?~t>>1:t>>1}function zOt(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=UOt(e());return n}function UE(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 vDe(t){return zE(()=>{let e=UE(t);if(e.length)return e})}function wDe(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(HOt(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(VOt(n,t))}return e.flat()}function zE(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function CDe(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)zOt(t,n).forEach((a,o)=>r[o].push(a));return r}function HOt(t,e){let n=1+e(),r=e(),s=zE(e);return CDe(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 VOt(t,e){let n=1+e();return CDe(n,1+t,e).map(s=>[s[0],s.slice(1)])}function WOt(t){let e=[],n=UE(t);return s(r([]),[]),e;function r(a){let o=t(),l=zE(()=>{let c=UE(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 qOt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function NDe(t){return`{${qOt(t)}}`}function GOt(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 WS(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 KOt(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 YOt="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 HE=44032,BR=4352,$R=4449,UR=4519,SDe=19,jDe=21,qS=28,zR=jDe*qS,XOt=SDe*zR,QOt=HE+XOt,ZOt=BR+SDe,JOt=$R+jDe,eMt=UR+qS;function u_(t){return t>>24&255}function ADe(t){return t&16777215}let kne,eye,Tne,_M;function tMt(){let t=yDe(YOt);kne=new Map(vDe(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),eye=new Set(UE(t)),Tne=new Map,_M=new Map;for(let[e,n]of wDe(t)){if(!eye.has(e)&&n.length==2){let[r,s]=n,a=_M.get(r);a||(a=new Map,_M.set(r,a)),a.set(s,e)}Tne.set(e,n.reverse())}}function _De(t){return t>=HE&&t<QOt}function nMt(t,e){if(t>=BR&&t<ZOt&&e>=$R&&e<JOt)return HE+(t-BR)*zR+(e-$R)*qS;if(_De(t)&&e>UR&&e<eMt&&(t-HE)%qS==0)return t+(e-UR);{let n=_M.get(t);return n&&(n=n.get(e),n)?n:-1}}function EDe(t){kne||tMt();let e=[],n=[],r=!1;function s(a){let o=kne.get(a);o&&(r=!0,a|=o),e.push(a)}for(let a of t)for(;;){if(a<128)e.push(a);else if(_De(a)){let o=a-HE,l=o/zR|0,c=o%zR/qS|0,u=o%qS;s(BR+l),s($R+c),u>0&&s(UR+u)}else{let o=Tne.get(a);o?n.push(...o):s(a)}if(!n.length)break;a=n.pop()}if(r&&e.length>1){let a=u_(e[0]);for(let o=1;o<e.length;o++){let l=u_(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=u_(e[--c]),a<=l))break}a=u_(e[o])}}return e}function rMt(t){let e=[],n=[],r=-1,s=0;for(let a of t){let o=u_(a),l=ADe(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=nMt(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 kDe(t){return EDe(t).map(ADe)}function sMt(t){return rMt(EDe(t))}const tye=45,TDe=".",PDe=65039,IDe=1,HR=t=>Array.from(t);function VE(t,e){return t.P.has(e)||t.Q.has(e)}class iMt extends Array{get is_emoji(){return!0}}let Pne,FDe,jw,Ine,ODe,$4,GW,e4,Zv,nye,Fne;function zce(){if(Pne)return;let t=yDe(ROt);const e=()=>UE(t),n=()=>new Set(e()),r=(d,f)=>f.forEach(x=>d.add(x));Pne=new Map(wDe(t)),FDe=n(),jw=e(),Ine=new Set(e().map(d=>jw[d])),jw=new Set(jw),ODe=n(),n();let s=vDe(t),a=t();const o=()=>{let d=new Set;return e().forEach(f=>r(d,s[f])),r(d,e()),d};$4=zE(d=>{let f=zE(t).map(x=>x+96);if(f.length){let x=d>=a;f[0]-=32,f=WS(f),x&&(f=`Restricted[${f}]`);let g=o(),y=o(),v=!t();return{N:f,P:g,Q:y,M:v,R:x}}}),GW=n(),e4=new Map;let l=e().concat(HR(GW)).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),GW.has(d)||e4.set(d,g)});for(let{V:d,M:f}of new Set(e4.values())){let x=[];for(let y of d){let v=$4.filter(S=>VE(S,y)),C=x.find(({G:S})=>v.some(T=>S.has(T)));C||(C={G:new Set,V:[]},x.push(C)),C.V.push(y),r(C.G,v)}let g=x.flatMap(y=>HR(y.G));for(let{G:y,V:v}of x){let C=new Set(g.filter(S=>!y.has(S)));for(let S of v)f.set(S,C)}}Zv=new Set;let c=new Set;const u=d=>Zv.has(d)?c.add(d):Zv.add(d);for(let d of $4){for(let f of d.P)u(f);for(let f of d.Q)u(f)}for(let d of Zv)!e4.has(d)&&!c.has(d)&&e4.set(d,IDe);r(Zv,kDe(Zv)),nye=WOt(t).map(d=>iMt.from(d)).sort(KOt),Fne=new Map;for(let d of nye){let f=[Fne];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===PDe?f.push(...g):f=g}for(let x of f)x.V=d}}function Hce(t){return(MDe(t)?"":`${Vce(LU([t]))} `)+NDe(t)}function Vce(t){return`"${t}"`}function aMt(t){if(t.length>=4&&t[2]==tye&&t[3]==tye)throw new Error(`invalid label extension: "${WS(t.slice(0,4))}"`)}function oMt(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function lMt(t){let e=t[0],n=Zbe.get(e);if(n)throw z_(`leading ${n}`);let r=t.length,s=-1;for(let a=1;a<r;a++){e=t[a];let o=Zbe.get(e);if(o){if(s==a)throw z_(`${n} + ${o}`);s=a+1,n=o}}if(s==r)throw z_(`trailing ${n}`)}function LU(t,e=1/0,n=NDe){let r=[];cMt(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];MDe(l)&&(r.push(WS(t.slice(s,o))),r.push(n(l)),s=o+1)}return r.push(WS(t.slice(s,a))),r.join("")}function cMt(t,e){return zce(),jw.has(t)}function MDe(t){return zce(),ODe.has(t)}function uMt(t){return pMt(dMt(t,sMt,gMt))}function dMt(t,e,n){if(!t)return[];zce();let r=0;return t.split(TDe).map(s=>{let a=GOt(s),o={input:a,offset:r};r+=a.length+1;try{let l=o.tokens=xMt(a,e,n),c=l.length,u;if(!c)throw new Error("empty label");let d=o.output=l.flat();if(oMt(d),!(o.emoji=c>1||l[0].is_emoji)&&d.every(x=>x<128))aMt(d),u="ASCII";else{let x=l.flatMap(g=>g.is_emoji?[]:g);if(!x.length)u="Emoji";else{if(jw.has(d[0]))throw z_("leading combining mark");for(let v=1;v<c;v++){let C=l[v];if(!C.is_emoji&&jw.has(C[0]))throw z_(`emoji + combining mark: "${WS(l[v-1])} + ${LU([C[0]])}"`)}lMt(d);let g=HR(new Set(x)),[y]=hMt(g);mMt(y,x),fMt(y,g),u=y.N}}o.type=u}catch(l){o.error=l}return o})}function fMt(t,e){let n,r=[];for(let s of e){let a=e4.get(s);if(a===IDe)return;if(a){let o=a.M.get(s);if(n=n?n.filter(l=>o.has(l)):HR(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(a=>VE(s,a)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function hMt(t){let e=$4;for(let n of t){let r=e.filter(s=>VE(s,n));if(!r.length)throw $4.some(s=>VE(s,n))?RDe(e[0],n):LDe(n);if(e=r,r.length==1)break}return e}function pMt(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 ${Vce(LU(e,63))}: ${s}`)}return WS(r)}).join(TDe)}function LDe(t){return new Error(`disallowed character: ${Hce(t)}`)}function RDe(t,e){let n=Hce(e),r=$4.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function z_(t){return new Error(`illegal placement: ${t}`)}function mMt(t,e){for(let n of e)if(!VE(t,n))throw RDe(t,n);if(t.M){let n=kDe(e);for(let r=1,s=n.length;r<s;r++)if(Ine.has(n[r])){let a=r+1;for(let o;a<s&&Ine.has(o=n[a]);a++)for(let l=r;l<a;l++)if(n[l]==o)throw new Error(`duplicate non-spacing marks: ${Hce(o)}`);if(a-r>Jbe)throw new Error(`excessive non-spacing marks: ${Vce(LU(n.slice(r-1,a)))} (${a-r}/${Jbe})`);r=a}}}function xMt(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let a=bMt(t);if(a)s.length&&(r.push(e(s)),s=[]),r.push(n(a));else{let o=t.pop();if(Zv.has(o))s.push(o);else{let l=Pne.get(o);if(l)s.push(...l);else if(!FDe.has(o))throw LDe(o)}}}return s.length&&r.push(e(s)),r}function gMt(t){return t.filter(e=>e!=PDe)}function bMt(t,e){let n=Fne,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 yMt(t){return uMt(t)}function vMt(t){return yMt(t)}const wMt={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},CMt={block:cmt({format(t){var n;return{transactions:(n=t.transactions)==null?void 0:n.map(r=>{if(typeof r=="string")return r;const s=y$(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:omt({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:Ixt({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 NMt(t,e){return AMt(t)?jMt(t):y1t(t,e)}const SMt={transaction:NMt};function jMt(t){_Mt(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?pi(o):"0x",c?pi(c):"0x",s?pi(s):"0x",a?"0x1":"0x",n??"0x"];return Im(["0x7e",t2(u)])}function AMt(t){return t.type==="deposit"||typeof t.sourceHash<"u"}function _Mt(t){const{from:e,to:n}=t;if(e&&!dc(e))throw new Nd({address:e});if(n&&!dc(n))throw new Nd({address:n})}const rye={contracts:wMt,formatters:CMt,serializers:SMt},sye=_$({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}}}),WE=_$({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}}}),p7=1,iye=_$({...rye,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:{...rye.contracts,disputeGameFactory:{[p7]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[p7]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[p7]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[p7]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:p7}),aye=_$({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 Xb=function(){return Xb=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},Xb.apply(this,arguments)};function EMt(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 kMt(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 H_="right-scroll-bar-position",V_="width-before-scroll-bar",TMt="with-scroll-bars-hidden",PMt="--removed-body-scroll-bar-size";function KW(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function IMt(t,e){var n=h.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 FMt=typeof window<"u"?h.useLayoutEffect:h.useEffect,oye=new WeakMap;function DDe(t,e){var n=IMt(null,function(r){return t.forEach(function(s){return KW(s,r)})});return FMt(function(){var r=oye.get(n);if(r){var s=new Set(r),a=new Set(t),o=n.current;s.forEach(function(l){a.has(l)||KW(l,null)}),a.forEach(function(l){s.has(l)||KW(l,o)})}oye.set(n,t)},[t]),n}var One=function(t,e){return One=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])},One(t,e)};function BDe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");One(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var GS=function(){return GS=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},GS.apply(this,arguments)};function Wce(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 $De(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 UDe(t,e){return function(n,r){e(n,r,t)}}function zDe(t,e,n,r,s,a){function o(S){if(S!==void 0&&typeof S!="function")throw new TypeError("Function expected");return S}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(S){if(x)throw new TypeError("Cannot add initializers after decoration has completed");a.push(o(S||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 HDe(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 VDe(t){return typeof t=="symbol"?t:"".concat(t)}function WDe(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 qDe(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function GDe(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 RU=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 YDe(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&RU(e,t,n)}function VR(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 qce(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 XDe(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(qce(arguments[e]));return t}function QDe(){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 ZDe(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 KS(t){return this instanceof KS?(this.v=t,this):new KS(t)}function JDe(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,S){a.push([g,v,C,S])>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 KS?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 eBe(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:KS(t[s](o)),done:!1}:a?a(o):o}:a}}function tBe(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 VR=="function"?VR(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 nBe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var OMt=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function rBe(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)&&RU(e,t,n);return OMt(e,t),e}function sBe(t){return t&&t.__esModule?t:{default:t}}function iBe(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 aBe(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 oBe(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 lBe(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 MMt=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 cBe(t){function e(a){t.error=t.hasError?new MMt(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 uBe(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 LMt={__extends:BDe,__assign:GS,__rest:Wce,__decorate:$De,__param:UDe,__esDecorate:zDe,__runInitializers:HDe,__propKey:VDe,__setFunctionName:WDe,__metadata:qDe,__awaiter:GDe,__generator:KDe,__createBinding:RU,__exportStar:YDe,__values:VR,__read:qce,__spread:XDe,__spreadArrays:QDe,__spreadArray:ZDe,__await:KS,__asyncGenerator:JDe,__asyncDelegator:eBe,__asyncValues:tBe,__makeTemplateObject:nBe,__importStar:rBe,__importDefault:sBe,__classPrivateFieldGet:iBe,__classPrivateFieldSet:aBe,__classPrivateFieldIn:oBe,__addDisposableResource:lBe,__disposeResources:cBe,__rewriteRelativeImportExtension:uBe},lNn=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:lBe,get __assign(){return GS},__asyncDelegator:eBe,__asyncGenerator:JDe,__asyncValues:tBe,__await:KS,__awaiter:GDe,__classPrivateFieldGet:iBe,__classPrivateFieldIn:oBe,__classPrivateFieldSet:aBe,__createBinding:RU,__decorate:$De,__disposeResources:cBe,__esDecorate:zDe,__exportStar:YDe,__extends:BDe,__generator:KDe,__importDefault:sBe,__importStar:rBe,__makeTemplateObject:nBe,__metadata:qDe,__param:UDe,__propKey:VDe,__read:qce,__rest:Wce,__rewriteRelativeImportExtension:uBe,__runInitializers:HDe,__setFunctionName:WDe,__spread:XDe,__spreadArray:ZDe,__spreadArrays:QDe,__values:VR,default:LMt},Symbol.toStringTag,{value:"Module"}));function RMt(t){return t}function DMt(t,e){e===void 0&&(e=RMt);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 dBe(t){t===void 0&&(t={});var e=DMt(null);return e.options=GS({async:!0,ssr:!1},t),e}var fBe=function(t){var e=t.sideCar,n=Wce(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 h.createElement(r,GS({},n))};fBe.isSideCarExport=!0;function hBe(t,e){return t.useMedium(e),fBe}var pBe=dBe(),YW=function(){},DU=h.forwardRef(function(t,e){var n=h.useRef(null),r=h.useState({onScrollCapture:YW,onWheelCapture:YW,onTouchMoveCapture:YW}),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,S=C===void 0?"div":C,T=t.gapMode,I=EMt(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=x,F=DDe([n,e]),$=Xb(Xb({},I),s);return h.createElement(h.Fragment,null,d&&h.createElement(L,{sideCar:pBe,removeScrollBar:u,shards:f,noIsolation:g,inert:y,setCallbacks:a,allowPinchZoom:!!v,lockRef:n,gapMode:T}),o?h.cloneElement(h.Children.only(l),Xb(Xb({},$),{ref:F})):h.createElement(S,Xb({},$,{className:c,ref:F}),l))});DU.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};DU.classNames={fullWidth:V_,zeroRight:H_};var BMt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function $Mt(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=BMt();return e&&t.setAttribute("nonce",e),t}function UMt(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function zMt(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var HMt=function(){var t=0,e=null;return{add:function(n){t==0&&(e=$Mt())&&(UMt(e,n),zMt(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},VMt=function(){var t=HMt();return function(e,n){h.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},Gce=function(){var t=VMt(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},WMt={left:0,top:0,right:0,gap:0},XW=function(t){return parseInt(t||"",10)||0},qMt=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[XW(n),XW(r),XW(s)]},GMt=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return WMt;var e=qMt(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])}},KMt=Gce(),U4="data-scroll-locked",YMt=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(TMt,` {
overflow: hidden `).concat(r,`;
padding-right: `).concat(l,"px ").concat(r,`;
}
body[`).concat(U4,`] {
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(H_,` {
right: `).concat(l,"px ").concat(r,`;
}
.`).concat(V_,` {
margin-right: `).concat(l,"px ").concat(r,`;
}
.`).concat(H_," .").concat(H_,` {
right: 0 `).concat(r,`;
}
.`).concat(V_," .").concat(V_,` {
margin-right: 0 `).concat(r,`;
}
body[`).concat(U4,`] {
`).concat(PMt,": ").concat(l,`px;
}
`)},lye=function(){var t=parseInt(document.body.getAttribute(U4)||"0",10);return isFinite(t)?t:0},XMt=function(){h.useEffect(function(){return document.body.setAttribute(U4,(lye()+1).toString()),function(){var t=lye()-1;t<=0?document.body.removeAttribute(U4):document.body.setAttribute(U4,t.toString())}},[])},mBe=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;XMt();var a=h.useMemo(function(){return GMt(s)},[s]);return h.createElement(KMt,{styles:YMt(a,!e,s,n?"":"!important")})},Mne=!1;if(typeof window<"u")try{var uF=Object.defineProperty({},"passive",{get:function(){return Mne=!0,!0}});window.addEventListener("test",uF,uF),window.removeEventListener("test",uF,uF)}catch{Mne=!1}var gC=Mne?{passive:!1}:!1,QMt=function(t){return t.tagName==="TEXTAREA"},xBe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!QMt(t)&&n[e]==="visible")},ZMt=function(t){return xBe(t,"overflowY")},JMt=function(t){return xBe(t,"overflowX")},cye=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=gBe(t,r);if(s){var a=bBe(t,r),o=a[1],l=a[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},eLt=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},tLt=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},gBe=function(t,e){return t==="v"?ZMt(e):JMt(e)},bBe=function(t,e){return t==="v"?eLt(e):tLt(e)},nLt=function(t,e){return t==="h"&&e==="rtl"?-1:1},rLt=function(t,e,n,r,s){var a=nLt(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=bBe(t,l),y=g[0],v=g[1],C=g[2],S=v-C-a*y;(y||S)&&gBe(t,l)&&(f+=S,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},dF=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},uye=function(t){return[t.deltaX,t.deltaY]},dye=function(t){return t&&"current"in t?t.current:t},sLt=function(t,e){return t[0]===e[0]&&t[1]===e[1]},iLt=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},aLt=0,bC=[];function oLt(t){var e=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(aLt++)[0],a=h.useState(Gce)[0],o=h.useRef(t);h.useEffect(function(){o.current=t},[t]),h.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var v=kMt([t.lockRef.current],(t.shards||[]).map(dye),!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=h.useCallback(function(v,C){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var S=dF(v),T=n.current,I="deltaX"in v?v.deltaX:T[0]-S[0],L="deltaY"in v?v.deltaY:T[1]-S[1],F,$=v.target,O=Math.abs(I)>Math.abs(L)?"h":"v";if("touches"in v&&O==="h"&&$.type==="range")return!1;var U=cye(O,$);if(!U)return!0;if(U?F=O:(F=O==="v"?"h":"v",U=cye(O,$)),!U)return!1;if(!r.current&&"changedTouches"in v&&(I||L)&&(r.current=F),!F)return!0;var Y=r.current||F;return rLt(Y,C,v,Y==="h"?I:L)},[]),c=h.useCallback(function(v){var C=v;if(!(!bC.length||bC[bC.length-1]!==a)){var S="deltaY"in C?uye(C):dF(C),T=e.current.filter(function(F){return F.name===C.type&&(F.target===C.target||C.target===F.shadowParent)&&sLt(F.delta,S)})[0];if(T&&T.should){C.cancelable&&C.preventDefault();return}if(!T){var I=(o.current.shards||[]).map(dye).filter(Boolean).filter(function(F){return F.contains(C.target)}),L=I.length>0?l(C,I[0]):!o.current.noIsolation;L&&C.cancelable&&C.preventDefault()}}},[]),u=h.useCallback(function(v,C,S,T){var I={name:v,delta:C,target:S,should:T,shadowParent:lLt(S)};e.current.push(I),setTimeout(function(){e.current=e.current.filter(function(L){return L!==I})},1)},[]),d=h.useCallback(function(v){n.current=dF(v),r.current=void 0},[]),f=h.useCallback(function(v){u(v.type,uye(v),v.target,l(v,t.lockRef.current))},[]),x=h.useCallback(function(v){u(v.type,dF(v),v.target,l(v,t.lockRef.current))},[]);h.useEffect(function(){return bC.push(a),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:x}),document.addEventListener("wheel",c,gC),document.addEventListener("touchmove",c,gC),document.addEventListener("touchstart",d,gC),function(){bC=bC.filter(function(v){return v!==a}),document.removeEventListener("wheel",c,gC),document.removeEventListener("touchmove",c,gC),document.removeEventListener("touchstart",d,gC)}},[]);var g=t.removeScrollBar,y=t.inert;return h.createElement(h.Fragment,null,y?h.createElement(a,{styles:iLt(s)}):null,g?h.createElement(mBe,{gapMode:t.gapMode}):null)}function lLt(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const cLt=hBe(pBe,oLt);var yBe=h.forwardRef(function(t,e){return h.createElement(DU,Xb({},t,{ref:e,sideCar:cLt}))});yBe.classNames=DU.classNames;function fye(t){var e=t.match(/^var\((.*)\)$/);return e?e[1]:t}function uLt(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 vBe(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]=vBe(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 hye(t,e){var n={};if(typeof e=="object"){var r=t;vBe(e,(l,c)=>{if(l!=null){var u=uLt(r,c);n[fye(u)]=String(l)}})}else{var s=t;for(var a in s){var o=s[a];o!=null&&(n[fye(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 d_={exports:{}},dLt=d_.exports,pye;function fLt(){return pye||(pye=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",S="architecture",T="console",I="mobile",L="tablet",F="smarttv",$="wearable",O="embedded",U=500,Y="Amazon",re="Apple",Q="ASUS",q="BlackBerry",te="Browser",fe="Chrome",G="Edge",ie="Firefox",oe="Google",K="Huawei",H="LG",ee="Microsoft",se="Motorola",pe="Opera",Se="Samsung",ge="Sharp",ve="Sony",be="Xiaomi",we="Zebra",je="Facebook",Fe="Chromium OS",Re="Mac OS",Qe=" Browser",Ye=function(Nn,dn){var rt={};for(var nt in Nn)dn[nt]&&dn[nt].length%2===0?rt[nt]=dn[nt].concat(Nn[nt]):rt[nt]=Nn[nt];return rt},dt=function(Nn){for(var dn={},rt=0;rt<Nn.length;rt++)dn[Nn[rt].toUpperCase()]=Nn[rt];return dn},st=function(Nn,dn){return typeof Nn===d?at(dn).indexOf(at(Nn))!==-1:!1},at=function(Nn){return Nn.toLowerCase()},He=function(Nn){return typeof Nn===d?Nn.replace(/[^\d\.]/g,a).split(".")[0]:r},qe=function(Nn,dn){if(typeof Nn===d)return Nn=Nn.replace(/^\s\s*/,a),typeof dn===c?Nn:Nn.substring(0,U)},vt=function(Nn,dn){for(var rt=0,nt,Ut,wn,Jt,Vt,xt;rt<dn.length&&!Vt;){var We=dn[rt],Pt=dn[rt+1];for(nt=Ut=0;nt<We.length&&!Vt&&We[nt];)if(Vt=We[nt++].exec(Nn),Vt)for(wn=0;wn<Pt.length;wn++)xt=Vt[++Ut],Jt=Pt[wn],typeof Jt===u&&Jt.length>0?Jt.length===2?typeof Jt[1]==l?this[Jt[0]]=Jt[1].call(this,xt):this[Jt[0]]=Jt[1]:Jt.length===3?typeof Jt[1]===l&&!(Jt[1].exec&&Jt[1].test)?this[Jt[0]]=xt?Jt[1].call(this,xt,Jt[2]):r:this[Jt[0]]=xt?xt.replace(Jt[1],Jt[2]):r:Jt.length===4&&(this[Jt[0]]=xt?Jt[3].call(this,xt.replace(Jt[1],Jt[2])):r):this[Jt]=xt||r;rt+=2}},yt=function(Nn,dn){for(var rt in dn)if(typeof dn[rt]===u&&dn[rt].length>0){for(var nt=0;nt<dn[rt].length;nt++)if(st(dn[rt][nt],Nn))return rt===o?r:rt}else if(st(dn[rt],Nn))return rt===o?r:rt;return dn.hasOwnProperty("*")?dn["*"]:Nn},Kt={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},jt={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"},un={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,pe+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[C,[g,pe+" GX"]],[/\bopr\/([\w\.]+)/i],[C,[g,pe]],[/\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,ie+" Focus"]],[/\bopt\/([\w\.]+)/i],[C,[g,pe+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[C,[g,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[C,[g,"Dolphin"]],[/coast\/([\w\.]+)/i],[C,[g,pe+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[C,[g,"MIUI"+Qe]],[/fxios\/([\w\.-]+)/i],[C,[g,ie]],[/\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,Se+" 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,yt,Kt]],[/(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,ie+" 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],[[S,"amd64"]],[/(ia32(?=;))/i],[[S,at]],[/((?:i[346]|x)86)[;\)]/i],[[S,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[S,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[S,"armhf"]],[/windows (ce|mobile); ppc;/i],[[S,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[S,/ower/,a,at]],[/(sun4\w)[;\)]/i],[[S,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[S,at]]],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,Se],[y,L]],[/\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,Se],[y,I]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[x,[v,re],[y,I]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[x,[v,re],[y,L]],[/(macintosh);/i],[x,[v,re]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[x,[v,ge],[y,I]],[/(?:honor)([-\w ]+)[;\)]/i],[x,[v,"Honor"],[y,I]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[x,[v,K],[y,L]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[x,[v,K],[y,I]],[/\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,be],[y,I]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[x,/_/g," "],[v,be],[y,L]],[/; (\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,I]],[/\b(opd2\d{3}a?) bui/i],[x,[v,"OPPO"],[y,L]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[x,[v,"Vivo"],[y,I]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[x,[v,"Realme"],[y,I]],[/\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,se],[y,I]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[x,[v,se],[y,L]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[x,[v,H],[y,L]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[x,[v,H],[y,I]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[x,[v,"Lenovo"],[y,L]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[x,/_/g," "],[v,"Nokia"],[y,I]],[/(pixel c)\b/i],[x,[v,oe],[y,L]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[x,[v,oe],[y,I]],[/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,ve],[y,I]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[x,"Xperia Tablet"],[v,ve],[y,L]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[x,[v,"OnePlus"],[y,I]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[x,[v,Y],[y,L]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[x,/(.+)/g,"Fire Phone $1"],[v,Y],[y,I]],[/(playbook);[-\w\),; ]+(rim)/i],[x,v,[y,L]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[x,[v,q],[y,I]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[x,[v,Q],[y,L]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[x,[v,Q],[y,I]],[/(nexus 9)/i],[x,[v,"HTC"],[y,L]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[v,[x,/_/g," "],[y,I]],[/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,L]],[/(itel) ((\w+))/i],[[v,at],x,[y,yt,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[x,[v,"Acer"],[y,L]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[x,[v,"Meizu"],[y,I]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[x,[v,"Ulefone"],[y,I]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[x,[v,"Energizer"],[y,I]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[x,[v,"Cat"],[y,I]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[x,[v,"Smartfren"],[y,I]],[/droid.+; (a(?:015|06[35]|142p?))/i],[x,[v,"Nothing"],[y,I]],[/(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,I]],[/(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,L]],[/(surface duo)/i],[x,[v,ee],[y,L]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[x,[v,"Fairphone"],[y,I]],[/(u304aa)/i],[x,[v,"AT&T"],[y,I]],[/\bsie-(\w*)/i],[x,[v,"Siemens"],[y,I]],[/\b(rct\w+) b/i],[x,[v,"RCA"],[y,L]],[/\b(venue[\d ]{2,7}) b/i],[x,[v,"Dell"],[y,L]],[/\b(q(?:mv|ta)\w+) b/i],[x,[v,"Verizon"],[y,L]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[x,[v,"Barnes & Noble"],[y,L]],[/\b(tm\d{3}\w+) b/i],[x,[v,"NuVision"],[y,L]],[/\b(k88) b/i],[x,[v,"ZTE"],[y,L]],[/\b(nx\d{3}j) b/i],[x,[v,"ZTE"],[y,I]],[/\b(gen\d{3}) b.+49h/i],[x,[v,"Swiss"],[y,I]],[/\b(zur\d{3}) b/i],[x,[v,"Swiss"],[y,L]],[/\b((zeki)?tb.*\b) b/i],[x,[v,"Zeki"],[y,L]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[v,"Dragon Touch"],x,[y,L]],[/\b(ns-?\w{0,9}) b/i],[x,[v,"Insignia"],[y,L]],[/\b((nxa|next)-?\w{0,9}) b/i],[x,[v,"NextBook"],[y,L]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[v,"Voice"],x,[y,I]],[/\b(lvtel\-)?(v1[12]) b/i],[[v,"LvTel"],x,[y,I]],[/\b(ph-1) /i],[x,[v,"Essential"],[y,I]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[x,[v,"Envizen"],[y,L]],[/\b(trio[-\w\. ]+) b/i],[x,[v,"MachSpeed"],[y,L]],[/\btu_(1491) b/i],[x,[v,"Rotor"],[y,L]],[/(shield[\w ]+) b/i],[x,[v,"Nvidia"],[y,L]],[/(sprint) (\w+)/i],[v,x,[y,I]],[/(kin\.[onetw]{3})/i],[[x,/\./g," "],[v,ee],[y,I]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[x,[v,we],[y,L]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[x,[v,we],[y,I]],[/smart-tv.+(samsung)/i],[v,[y,F]],[/hbbtv.+maple;(\d+)/i],[[x,/^/,"SmartTV"],[v,Se],[y,F]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[v,H],[y,F]],[/(apple) ?tv/i],[v,[x,re+" TV"],[y,F]],[/crkey/i],[[x,fe+"cast"],[v,oe],[y,F]],[/droid.+aft(\w+)( bui|\))/i],[x,[v,Y],[y,F]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[x,[v,ge],[y,F]],[/(bravia[\w ]+)( bui|\))/i],[x,[v,ve],[y,F]],[/(mitv-\w{5}) bui/i],[x,[v,be],[y,F]],[/Hbbtv.*(technisat) (.*);/i],[v,x,[y,F]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[v,qe],[x,qe],[y,F]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[y,F]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[v,x,[y,T]],[/droid.+; (shield) bui/i],[x,[v,"Nvidia"],[y,T]],[/(playstation [345portablevi]+)/i],[x,[v,ve],[y,T]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[x,[v,ee],[y,T]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[x,[v,Se],[y,$]],[/((pebble))app/i],[v,x,[y,$]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[x,[v,re],[y,$]],[/droid.+; (glass) \d/i],[x,[v,oe],[y,$]],[/droid.+; (wt63?0{2,3})\)/i],[x,[v,we],[y,$]],[/droid.+; (glass) \d/i],[x,[v,oe],[y,$]],[/(pico) (4|neo3(?: link|pro)?)/i],[v,x,[y,$]],[/; (quest( \d| pro)?)/i],[x,[v,je],[y,$]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[v,[y,O]],[/(aeobc)\b/i],[x,[v,Y],[y,O]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[x,[y,I]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[x,[y,L]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[y,L]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[y,I]],[/(android[-\w\. ]{0,9});.+buil/i],[x,[v,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[C,[g,G+"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,yt,jt]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[C,yt,jt],[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,q]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[C,[g,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[C,[g,ie+" 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,Fe],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]]},vn=function(Nn,dn){if(typeof Nn===u&&(dn=Nn,Nn=r),!(this instanceof vn))return new vn(Nn,dn).getResult();var rt=typeof n!==c&&n.navigator?n.navigator:r,nt=Nn||(rt&&rt.userAgent?rt.userAgent:a),Ut=rt&&rt.userAgentData?rt.userAgentData:r,wn=dn?Ye(un,dn):un,Jt=rt&&rt.userAgent==nt;return this.getBrowser=function(){var Vt={};return Vt[g]=r,Vt[C]=r,vt.call(Vt,nt,wn.browser),Vt[f]=He(Vt[C]),Jt&&rt&&rt.brave&&typeof rt.brave.isBrave==l&&(Vt[g]="Brave"),Vt},this.getCPU=function(){var Vt={};return Vt[S]=r,vt.call(Vt,nt,wn.cpu),Vt},this.getDevice=function(){var Vt={};return Vt[v]=r,Vt[x]=r,Vt[y]=r,vt.call(Vt,nt,wn.device),Jt&&!Vt[y]&&Ut&&Ut.mobile&&(Vt[y]=I),Jt&&Vt[x]=="Macintosh"&&rt&&typeof rt.standalone!==c&&rt.maxTouchPoints&&rt.maxTouchPoints>2&&(Vt[x]="iPad",Vt[y]=L),Vt},this.getEngine=function(){var Vt={};return Vt[g]=r,Vt[C]=r,vt.call(Vt,nt,wn.engine),Vt},this.getOS=function(){var Vt={};return Vt[g]=r,Vt[C]=r,vt.call(Vt,nt,wn.os),Jt&&!Vt[g]&&Ut&&Ut.platform&&Ut.platform!="Unknown"&&(Vt[g]=Ut.platform.replace(/chrome os/i,Fe).replace(/macos/i,Re)),Vt},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 nt},this.setUA=function(Vt){return nt=typeof Vt===d&&Vt.length>U?qe(Vt,U):Vt,this},this.setUA(nt),this};vn.VERSION=s,vn.BROWSER=dt([g,C,f]),vn.CPU=dt([S]),vn.DEVICE=dt([x,v,y,T,I,F,L,$,O]),vn.ENGINE=vn.OS=dt([g,C]),t.exports&&(e=t.exports=vn),e.UAParser=vn;var Hn=typeof n!==c&&(n.jQuery||n.Zepto);if(Hn&&!Hn.ua){var ln=new vn;Hn.ua=ln.getResult(),Hn.ua.get=function(){return ln.getUA()},Hn.ua.set=function(Nn){ln.setUA(Nn);var dn=ln.getResult();for(var rt in dn)Hn.ua[rt]=dn[rt]}}})(typeof window=="object"?window:dLt)}(d_,d_.exports)),d_.exports}var hLt=fLt(),yC={},QW,mye;function pLt(){return mye||(mye=1,QW=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),QW}var ZW={},Eb={},xye;function B5(){if(xye)return Eb;xye=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 Eb.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},Eb.getSymbolTotalCodewords=function(r){return e[r]},Eb.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},Eb.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');t=r},Eb.isKanjiModeEnabled=function(){return typeof t<"u"},Eb.toSJIS=function(r){return t(r)},Eb}var JW={},gye;function Kce(){return gye||(gye=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}}}(JW)),JW}var eq,bye;function mLt(){if(bye)return eq;bye=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++}},eq=t,eq}var tq,yye;function xLt(){if(yye)return tq;yye=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]},tq=t,tq}var nq={},vye;function gLt(){return vye||(vye=1,function(t){const e=B5().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}}(nq)),nq}var rq={},wye;function bLt(){if(wye)return rq;wye=1;const t=B5().getSymbolSize,e=7;return rq.getPositions=function(r){const s=t(r);return[[0,0],[s-e,0],[0,s-e]]},rq}var sq={},Cye;function yLt(){return Cye||(Cye=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}}(sq)),sq}var fF={},Nye;function wBe(){if(Nye)return fF;Nye=1;const t=Kce(),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 fF.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}},fF.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}},fF}var iq={},m7={},Sye;function vLt(){if(Sye)return m7;Sye=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]}(),m7.log=function(r){if(r<1)throw new Error("log("+r+")");return e[r]},m7.exp=function(r){return t[r]},m7.mul=function(r,s){return r===0||s===0?0:t[e[r]+e[s]]},m7}var jye;function wLt(){return jye||(jye=1,function(t){const e=vLt();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}}(iq)),iq}var aq,Aye;function CLt(){if(Aye)return aq;Aye=1;const t=wLt();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},aq=e,aq}var oq={},lq={},cq={},_ye;function CBe(){return _ye||(_ye=1,cq.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),cq}var o0={},Eye;function NBe(){if(Eye)return o0;Eye=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 kye;function $5(){return kye||(kye=1,function(t){const e=CBe(),n=NBe();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}}}(lq)),lq}var Tye;function NLt(){return Tye||(Tye=1,function(t){const e=B5(),n=wBe(),r=Kce(),s=$5(),a=CBe(),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),S=n.getTotalCodewordsCount(g,y),T=(C-S)*8;if(v===s.MIXED)return T;const I=T-u(v,g);switch(v){case s.NUMERIC:return Math.floor(I/10*3);case s.ALPHANUMERIC:return Math.floor(I/11*2);case s.KANJI:return Math.floor(I/13);case s.BYTE:default:return Math.floor(I/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}}(oq)),oq}var uq={},Pye;function SLt(){if(Pye)return uq;Pye=1;const t=B5(),e=1335,n=21522,r=t.getBCHDigit(e);return uq.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},uq}var dq={},fq,Iye;function jLt(){if(Iye)return fq;Iye=1;const t=$5();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))},fq=e,fq}var hq,Fye;function ALt(){if(Fye)return hq;Fye=1;const t=$5(),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)},hq=n,hq}var pq,Oye;function _Lt(){if(Oye)return pq;Oye=1;const t=$5();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)},pq=e,pq}var mq,Mye;function ELt(){if(Mye)return mq;Mye=1;const t=$5(),e=B5();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)}},mq=n,mq}var xq={exports:{}},Lye;function kLt(){return Lye||(Lye=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 S=["Could not find a path from ",r," to ",s,"."].join("");throw new Error(S)}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}(xq)),xq.exports}var Rye;function TLt(){return Rye||(Rye=1,function(t){const e=$5(),n=jLt(),r=ALt(),s=_Lt(),a=ELt(),o=NBe(),l=B5(),c=kLt();function u(S){return unescape(encodeURIComponent(S)).length}function d(S,T,I){const L=[];let F;for(;(F=S.exec(I))!==null;)L.push({data:F[0],index:F.index,mode:T,length:F[0].length});return L}function f(S){const T=d(o.NUMERIC,e.NUMERIC,S),I=d(o.ALPHANUMERIC,e.ALPHANUMERIC,S);let L,F;return l.isKanjiModeEnabled()?(L=d(o.BYTE,e.BYTE,S),F=d(o.KANJI,e.KANJI,S)):(L=d(o.BYTE_KANJI,e.BYTE,S),F=[]),T.concat(I,L,F).sort(function(O,U){return O.index-U.index}).map(function(O){return{data:O.data,mode:O.mode,length:O.length}})}function x(S,T){switch(T){case e.NUMERIC:return n.getBitsLength(S);case e.ALPHANUMERIC:return r.getBitsLength(S);case e.KANJI:return a.getBitsLength(S);case e.BYTE:return s.getBitsLength(S)}}function g(S){return S.reduce(function(T,I){const L=T.length-1>=0?T[T.length-1]:null;return L&&L.mode===I.mode?(T[T.length-1].data+=I.data,T):(T.push(I),T)},[])}function y(S){const T=[];for(let I=0;I<S.length;I++){const L=S[I];switch(L.mode){case e.NUMERIC:T.push([L,{data:L.data,mode:e.ALPHANUMERIC,length:L.length},{data:L.data,mode:e.BYTE,length:L.length}]);break;case e.ALPHANUMERIC:T.push([L,{data:L.data,mode:e.BYTE,length:L.length}]);break;case e.KANJI:T.push([L,{data:L.data,mode:e.BYTE,length:u(L.data)}]);break;case e.BYTE:T.push([{data:L.data,mode:e.BYTE,length:u(L.data)}])}}return T}function v(S,T){const I={},L={start:{}};let F=["start"];for(let $=0;$<S.length;$++){const O=S[$],U=[];for(let Y=0;Y<O.length;Y++){const re=O[Y],Q=""+$+Y;U.push(Q),I[Q]={node:re,lastCount:0},L[Q]={};for(let q=0;q<F.length;q++){const te=F[q];I[te]&&I[te].node.mode===re.mode?(L[te][Q]=x(I[te].lastCount+re.length,re.mode)-x(I[te].lastCount,re.mode),I[te].lastCount+=re.length):(I[te]&&(I[te].lastCount=re.length),L[te][Q]=x(re.length,re.mode)+4+e.getCharCountIndicator(re.mode,T))}}F=U}for(let $=0;$<F.length;$++)L[F[$]].end=0;return{map:L,table:I}}function C(S,T){let I;const L=e.getBestModeForData(S);if(I=e.from(T,L),I!==e.BYTE&&I.bit<L.bit)throw new Error('"'+S+'" cannot be encoded with mode '+e.toString(I)+`.
Suggested mode is: `+e.toString(L));switch(I===e.KANJI&&!l.isKanjiModeEnabled()&&(I=e.BYTE),I){case e.NUMERIC:return new n(S);case e.ALPHANUMERIC:return new r(S);case e.KANJI:return new a(S);case e.BYTE:return new s(S)}}t.fromArray=function(T){return T.reduce(function(I,L){return typeof L=="string"?I.push(C(L,null)):L.data&&I.push(C(L.data,L.mode)),I},[])},t.fromString=function(T,I){const L=f(T,l.isKanjiModeEnabled()),F=y(L),$=v(F,I),O=c.find_path($.map,"start","end"),U=[];for(let Y=1;Y<O.length-1;Y++)U.push($.table[O[Y]].node);return t.fromArray(g(U))},t.rawSplit=function(T){return t.fromArray(f(T,l.isKanjiModeEnabled()))}}(dq)),dq}var Dye;function PLt(){if(Dye)return ZW;Dye=1;const t=B5(),e=Kce(),n=mLt(),r=xLt(),s=gLt(),a=bLt(),o=yLt(),l=wBe(),c=CLt(),u=NLt(),d=SLt(),f=$5(),x=TLt();function g($,O){const U=$.size,Y=a.getPositions(O);for(let re=0;re<Y.length;re++){const Q=Y[re][0],q=Y[re][1];for(let te=-1;te<=7;te++)if(!(Q+te<=-1||U<=Q+te))for(let fe=-1;fe<=7;fe++)q+fe<=-1||U<=q+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(Q+te,q+fe,!0,!0):$.set(Q+te,q+fe,!1,!0))}}function y($){const O=$.size;for(let U=8;U<O-8;U++){const Y=U%2===0;$.set(U,6,Y,!0),$.set(6,U,Y,!0)}}function v($,O){const U=s.getPositions(O);for(let Y=0;Y<U.length;Y++){const re=U[Y][0],Q=U[Y][1];for(let q=-2;q<=2;q++)for(let te=-2;te<=2;te++)q===-2||q===2||te===-2||te===2||q===0&&te===0?$.set(re+q,Q+te,!0,!0):$.set(re+q,Q+te,!1,!0)}}function C($,O){const U=$.size,Y=u.getEncodedBits(O);let re,Q,q;for(let te=0;te<18;te++)re=Math.floor(te/3),Q=te%3+U-8-3,q=(Y>>te&1)===1,$.set(re,Q,q,!0),$.set(Q,re,q,!0)}function S($,O,U){const Y=$.size,re=d.getEncodedBits(O,U);let Q,q;for(Q=0;Q<15;Q++)q=(re>>Q&1)===1,Q<6?$.set(Q,8,q,!0):Q<8?$.set(Q+1,8,q,!0):$.set(Y-15+Q,8,q,!0),Q<8?$.set(8,Y-Q-1,q,!0):Q<9?$.set(8,15-Q-1+1,q,!0):$.set(8,15-Q-1,q,!0);$.set(Y-8,8,1,!0)}function T($,O){const U=$.size;let Y=-1,re=U-1,Q=7,q=0;for(let te=U-1;te>0;te-=2)for(te===6&&te--;;){for(let fe=0;fe<2;fe++)if(!$.isReserved(re,te-fe)){let G=!1;q<O.length&&(G=(O[q]>>>Q&1)===1),$.set(re,te-fe,G),Q--,Q===-1&&(q++,Q=7)}if(re+=Y,re<0||U<=re){re-=Y,Y=-Y;break}}}function I($,O,U){const Y=new n;U.forEach(function(fe){Y.put(fe.mode.bit,4),Y.put(fe.getLength(),f.getCharCountIndicator(fe.mode,$)),fe.write(Y)});const re=t.getSymbolTotalCodewords($),Q=l.getTotalCodewordsCount($,O),q=(re-Q)*8;for(Y.getLengthInBits()+4<=q&&Y.put(0,4);Y.getLengthInBits()%8!==0;)Y.putBit(0);const te=(q-Y.getLengthInBits())/8;for(let fe=0;fe<te;fe++)Y.put(fe%2?17:236,8);return L(Y,$,O)}function L($,O,U){const Y=t.getSymbolTotalCodewords(O),re=l.getTotalCodewordsCount(O,U),Q=Y-re,q=l.getBlocksCount(O,U),te=Y%q,fe=q-te,G=Math.floor(Y/q),ie=Math.floor(Q/q),oe=ie+1,K=G-ie,H=new c(K);let ee=0;const se=new Array(q),pe=new Array(q);let Se=0;const ge=new Uint8Array($.buffer);for(let Fe=0;Fe<q;Fe++){const Re=Fe<fe?ie:oe;se[Fe]=ge.slice(ee,ee+Re),pe[Fe]=H.encode(se[Fe]),ee+=Re,Se=Math.max(Se,Re)}const ve=new Uint8Array(Y);let be=0,we,je;for(we=0;we<Se;we++)for(je=0;je<q;je++)we<se[je].length&&(ve[be++]=se[je][we]);for(we=0;we<K;we++)for(je=0;je<q;je++)ve[be++]=pe[je][we];return ve}function F($,O,U,Y){let re;if(Array.isArray($))re=x.fromArray($);else if(typeof $=="string"){let G=O;if(!G){const ie=x.rawSplit($);G=u.getBestVersionForData(ie,U)}re=x.fromString($,G||40)}else throw new Error("Invalid data");const Q=u.getBestVersionForData(re,U);if(!Q)throw new Error("The amount of data is too big to be stored in a QR Code");if(!O)O=Q;else if(O<Q)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+Q+`.
`);const q=I(O,U,re),te=t.getSymbolSize(O),fe=new r(te);return g(fe,O),y(fe),v(fe,O),S(fe,U,0),O>=7&&C(fe,O),T(fe,q),isNaN(Y)&&(Y=o.getBestMask(fe,S.bind(null,fe,U))),o.applyMask(Y,fe),S(fe,U,Y),{modules:fe,version:O,errorCorrectionLevel:U,maskPattern:Y,segments:re}}return ZW.create=function(O,U){if(typeof O>"u"||O==="")throw new Error("No input text");let Y=e.M,re,Q;return typeof U<"u"&&(Y=e.from(U.errorCorrectionLevel,e.M),re=u.from(U.version),Q=o.from(U.maskPattern),U.toSJISFunc&&t.setToSJISFunction(U.toSJISFunc)),F(O,re,Y,Q)},ZW}var gq={},bq={},Bye;function SBe(){return Bye||(Bye=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),S=Math.floor((g-d)/c);v=f[l[C*o+S]?1:0]}r[y++]=v.r,r[y++]=v.g,r[y++]=v.b,r[y]=v.a}}}(bq)),bq}var $ye;function ILt(){return $ye||($ye=1,function(t){const e=SBe();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)}}(gq)),gq}var yq={},Uye;function FLt(){if(Uye)return yq;Uye=1;const t=SBe();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 yq.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},yq}var zye;function OLt(){if(zye)return yC;zye=1;const t=pLt(),e=PLt(),n=ILt(),r=FLt();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 yC.create=e.create,yC.toCanvas=s.bind(null,n.render),yC.toDataURL=s.bind(null,n.renderToDataURL),yC.toString=s.bind(null,function(a,o,l){return r.render(a,l)}),yC}var MLt=OLt();const LLt=Pi(MLt);BU.type="coinbaseWallet";function BU(t={}){return t.version==="3"||t.headlessMode?DLt(t):RLt(t)}function RLt(t){let e,n,r,s;return a=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:BU.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=>Pc(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===Eo.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 Eo(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=>Pc(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 ps(async()=>{const{createCoinbaseWalletSDK:u}=await import("./index-C7pXoVEH.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 K3);const u=await this.getProvider();try{return await u.request({method:"wallet_switchEthereumChain",params:[{chainId:Gs(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 S={blockExplorerUrls:v,chainId:Gs(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:[S]}),c}catch(v){throw new Eo(v)}throw new pp(y)}},onAccountsChanged(o){o.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:o.map(l=>Pc(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 DLt(t){let n,r,s,a,o;return l=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",type:BU.type,async connect({chainId:c}={}){try{const u=await this.getProvider(),d=(await u.request({method:"eth_requestAccounts"})).map(x=>Pc(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===Eo.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 Eo(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=>Pc(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 ps(async()=>{const{default:v}=await import("./index-D35K2REE.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 K3);const f=await this.getProvider();try{return await f.request({method:"wallet_switchEthereumChain",params:[{chainId:Gs(d.id)}]}),d}catch(C){if(C.code===4902)try{let S;c!=null&&c.blockExplorerUrls?S=c.blockExplorerUrls:S=(x=d.blockExplorers)!=null&&x.default.url?[(g=d.blockExplorers)==null?void 0:g.default.url]:[];let T;(y=c==null?void 0:c.rpcUrls)!=null&&y.length?T=c.rpcUrls:T=[((v=d.rpcUrls.default)==null?void 0:v.http[0])??""];const I={blockExplorerUrls:S,chainId:Gs(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:T};return await f.request({method:"wallet_addEthereumChain",params:[I]}),d}catch(S){throw new Eo(S)}throw new pp(C)}},onAccountsChanged(c){c.length===0?this.onDisconnect():l.emitter.emit("change",{accounts:c.map(u=>Pc(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)}})}Yce.type="safe";function Yce(t={}){const{shimDisconnect:e=!1}=t;let n,r;return s=>({id:"safe",name:"Safe",type:Yce.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(Pc)},async getProvider(){if(typeof window<"u"&&(window==null?void 0:window.parent)!==window){if(!n){const{default:o}=await ps(async()=>{const{default:d}=await import("./index-B8lqC164.js");return{default:d}},__vite__mapDeps([6,7,2])),l=new o(t),c=await Eoe(()=>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 ps(()=>import("./index-EovvEqYV.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")}})}Xce.type="walletConnect";function Xce(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:Xce.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 S=x;if(!S){const F=await((y=f.storage)==null?void 0:y.getItem("state"))??{};f.chains.some(O=>O.id===F.chainId)?S=F.chainId:S=(v=f.chains[0])==null?void 0:v.id}if(!S)throw new Error("No chains found on connector.");const T=await this.isChainsStale();if(C.session&&T&&await C.disconnect(),!C.session||T){const F=f.chains.filter($=>$.id!==S).map($=>$.id);await C.connect({optionalChains:[S,...F],..."pairingTopic"in g?{pairingTopic:g.pairingTopic}:{}}),this.setRequestedChainsIds(f.chains.map($=>$.id))}const I=(await C.enable()).map(F=>Pc(F)),L=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:I,chainId:L}}catch(C){throw/(user rejected|connection request reset)/i.test(C==null?void 0:C.message)?new Eo(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=>Pc(g))},async getProvider({chainId:x}={}){var y;async function g(){const v=f.chains.map(S=>S.id);if(!v.length)return;const{EthereumProvider:C}=await ps(async()=>{const{EthereumProvider:S}=await import("./index.es-Bad1qmqc.js");return{EthereumProvider:S}},__vite__mapDeps([9,5]));return await C.init({...t,disableProviderPing:!0,optionalChains:v,projectId:t.projectId,rpcMap:Object.fromEntries(f.chains.map(S=>{const[T]=wyt({chain:S,transports:f.transports});return[S.id,T]})),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,S,T;const y=await this.getProvider();if(!y)throw new tp;const v=f.chains.find(I=>I.id===g);if(!v)throw new pp(new K3);try{await Promise.all([new Promise(L=>{const F=({chainId:$})=>{$===g&&(f.emitter.off("change",F),L())};f.emitter.on("change",F)}),y.request({method:"wallet_switchEthereumChain",params:[{chainId:Gs(g)}]})]);const I=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...I,g]),v}catch(I){const L=I;if(/(user rejected)/i.test(L.message))throw new Eo(L);try{let F;x!=null&&x.blockExplorerUrls?F=x.blockExplorerUrls:F=(C=v.blockExplorers)!=null&&C.default.url?[(S=v.blockExplorers)==null?void 0:S.default.url]:[];let $;(T=x==null?void 0:x.rpcUrls)!=null&&T.length?$=x.rpcUrls:$=[...v.rpcUrls.default.http];const O={blockExplorerUrls:F,chainId:Gs(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:[O]});const U=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...U,g]),v}catch(F){throw new Eo(F)}}},onAccountsChanged(x){x.length===0?this.onDisconnect():f.emitter.emit("change",{accounts:x.map(g=>Pc(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 WR={},BLt=768;TOt({conditions:{defaultCondition:"smallScreen",conditionNames:["smallScreen","largeScreen"],responsiveArray:void 0}});var $Lt=xDe({conditions:{defaultCondition:"smallScreen",conditionNames:["smallScreen","largeScreen"],responsiveArray:void 0}}),Lne=LOt({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"}}}}}),Hye={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)"}},ULt={shrink:"_12cbo8i6",shrinkSm:"_12cbo8i7"},zLt="_12cbo8i3 ju367v8r",HLt={grow:"_12cbo8i4",growLg:"_12cbo8i5"};function uu({active:t,hover:e}){return[zLt,e&&HLt[e],ULt[t]]}var jBe=h.createContext(null);function VLt(){const{adapter:t}=h.useContext(jBe)??{};if(!t)throw new Error("No authentication adapter found");return t}function $U(){const t=h.useContext(jBe);return(t==null?void 0:t.status)??null}function ABe(){const t=$U(),{isConnected:e}=ds();return e?t&&(t==="loading"||t==="unauthenticated")?t:"connected":"disconnected"}function Qce(){return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}function WLt(){return typeof navigator<"u"&&/iPhone|iPod/.test(navigator.userAgent)}function qLt(){return typeof navigator<"u"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function U5(){return WLt()||qLt()}function fu(){return Qce()||U5()}var GLt="iekbcc0",KLt={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"},YLt=({reset:t,...e})=>{if(!t)return Lne(e);const n=KLt[t],r=Lne(e);return bDe(GLt,n,r)},Bn=ke.forwardRef(({as:t="div",className:e,testId:n,...r},s)=>{const a={},o={};for(const c in r)Lne.properties.has(c)?a[c]=r[c]:o[c]=r[c];const l=YLt({reset:typeof t=="string"?t:"div",...a});return ke.createElement(t,{className:bDe(l,e),...o,"data-testid":n?`rk-${n.replace(/^rk-/,"")}`:void 0,ref:s})});Bn.displayName="Box";var _Be=new Map,vq=new Map;async function EBe(t){const e=vq.get(t);if(e)return e;const n=async()=>t().then(async s=>(_Be.set(t,s),s)),r=n().catch(s=>n().catch(a=>{vq.delete(t)}));return vq.set(t,r),r}async function xx(...t){return await Promise.all(t.map(e=>typeof e=="function"?EBe(e):e))}function XLt(){const[,t]=h.useReducer(e=>e+1,0);return t}function Zce(t){const e=typeof t=="function"?_Be.get(t):void 0,n=XLt();return h.useEffect(()=>{typeof t=="function"&&!e&&EBe(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=U5(),f=Zce(l),x=f&&/^http/.test(f),[g,y]=h.useReducer(()=>!0,!1);return ke.createElement(Bn,{"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},ke.createElement(Bn,{...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?ke.createElement(Bn,{...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 QLt="_1luule42",ZLt="_1luule43",JLt=t=>h.useMemo(()=>`${t}_${Math.round(Math.random()*1e9)}`,[t]),qE=({height:t=21,width:e=21})=>{const n=JLt("spinner");return ke.createElement("svg",{className:QLt,fill:"none",height:t,viewBox:"0 0 21 21",width:e,xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Loading"),ke.createElement("clipPath",{id:n},ke.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"})),ke.createElement("foreignObject",{clipPath:`url(#${n})`,height:"21",width:"21",x:"0",y:"0"},ke.createElement("div",{className:ZLt})))},na=["#FC5C54","#FFD95A","#E95D72","#6A87C8","#5FD0F3","#75C06B","#FFDD86","#5FC6D4","#FF949A","#FF8024","#9BA1A4","#EC66FF","#FF8CBC","#FF9A23","#C5DADB","#A8CE63","#71ABFF","#FFE279","#B6B1B6","#FF6780","#A575FF","#4D82FF","#FFB35A"],Vye=[{color:na[0],emoji:"🌶"},{color:na[1],emoji:"🤑"},{color:na[2],emoji:"🐙"},{color:na[3],emoji:"🫐"},{color:na[4],emoji:"🐳"},{color:na[0],emoji:"🤶"},{color:na[5],emoji:"🌲"},{color:na[6],emoji:"🌞"},{color:na[7],emoji:"🐒"},{color:na[8],emoji:"🐵"},{color:na[9],emoji:"🦊"},{color:na[10],emoji:"🐼"},{color:na[11],emoji:"🦄"},{color:na[12],emoji:"🐷"},{color:na[13],emoji:"🐧"},{color:na[8],emoji:"🦩"},{color:na[14],emoji:"👽"},{color:na[0],emoji:"🎈"},{color:na[8],emoji:"🍉"},{color:na[1],emoji:"🎉"},{color:na[15],emoji:"🐲"},{color:na[16],emoji:"🌎"},{color:na[17],emoji:"🍊"},{color:na[18],emoji:"🐭"},{color:na[19],emoji:"🍣"},{color:na[1],emoji:"🐥"},{color:na[20],emoji:"👾"},{color:na[15],emoji:"🥦"},{color:na[0],emoji:"👹"},{color:na[17],emoji:"🙀"},{color:na[4],emoji:"⛱"},{color:na[21],emoji:"⛵️"},{color:na[17],emoji:"🥳"},{color:na[8],emoji:"🤯"},{color:na[22],emoji:"🤠"}];function eRt(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(eRt((typeof t=="string"?t:"").toLowerCase())%Vye.length);return Vye[n??0]}var nRt=({address:t,ensImage:e,size:n})=>{const[r,s]=h.useState(!1);h.useEffect(()=>{if(e){const l=new Image;l.src=e,l.onload=()=>s(!0)}},[e]);const{color:a,emoji:o}=h.useMemo(()=>tRt(t),[t]);return e?r?ke.createElement(Bn,{backgroundSize:"cover",borderRadius:"full",position:"absolute",style:{backgroundImage:`url(${e})`,backgroundPosition:"center",height:n,width:n}}):ke.createElement(Bn,{alignItems:"center",backgroundSize:"cover",borderRadius:"full",color:"modalText",display:"flex",justifyContent:"center",position:"absolute",style:{height:n,width:n}},ke.createElement(qE,null)):ke.createElement(Bn,{alignItems:"center",display:"flex",justifyContent:"center",overflow:"hidden",style:{...!e&&{backgroundColor:a},height:n,width:n}},o)},kBe=nRt,TBe=h.createContext(kBe);function rRt({address:t,imageUrl:e,loading:n,size:r}){const s=h.useContext(TBe);return ke.createElement(Bn,{"aria-hidden":!0,borderRadius:"full",overflow:"hidden",position:"relative",style:{height:`${r}px`,width:`${r}px`},userSelect:"none"},ke.createElement(Bn,{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"},ke.createElement(s,{address:t,ensImage:e,size:r})),n&&ke.createElement(Bn,{color:"accentColor",display:"flex",height:"full",position:"absolute",width:"full"},ke.createElement(qE,{height:"100%",width:"100%"})))}var Wye={defaultLocale:"en",locale:"en"},sRt=class{constructor(t){this.listeners=new Set,this.defaultLocale=Wye.defaultLocale,this.enableFallback=!1,this.locale=Wye.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 sRt({en:JSON.parse(Ene),"en-US":JSON.parse(Ene)});ip.defaultLocale="en-US";ip.locale="en-US";ip.enableFallback=!0;var iRt=async t=>{switch(t){case"ar":case"ar-AR":return(await ps(async()=>{const{default:e}=await import("./ar_AR-ZRPPM56D-d2WEfzQ_.js");return{default:e}},[])).default;case"de":case"de-DE":return(await ps(async()=>{const{default:e}=await import("./de_DE-GYZFZXWH-CYZf24IR.js");return{default:e}},[])).default;case"en":case"en-US":return(await ps(async()=>{const{default:e}=await Promise.resolve().then(()=>SAe);return{default:e}},void 0)).default;case"es":case"es-419":return(await ps(async()=>{const{default:e}=await import("./es_419-OGVOQEFZ-D6BJPTeQ.js");return{default:e}},[])).default;case"fr":case"fr-FR":return(await ps(async()=>{const{default:e}=await import("./fr_FR-Q5QBQBX2-lQoTmpTH.js");return{default:e}},[])).default;case"hi":case"hi-IN":return(await ps(async()=>{const{default:e}=await import("./hi_IN-7I7LRHGW-CTQjmeYe.js");return{default:e}},[])).default;case"id":case"id-ID":return(await ps(async()=>{const{default:e}=await import("./id_ID-ZMGZ2JFV-CgKQKAmU.js");return{default:e}},[])).default;case"ja":case"ja-JP":return(await ps(async()=>{const{default:e}=await import("./ja_JP-NYBCHQTZ-CMaBl8Za.js");return{default:e}},[])).default;case"ko":case"ko-KR":return(await ps(async()=>{const{default:e}=await import("./ko_KR-67WE736M-DHWhIjcm.js");return{default:e}},[])).default;case"ms":case"ms-MY":return(await ps(async()=>{const{default:e}=await import("./ms_MY-65AJIBUS-BLlUrxe6.js");return{default:e}},[])).default;case"pt":case"pt-BR":return(await ps(async()=>{const{default:e}=await import("./pt_BR-DMJANC65-DMs4DrlC.js");return{default:e}},[])).default;case"ru":case"ru-RU":return(await ps(async()=>{const{default:e}=await import("./ru_RU-WER7RQ6A-DsJK55uv.js");return{default:e}},[])).default;case"th":case"th-TH":return(await ps(async()=>{const{default:e}=await import("./th_TH-JOSHEZ6D-Cp87mIRZ.js");return{default:e}},[])).default;case"tr":case"tr-TR":return(await ps(async()=>{const{default:e}=await import("./tr_TR-EAMG2YPO-C52_xfsf.js");return{default:e}},[])).default;case"ua":case"uk-UA":return(await ps(async()=>{const{default:e}=await import("./uk_UA-GO2TRVWA-C1C1400t.js");return{default:e}},[])).default;case"vi":case"vi-VN":return(await ps(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 ps(async()=>{const{default:e}=await import("./zh_CN-THPIFVWJ-Cbp71xMR.js");return{default:e}},[])).default;case"zh-HK":return(await ps(async()=>{const{default:e}=await import("./zh_HK-R7XP4TGF-CyJtfKGw.js");return{default:e}},[])).default;case"zh-Hant":case"zh-TW":return(await ps(async()=>{const{default:e}=await import("./zh_TW-F5LD752V-AHFgsYw-.js");return{default:e}},[])).default;default:return(await ps(async()=>{const{default:e}=await Promise.resolve().then(()=>SAe);return{default:e}},void 0)).default}};async function qye(t){if(ip.isLocaleCached(t)){ip.updateLocale(t);return}const n=await iRt(t);ip.setTranslations(t,JSON.parse(n))}var aRt=()=>{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}},hc=h.createContext({i18n:ip}),oRt=({children:t,locale:e})=>{const[n,r]=h.useState(0),s=h.useMemo(()=>aRt(),[]);h.useEffect(()=>ip.onChange(()=>{r(l=>l+1)}),[]),h.useEffect(()=>{e&&e!==ip.locale?qye(e):!e&&s&&s!==ip.locale&&qye(s)},[e,s]);const a=h.useMemo(()=>({t:(l,c)=>ip.t(l,c),i18n:ip}),[n]);return ke.createElement(hc.Provider,{value:a},t)};function PBe(t){return t!=null}var Gye={iconBackground:"#7290CC",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./apechain-COEQ5RUI-0TDoXOYf.js");return{default:t}},[])).default},wq={iconBackground:"#96bedc",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./arbitrum-HW44W6XR-hPA5bMPt.js");return{default:t}},[])).default},Kye={iconBackground:"#e84141",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./avalanche-MXEFEDSW-DcC5FNt3.js");return{default:t}},[])).default},Cq={iconBackground:"#0052ff",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./base-Z4LFBE5D-DHfqMzJC.js");return{default:t}},[])).default},Nq={iconBackground:"#814625",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./berachain-ZN3U5LDZ-CAvW_8ws.js");return{default:t}},[])).default},Yye={iconBackground:"#000000",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./blast-46UQLYYY-BV_Xlsq4.js");return{default:t}},[])).default},Xye={iconBackground:"#ebac0e",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./bsc-RVE67I5L-DVYEF0vl.js");return{default:t}},[])).default},Qye={iconBackground:"#FCFF52",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./celo-E6XU57FO-C5IguUgF.js");return{default:t}},[])).default},Zye={iconBackground:"#002D74",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./cronos-ROYR77VZ-Prn3LRPZ.js");return{default:t}},[])).default},lRt={iconBackground:"#A36EFD",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./degen-7ROC3GCY-9HqAkHtZ.js");return{default:t}},[])).default},kb={iconBackground:"#484c50",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./ethereum-RFBAMUVK-WsW8NXqo.js");return{default:t}},[])).default},Jye={iconBackground:"transparent",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./flow-NBCRNYVF-D2XasjKk.js");return{default:t}},[])).default},cRt={iconBackground:"#04795c",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./gnosis-Y56LN66M-D4_J-ZQH.js");return{default:t}},[])).default},e2e={iconBackground:"#000000",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./gravity-LMEBVSFN-DLxWpxhy.js");return{default:t}},[])).default},uRt={iconBackground:"#f9f7ec",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./hardhat-NEEC6JX7-DzuWQYyS.js");return{default:t}},[])).default},dRt={iconBackground:"#000000",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./hyperevm-J6CONVCX-C6oeYIAP.js");return{default:t}},[])).default},t2e={iconBackground:"#7132F5",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./ink-4U4ZVNAB-AlM1MLfQ.js");return{default:t}},[])).default},n2e={iconBackground:"transparent",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./kaia-A33DVQBT-Fgclbhio.js");return{default:t}},[])).default},Sq={iconBackground:"#ffffff",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./linea-IALBSJQC-Cmyd7vgA.js");return{default:t}},[])).default},jq={iconBackground:"#ffffff",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./manta-5V6W5D7G-BnjsGzeJ.js");return{default:t}},[])).default},r2e={iconBackground:"#000000",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./mantle-KBL3OIYT-DIpe0poV.js");return{default:t}},[])).default},hF={iconBackground:"#ff5a57",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./optimism-YWJ3IQHA-DYER-OR5.js");return{default:t}},[])).default},Aq={iconBackground:"#9f71ec",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./polygon-WWEUOMKW-CNBYSB1T.js");return{default:t}},[])).default},fRt={iconBackground:"#1273EA",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./ronin-PNHX5V6H-BS-WPXjQ.js");return{default:t}},[])).default},hRt={iconBackground:"#000000",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./sanko-RHQYXGM5-OX010CbN.js");return{default:t}},[])).default},s2e={iconBackground:"#FFEEDA",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./scroll-MCKFTBRS-C2gqZSab.js");return{default:t}},[])).default},i2e={iconBackground:"#F50DB4",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./unichain-OQ3BZUDH-CyMLDmFg.js");return{default:t}},[])).default},a2e={iconBackground:"#f9f7ec",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./xdc-X7V4QFNF-CSGs0o6M.js");return{default:t}},[])).default},o2e={iconBackground:"#000000",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./zetachain-BMJKVYBN-IK2CZBr3.js");return{default:t}},[])).default},l2e={iconBackground:"#f9f7ec",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./zksync-UWUXFL74-Bt0brpXu.js");return{default:t}},[])).default},_q={iconBackground:"#000000",iconUrl:async()=>(await ps(async()=>{const{default:t}=await import("./zora-YZH32HP3-CY3tp3EJ.js");return{default:t}},[])).default},pRt={apechain:{chainId:33139,name:"ApeChain",...Gye},apechainCurtis:{chainId:33111,name:"ApeChain Curtis",...Gye},arbitrum:{chainId:42161,name:"Arbitrum",...wq},arbitrumGoerli:{chainId:421613,...wq},arbitrumSepolia:{chainId:421614,...wq},avalanche:{chainId:43114,...Kye},avalancheFuji:{chainId:43113,...Kye},base:{chainId:8453,name:"Base",...Cq},baseGoerli:{chainId:84531,...Cq},baseSepolia:{chainId:84532,...Cq},berachain:{chainId:80094,name:"Berachain",...Nq},berachainArtio:{chainId:80085,name:"Berachain Artio",...Nq},berachainBArtio:{chainId:80084,name:"Berachain bArtio",...Nq},blast:{chainId:81457,name:"Blast",...Yye},blastSepolia:{chainId:168587773,...Yye},bsc:{chainId:56,name:"BSC",...Xye},bscTestnet:{chainId:97,...Xye},celo:{chainId:42220,name:"Celo",...Qye},celoAlfajores:{chainId:44787,name:"Celo Alfajores",...Qye},cronos:{chainId:25,...Zye},cronosTestnet:{chainId:338,...Zye},degen:{chainId:666666666,name:"Degen",...lRt},flow:{chainId:747,...Jye},flowTestnet:{chainId:545,...Jye},gnosis:{chainId:100,name:"Gnosis",...cRt},goerli:{chainId:5,...kb},gravity:{chainId:1625,name:"Gravity",...e2e},gravitySepolia:{chainId:13505,name:"Gravity Sepolia",...e2e},hardhat:{chainId:31337,...uRt},holesky:{chainId:17e3,...kb},hyperevm:{chainId:999,...dRt},ink:{chainId:57073,...t2e},inkSepolia:{chainId:763373,...t2e},kaia:{chainId:8217,name:"Kaia",...n2e},kairos:{chainId:1001,name:"Kairos",...n2e},kovan:{chainId:42,...kb},linea:{chainId:59144,name:"Linea",...Sq},lineaGoerli:{chainId:59140,name:"Linea Goerli",...Sq},lineaSepolia:{chainId:59141,name:"Linea Sepolia",...Sq},localhost:{chainId:1337,...kb},mainnet:{chainId:1,name:"Ethereum",...kb},manta:{chainId:169,name:"Manta",...jq},mantaSepolia:{chainId:3441006,...jq},mantaTestnet:{chainId:3441005,...jq},mantle:{chainId:5e3,...r2e},mantleTestnet:{chainId:5001,...r2e},optimism:{chainId:10,name:"Optimism",...hF},optimismGoerli:{chainId:420,...hF},optimismKovan:{chainId:69,...hF},optimismSepolia:{chainId:11155420,...hF},polygon:{chainId:137,name:"Polygon",...Aq},polygonAmoy:{chainId:80002,...Aq},polygonMumbai:{chainId:80001,...Aq},rinkeby:{chainId:4,...kb},ronin:{chainId:2020,...fRt},ropsten:{chainId:3,...kb},sanko:{chainId:1996,name:"Sanko",...hRt},scroll:{chainId:534352,...s2e},scrollSepolia:{chainId:534351,...s2e},sepolia:{chainId:11155111,...kb},unichain:{chainId:130,...i2e},unichainSepolia:{chainId:1301,...i2e},xdc:{chainId:50,name:"XinFin",...a2e},xdcTestnet:{chainId:51,...a2e},zetachain:{chainId:7e3,name:"ZetaChain",...o2e},zetachainAthensTestnet:{chainId:7001,name:"Zeta Athens",...o2e},zkSync:{chainId:324,name:"zkSync",...l2e},zkSyncTestnet:{chainId:280,...l2e},zora:{chainId:7777777,name:"Zora",..._q},zoraSepolia:{chainId:999999999,..._q},zoraTestnet:{chainId:999,..._q}},mRt=Object.fromEntries(Object.values(pRt).filter(PBe).map(({chainId:t,...e})=>[t,e])),xRt=t=>t.map(e=>{const n=mRt[e.id]??{};return{...e,name:n.name??e.name,iconUrl:e.iconUrl??n.iconUrl,iconBackground:e.iconBackground??n.iconBackground}}),Jce=h.createContext({chains:[]});function gRt({children:t,initialChain:e}){const{chains:n}=Fl();return ke.createElement(Jce.Provider,{value:h.useMemo(()=>({chains:xRt(n),initialChainId:typeof e=="number"?e:e==null?void 0:e.id}),[n,e])},t)}var C8=()=>h.useContext(Jce).chains,bRt=()=>h.useContext(Jce).initialChainId,yRt=()=>{const t=C8();return h.useMemo(()=>{const e={};for(const n of t)e[n.id]=n;return e},[t])},IBe=h.createContext({showBalance:void 0,setShowBalance:()=>{}});function vRt({children:t}){const[e,n]=h.useState();return ke.createElement(IBe.Provider,{value:{showBalance:e,setShowBalance:n}},t)}var wRt=()=>h.useContext(IBe);function CRt(){const[t,e]=h.useState(!1);return h.useEffect(()=>(e(!0),()=>{e(!1)}),[]),h.useCallback(()=>t,[t])}function FBe(){const t=C8(),e=WE.id;return t.some(r=>r.id===e)}function NRt(t){const e=FBe(),n=s=>{try{return vMt(s)}catch{}},{data:r}=F2t({chainId:WE.id,name:t?n(t):void 0,query:{enabled:e}});return r}async function Iv(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}${jRt(a)}`,{...l,body:c,headers:{Accept:"application/json","Content-Type":"application/json",...o},signal:n.signal});clearTimeout(r);const d=await SRt(u);if(u.ok){const{headers:g,status:y}=u;return{data:d,headers:g,status:y}}throw ARt({requestBody:s,response:u,responseBody:typeof d=="string"?{error:d}:d})}function SRt(t){const e=t.headers.get("Content-Type");return e!=null&&e.startsWith("application/json")?t.json():t.text()}function jRt(t){return t&&Object.keys(t).length?`?${new URLSearchParams(t)}`:""}function ARt({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 _Rt=class{constructor(t={}){const{baseUrl:e="",...n}=t;this.baseUrl=e,this.opts=n}get(t,e){return Iv(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"get"})}delete(t,e){return Iv(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"delete"})}head(t,e){return Iv(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"head"})}options(t,e){return Iv(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"options"})}post(t,e,n){return Iv(`${this.baseUrl}${t}`,{...this.opts,...n||{},body:e,method:"post"})}put(t,e,n){return Iv(`${this.baseUrl}${t}`,{...this.opts,...n||{},body:e,method:"put"})}patch(t,e,n){return Iv(`${this.baseUrl}${t}`,{...this.opts,...n||{},body:e,method:"patch"})}};function ERt({baseUrl:t,headers:e,params:n,timeout:r}){return new _Rt({baseUrl:t,headers:e,params:n,timeout:r})}var kRt=!!(typeof process<"u"&&typeof WR<"u"&&WR.RAINBOW_PROVIDER_API_KEY),TRt=ERt({baseUrl:"https://enhanced-provider.rainbow.me",headers:{"x-api-key":typeof process<"u"&&typeof WR<"u"&&WR.RAINBOW_PROVIDER_API_KEY||"LzbasoBiLqltex3VkcQ7LRmL4PtfiiZ1EMJrizrgfonWN6byJReu/l6yrUoo3zLW"}});function PRt(t,e,n={}){return[t,e,n]}function EM(t){return`rk-ens-name-${t}`}function IRt(t){try{const e=t?JSON.parse(t):null;return typeof e=="object"?e:null}catch{return null}}function FRt(t,e){if(!dc(t))return;const n=new Date,r=new Date(n.getTime()+180*6e4);localStorage.setItem(EM(t),JSON.stringify({ensName:e,expires:r.getTime()}))}function ORt(t){const e=IRt(localStorage.getItem(EM(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(EM(t)),null):n}async function MRt({address:t}){const e=ORt(t);if(e)return e;const r=(await TRt.get("/v1/resolve-ens",{params:{address:t}})).data.data;return r&&FRt(t,r),r}function LRt(t){const e=FBe(),{data:n}=O2t({chainId:WE.id,address:t,query:{enabled:e}}),{data:r}=APe({queryKey:PRt("address",t),queryFn:()=>MRt({address:t}),enabled:!e&&!!t&&kRt,staleTime:10*(60*1e3),retry:1});return n||r}function OBe({address:t,includeBalance:e}){const n=LRt(t),r=NRt(n),{data:s}=_Pe({address:e?t:void 0});return{ensName:n,ensAvatar:r,balance:s}}function eue(){const{chain:t}=ds();return(t==null?void 0:t.id)??null}var MBe="rk-transactions";function RRt(t){try{const e=t?JSON.parse(t):{};return typeof e=="object"?e:{}}catch{return{}}}function c2e(){return RRt(typeof localStorage<"u"?localStorage.getItem(MBe):null)}var DRt=/^0x([A-Fa-f0-9]{64})$/;function BRt(t){const e=[];return DRt.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 $Rt({provider:t}){let e=c2e(),n=t;const r=new Set,s=new Set,a=new Map;function o(T){n=T}function l(T,I){var L;return((L=e[T])==null?void 0:L[I])??[]}function c(T,I,L){const F=BRt(L);if(F.length>0)throw new Error(["Unable to add transaction",...F].join(`
`));x(T,I,$=>[{...L,status:"pending"},...$.filter(({hash:O})=>O!==L.hash)])}function u(T,I){x(T,I,()=>[])}function d(T,I,L,F){x(T,I,$=>$.map(O=>O.hash===L?{...O,status:F}:O))}async function f(T,I){await Promise.all(l(T,I).filter(L=>L.status==="pending").map(async L=>{const{confirmations:F,hash:$}=L,O=a.get($);if(O)return await O;const U=n.waitForTransactionReceipt({confirmations:F,hash:$,timeout:3e5}).then(({status:Y})=>{a.delete($),Y!==void 0&&(d(T,I,$,Y===0||Y==="reverted"?"failed":"confirmed"),v(Y))}).catch(()=>{d(T,I,$,"failed")});return a.set($,U),await U}))}function x(T,I,L){e=c2e(),e[T]=e[T]??{};let F=0;const $=10,O=L(e[T][I]??[]).filter(({status:U})=>U==="pending"?!0:F++<=$);e[T][I]=O.length>0?O:void 0,g(),y(),f(T,I)}function g(){localStorage.setItem(MBe,JSON.stringify(e))}function y(){for(const T of r)T()}function v(T){for(const I of s)I(T)}function C(T){return r.add(T),()=>{r.delete(T)}}function S(T){return s.add(T),()=>{s.delete(T)}}return{addTransaction:c,clearTransactions:u,getTransactions:l,onTransactionStatus:S,onChange:C,setProvider:o,waitForPendingTransactions:f}}var u2e,LBe=ke.createContext(null);function URt({children:t}){const e=EPe(),{address:n}=ds(),r=eue(),{refetch:s}=_Pe({address:n,query:{enabled:!1}}),[a]=ke.useState(()=>u2e??(u2e=$Rt({provider:e}))),o=ke.useCallback(l=>{l==="success"&&s()},[s]);return ke.useEffect(()=>{a.setProvider(e)},[a,e]),ke.useEffect(()=>{n&&r&&a.waitForPendingTransactions(n,r)},[a,n,r]),ke.useEffect(()=>{if(a&&n&&r)return a.onTransactionStatus(o)},[a,n,r,o]),ke.createElement(LBe.Provider,{value:a},t)}function RBe(){const t=ke.useContext(LBe);if(!t)throw new Error("Transaction hooks must be used within RainbowKitProvider");return t}function DBe(){const t=RBe(),{address:e}=ds(),n=eue(),[r,s]=h.useState(()=>t&&e&&n?t.getTransactions(e,n):[]);return h.useEffect(()=>{if(t&&e&&n)return s(t.getTransactions(e,n)),t.onChange(()=>{s(t.getTransactions(e,n))})},[t,e,n]),r}var d2e=t=>typeof t=="function"?t():t;function zRt(t,{extends:e}={}){const n={...hye(Hye,d2e(t))};if(!e)return n;const r=hye(Hye,d2e(e));return Object.fromEntries(Object.entries(n).filter(([a,o])=>o!==r[a]))}function f2e(t,e={}){return Object.entries(zRt(t,e)).map(([n,r])=>`${n}:${r.replace(/[:;{}</>]/g,"")};`).join("")}var BBe={appName:void 0,disclaimer:void 0,learnMoreUrl:"https://learn.rainbow.me/understanding-web3?utm_source=rainbowkit&utm_campaign=learnmore"},eP=h.createContext(BBe),$Be=h.createContext(!1);function HRt(t,e){let n;return()=>{n&&clearTimeout(n),n=setTimeout(()=>{n=null,t()},e)}}var UBe=()=>{const[t,e]=h.useState({height:void 0,width:void 0});return h.useEffect(()=>{const n=HRt(()=>{e({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",n),n(),()=>window.removeEventListener("resize",n)},[]),t},tP=h.createContext({connector:null,setConnector:()=>{}});function VRt({children:t}){const[e,n]=h.useState(null);return ke.createElement(tP.Provider,{value:h.useMemo(()=>({connector:e,setConnector:n}),[e])},t)}var nP={COMPACT:"compact",WIDE:"wide"},UU=h.createContext(nP.WIDE);function WRt({children:t,modalSize:e}){const{width:n}=UBe(),r=n&&n<BLt,{connector:s}=h.useContext(tP);return ke.createElement(UU.Provider,{value:r||s?nP.COMPACT:e},t)}var tue=h.createContext(!1),qRt="rk-version";function GRt({version:t}){localStorage.setItem(qRt,t)}function KRt(){const t=h.useCallback(()=>{GRt({version:"2.2.4"})},[]);h.useEffect(()=>{t()},[t])}function YRt(t,e){const n={};for(const r of t){const s=e(r);s&&(n[s]=r)}return n}function nue(){return typeof navigator<"u"&&typeof navigator.userAgent<"u"&&/Version\/([0-9._]+).*Safari/.test(navigator.userAgent)}function XRt(){return typeof document<"u"&&getComputedStyle(document.body).getPropertyValue("--arc-palette-focus")!==""}function rue(){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":XRt()?"Arc":(t==null?void 0:t.indexOf("chrome"))>-1?"Chrome":(t==null?void 0:t.indexOf("firefox"))>-1?"Firefox":nue()?"Safari":"Browser"}var QRt=hLt.UAParser(),{os:sue}=QRt;function ZRt(){return sue.name==="Windows"}function JRt(){return sue.name==="Mac OS"}function eDt(){return["Ubuntu","Mint","Fedora","Debian","Arch","Linux"].includes(sue.name)}function iue(){return ZRt()?"Windows":JRt()?"macOS":eDt()?"Linux":"Desktop"}var tDt=t=>{var n,r,s,a,o,l,c,u,d,f,x;const e=rue();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)},nDt=t=>{var n,r,s;return(U5()?(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)},rDt=t=>{var n,r,s,a,o;const e=iue();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)},zBe=(t,e)=>t.some(n=>n.id===e),sDt=t=>!!t.isRainbowKitConnector,h2e=t=>{var e;return!!(!t.isRainbowKitConnector&&((e=t.icon)!=null&&e.replace(/\n/g,"").startsWith("data:image"))&&t.uid&&t.name)},iDt=(t,e)=>t.id==="walletConnect"&&e?{...t,walletConnectModalConnector:e}:t,aDt=({wallets:t,recentWallets:e})=>[...e,...t.filter(n=>!zBe(e,n.id))],HBe="rk-recent";function oDt(t){try{const e=t?JSON.parse(t):[];return Array.isArray(e)?e:[]}catch{return[]}}function VBe(){return typeof localStorage<"u"?oDt(localStorage.getItem(HBe)):[]}function lDt(t){return[...new Set(t)]}function cDt(t){const e=lDt([t,...VBe()]);localStorage.setItem(HBe,JSON.stringify(e))}function GE(t=!1){var L,F,$;const e=C8(),n=bRt(),{connectAsync:r,connectors:s}=P2t(),a=s,{setIsWalletConnectModalOpen:o}=m$e(),l=a.map(O=>({...O,...O.rkDetails||{}}));async function c(O){var re,Q;const U=await O.getChainId(),Y=await r({chainId:n??((re=e.find(({id:q})=>q===U))==null?void 0:re.id)??((Q=e[0])==null?void 0:Q.id),connector:O});return Y&&cDt(O.id),Y}async function u(O){try{o(!0),await c(O),o(!1)}catch(U){const Y=U.name==="UserRejectedRequestError"||U.message==="Connection request reset. Please try again.";if(o(!1),!Y)throw U}}const d=async(O,U)=>{const Y=await O.getProvider();return O.id==="coinbase"?Y.qrUrl:new Promise(re=>Y.once("display_uri",Q=>{re(U(Q))}))},f=l.find(O=>O.id==="walletConnect"&&O.isWalletConnectModalConnector),x=l.filter(h2e).map(O=>({...O,groupIndex:0})),g=l.filter(sDt).filter(O=>!O.isWalletConnectModalConnector).filter(O=>t?!x.some(Y=>Y.id===O.rdns):!0).map(O=>iDt(O,f)),y=[...x,...g],v=YRt(y,O=>O.id),S=VBe().map(O=>v[O]).filter(Boolean).slice(0,3),T=[],I=aDt({wallets:y,recentWallets:S});for(const O of I){if(!O)continue;const U=h2e(O),Y=zBe(S,O.id);if(U){T.push({...O,iconUrl:O.icon,ready:!0,connect:()=>c(O),groupName:"Installed",recent:Y});continue}T.push({...O,ready:O.installed??!0,connect:()=>c(O),desktopDownloadUrl:rDt(O),extensionDownloadUrl:tDt(O),groupName:O.groupName,mobileDownloadUrl:nDt(O),getQrCodeUri:(L=O.qrCode)!=null&&L.getUri?()=>d(O,O.qrCode.getUri):void 0,getDesktopUri:(F=O.desktop)!=null&&F.getUri?()=>d(O,O.desktop.getUri):void 0,getMobileUri:($=O.mobile)!=null&&$.getUri?()=>{var re;return d(O,(re=O.mobile)==null?void 0:re.getUri)}:void 0,recent:Y,showWalletConnectModal:O.walletConnectModalConnector?()=>u(O.walletConnectModalConnector):void 0})}return T}var WBe=async()=>(await ps(async()=>{const{default:t}=await import("./assets-NU2OP443-COMs-Mo6.js");return{default:t}},[])).default,uDt=()=>xx(WBe),dDt=()=>ke.createElement(Rc,{background:"#d0d5de",borderRadius:"10",height:"48",src:WBe,width:"48"}),qBe=async()=>(await ps(async()=>{const{default:t}=await import("./login-CWDTIDNK-DhDUYE4b.js");return{default:t}},[])).default,fDt=()=>xx(qBe),hDt=()=>ke.createElement(Rc,{background:"#d0d5de",borderRadius:"10",height:"48",src:qBe,width:"48"}),Hs=ke.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)=>ke.createElement(Bn,{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));Hs.displayName="Text";var pDt={large:{fontSize:"16",paddingX:"24",paddingY:"10"},medium:{fontSize:"14",height:"28",paddingX:"12",paddingY:"4"},small:{fontSize:"14",paddingX:"10",paddingY:"5"}};function wd({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}=pDt[a],S=!f||!d;return ke.createElement(Bn,{...e?t?{}:{as:"a",href:e,rel:s,target:o}:{as:"button",type:"button"},onClick:t?void 0:r,...S?{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}:{}},ke.createElement(Hs,{color:t?"modalTextSecondary":u?"accentColorForeground":"accentColor",size:g,weight:"bold"},n))}var mDt=()=>fu()?ke.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"},ke.createElement("title",null,"Close"),ke.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"})):ke.createElement("svg",{"aria-hidden":!0,fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Close"),ke.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"})),h5=({"aria-label":t="Close",onClose:e})=>{const n=fu();return ke.createElement(Bn,{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"},ke.createElement(mDt,null))},GBe=async()=>(await ps(async()=>{const{default:t}=await import("./sign-A7IJEUT5-CGsRnPrd.js");return{default:t}},[])).default;function xDt({onClose:t,onCloseModal:e}){const{i18n:n}=h.useContext(hc),[{status:r,...s},a]=ke.useState({status:"idle"}),o=VLt(),l=h.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=h.useRef(!1);ke.useEffect(()=>{c.current||(c.current=!0,l())},[l]);const u=fu(),{address:d,chain:f}=ds(),{signMessageAsync:x}=zoe(),g=async()=>{try{const y=f==null?void 0:f.id,{nonce:v}=s;if(!d||!y||!v)return;a(T=>({...T,errorMessage:void 0,status:"signing"}));const C=o.createMessage({address:d,chainId:y,nonce:v});let S;try{S=await x({message:C})}catch(T){return T instanceof Eo?a(I=>({...I,status:"idle"})):a(I=>({...I,errorMessage:n.t("sign_in.signature.signing_error"),status:"idle"}))}a(T=>({...T,status:"verifying"}));try{if(await o.verify({message:C,signature:S})){e();return}throw new Error}catch{return a(T=>({...T,errorMessage:n.t("sign_in.signature.verifying_error"),status:"idle"}))}}catch{a({errorMessage:n.t("sign_in.signature.oops_error"),status:"idle"})}};return ke.createElement(Bn,{position:"relative"},ke.createElement(Bn,{display:"flex",paddingRight:"16",paddingTop:"16",position:"absolute",right:"0"},ke.createElement(h5,{onClose:t})),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"32":"24",padding:"24",paddingX:"18",style:{paddingTop:u?"60px":"36px"}},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"6":"4",style:{maxWidth:u?320:280}},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"32":"16"},ke.createElement(Rc,{height:40,src:GBe,width:40}),ke.createElement(Hs,{color:"modalText",size:u?"20":"18",textAlign:"center",weight:"heavy"},n.t("sign_in.label"))),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"16":"12"},ke.createElement(Hs,{color:"modalTextSecondary",size:u?"16":"14",textAlign:"center"},n.t("sign_in.description")),r==="idle"&&s.errorMessage?ke.createElement(Hs,{color:"error",size:u?"16":"14",textAlign:"center",weight:"bold"},s.errorMessage):null)),ke.createElement(Bn,{alignItems:u?void 0:"center",display:"flex",flexDirection:"column",gap:"8",width:"full"},ke.createElement(wd,{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?ke.createElement(wd,{label:"Cancel",onClick:t,size:"large",type:"secondary"}):ke.createElement(Bn,{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"},ke.createElement(Hs,{color:"closeButton",size:u?"16":"14",weight:"bold"},n.t("sign_in.message.cancel"))))))}function gDt(){const t=C8(),e=GE(),n=$U()==="unauthenticated",r=h.useCallback(()=>{xx(...e.map(s=>s.iconUrl),...t.map(s=>s.iconUrl).filter(PBe)),fu()||(uDt(),fDt()),n&&xx(GBe)},[e,t,n]);h.useEffect(()=>{r()},[r])}var KBe="WALLETCONNECT_DEEPLINK_CHOICE";function bDt({mobileUri:t,name:e}){localStorage.setItem(KBe,JSON.stringify({href:t.split("?")[0],name:e}))}function yDt(){localStorage.removeItem(KBe)}var YBe=h.createContext(void 0),Rne="data-rk",XBe=t=>({[Rne]:t||""}),vDt=t=>{if(t&&!/^[a-zA-Z0-9_]+$/.test(t))throw new Error(`Invalid ID: ${t}`);return t?`[${Rne}="${t}"]`:`[${Rne}]`},wDt=()=>{const t=h.useContext(YBe);return XBe(t)},CDt=fDe();function NDt({appInfo:t,avatar:e,children:n,coolMode:r=!1,id:s,initialChain:a,locale:o,modalSize:l=nP.WIDE,showRecentTransactions:c=!1,theme:u=CDt}){if(gDt(),KRt(),fPe({onDisconnect:yDt}),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=vDt(s),f={...BBe,...t},x=e??kBe;return ke.createElement(gRt,{initialChain:a},ke.createElement(VRt,null,ke.createElement(oRt,{locale:o},ke.createElement($Be.Provider,{value:r},ke.createElement(WRt,{modalSize:l},ke.createElement(tue.Provider,{value:c},ke.createElement(URt,null,ke.createElement(TBe.Provider,{value:x},ke.createElement(eP.Provider,{value:f},ke.createElement(YBe.Provider,{value:s},ke.createElement(vRt,null,ke.createElement(DBt,null,u?ke.createElement("div",{...XBe(s)},ke.createElement("style",{dangerouslySetInnerHTML:{__html:[`${d}{${f2e("lightMode"in u?u.lightMode:u)}}`,"darkMode"in u?`@media(prefers-color-scheme:dark){${d}{${f2e(u.darkMode,{extends:u.lightMode})}}}`:null].join("")}}),n):n))))))))))))}var SDt="_9pm4ki5 ju367va ju367v15 ju367v8r",jDt="_9pm4ki3 ju367v9h ju367vb3 ju367va ju367v2q ju367v8q",p2e=(t,e)=>{const n=t.querySelectorAll("button:not(:disabled), a[href]");n.length!==0&&n[e==="end"?n.length-1:0].focus()};function ADt(t){const e=h.useRef(null);return h.useEffect(()=>{const n=document.activeElement;return()=>{var r;(r=n.focus)==null||r.call(n)}},[]),h.useEffect(()=>{if(e.current){const n=e.current.querySelector("[data-auto-focus]");n?n.focus():e.current.focus()}},[]),ke.createElement(ke.Fragment,null,ke.createElement("div",{onFocus:h.useCallback(()=>e.current&&p2e(e.current,"end"),[]),tabIndex:0}),ke.createElement("div",{ref:e,style:{outline:"none"},tabIndex:-1,...t}),ke.createElement("div",{onFocus:h.useCallback(()=>e.current&&p2e(e.current,"start"),[]),tabIndex:0}))}var _Dt=t=>t.stopPropagation();function qR({children:t,onClose:e,open:n,titleId:r}){h.useEffect(()=>{const u=d=>n&&d.key==="Escape"&&e();return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n,e]);const[s,a]=h.useState(!0);h.useEffect(()=>{a(getComputedStyle(window.document.body).overflow!=="hidden")},[]);const o=h.useCallback(()=>e(),[e]),l=wDt(),c=fu();return ke.createElement(ke.Fragment,null,n?Ea.createPortal(ke.createElement(yBe,{enabled:s},ke.createElement(Bn,{...l},ke.createElement(Bn,{...l,alignItems:c?"flex-end":"center","aria-labelledby":r,"aria-modal":!0,className:jDt,onClick:o,position:"fixed",role:"dialog"},ke.createElement(ADt,{className:SDt,onClick:_Dt,role:"document"},t)))),document.body):null)}var EDt="_1ckjpok7",kDt="_1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r",TDt="_1ckjpok4 _1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r",PDt="_1ckjpok6 ju367vq",IDt="_1ckjpok3 _1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r",FDt="_1ckjpok2 _1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r";function GR({bottomSheetOnMobile:t=!1,children:e,marginTop:n,padding:r="16",paddingBottom:s,wide:a=!1}){const o=fu(),c=h.useContext(UU)===nP.COMPACT;return ke.createElement(Bn,{marginTop:n},ke.createElement(Bn,{className:[a?o?FDt:c?TDt:IDt:kDt,o?PDt:null,o&&t?EDt:null].join(" ")},ke.createElement(Bn,{padding:r,paddingBottom:s??r},e)))}var m2e=["k","m","b","t"];function pF(t,e=1){return t.toString().replace(new RegExp(`(.+\\.\\d{${e}})\\d+`),"$1").replace(/(\.[1-9]*)0+$/,"$1").replace(/\.$/,"")}function QBe(t){if(t<1)return pF(t,3);if(t<10**2)return pF(t,2);if(t<10**4)return new Intl.NumberFormat().format(Number.parseFloat(pF(t,1)));const e=10**1;let n=String(t);for(let r=m2e.length-1;r>=0;r--){const s=10**((r+1)*3);if(s<=t){t=t*e/s/e,n=pF(t,1)+m2e[r];break}}return n}function ZBe(t){return t.length<8?t:`${t.substring(0,4)}…${t.substring(t.length-4)}`}function JBe(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 ODt=()=>ke.createElement("svg",{fill:"none",height:"13",viewBox:"0 0 13 13",width:"13",xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Copied"),ke.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"})),MDt=()=>ke.createElement("svg",{fill:"none",height:"16",viewBox:"0 0 17 16",width:"17",xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Copy"),ke.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"})),LDt=()=>ke.createElement("svg",{fill:"none",height:"16",viewBox:"0 0 18 16",width:"18",xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Disconnect"),ke.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 RDt(){const t=RBe(),{address:e}=ds(),n=eue();return h.useCallback(()=>{if(!e||!n)throw new Error("No address or chain ID found");t.clearTransactions(e,n)},[t,e,n])}var e$e=t=>{var e,n;return(n=(e=t==null?void 0:t.blockExplorers)==null?void 0:e.default)==null?void 0:n.url},t$e=()=>ke.createElement("svg",{fill:"none",height:"19",viewBox:"0 0 20 19",width:"20",xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Link"),ke.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"})),DDt=()=>ke.createElement("svg",{fill:"none",height:"19",viewBox:"0 0 20 19",width:"20",xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Cancel"),ke.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"})),BDt=()=>ke.createElement("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Success"),ke.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"})),$Dt=t=>{switch(t){case"pending":return qE;case"confirmed":return BDt;case"failed":return DDt;default:return qE}};function UDt({tx:t}){const e=fu(),n=$Dt(t.status),r=t.status==="failed"?"error":"accentColor",{chain:s}=ds(),a=t.status==="confirmed"?"Confirmed":t.status==="failed"?"Failed":"Pending",o=e$e(s);return ke.createElement(ke.Fragment,null,ke.createElement(Bn,{...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"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:e?"16":"14"},ke.createElement(Bn,{color:r},ke.createElement(n,null)),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:e?"3":"1"},ke.createElement(Bn,null,ke.createElement(Hs,{color:"modalText",font:"body",size:e?"16":"14",weight:"bold"},t==null?void 0:t.description)),ke.createElement(Bn,null,ke.createElement(Hs,{color:t.status==="pending"?"modalTextSecondary":r,font:"body",size:"14",weight:e?"medium":"regular"},a)))),o&&ke.createElement(Bn,{alignItems:"center",color:"modalTextDim",display:"flex"},ke.createElement(t$e,null))))}var zDt=3;function HDt({address:t}){const e=DBe(),n=RDt(),{chain:r}=ds(),s=e$e(r),a=e.slice(0,zDt),o=a.length>0,l=fu(),{appName:c}=h.useContext(eP),{i18n:u}=h.useContext(hc);return ke.createElement(ke.Fragment,null,ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"10",paddingBottom:"2",paddingTop:"16",paddingX:l?"8":"18"},o&&ke.createElement(Bn,{paddingBottom:l?"4":"0",paddingTop:"8",paddingX:l?"12":"6"},ke.createElement(Bn,{display:"flex",justifyContent:"space-between"},ke.createElement(Hs,{color:"modalTextSecondary",size:l?"16":"14",weight:"semibold"},u.t("profile.transactions.recent.title")),ke.createElement(Bn,{style:{marginBottom:-6,marginLeft:-10,marginRight:-10,marginTop:-6}},ke.createElement(Bn,{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"},ke.createElement(Hs,{color:"modalTextSecondary",size:l?"16":"14",weight:"semibold"},u.t("profile.transactions.clear.label")))))),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"4"},o?a.map(d=>ke.createElement(UDt,{key:d.hash,tx:d})):ke.createElement(ke.Fragment,null,ke.createElement(Bn,{padding:l?"12":"8"},ke.createElement(Hs,{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&&ke.createElement(Bn,{background:"generalBorderDim",height:"1",marginX:"12",marginY:"8"})))),s&&ke.createElement(Bn,{paddingBottom:"18",paddingX:l?"8":"18"},ke.createElement(Bn,{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"}:{}},ke.createElement(Hs,{color:"modalText",font:"body",size:l?"16":"14",weight:l?"semibold":"bold"},u.t("profile.explorer.label")),ke.createElement(t$e,null))))}function x2e({action:t,icon:e,label:n,testId:r,url:s}){const a=fu();return ke.createElement(Bn,{...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"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"1",justifyContent:"center",paddingTop:"2",width:"full"},ke.createElement(Bn,{color:"modalText",height:"max"},e),ke.createElement(Bn,null,ke.createElement(Hs,{color:"modalText",size:a?"12":"13",weight:"semibold"},n))))}function VDt({address:t,ensAvatar:e,ensName:n,balance:r,onClose:s,onDisconnect:a}){const o=h.useContext(tue),[l,c]=h.useState(!1),u=h.useCallback(()=>{t&&(navigator.clipboard.writeText(t),c(!0))},[t]);if(h.useEffect(()=>{if(l){const C=setTimeout(()=>{c(!1)},1500);return()=>clearTimeout(C)}},[l]),!t)return null;const d=n?JBe(n):ZBe(t),f=r==null?void 0:r.formatted,x=f?QBe(Number.parseFloat(f)):void 0,g="rk_profile_title",y=fu(),{i18n:v}=h.useContext(hc);return ke.createElement(ke.Fragment,null,ke.createElement(Bn,{display:"flex",flexDirection:"column"},ke.createElement(Bn,{background:"profileForeground",padding:"16"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:y?"16":"12",justifyContent:"center",margin:"8",style:{textAlign:"center"}},ke.createElement(Bn,{style:{position:"absolute",right:16,top:16,willChange:"transform"}},ke.createElement(h5,{onClose:s}))," ",ke.createElement(Bn,{marginTop:y?"24":"0"},ke.createElement(rRt,{address:t,imageUrl:e,size:y?82:74})),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:y?"4":"0",textAlign:"center"},ke.createElement(Bn,{textAlign:"center"},ke.createElement(Hs,{as:"h1",color:"modalText",id:g,size:y?"20":"18",weight:"heavy"},d)),!!r&&ke.createElement(Bn,{textAlign:"center"},ke.createElement(Hs,{as:"h1",color:"modalTextSecondary",id:g,size:y?"16":"14",weight:"semibold"},x," ",r.symbol)))),ke.createElement(Bn,{display:"flex",flexDirection:"row",gap:"8",margin:"2",marginTop:"16"},ke.createElement(x2e,{action:u,icon:l?ke.createElement(ODt,null):ke.createElement(MDt,null),label:l?v.t("profile.copy_address.copied"):v.t("profile.copy_address.label")}),ke.createElement(x2e,{action:a,icon:ke.createElement(LDt,null),label:v.t("profile.disconnect.label"),testId:"disconnect-button"}))),o&&ke.createElement(ke.Fragment,null,ke.createElement(Bn,{background:"generalBorder",height:"1",marginTop:"-1"}),ke.createElement(Bn,null,ke.createElement(HDt,{address:t})))))}function WDt({onClose:t,open:e}){const{address:n}=ds(),{balance:r,ensAvatar:s,ensName:a}=OBe({address:n,includeBalance:e}),{disconnect:o}=M$();return n?ke.createElement(ke.Fragment,null,n&&ke.createElement(qR,{onClose:t,open:e,titleId:"rk_account_modal_title"},ke.createElement(GR,{bottomSheetOnMobile:!0,padding:"0"},ke.createElement(VDt,{address:n,ensAvatar:s,ensName:a,balance:r,onClose:t,onDisconnect:o})))):null}var qDt=({size:t})=>ke.createElement("svg",{fill:"none",height:t,viewBox:"0 0 28 28",width:t,xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Disconnect"),ke.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"})),GDt="v9horb0",aue=ke.forwardRef(({children:t,currentlySelected:e=!1,onClick:n,testId:r,...s},a)=>{const o=fu();return ke.createElement(Bn,{as:"button",borderRadius:"menuButton",disabled:e,display:"flex",onClick:n,ref:a,testId:r,type:"button"},ke.createElement(Bn,{borderRadius:"menuButton",className:[o?GDt: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))});aue.displayName="MenuButton";var KDt=({chainId:t,currentChainId:e,switchChain:n,chainIconSize:r,isLoading:s,src:a,name:o,iconBackground:l,idx:c})=>{const u=fu(),{i18n:d}=h.useContext(hc),f=C8(),x=e===t;return ke.createElement(h.Fragment,null,ke.createElement(aue,{currentlySelected:x,onClick:x?void 0:()=>n({chainId:t}),testId:`chain-option-${t}`},ke.createElement(Bn,{fontFamily:"body",fontSize:"16",fontWeight:"bold"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"4",height:r},a&&ke.createElement(Bn,{height:"full",marginRight:"8"},ke.createElement(Rc,{alt:o,background:l,borderRadius:"full",height:r,src:a,width:r,testId:`chain-option-${t}-icon`})),ke.createElement("div",null,o??o)),x&&ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",marginRight:"6"},ke.createElement(Hs,{color:"accentColorForeground",size:"14",weight:"medium"},d.t("chains.connected")),ke.createElement(Bn,{background:"connectionIndicator",borderColor:"selectedOptionBorder",borderRadius:"full",borderStyle:"solid",borderWidth:"1",height:"8",marginLeft:"8",width:"8"})),s&&ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",marginRight:"6"},ke.createElement(Hs,{color:"modalText",size:"14",weight:"medium"},d.t("chains.confirm")),ke.createElement(Bn,{background:"standby",borderRadius:"full",height:"8",marginLeft:"8",width:"8"}))))),u&&c<f.length-1&&ke.createElement(Bn,{background:"generalBorderDim",height:"1",marginX:"8"}))},YDt=KDt,XDt="_18dqw9x0",QDt="_18dqw9x1";function ZDt({onClose:t,open:e}){const{chainId:n}=ds(),{chains:r}=Fl(),[s,a]=h.useState(null),{switchChain:o}=Hoe({mutation:{onMutate:({chainId:y})=>{a(y)},onSuccess:()=>{s&&a(null)},onError:()=>{s&&a(null)},onSettled:()=>{t()}}}),{i18n:l}=h.useContext(hc),{disconnect:c}=M$(),u="rk_chain_modal_title",d=fu(),f=r.some(y=>y.id===n),x=d?"36":"28",g=C8();return n?ke.createElement(qR,{onClose:t,open:e,titleId:u},ke.createElement(GR,{bottomSheetOnMobile:!0,paddingBottom:"0"},ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"14"},ke.createElement(Bn,{display:"flex",flexDirection:"row",justifyContent:"space-between"},d&&ke.createElement(Bn,{width:"30"}),ke.createElement(Bn,{paddingBottom:"0",paddingLeft:"8",paddingTop:"4"},ke.createElement(Hs,{as:"h1",color:"modalText",id:u,size:d?"20":"18",weight:"heavy"},l.t("chains.title"))),ke.createElement(h5,{onClose:t})),!f&&ke.createElement(Bn,{marginX:"8",textAlign:d?"center":"left"},ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},l.t("chains.wrong_network"))),ke.createElement(Bn,{className:d?QDt:XDt,display:"flex",flexDirection:"column",gap:"4",padding:"2",paddingBottom:"16"},g.map(({iconBackground:y,iconUrl:v,id:C,name:S},T)=>ke.createElement(YDt,{key:C,chainId:C,currentChainId:n,switchChain:o,chainIconSize:x,isLoading:s===C,src:v,name:S,iconBackground:y,idx:T})),!f&&ke.createElement(ke.Fragment,null,ke.createElement(Bn,{background:"generalBorderDim",height:"1",marginX:"8"}),ke.createElement(aue,{onClick:()=>c(),testId:"chain-option-disconnect"},ke.createElement(Bn,{color:"error",fontFamily:"body",fontSize:"16",fontWeight:"bold"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"4",height:x},ke.createElement(Bn,{alignItems:"center",color:"error",height:x,justifyContent:"center",marginRight:"8"},ke.createElement(qDt,{size:Number(x)})),ke.createElement("div",null,l.t("chains.disconnect"))))))))))):null}function JDt(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 oue=({children:t,href:e})=>ke.createElement(Bn,{as:"a",color:"accentColor",href:e,rel:"noreferrer",target:"_blank"},t),lue=({children:t})=>ke.createElement(Hs,{color:"modalTextSecondary",size:"12",weight:"medium"},t);function g2e({compactModeEnabled:t=!1,getWallet:e}){const{disclaimer:n,learnMoreUrl:r}=h.useContext(eP),{i18n:s}=h.useContext(hc);return ke.createElement(ke.Fragment,null,ke.createElement(Bn,{alignItems:"center",color:"accentColor",display:"flex",flexDirection:"column",height:"full",justifyContent:"space-around"},ke.createElement(Bn,{marginBottom:"10"},!t&&ke.createElement(Hs,{color:"modalText",size:"18",weight:"heavy"},s.t("intro.title"))),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"32",justifyContent:"center",marginY:"20",style:{maxWidth:312}},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16"},ke.createElement(Bn,{borderRadius:"6",height:"48",minWidth:"48",width:"48"},ke.createElement(dDt,null)),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"4"},ke.createElement(Hs,{color:"modalText",size:"14",weight:"bold"},s.t("intro.digital_asset.title")),ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},s.t("intro.digital_asset.description")))),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16"},ke.createElement(Bn,{borderRadius:"6",height:"48",minWidth:"48",width:"48"},ke.createElement(hDt,null)),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"4"},ke.createElement(Hs,{color:"modalText",size:"14",weight:"bold"},s.t("intro.login.title")),ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},s.t("intro.login.description"))))),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",margin:"10"},ke.createElement(wd,{label:s.t("intro.get.label"),onClick:e}),ke.createElement(Bn,{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"},ke.createElement(Hs,{color:"accentColor",size:"14",weight:"bold"},s.t("intro.learn_more.label")))),n&&!t&&ke.createElement(Bn,{marginBottom:"8",marginTop:"12",textAlign:"center"},ke.createElement(n,{Link:oue,Text:lue}))))}var n$e=()=>ke.createElement("svg",{fill:"none",height:"17",viewBox:"0 0 11 17",width:"11",xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Back"),ke.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"})),eBt=()=>ke.createElement("svg",{fill:"none",height:"12",viewBox:"0 0 8 12",width:"8",xmlns:"http://www.w3.org/2000/svg"},ke.createElement("title",null,"Info"),ke.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"})),tBt=({"aria-label":t="Info",onClick:e})=>{const n=fu();return ke.createElement(Bn,{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"},ke.createElement(eBt,null))},r$e=t=>{const e=h.useRef(null),n=h.useContext($Be),r=Zce(t);return h.useEffect(()=>{if(n&&e.current&&r)return rBt(e.current,r)},[n,r]),e},nBt=()=>{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},b2e=0;function rBt(t,e){b2e++;const n=[15,20,25,35,45],r=35;let s=[],a=!1,o=0,l=0;const c=nBt();function u(){const L=n[Math.floor(Math.random()*n.length)],F=Math.random()*10,$=Math.random()*25,O=Math.random()*360,U=Math.random()*35*(Math.random()<=.5?-1:1),Y=l-L/2,re=o-L/2,Q=Math.random()<=.5?-1:1,q=document.createElement("div");q.innerHTML=`<img src="${e}" width="${L}" height="${L}" style="border-radius: 25%">`,q.setAttribute("style",["position:absolute","will-change:transform",`top:${Y}px`,`left:${re}px`,`transform:rotate(${O}deg)`].join(";")),c.appendChild(q),s.push({direction:Q,element:q,left:re,size:L,speedHorz:F,speedUp:$,spinSpeed:U,spinVal:O,top:Y})}function d(){for(const L of s)L.left=L.left-L.speedHorz*L.direction,L.top=L.top-L.speedUp,L.speedUp=Math.min(L.size,L.speedUp-1),L.spinVal=L.spinVal+L.spinSpeed,L.top>=Math.max(window.innerHeight,document.body.clientHeight)+L.size&&(s=s.filter(F=>F!==L),L.element.remove()),L.element.setAttribute("style",["position:absolute","will-change:transform",`top:${L.top}px`,`left:${L.left}px`,`transform:rotate(${L.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",S=L=>{var F,$;"touches"in L?(o=(F=L.touches)==null?void 0:F[0].clientX,l=($=L.touches)==null?void 0:$[0].clientY):(o=L.clientX,l=L.clientY)},T=L=>{S(L),a=!0},I=()=>{a=!1};return t.addEventListener(C,S,{passive:!1}),t.addEventListener(y,T),t.addEventListener(v,I),t.addEventListener("mouseleave",I),()=>{t.removeEventListener(C,S),t.removeEventListener(y,T),t.removeEventListener(v,I),t.removeEventListener("mouseleave",I);const L=setInterval(()=>{f&&s.length===0&&(cancelAnimationFrame(f),clearInterval(L),--b2e===0&&c.remove())},500)}}var sBt="g5kl0l0",s$e=({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=r$e(r),[x,g]=ke.useState(!1),{i18n:y}=ke.useContext(hc);return ke.createElement(Bn,{display:"flex",flexDirection:"column",onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),ref:f},ke.createElement(Bn,{as:t,borderRadius:"menuButton",borderStyle:"solid",borderWidth:"1",className:e?void 0:[sBt,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},ke.createElement(Bn,{color:e?"accentColorForeground":"modalText",disabled:!o,fontFamily:"body",fontSize:"16",fontWeight:"bold",transition:"default"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"12"},ke.createElement(Rc,{background:n,...!x&&u?{borderColor:"actionButtonBorder"}:{},useAsImage:!u,borderRadius:"6",height:"28",src:r,width:"28"}),ke.createElement(Bn,null,ke.createElement(Bn,{style:{marginTop:l?-2:void 0},maxWidth:"200"},s),l&&ke.createElement(Hs,{color:e?"accentColorForeground":"accentColor",size:"12",style:{lineHeight:1,marginTop:-1},weight:"medium"},y.t("connect.recent")))))))};s$e.displayName="ModalSelection";var iBt="rk-latest-id";function aBt(t){localStorage.setItem(iBt,t)}var Eq=(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})`},oBt=t=>t?[Eq(t,.2),Eq(t,.14),Eq(t,.1)]:null,lBt=t=>/^#([0-9a-f]{3}){1,2}$/i.test(t),i$e=async()=>(await ps(async()=>{const{default:t}=await import("./connect-MR6XDLIE-BET5HMNk.js");return{default:t}},[])).default,cBt=()=>xx(i$e),uBt=()=>ke.createElement(Rc,{background:"#515a70",borderColor:"generalBorder",borderRadius:"10",height:"48",src:i$e,width:"48"}),a$e=async()=>(await ps(async()=>{const{default:t}=await import("./create-X4WFHLCW-De9pC3ym.js");return{default:t}},[])).default,o$e=()=>xx(a$e),dBt=()=>ke.createElement(Rc,{background:"#e3a5e8",borderColor:"generalBorder",borderRadius:"10",height:"48",src:a$e,width:"48"}),l$e=async()=>(await ps(async()=>{const{default:t}=await import("./refresh-HJGJRASX-D0rkc63_.js");return{default:t}},[])).default,fBt=()=>xx(l$e),hBt=()=>ke.createElement(Rc,{background:"#515a70",borderColor:"generalBorder",borderRadius:"10",height:"48",src:l$e,width:"48"}),c$e=async()=>(await ps(async()=>{const{default:t}=await import("./scan-DEOT2M37-1-mJ5OyF.js");return{default:t}},[])).default,u$e=()=>xx(c$e),pBt=()=>ke.createElement(Rc,{background:"#515a70",borderColor:"generalBorder",borderRadius:"10",height:"48",src:c$e,width:"48"}),mBt="_1vwt0cg0",xBt="_1vwt0cg2 ju367v7a ju367v7v",gBt="_1vwt0cg3",bBt="_1vwt0cg4",yBt=(t,e)=>{const n=Array.prototype.slice.call(LLt.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 d$e({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=h.useMemo(()=>{const x=[],g=yBt(o,t),y=c/g.length;[{x:0,y:0},{x:1,y:0},{x:0,y:1}].forEach(({x:I,y:L})=>{const F=(g.length-7)*y*I,$=(g.length-7)*y*L;for(let O=0;O<3;O++)x.push(ke.createElement("rect",{fill:O%2!==0?"white":"black",height:y*(7-O*2),key:`${O}-${I}-${L}`,rx:(O-2)*-5+(O===0?2:0),ry:(O-2)*-5+(O===0?2:0),width:y*(7-O*2),x:F+y*O,y:$+y*O}))});const C=Math.floor((r+25)/y),S=g.length/2-C/2,T=g.length/2+C/2-1;return g.forEach((I,L)=>{I.forEach((F,$)=>{g[L][$]&&(L<7&&$<7||L>g.length-8&&$<7||L<7&&$>g.length-8||L>S&&L<T&&$>S&&$<T||x.push(ke.createElement("circle",{cx:L*y+y/2,cy:$*y+y/2,fill:"black",key:`circle-${L}-${$}`,r:y/3})))})}),x},[t,r,c,o]),d=c/2-r/2,f=r+n*2;return ke.createElement(Bn,{borderColor:"generalBorder",borderRadius:"menuButton",borderStyle:"solid",borderWidth:"1",className:mBt,padding:l,width:"max"},ke.createElement(Bn,{style:{height:c,userSelect:"none",width:c},userSelect:"none"},ke.createElement(Bn,{display:"flex",justifyContent:"center",position:"relative",style:{height:0,top:d,width:c},width:"full"},ke.createElement(Rc,{background:e,borderColor:{custom:"rgba(0, 0, 0, 0.06)"},borderRadius:"13",height:r,src:s,width:r})),ke.createElement("svg",{height:c,style:{all:"revert"},width:c},ke.createElement("title",null,"QR Code"),ke.createElement("defs",null,ke.createElement("clipPath",{id:"clip-wrapper"},ke.createElement("rect",{height:f,width:f})),ke.createElement("clipPath",{id:"clip-logo"},ke.createElement("rect",{height:r,width:r}))),ke.createElement("rect",{fill:"transparent",height:c,width:c}),u)))}var f$e=async()=>{switch(rue()){case"Arc":return(await ps(async()=>{const{default:e}=await import("./Arc-R3PUWRPJ-CUdEQO8X.js");return{default:e}},[])).default;case"Brave":return(await ps(async()=>{const{default:e}=await import("./Brave-24BM36UM-C6C5mkTK.js");return{default:e}},[])).default;case"Chrome":return(await ps(async()=>{const{default:e}=await import("./Chrome-TLI42HDP-BgiVz-ma.js");return{default:e}},[])).default;case"Edge":return(await ps(async()=>{const{default:e}=await import("./Edge-AZ34LAFM-EBh9cG_z.js");return{default:e}},[])).default;case"Firefox":return(await ps(async()=>{const{default:e}=await import("./Firefox-ZDK7RHKK-5nyhB0sj.js");return{default:e}},[])).default;case"Opera":return(await ps(async()=>{const{default:e}=await import("./Opera-BKMCKUXC-CCypmVaM.js");return{default:e}},[])).default;case"Safari":return(await ps(async()=>{const{default:e}=await import("./Safari-PXQIVS6N-B-Lfxb9r.js");return{default:e}},[])).default;default:return(await ps(async()=>{const{default:e}=await import("./Browser-4R4QKTV2-D3ON1q-S.js");return{default:e}},[])).default}},vBt=()=>xx(f$e),h$e=async()=>{switch(iue()){case"Windows":return(await ps(async()=>{const{default:e}=await import("./Windows-GTAT3OTE-K9Pt3pUF.js");return{default:e}},[])).default;case"macOS":return(await ps(async()=>{const{default:e}=await import("./Macos-5QL4JBJE-DLNYPiln.js");return{default:e}},[])).default;case"Linux":return(await ps(async()=>{const{default:e}=await import("./Linux-VYP66PDO--MOvpQUa.js");return{default:e}},[])).default;default:return(await ps(async()=>{const{default:e}=await import("./Linux-VYP66PDO--MOvpQUa.js");return{default:e}},[])).default}},wBt=()=>xx(h$e);function CBt({getWalletDownload:t,compactModeEnabled:e}){const r=GE().filter(a=>a.isRainbowKitConnector).splice(0,5),{i18n:s}=h.useContext(hc);return ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",marginTop:"18",width:"full"},ke.createElement(Bn,{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 ke.createElement(Bn,{alignItems:"center",display:"flex",gap:"16",justifyContent:"space-between",key:a.id,width:"full"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16"},ke.createElement(Rc,{background:l,borderColor:"actionButtonBorder",borderRadius:"10",height:"48",src:c,width:"48"}),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"2"},ke.createElement(Hs,{color:"modalText",size:"14",weight:"bold"},d),ke.createElement(Hs,{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))),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"4"},ke.createElement(wd,{label:s.t("get.action.label"),onClick:()=>t(u),type:"secondary"})))})),ke.createElement(Bn,{alignItems:"center",borderRadius:"10",display:"flex",flexDirection:"column",gap:"8",justifyContent:"space-between",marginBottom:"4",paddingY:"8",style:{maxWidth:275,textAlign:"center"}},ke.createElement(Hs,{color:"modalText",size:"14",weight:"bold"},s.t("get.looking_for.title")),ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},e?s.t("get.looking_for.desktop.compact_description"):s.t("get.looking_for.desktop.wide_description"))))}var kq="44";function NBt({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=nue(),{i18n:S}=h.useContext(hc),T=!!o.extensionDownloadUrl,I=(l==null?void 0:l.qrCode)&&T,L=(l==null?void 0:l.qrCode)&&!!o.desktopDownloadUrl,F=f&&s,$=async()=>{const re=await(y==null?void 0:y());window.open(re,C?"_blank":"_self")},O=g?{description:e?S.t("connect.walletconnect.description.compact"):S.t("connect.walletconnect.description.full"),label:S.t("connect.walletconnect.open.label"),onClick:()=>{r(),g()}}:F?{description:S.t("connect.secondary_action.get.description",{wallet:d}),label:S.t("connect.secondary_action.get.label"),onClick:()=>t(I||L?"DOWNLOAD_OPTIONS":"DOWNLOAD")}:null,{width:U}=UBe(),Y=U&&U<768;return h.useEffect(()=>{vBt(),wBt()},[]),ke.createElement(Bn,{display:"flex",flexDirection:"column",height:"full",width:"full"},F?ke.createElement(Bn,{alignItems:"center",display:"flex",height:"full",justifyContent:"center"},ke.createElement(d$e,{logoBackground:c,logoSize:e?60:72,logoUrl:u,size:e?318:Y?Math.max(280,Math.min(U-308,382)):382,uri:s})):ke.createElement(Bn,{alignItems:"center",display:"flex",justifyContent:"center",style:{flexGrow:1}},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"8"},ke.createElement(Bn,{borderRadius:"10",height:kq,overflow:"hidden"},ke.createElement(Rc,{useAsImage:!o.isRainbowKitConnector,height:kq,src:u,width:kq})),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"4",paddingX:"32",style:{textAlign:"center"}},ke.createElement(Hs,{color:"modalText",size:"18",weight:"bold"},x?S.t("connect.status.opening",{wallet:d}):T?S.t("connect.status.not_installed",{wallet:d}):S.t("connect.status.not_available",{wallet:d})),!x&&T?ke.createElement(Bn,{paddingTop:"20"},ke.createElement(wd,{href:o.extensionDownloadUrl,label:S.t("connect.secondary_action.install.label"),type:"secondary"})):null,x&&!F&&ke.createElement(ke.Fragment,null,ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",justifyContent:"center"},ke.createElement(Hs,{color:"modalTextSecondary",size:"14",textAlign:"center",weight:"medium"},S.t("connect.status.confirm"))),ke.createElement(Bn,{alignItems:"center",color:"modalText",display:"flex",flexDirection:"row",height:"32",marginTop:"8"},n?ke.createElement(wd,{label:S.t("connect.secondary_action.retry.label"),onClick:async()=>{v&&$(),a(o)}}):ke.createElement(Bn,{color:"modalTextSecondary"},ke.createElement(qE,null))))))),ke.createElement(Bn,{alignItems:"center",borderRadius:"10",display:"flex",flexDirection:"row",gap:"8",height:"28",justifyContent:"space-between",marginTop:"12"},x&&O&&ke.createElement(ke.Fragment,null,ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},O.description),ke.createElement(wd,{label:O.label,onClick:O.onClick,type:"secondary"}))))}var Tq=({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&&oBt(n);return ke.createElement(Bn,{alignItems:"center",borderRadius:"13",display:"flex",justifyContent:"center",overflow:"hidden",paddingX:a?"18":"44",position:"relative",style:{flex:1,isolation:"isolate"},width:"full"},ke.createElement(Bn,{borderColor:"actionButtonBorder",borderRadius:"13",borderStyle:"solid",borderWidth:"1",style:{bottom:"0",left:"0",position:"absolute",right:"0",top:"0",zIndex:1}}),d&&ke.createElement(Bn,{background:"downloadTopCardBackground",height:"full",position:"absolute",style:{zIndex:0},width:"full"},ke.createElement(Bn,{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)"}},ke.createElement(Bn,{style:{filter:"blur(100px)",marginLeft:-27,marginTop:-20,opacity:.6,transform:"translate3d(0, 0, 0)"}},ke.createElement(Rc,{borderRadius:"full",height:"200",src:s,width:"200"})),ke.createElement(Bn,{style:{filter:"blur(100px)",marginRight:0,marginTop:105,opacity:.6,overflow:"auto",transform:"translate3d(0, 0, 0)"}},ke.createElement(Rc,{borderRadius:"full",height:"200",src:s,width:"200"})))),!d&&f&&ke.createElement(Bn,{background:"downloadBottomCardBackground",style:{bottom:"0",left:"0",position:"absolute",right:"0",top:"0"}},ke.createElement(Bn,{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}}),ke.createElement(Bn,{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}})),ke.createElement(Bn,{alignItems:"flex-start",display:"flex",flexDirection:"row",gap:"24",height:"max",justifyContent:"center",style:{zIndex:1}},ke.createElement(Bn,null,ke.createElement(Rc,{height:"60",src:s,width:"60",...r?{background:r,borderColor:"generalBorder",borderRadius:"10"}:null})),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"4",style:{flex:1},width:"full"},ke.createElement(Hs,{color:"modalText",size:"14",weight:"bold"},l),ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},e),ke.createElement(Bn,{marginTop:"14",width:"max"},ke.createElement(wd,{href:c,label:t,onClick:o,size:"medium"})))))};function SBt({changeWalletStep:t,wallet:e}){const n=rue(),r=iue(),a=h.useContext(UU)==="compact",{desktop:o,desktopDownloadUrl:l,extension:c,extensionDownloadUrl:u,mobileDownloadUrl:d}=e,{i18n:f}=h.useContext(hc);return h.useEffect(()=>{o$e(),u$e(),fBt(),cBt()},[]),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"24",height:"full",marginBottom:"8",marginTop:"4",width:"full"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"8",height:"full",justifyContent:"center",width:"full"},u&&ke.createElement(Tq,{actionLabel:f.t("get_options.extension.download.label",{browser:n}),description:f.t("get_options.extension.description"),iconUrl:f$e,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&&ke.createElement(Tq,{actionLabel:f.t("get_options.desktop.download.label",{platform:r}),description:f.t("get_options.desktop.description"),iconUrl:h$e,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&&ke.createElement(Tq,{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 jBt({changeWalletStep:t,wallet:e}){const{downloadUrls:n,qrCode:r}=e,{i18n:s}=h.useContext(hc);return h.useEffect(()=>{o$e(),u$e()},[]),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"24",height:"full",width:"full"},ke.createElement(Bn,{style:{maxWidth:220,textAlign:"center"}},ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"semibold"},s.t("get_mobile.description"))),ke.createElement(Bn,{height:"full"},n!=null&&n.qrCode?ke.createElement(d$e,{logoSize:0,size:268,uri:n.qrCode}):null),ke.createElement(Bn,{alignItems:"center",borderRadius:"10",display:"flex",flexDirection:"row",gap:"8",height:"34",justifyContent:"space-between",marginBottom:"12",paddingY:"8"},ke.createElement(wd,{label:s.t("get_mobile.continue.label"),onClick:()=>t(r!=null&&r.instructions?"INSTRUCTIONS_MOBILE":"CONNECT")})))}var o1={connect:()=>ke.createElement(uBt,null),create:()=>ke.createElement(dBt,null),install:t=>ke.createElement(Rc,{background:t.iconBackground,borderColor:"generalBorder",borderRadius:"10",height:"48",src:t.iconUrl,width:"48"}),refresh:()=>ke.createElement(hBt,null),scan:()=>ke.createElement(pBt,null)};function ABt({connectWallet:t,wallet:e}){var r,s,a,o;const{i18n:n}=h.useContext(hc);return ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",width:"full"},ke.createElement(Bn,{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 ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16",key:c},ke.createElement(Bn,{borderRadius:"10",height:"48",minWidth:"48",overflow:"hidden",position:"relative",width:"48"},(u=o1[l.step])==null?void 0:u.call(o1,e)),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"4"},ke.createElement(Hs,{color:"modalText",size:"14",weight:"bold"},n.t(l.title,void 0,{rawKeyIfTranslationMissing:!0})),ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},n.t(l.description,void 0,{rawKeyIfTranslationMissing:!0}))))})),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",marginBottom:"16"},ke.createElement(wd,{label:n.t("get_instructions.mobile.connect.label"),onClick:()=>t(e)}),ke.createElement(Bn,{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"},ke.createElement(Hs,{color:"accentColor",size:"14",weight:"bold"},n.t("get_instructions.mobile.learn_more.label")))))}function _Bt({wallet:t}){var n,r,s,a;const{i18n:e}=h.useContext(hc);return ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",width:"full"},ke.createElement(Bn,{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 ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16",key:l},ke.createElement(Bn,{borderRadius:"10",height:"48",minWidth:"48",overflow:"hidden",position:"relative",width:"48"},(c=o1[o.step])==null?void 0:c.call(o1,t)),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"4"},ke.createElement(Hs,{color:"modalText",size:"14",weight:"bold"},e.t(o.title,void 0,{rawKeyIfTranslationMissing:!0})),ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},e.t(o.description,void 0,{rawKeyIfTranslationMissing:!0}))))})),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",marginBottom:"16"},ke.createElement(wd,{label:e.t("get_instructions.extension.refresh.label"),onClick:window.location.reload.bind(window.location)}),ke.createElement(Bn,{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"},ke.createElement(Hs,{color:"accentColor",size:"14",weight:"bold"},e.t("get_instructions.extension.learn_more.label")))))}function EBt({connectWallet:t,wallet:e}){var r,s,a,o;const{i18n:n}=h.useContext(hc);return ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",width:"full"},ke.createElement(Bn,{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 ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16",key:c},ke.createElement(Bn,{borderRadius:"10",height:"48",minWidth:"48",overflow:"hidden",position:"relative",width:"48"},(u=o1[l.step])==null?void 0:u.call(o1,e)),ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"4"},ke.createElement(Hs,{color:"modalText",size:"14",weight:"bold"},n.t(l.title,void 0,{rawKeyIfTranslationMissing:!0})),ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},n.t(l.description,void 0,{rawKeyIfTranslationMissing:!0}))))})),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",marginBottom:"16"},ke.createElement(wd,{label:n.t("get_instructions.desktop.connect.label"),onClick:()=>t(e)}),ke.createElement(Bn,{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"},ke.createElement(Hs,{color:"accentColor",size:"14",weight:"bold"},n.t("get_instructions.desktop.learn_more.label")))))}function kBt({onClose:t}){const e="rk_connect_title",[n,r]=h.useState(),[s,a]=h.useState(),[o,l]=h.useState(),c=!!(s!=null&&s.qrCode)&&o,[u,d]=h.useState(!1),x=h.useContext(UU)===nP.COMPACT,{disclaimer:g}=h.useContext(eP),{i18n:y}=h.useContext(hc),v=nue(),C=h.useRef(!1),{connector:S}=h.useContext(tP),I=GE(!S).filter(ge=>ge.ready||!!ge.extensionDownloadUrl).sort((ge,ve)=>ge.groupIndex-ve.groupIndex),L=GE(),F=JDt(I,ge=>ge.groupName),$=["Recommended","Other","Popular","More","Others","Installed"];h.useEffect(()=>{S&&!C.current&&(te("CONNECT"),re(S),C.current=!0)},[S]);const O=ge=>{var ve,be;d(!1),ge.ready&&((be=(ve=ge==null?void 0:ge.connect)==null?void 0:ve.call(ge))==null||be.catch(()=>{d(!0)}))},U=async ge=>{const ve=I.find(be=>ge.id===be.id);ve!=null&&ve.getDesktopUri&&setTimeout(async()=>{var we;const be=await((we=ve==null?void 0:ve.getDesktopUri)==null?void 0:we.call(ve));be&&window.open(be,v?"_blank":"_self")},0)},Y=async ge=>{var we;const ve=I.find(je=>ge.id===je.id),be=await((we=ve==null?void 0:ve.getQrCodeUri)==null?void 0:we.call(ve));l(be),setTimeout(()=>{a(ve),te("CONNECT")},be?0:50)},re=async ge=>{aBt(ge.id),ge.ready&&(Y(ge),U(ge)),O(ge),r(ge.id),ge.ready||(a(ge),te(ge!=null&&ge.extensionDownloadUrl?"DOWNLOAD_OPTIONS":"CONNECT"))},Q=ge=>{var Fe;const ve=L.find(Re=>ge===Re.id),be=(Fe=ve==null?void 0:ve.downloadUrls)==null?void 0:Fe.qrCode,we=!!(ve!=null&&ve.desktopDownloadUrl),je=!!(ve!=null&&ve.extensionDownloadUrl);a(ve),te(be&&(je||we)?"DOWNLOAD_OPTIONS":be?"DOWNLOAD":we?"INSTRUCTIONS_DESKTOP":"INSTRUCTIONS_EXTENSION")},q=()=>{r(void 0),a(void 0),l(void 0)},te=(ge,ve=!1)=>{ve&&ge==="GET"&&fe==="GET"?q():!ve&&ge==="GET"?G("GET"):!ve&&ge==="CONNECT"&&G("CONNECT"),oe(ge)},[fe,G]=h.useState("NONE"),[ie,oe]=h.useState("NONE");let K=null,H=null,ee=null,se;h.useEffect(()=>{d(!1)},[ie,s]);const Se=!!(!!(s!=null&&s.extensionDownloadUrl)&&(s!=null&&s.mobileDownloadUrl));switch(ie){case"NONE":K=ke.createElement(g2e,{getWallet:()=>te("GET")});break;case"LEARN_COMPACT":K=ke.createElement(g2e,{compactModeEnabled:x,getWallet:()=>te("GET")}),H=y.t("intro.title"),ee="NONE";break;case"GET":K=ke.createElement(CBt,{getWalletDownload:Q,compactModeEnabled:x}),H=y.t("get.title"),ee=x?"LEARN_COMPACT":"NONE";break;case"CONNECT":K=s&&ke.createElement(NBt,{changeWalletStep:te,compactModeEnabled:x,connectionError:u,onClose:t,qrCodeUri:o,reconnect:O,wallet:s}),H=c&&(s.name==="WalletConnect"?y.t("connect_scan.fallback_title"):y.t("connect_scan.title",{wallet:s.name})),ee=x?S?null:"NONE":null,se=x?S?()=>{}:q:()=>{};break;case"DOWNLOAD_OPTIONS":K=s&&ke.createElement(SBt,{changeWalletStep:te,wallet:s}),H=s&&y.t("get_options.short_title",{wallet:s.name}),ee=S?"CONNECT":x?"NONE":fe;break;case"DOWNLOAD":K=s&&ke.createElement(jBt,{changeWalletStep:te,wallet:s}),H=s&&y.t("get_mobile.title",{wallet:s.name}),ee=Se?"DOWNLOAD_OPTIONS":fe;break;case"INSTRUCTIONS_MOBILE":K=s&&ke.createElement(ABt,{connectWallet:re,wallet:s}),H=s&&y.t("get_options.title",{wallet:x&&s.shortName||s.name}),ee="DOWNLOAD";break;case"INSTRUCTIONS_EXTENSION":K=s&&ke.createElement(_Bt,{wallet:s}),H=s&&y.t("get_options.title",{wallet:x&&s.shortName||s.name}),ee="DOWNLOAD_OPTIONS";break;case"INSTRUCTIONS_DESKTOP":K=s&&ke.createElement(EBt,{connectWallet:re,wallet:s}),H=s&&y.t("get_options.title",{wallet:x&&s.shortName||s.name}),ee="DOWNLOAD_OPTIONS";break}return ke.createElement(Bn,{display:"flex",flexDirection:"row",style:{maxHeight:x?468:504}},(x?ie==="NONE":!0)&&ke.createElement(Bn,{className:x?bBt:gBt,display:"flex",flexDirection:"column",marginTop:"16"},ke.createElement(Bn,{display:"flex",justifyContent:"space-between"},x&&g&&ke.createElement(Bn,{marginLeft:"16",width:"28"},ke.createElement(tBt,{onClick:()=>te("LEARN_COMPACT")})),x&&!g&&ke.createElement(Bn,{marginLeft:"16",width:"28"}),ke.createElement(Bn,{marginLeft:x?"0":"6",paddingBottom:"8",paddingTop:"2",paddingX:"18"},ke.createElement(Hs,{as:"h1",color:"modalText",id:e,size:"18",weight:"heavy",testId:"connect-header-label"},y.t("connect.title"))),x&&ke.createElement(Bn,{marginRight:"16"},ke.createElement(h5,{onClose:t}))),ke.createElement(Bn,{className:xBt,paddingBottom:"18"},Object.entries(F).map(([ge,ve],be)=>ve.length>0&&ke.createElement(h.Fragment,{key:be},ge?ke.createElement(Bn,{marginBottom:"8",marginTop:"16",marginX:"6"},ke.createElement(Hs,{color:ge==="Installed"?"accentColor":"modalTextSecondary",size:"14",weight:"bold"},$.includes(ge)?y.t(`connector_group.${ge.toLowerCase()}`):ge)):null,ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"4"},ve.map(we=>ke.createElement(s$e,{currentlySelected:we.id===n,iconBackground:we.iconBackground,iconUrl:we.iconUrl,key:we.id,name:we.name,onClick:()=>re(we),ready:we.ready,recent:we.recent,testId:`wallet-option-${we.id}`,isRainbowKitConnector:we.isRainbowKitConnector})))))),x&&ke.createElement(ke.Fragment,null,ke.createElement(Bn,{background:"generalBorder",height:"1",marginTop:"-1"}),g?ke.createElement(Bn,{paddingX:"24",paddingY:"16",textAlign:"center"},ke.createElement(g,{Link:oue,Text:lue})):ke.createElement(Bn,{alignItems:"center",display:"flex",justifyContent:"space-between",paddingX:"24",paddingY:"16"},ke.createElement(Bn,{paddingY:"4"},ke.createElement(Hs,{color:"modalTextSecondary",size:"14",weight:"medium"},y.t("connect.new_to_ethereum.description"))),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"4",justifyContent:"center"},ke.createElement(Bn,{className:uu({active:"shrink",hover:"grow"}),cursor:"pointer",onClick:()=>te("LEARN_COMPACT"),paddingY:"4",style:{willChange:"transform"},transition:"default"},ke.createElement(Hs,{color:"accentColor",size:"14",weight:"bold"},y.t("connect.new_to_ethereum.learn_more.label"))))))),(x?ie!=="NONE":!0)&&ke.createElement(ke.Fragment,null,!x&&ke.createElement(Bn,{background:"generalBorder",minWidth:"1",width:"1"}),ke.createElement(Bn,{display:"flex",flexDirection:"column",margin:"16",style:{flexGrow:1}},ke.createElement(Bn,{alignItems:"center",display:"flex",justifyContent:"space-between",marginBottom:"12"},ke.createElement(Bn,{width:"28"},ee&&ke.createElement(Bn,{as:"button",className:uu({active:"shrinkSm",hover:"growLg"}),color:"accentColor",onClick:()=>{ee&&te(ee,!0),se==null||se()},paddingX:"8",paddingY:"4",style:{boxSizing:"content-box",height:17,willChange:"transform"},transition:"default",type:"button"},ke.createElement(n$e,null))),ke.createElement(Bn,{display:"flex",justifyContent:"center",style:{flexGrow:1}},H&&ke.createElement(Hs,{color:"modalText",size:"18",textAlign:"center",weight:"heavy"},H)),ke.createElement(h5,{onClose:t})),ke.createElement(Bn,{display:"flex",flexDirection:"column",style:{minHeight:x?396:432}},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"6",height:"full",justifyContent:"center",marginX:"8"},K)))))}var TBt="_1am14412",PBt="_1am14410",IBt="_1am14413",FBt=({wallet:t})=>ke.createElement("svg",{className:IBt,viewBox:"0 0 86 86",width:"86",height:"86"},ke.createElement("title",null,"Loading"),ke.createElement("rect",{x:"3",y:"3",width:80,height:80,rx:20,ry:20,strokeDasharray:`${160/3} ${2*160/3}`,strokeDashoffset:160,className:TBt,style:{stroke:(t==null?void 0:t.iconAccent)||"#0D3887"}}));function p$e({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=r$e(a),g=h.useRef(!1),{i18n:y}=h.useContext(hc),v=h.useCallback(async()=>{if(o!=="walletConnect"&&(async()=>{const S=await(c==null?void 0:c());if(S)if(S&&bDt({mobileUri:S,name:l}),S.startsWith("http")){const T=document.createElement("a");T.href=S,T.target="_blank",T.rel="noreferrer noopener",T.click()}else window.location.href=S})(),f){f(),t==null||t();return}r==null||r()},[r,c,f,t,l,o]);return h.useEffect(()=>{n&&!g.current&&(v(),g.current=!0)},[n,v]),ke.createElement(Bn,{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"},ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",justifyContent:"center"},ke.createElement(Bn,{display:"flex",alignItems:"center",justifyContent:"center",paddingBottom:"8",paddingTop:"10",position:"relative"},n?ke.createElement(FBt,{wallet:e}):null,ke.createElement(Rc,{background:s,borderRadius:"13",boxShadow:"walletLogo",height:"60",src:a,width:"60"})),n?null:ke.createElement(Bn,{display:"flex",flexDirection:"column",textAlign:"center"},ke.createElement(Hs,{as:"h2",color:e.ready?"modalText":"modalTextSecondary",size:"13",weight:"medium"},ke.createElement(Bn,{as:"span",position:"relative"},d??l,!e.ready&&" (unsupported)")),e.recent&&ke.createElement(Hs,{color:"accentColor",size:"12",weight:"medium"},y.t("connect.recent")))))}function OBt({onClose:t}){var g;const e="rk_connect_title",n=GE().filter(y=>y.isRainbowKitConnector),{disclaimer:r,learnMoreUrl:s}=h.useContext(eP);let a=null,o=null,l=!1,c=null;const[u,d]=h.useState("CONNECT"),{i18n:f}=h.useContext(hc),x=U5();switch(u){case"CONNECT":{a=f.t("connect.title"),l=!0,o=ke.createElement(Bn,null,ke.createElement(Bn,{background:"profileForeground",className:PBt,display:"flex",paddingBottom:"20",paddingTop:"6"},ke.createElement(Bn,{display:"flex",style:{margin:"0 auto"}},n.filter(y=>y.ready).map(y=>ke.createElement(Bn,{key:y.id,paddingX:"20"},ke.createElement(Bn,{width:"60"},ke.createElement(p$e,{onClose:t,wallet:y})))))),ke.createElement(Bn,{background:"generalBorder",height:"1",marginBottom:"32",marginTop:"-1"}),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"32",paddingX:"32",style:{textAlign:"center"}},ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"8",textAlign:"center"},ke.createElement(Hs,{color:"modalText",size:"16",weight:"bold"},f.t("intro.title")),ke.createElement(Hs,{color:"modalTextSecondary",size:"16"},f.t("intro.description")))),ke.createElement(Bn,{paddingTop:"32",paddingX:"20"},ke.createElement(Bn,{display:"flex",gap:"14",justifyContent:"center"},ke.createElement(wd,{label:f.t("intro.get.label"),onClick:()=>d("GET"),size:"large",type:"secondary"}),ke.createElement(wd,{href:s,label:f.t("intro.learn_more.label"),size:"large",type:"secondary"}))),r&&ke.createElement(Bn,{marginTop:"28",marginX:"32",textAlign:"center"},ke.createElement(r,{Link:oue,Text:lue})));break}case"GET":{a=f.t("get.title"),c="CONNECT";const y=(g=n==null?void 0:n.filter(v=>{var C,S,T;return((C=v.downloadUrls)==null?void 0:C.ios)||((S=v.downloadUrls)==null?void 0:S.android)||((T=v.downloadUrls)==null?void 0:T.mobile)}))==null?void 0:g.splice(0,3);o=ke.createElement(Bn,null,ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",marginBottom:"36",marginTop:"5",paddingTop:"12",width:"full"},y.map((v,C)=>{const{downloadUrls:S,iconBackground:T,iconUrl:I,name:L}=v;return!(S!=null&&S.ios)&&!(S!=null&&S.android)&&!(S!=null&&S.mobile)?null:ke.createElement(Bn,{display:"flex",gap:"16",key:v.id,paddingX:"20",width:"full"},ke.createElement(Bn,{style:{minHeight:48,minWidth:48}},ke.createElement(Rc,{background:T,borderColor:"generalBorder",borderRadius:"10",height:"48",src:I,width:"48"})),ke.createElement(Bn,{display:"flex",flexDirection:"column",width:"full"},ke.createElement(Bn,{alignItems:"center",display:"flex",height:"48"},ke.createElement(Bn,{width:"full"},ke.createElement(Hs,{color:"modalText",size:"18",weight:"bold"},L)),ke.createElement(wd,{href:(x?S==null?void 0:S.ios:S==null?void 0:S.android)||(S==null?void 0:S.mobile),label:f.t("get.action.label"),size:"small",type:"secondary"})),C<y.length-1&&ke.createElement(Bn,{background:"generalBorderDim",height:"1",marginY:"10",width:"full"})))})),ke.createElement(Bn,{style:{marginBottom:"42px"}}),ke.createElement(Bn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"36",paddingX:"36",style:{textAlign:"center"}},ke.createElement(Bn,{display:"flex",flexDirection:"column",gap:"12",textAlign:"center"},ke.createElement(Hs,{color:"modalText",size:"16",weight:"bold"},f.t("get.looking_for.title")),ke.createElement(Hs,{color:"modalTextSecondary",size:"16"},f.t("get.looking_for.mobile.description")))));break}}return ke.createElement(Bn,{display:"flex",flexDirection:"column",paddingBottom:"36"},ke.createElement(Bn,{background:l?"profileForeground":"modalBackground",display:"flex",flexDirection:"column",paddingBottom:"4",paddingTop:"14"},ke.createElement(Bn,{display:"flex",justifyContent:"center",paddingBottom:"6",paddingX:"20",position:"relative"},c&&ke.createElement(Bn,{display:"flex",position:"absolute",style:{left:0,marginBottom:-20,marginTop:-20}},ke.createElement(Bn,{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"},ke.createElement(n$e,null))),ke.createElement(Bn,{marginTop:"4",textAlign:"center",width:"full"},ke.createElement(Hs,{as:"h1",color:"modalText",id:e,size:"20",weight:"bold"},a)),ke.createElement(Bn,{alignItems:"center",display:"flex",height:"32",paddingRight:"14",position:"absolute",right:"0"},ke.createElement(Bn,{style:{marginBottom:-20,marginTop:-20}},ke.createElement(h5,{onClose:t}))))),ke.createElement(Bn,{display:"flex",flexDirection:"column"},o))}var MBt=({onClose:t})=>{const{connector:e}=h.useContext(tP),{i18n:n}=h.useContext(hc),r=(e==null?void 0:e.name)||"";return ke.createElement(Bn,null,ke.createElement(Bn,{display:"flex",paddingBottom:"32",justifyContent:"center",alignItems:"center",background:"profileForeground",flexDirection:"column"},ke.createElement(Bn,{width:"full",display:"flex",justifyContent:"flex-end",marginTop:"18",marginRight:"24"},ke.createElement(h5,{onClose:t})),ke.createElement(Bn,{width:"60"},ke.createElement(p$e,{onClose:t,wallet:e,connecting:!0})),ke.createElement(Bn,{marginTop:"20"},ke.createElement(Hs,{textAlign:"center",color:"modalText",size:"18",weight:"semibold"},n.t("connect.status.connect_mobile",{wallet:r}))),ke.createElement(Bn,{maxWidth:"full",marginTop:"8"},ke.createElement(Hs,{textAlign:"center",color:"modalText",size:"16",weight:"medium"},n.t("connect.status.confirm_mobile",{wallet:r})))))};function LBt({onClose:t}){const{connector:e}=h.useContext(tP);return fu()?e?ke.createElement(MBt,{onClose:t}):ke.createElement(OBt,{onClose:t}):ke.createElement(kBt,{onClose:t})}function RBt({onClose:t,open:e}){const n="rk_connect_title",r=ABe(),{disconnect:s}=M$(),{isConnecting:a}=ds(),o=ke.useCallback(()=>{t(),s()},[t,s]),l=ke.useCallback(()=>{a&&s(),t()},[t,s,a]);return r==="disconnected"?ke.createElement(qR,{onClose:l,open:e,titleId:n},ke.createElement(GR,{bottomSheetOnMobile:!0,padding:"0",wide:!0},ke.createElement(LBt,{onClose:l}))):r==="unauthenticated"?ke.createElement(qR,{onClose:o,open:e,titleId:n},ke.createElement(GR,{bottomSheetOnMobile:!0,padding:"0"},ke.createElement(xDt,{onClose:o,onCloseModal:t}))):null}function Pq(){const[t,e]=h.useState(!1);return{closeModal:h.useCallback(()=>e(!1),[]),isModalOpen:t,openModal:h.useCallback(()=>e(!0),[])}}var N8=h.createContext({accountModalOpen:!1,chainModalOpen:!1,connectModalOpen:!1,isWalletConnectModalOpen:!1,setIsWalletConnectModalOpen:()=>{}});function DBt({children:t}){const{closeModal:e,isModalOpen:n,openModal:r}=Pq(),{closeModal:s,isModalOpen:a,openModal:o}=Pq(),{closeModal:l,isModalOpen:c,openModal:u}=Pq(),[d,f]=h.useState(!1),x=ABe(),{chainId:g}=ds(),{chains:y}=Fl(),v=y.some(T=>T.id===g),C=h.useCallback(({keepConnectModalOpen:T=!1}={})=>{T||e(),s(),l()},[e,s,l]),S=$U()==="unauthenticated";return fPe({onConnect:()=>C({keepConnectModalOpen:S}),onDisconnect:()=>C()}),h.useEffect(()=>{S&&C()},[S,C]),ke.createElement(N8.Provider,{value:h.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,ke.createElement(RBt,{onClose:e,open:n}),ke.createElement(WDt,{onClose:s,open:a}),ke.createElement(ZDt,{onClose:l,open:c}))}function BBt(){const{accountModalOpen:t,chainModalOpen:e,connectModalOpen:n}=h.useContext(N8);return{accountModalOpen:t,chainModalOpen:e,connectModalOpen:n}}function $Bt(){const{accountModalOpen:t,openAccountModal:e}=h.useContext(N8);return{accountModalOpen:t,openAccountModal:e}}function UBt(){const{chainModalOpen:t,openChainModal:e}=h.useContext(N8);return{chainModalOpen:t,openChainModal:e}}function m$e(){const{isWalletConnectModalOpen:t,setIsWalletConnectModalOpen:e}=h.useContext(N8);return{isWalletConnectModalOpen:t,setIsWalletConnectModalOpen:e}}function z5(){const{connectModalOpen:t,openConnectModal:e}=h.useContext(N8),{isWalletConnectModalOpen:n}=m$e();return{connectModalOpen:t||n,openConnectModal:e}}var Iq=()=>{};function zBt({children:t}){const e=CRt(),{address:n}=ds(),{chainId:r}=ds(),{chains:s}=Fl(),a=s.some(q=>q.id===r),o=yRt(),l=$U()??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=Zce(d),g=h.useContext(tue),y=DBe().some(({status:q})=>q==="pending")&&g,{showBalance:v}=wRt(),S=typeof v=="boolean"?v:v?$Lt(v)[fu()?"smallScreen":"largeScreen"]:!0,{balance:T,ensAvatar:I,ensName:L}=OBe({address:n,includeBalance:S}),F=T?`${QBe(Number.parseFloat(T.formatted))} ${T.symbol}`:void 0,{openConnectModal:$}=z5(),{openChainModal:O}=UBt(),{openAccountModal:U}=$Bt(),{accountModalOpen:Y,chainModalOpen:re,connectModalOpen:Q}=BBt();return ke.createElement(ke.Fragment,null,t({account:n?{address:n,balanceDecimals:T==null?void 0:T.decimals,balanceFormatted:T==null?void 0:T.formatted,balanceSymbol:T==null?void 0:T.symbol,displayBalance:F,displayName:L?JBe(L):ZBe(n),ensAvatar:I??void 0,ensName:L??void 0,hasPendingTransactions:y}:void 0,accountModalOpen:Y,authenticationStatus:l,chain:r?{hasIcon:!!d,iconBackground:f,iconUrl:x,id:r,name:u,unsupported:!a}:void 0,chainModalOpen:re,connectModalOpen:Q,mounted:e(),openAccountModal:U??Iq,openChainModal:O??Iq,openConnectModal:$??Iq}))}zBt.displayName="ConnectButton.Custom";var x$e=({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 HBt(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>n!==void 0))}function VBt(t,e){const n=[];for(const r of t)n.some(s=>s[e]===r[e])||n.push(r);return n}var WBt=(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=x$e({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 S=C({projectId:e,appName:r,appIcon:o,options:{metadata:f,...n},walletConnectParameters:{metadata:f,...n}});if(S!=null&&S.iconAccent&&!lBt(S==null?void 0:S.iconAccent))throw new Error(`Property \`iconAccent\` is not a hex value for wallet: ${S.name}`);const T={...S,groupIndex:g+1,groupName:y,index:l};typeof S.hidden=="function"?d.push(T):u.push(T)}const x=VBt([...u,...d],"id");for(const{createConnector:g,groupIndex:y,groupName:v,hidden:C,...S}of x){if(typeof C=="function"&&C())continue;const T=F=>({rkDetails:HBt({...S,groupIndex:y,groupName:v,isRainbowKitConnector:!0,...F||{}})});S.id==="walletConnect"&&c.push(g(T({isWalletConnectModalConnector:!0,showQrModal:!0})));const L=g(T());c.push(L)}return c},y2e=new Map,qBt=({projectId:t,walletConnectParameters:e,rkDetailsShowQrModal:n})=>{let r={...e||{},projectId:t,showQrModal:!1};n&&(r={...r,showQrModal:!0});const s=JSON.stringify(r),a=y2e.get(s);if(a)return a;const o=Xce(r);return y2e.set(s,o),o};function GBt({projectId:t,walletDetails:e,walletConnectParameters:n}){return r=>({...qBt({projectId:t,walletConnectParameters:n,rkDetailsShowQrModal:e.rkDetails.showQrModal})(r),...e})}function cue({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=>GBt({projectId:t,walletDetails:r,walletConnectParameters:e})}function g$e(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 b$e(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 y$e({flag:t,namespace:e}){return!!(e&&typeof b$e(e)<"u"||t&&typeof g$e(t)<"u")}function KBt({flag:t,namespace:e}){var s;const n=typeof window<"u"?window:void 0;if(typeof n>"u")return;if(e){const a=b$e(e);if(a)return a}const r=(s=n.ethereum)==null?void 0:s.providers;if(t){const a=g$e(t);if(a)return a}return typeof r<"u"&&r.length>0?r[0]:n.ethereum}function YBt(t){return e=>{const n=t?{target:()=>({id:e.rkDetails.id,name:e.rkDetails.name,provider:t})}:{};return r=>({...I$(n)(r),...e})}}function v$e({flag:t,namespace:e,target:n}){const r=n||KBt({flag:t,namespace:e});return YBt(r)}var w$e=({appName:t,appIcon:e})=>{const n=s=>s,r=U5();return{id:"coinbase",name:"Coinbase Wallet",shortName:"Coinbase",rdns:"com.coinbase.wallet",iconUrl:async()=>(await ps(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=BU({appName:t,appLogoUrl:e,preference:w$e.preference});return o=>({...a(o),...s})}}};function XBt(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 QBt=({projectId:t,walletConnectParameters:e})=>{var a,o;const n=y$e({flag:"isMetaMask"}),r=!n,s=l=>Qce()?l:U5()?`metamask://wc?uri=${encodeURIComponent(l)}`:`https://metamask.app.link/wc?uri=${encodeURIComponent(l)}`;return{id:"metaMask",name:"MetaMask",rdns:"io.metamask",iconUrl:async()=>(await ps(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?cue({projectId:t,walletConnectParameters:e}):v$e({target:typeof window<"u"?((o=(a=window.ethereum)==null?void 0:a.providers)==null?void 0:o.find(XBt))??window.ethereum:void 0})}},ZBt=({projectId:t,walletConnectParameters:e})=>{const n=y$e({flag:"isRainbow"}),r=!n,s=a=>Qce()?a:U5()?`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 ps(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?cue({projectId:t,walletConnectParameters:e}):v$e({flag:"isRainbow"})}},JBt=()=>({id:"safe",name:"Safe",iconAccent:"#12ff80",iconBackground:"#fff",iconUrl:async()=>(await ps(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=>({...Yce()(e),...t})}),e$t=({projectId:t,options:e})=>({id:"walletConnect",name:"WalletConnect",installed:void 0,iconUrl:async()=>(await ps(async()=>{const{default:r}=await import("./walletConnectWallet-FNSU4KNU-B0ci71fU.js");return{default:r}},[])).default,iconBackground:"#3b99fc",qrCode:{getUri:r=>r},createConnector:cue({projectId:t,walletConnectParameters:e})}),t$t=t=>t.reduce((n,r)=>{const s=r.id;return n[s]=X7(),n},{}),n$t=({appName:t,appDescription:e,appUrl:n,appIcon:r,wallets:s,projectId:a,...o})=>{const{transports:l,chains:c,...u}=o,d=x$e({appName:t,appDescription:e,appUrl:n,appIcon:r}),f=WBt(s||[{groupName:"Popular",wallets:[JBt,ZBt,w$e,QBt,e$t]}],{projectId:a,appName:t,appDescription:e,appUrl:n,appIcon:r,walletConnectParameters:{metadata:d}});return yyt({connectors:f,chains:c,transports:l||t$t(c),...u})};function r$t({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 v2e=h.forwardRef(r$t);function s$t({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 Iy=h.forwardRef(s$t);function i$t({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 a$t=h.forwardRef(i$t);function o$t({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 l$t=h.forwardRef(o$t);function c$t({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 u$t=h.forwardRef(c$t),d$t=()=>{const{address:t}=ds(),{disconnect:e}=M$(),{subsExpireDay:n}=h.useContext(Qr),[r,s]=h.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(M5,{open:r,setOpen:s,handleListRequest:()=>{},handlePageChange:()=>{}}),i.jsxs(YB,{as:"div",className:"relative inline-block text-left font-manrope",children:[i.jsx("div",{children:i.jsxs(GB,{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(a$t,{className:"size-4 fill-white/60"})]})}),i.jsx(KB,{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(t4,{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:B9e,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"})]})})})]})]})},f$t=()=>{const t=yo(),[e,n]=h.useState(Date.now()),{isConnected:r,address:s,isDisconnected:a}=ds(),{walletLogin:o,signIn:l,hyperToken:c,hyperAddress:u,setTelegramChatId:d,setSubscriberRole:f,setSubsExpireDay:x,setIsReferralCode:g,setIsReferralCodeName:y,setMushboomerETH:v,setMushboomerSOL:C,setIsWhitelist:S,setHyperToken:T,setHyperAddress:I,setSignModalOpen:L,signInConnectButtonOpen:F,setSignInConnectButtonOpen:$}=h.useContext(Qr),{openConnectModal:O}=z5(),U=typeof window<"u"&&window.matchMedia("(max-width:640px)").matches;h.useEffect(()=>{!a&&s==null&&!U&&(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),T(""),I(""))},[a]);const Y=()=>{window.localStorage.getItem("hyperToken")&&c?o():l(1)};h.useEffect(()=>{F&&(L(!0),$(!1))},[F]),h.useEffect(()=>{s!=null&&window.localStorage.getItem("hyperAddress")!=null&&window.localStorage.getItem("hyperAddress").toLowerCase()!==s.toLowerCase()&&!U&&(window.localStorage.removeItem("hyperToken"),T(""))},[s,u]);const re=h.useRef(!1);return h.useEffect(()=>{const Q=async()=>{var G,ie;if(re.current)return;re.current=!0;const te=window.localStorage.getItem("hyperToken"),fe=window.localStorage.getItem("hyperAddress");if(!te||!fe){re.current=!1;return}try{const oe=await bi(fe.toLowerCase(),te);oe!=null&&oe.success?(d(oe==null?void 0:oe.telegram_chat_id),f(oe==null?void 0:oe.subscriber_role),x(oe==null?void 0:oe.subs_expire_day),v((G=oe==null?void 0:oe.mushboomer_counts)==null?void 0:G.eth),C((ie=oe==null?void 0:oe.mushboomer_counts)==null?void 0:ie.sol),g(oe==null?void 0:oe.referral_code),y(oe==null?void 0:oe.refcode),S(oe==null?void 0:oe.whitelist),T(te),I(fe)):(window.localStorage.removeItem("hyperAddress"),window.localStorage.removeItem("hyperToken"),T(""),I(""))}catch(oe){console.error("Token verification error:",oe),oe.response?console.error("Server Error Response:",oe.response):oe.message?console.error("Network or Other Error:",oe.message):console.error("Unknown Error:",oe)}finally{re.current=!1}},q=()=>{if(document.visibilityState==="visible"){const te=Date.now();te-e>1e3&&Q(),n(te)}};return document.addEventListener("visibilitychange",q),()=>{document.removeEventListener("visibilitychange",q)}},[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(d$t,{}),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:$lt,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:Ult,alt:""}),i.jsx("span",{className:"text-[#0A9C55] text-[10px] leading-4 font-medium",children:"Connected"})]})})]}):i.jsx("div",{onClick:Q=>Y(),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:()=>{O(),$(!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 vC={},Fq={exports:{}},Oq,w2e;function h$t(){if(w2e)return Oq;w2e=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Oq=t,Oq}var Mq,C2e;function p$t(){if(C2e)return Mq;C2e=1;var t=h$t();function e(){}function n(){}return n.resetWarningCache=e,Mq=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},Mq}var N2e;function zU(){return N2e||(N2e=1,Fq.exports=p$t()()),Fq.exports}var Lq,S2e;function C$e(){return S2e||(S2e=1,Lq={L:1,M:0,Q:3,H:2}),Lq}var Rq,j2e;function N$e(){return j2e||(j2e=1,Rq={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}),Rq}var Dq,A2e;function m$t(){if(A2e)return Dq;A2e=1;var t=N$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)}},Dq=e,Dq}var Bq,_2e;function x$t(){if(_2e)return Bq;_2e=1;var t=C$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}},Bq=e,Bq}var $q,E2e;function g$t(){if(E2e)return $q;E2e=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++}},$q=t,$q}var Uq,k2e;function S$e(){if(k2e)return Uq;k2e=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 Uq=t,Uq}var zq,T2e;function j$e(){if(T2e)return zq;T2e=1;var t=S$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)}},zq=e,zq}var Hq,P2e;function b$t(){if(P2e)return Hq;P2e=1;var t=N$e(),e=j$e(),n=S$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 Hq=s,Hq}var Vq,I2e;function y$t(){if(I2e)return Vq;I2e=1;var t=m$t(),e=x$t(),n=g$t(),r=b$t(),s=j$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 S=0;S<x[y].length;S++)x[y][S]=255&l.buffer[S+u];u+=v;var T=r.getErrorCorrectPolynomial(C),I=new s(x[y],T.getLength()-1),L=I.mod(T);g[y]=new Array(T.getLength()-1);for(var S=0;S<g[y].length;S++){var F=S+L.getLength()-g[y].length;g[y][S]=F>=0?L.get(F):0}}for(var $=0,S=0;S<c.length;S++)$+=c[S].totalCount;for(var O=new Array($),U=0,S=0;S<d;S++)for(var y=0;y<c.length;y++)S<x[y].length&&(O[U++]=x[y][S]);for(var S=0;S<f;S++)for(var y=0;y<c.length;y++)S<g[y].length&&(O[U++]=g[y][S]);return O},Vq=a,Vq}var mF={},F2e;function v$t(){if(F2e)return mF;F2e=1,Object.defineProperty(mF,"__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=zU(),n=a(e),r=bx(),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,S=u.viewBoxSize,T=u.xmlns,I=T===void 0?"http://www.w3.org/2000/svg":T,L=o(u,["bgColor","bgD","fgD","fgColor","size","title","viewBoxSize","xmlns"]);return s.default.createElement("svg",t({},L,{height:v,ref:d,viewBox:"0 0 "+S+" "+S,width:v,xmlns:I}),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,mF.default=c,mF}var O2e;function w$t(){if(O2e)return vC;O2e=1,Object.defineProperty(vC,"__esModule",{value:!0}),vC.QRCode=void 0;var t=Object.assign||function(v){for(var C=1;C<arguments.length;C++){var S=arguments[C];for(var T in S)Object.prototype.hasOwnProperty.call(S,T)&&(v[T]=S[T])}return v},e=zU(),n=f(e),r=C$e(),s=f(r),a=y$t(),o=f(a),l=bx(),c=f(l),u=v$t(),d=f(u);function f(v){return v&&v.__esModule?v:{default:v}}function x(v,C){var S={};for(var T in v)C.indexOf(T)>=0||Object.prototype.hasOwnProperty.call(v,T)&&(S[T]=v[T]);return S}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 S=v.bgColor,T=S===void 0?"#FFFFFF":S,I=v.fgColor,L=I===void 0?"#000000":I,F=v.level,$=F===void 0?"L":F,O=v.size,U=O===void 0?256:O,Y=v.value,re=x(v,["bgColor","fgColor","level","size","value"]),Q=new o.default(-1,s.default[$]);Q.addData(Y),Q.make();var q=Q.modules;return c.default.createElement(d.default,t({},re,{bgColor:T,bgD:q.map(function(te,fe){return te.map(function(G,ie){return G?"":"M "+ie+" "+fe+" l 1 0 0 1 -1 0 Z"}).join(" ")}).join(" "),fgColor:L,fgD:q.map(function(te,fe){return te.map(function(G,ie){return G?"M "+ie+" "+fe+" l 1 0 0 1 -1 0 Z":""}).join(" ")}).join(" "),ref:C,size:U,viewBoxSize:q.length}))});return vC.QRCode=y,y.displayName="QRCode",y.propTypes=g,vC.default=y,vC}var C$t=w$t();const N$t=Pi(C$t),yp=({isOpen:t,onClose:e,children:n,fullscreen:r=!1,blurBackground:s=!1})=>{const[a,o]=h.useState(t),[l,c]=h.useState(!1);h.useEffect(()=>{t?(o(!0),c(!0)):(c(!1),o(!1))},[t]),h.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?Ea.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},S$t=({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"})]})},j$t=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState(null),[s,a]=h.useState(0),[o,l]=h.useState(15),c=window.localStorage.getItem("hyperToken"),u=window.localStorage.getItem("hyperAddress"),d=h.useRef(null),f=h.useRef(null),x=2e3;h.useEffect(()=>{let T=null;return n&&(l(15),T=setInterval(()=>{l(I=>I<=1?(clearInterval(T),y(),0):I-1)},1e3)),()=>{T&&clearInterval(T)}},[n]);const g=()=>{r(null),a(0),e(!0)},y=()=>{e(!1),S()},v=()=>{a(0),f.current=Date.now(),d.current=setInterval(()=>{const I=(Date.now()-f.current)/x,L=Math.min(I*100,100);a(L),I>=1&&(clearInterval(d.current),d.current=null,a(100),Ns.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=()=>{S()},S=()=>{d.current&&(clearInterval(d.current),d.current=null),a(0)};return h.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(nSt,{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:Hi,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(N$t,{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:Hi,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(S$t,{progress:s,size:16,strokeWidth:3})}),i.jsx("span",{children:"Hold to Reveal"})]})]})})})]})},Us=({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"})]}),Ra=({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"})})]}),A$t=()=>{const{hyperToken:t,notificationData:e,setNotificationData:n,announcementData:r,setAnnouncementData:s,handleAnnouncement:a}=h.useContext(Qr),{isConnected:o,address:l}=ds(),[c,u]=h.useState(window.localStorage.getItem("selectedNotificationTab")||"notification"),f=localStorage.getItem("isDateNotificationFormat")||"date",[x,g]=h.useState(f),v=localStorage.getItem("isDateAnnouncementFormat")||"date",[C,S]=h.useState(v),[T,I]=h.useState(!1);h.useEffect(()=>{localStorage.setItem("isDateNotificationFormat",x)},[x]),h.useEffect(()=>{localStorage.setItem("isDateNotificationFormat",C)},[C]),h.useEffect(()=>{if(!window.localStorage.getItem("hyperToken")||!l){n([]),s([]);return}const Y=`notificationsFeedSocket_${l==null?void 0:l.toLowerCase()}`,re=Q=>{if(Q.key===Y){const q=JSON.parse(Q.newValue||"[]");n(q)}};return window.addEventListener("storage",re),()=>window.removeEventListener("storage",re)},[t,l]),h.useEffect(()=>{const O=window.localStorage.getItem("hyperToken");if(!T||c!="notification"||!O)return;const Y=`notificationsFeedSocket_${l==null?void 0:l.toLowerCase()}`;if(!e.some(q=>!q.is_read))return;const Q=setTimeout(()=>{const q=e.map(te=>te.is_read?te:{...te,is_read:!0});n(q),localStorage.setItem(Y,JSON.stringify(q))},1e3);return()=>clearTimeout(Q)},[e,T,c]),h.useEffect(()=>{var Y;if(!T||c!=="announcement"||!(r!=null&&r.announcements)||((Y=r==null?void 0:r.announcements)==null?void 0:Y.length)===0)return;const O="readNotSignAnnouncementIds",U=setTimeout(()=>{const re=JSON.parse(localStorage.getItem(O)||"[]"),Q=r==null?void 0:r.announcements.map(q=>q.id).filter(q=>!re.includes(q));if(Q.length>0){const q=[...re,...Q];localStorage.setItem(O,JSON.stringify(q))}},1e3);return()=>clearTimeout(U)},[r,T,c,t]);const L=async()=>{try{const O=window.localStorage.getItem("hyperToken"),U="https://dextrabothypev2.nftinit.io/api/subscriber/announcement/setlastseenannouncement/";if(!o||!O)return;const Y=await fetch(U,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:l==null?void 0:l.toLowerCase(),token:O})});if(!Y.ok)throw new Error(`Server responded with status ${Y.status}`);const re=await Y.json();re.success?a():console.log(re.error_message)}catch(O){console.error("Error in handleAnnouncement:",O)}};h.useEffect(()=>{!T||c!=="announcement"||(r==null?void 0:r.new_announcement_count)>0&&t&&o&&L()},[T,c]);const F=e.filter(O=>!O.is_read).length,$=(()=>{var Y,re;const O=l==null?void 0:l.toLowerCase(),U=window.localStorage.getItem("hyperToken");if(!O||!U){const Q="readNotSignAnnouncementIds",q=new Set(JSON.parse(localStorage.getItem(Q)||"[]").map(String)),te=new Date,fe=new Date;return fe.setDate(te.getDate()-2),(Y=r==null?void 0:r.announcements)==null?void 0:Y.filter(G=>{const ie=new Date(G==null?void 0:G.created_at);return!q.has(String(G==null?void 0:G.id))&&ie>=fe}).length}if(O&&U&&(r==null?void 0:r.new_announcement_count)>0){const Q="readNotSignAnnouncementIds",q=new Set(JSON.parse(localStorage.getItem(Q)||"[]").map(String));return((re=r==null?void 0:r.announcements)==null?void 0:re.filter(fe=>fe.is_new&&!q.has(String(fe.id))).length)||0}return(r==null?void 0:r.new_announcement_count)||0})();return i.jsx(YB,{as:"div",className:"relative hidden sm:inline-block text-left",children:({open:O,close:U})=>{var Y,re;return h.useEffect(()=>{I(O)},[O]),i.jsxs(i.Fragment,{children:[i.jsx("div",{children:i.jsxs(GB,{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:hct,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(d_e,{as:h.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(KB,{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:B9e})}),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(u$t,{onClick:Q=>{Q.preventDefault();const q=window.localStorage.getItem("hyperToken");if(!l||!q)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(Ra,{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((Q,q)=>i.jsx(_$t,{listenUser:Q==null?void 0:Q.listen_user,asset:Q==null?void 0:Q.coin,feeToken:Q==null?void 0:Q.feeToken,dir:Q==null?void 0:Q.dir,leverage:Q==null?void 0:Q.leverage,type:Q==null?void 0:Q.fill_direction_type,time:Q==null?void 0:Q.time,status:Q.message,isDateFormat:x,setIsDateFormat:g,close:U,isError:Q==null?void 0:Q.success,traderPNL:Q==null?void 0:Q.trader_pnl,targetPlatform:Q==null?void 0:Q.target_platform},q))}):c==="announcement"&&((Y=r==null?void 0:r.announcements)==null?void 0:Y.length)>0?i.jsx("div",{className:"flex flex-col items-start justify-center gap-1 w-full",children:(re=r==null?void 0:r.announcements)==null?void 0:re.map((Q,q)=>i.jsx(E$t,{address:Q==null?void 0:Q.address,content:Q==null?void 0:Q.content,createdAt:Q==null?void 0:Q.created_at,typeId:Q==null?void 0:Q.type_id,isDateAnnouncementFormat:C,setIsDateAnnouncementFormat:S},q))}):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:Jlt,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"})]})})]})})]})}})},_$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[S,T]=h.useState(vo(C));return h.useEffect(()=>{const I=setInterval(()=>{T(vo(C))},1e3);return()=>clearInterval(I)},[C]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:S.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:O1,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(yf,{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(Us,{className:"text-[#67FFBD] rotate-180 w-2.5 h-2.5"}):s==="Long > Short"?i.jsx(Us,{className:"text-[#FF797C] w-2.5 h-2.5"}):i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-2.5 h-2.5"}):s=="Buy"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-2.5 h-2.5"}):i.jsx(Us,{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),fn.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:io,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:Iae,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?`+$${Ir(x)}`:`-$${Ir(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}):$c(l)})]})]})]})},E$t=({address:t,content:e,createdAt:n,typeId:r,isDateAnnouncementFormat:s,setIsDateAnnouncementFormat:a})=>{function o({date:u}){const[d,f]=h.useState(vo(u));return h.useEffect(()=>{const x=setInterval(()=>{f(vo(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?fct:r==2?c||mct:pct,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:Iae,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}):$c(n)})})]})]})},k$t=()=>{const{hyperToken:t}=h.useContext(Qr),[e,n]=h.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(MU,{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(SOt,{})})}),i.jsxs("div",{className:"ml-auto flex items-center",children:[i.jsx("div",{className:"hidden sm:block w-[140px] mr-[12px]",children:i.jsx(cDe,{})}),t&&i.jsx(j$t,{}),i.jsx(A$t,{}),i.jsx("span",{className:"hidden sm:block ml-2",children:i.jsx(f$t,{})})]})]})})]})},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 Os;(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"})(Os||(Os={}));var M2e=new Map([[Os.QR_CODE,"QR_CODE"],[Os.AZTEC,"AZTEC"],[Os.CODABAR,"CODABAR"],[Os.CODE_39,"CODE_39"],[Os.CODE_93,"CODE_93"],[Os.CODE_128,"CODE_128"],[Os.DATA_MATRIX,"DATA_MATRIX"],[Os.MAXICODE,"MAXICODE"],[Os.ITF,"ITF"],[Os.EAN_13,"EAN_13"],[Os.EAN_8,"EAN_8"],[Os.PDF_417,"PDF_417"],[Os.RSS_14,"RSS_14"],[Os.RSS_EXPANDED,"RSS_EXPANDED"],[Os.UPC_A,"UPC_A"],[Os.UPC_E,"UPC_E"],[Os.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),L2e;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.URL=1]="URL"})(L2e||(L2e={}));function T$t(t){return Object.values(Os).includes(t)}var KR;(function(t){t[t.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",t[t.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(KR||(KR={}));var P$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=[KR.SCAN_TYPE_CAMERA,KR.SCAN_TYPE_FILE],t}(),A$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(!M2e.has(e))throw"".concat(e," not in html5QrcodeSupportedFormatsTextMap");return new t(e,M2e.get(e))},t}(),R2e=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}(),Dne;(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"})(Dne||(Dne={}));var I$t=function(){function t(){}return t.createFrom=function(e){return{errorMessage:e,type:Dne.UNKWOWN_ERROR}},t}(),F$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 gg(t){return typeof t>"u"||t===null}var f4=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}(),_$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}(),f_={exports:{}},O$t=f_.exports,D2e;function M$t(){return D2e||(D2e=1,function(t,e){(function(n,r){r(e)})(O$t,function(n){function r(St){return St==null}var s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(St,w){St.__proto__=w}||function(St,w){for(var E in w)w.hasOwnProperty(E)&&(St[E]=w[E])};function a(St,w){s(St,w);function E(){this.constructor=St}St.prototype=w===null?Object.create(w):(E.prototype=w.prototype,new E)}function o(St,w){var E=Object.setPrototypeOf;E?E(St,w):St.__proto__=w}function l(St,w){w===void 0&&(w=St.constructor);var E=Error.captureStackTrace;E&&E(St,w)}var c=function(St){a(w,St);function w(E){var M=this.constructor,z=St.call(this,E)||this;return Object.defineProperty(z,"name",{value:M.name,enumerable:!1}),o(z,M.prototype),l(z),z}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,M,z){const W=this.binarizer.getLuminanceSource().crop(w,E,M,z);return new x(this.binarizer.createBinarizer(W))}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,M,z,W){for(;W--;)M[z++]=w[E++]}static currentTimeMillis(){return Date.now()}}class C extends u{}C.kind="IndexOutOfBoundsException";class S extends C{constructor(w=void 0,E=void 0){super(E),this.index=w,this.message=E}}S.kind="ArrayIndexOutOfBoundsException";class T{static fill(w,E){for(let M=0,z=w.length;M<z;M++)w[M]=E}static fillWithin(w,E,M,z){T.rangeCheck(w.length,E,M);for(let W=E;W<M;W++)w[W]=z}static rangeCheck(w,E,M){if(E>M)throw new f("fromIndex("+E+") > toIndex("+M+")");if(E<0)throw new S(E);if(M>w)throw new S(M)}static asList(...w){return w}static create(w,E,M){return Array.from({length:w}).map(W=>Array.from({length:E}).fill(M))}static createInt32Array(w,E,M){return Array.from({length:w}).map(W=>Int32Array.from({length:E}).fill(M))}static equals(w,E){if(!w||!E||!w.length||!E.length||w.length!==E.length)return!1;for(let M=0,z=w.length;M<z;M++)if(w[M]!==E[M])return!1;return!0}static hashCode(w){if(w===null)return 0;let E=1;for(const M of w)E=31*E+M;return E}static fillUint8Array(w,E){for(let M=0;M!==w.length;M++)w[M]=E}static copyOf(w,E){return w.slice(0,E)}static copyOfUint8Array(w,E){if(w.length<=E){const M=new Uint8Array(E);return M.set(w),M}return w.slice(0,E)}static copyOfRange(w,E,M){const z=M-E,W=new Int32Array(z);return v.arraycopy(w,E,W,0,z),W}static binarySearch(w,E,M){M===void 0&&(M=T.numberComparator);let z=0,W=w.length-1;for(;z<=W;){const J=W+z>>1,de=M(E,w[J]);if(de>0)z=J+1;else if(de<0)W=J-1;else return J}return-z-1}static numberComparator(w,E){return w-E}}class I{static numberOfTrailingZeros(w){let E;if(w===0)return 32;let M=31;return E=w<<16,E!==0&&(M-=16,w=E),E=w<<8,E!==0&&(M-=8,w=E),E=w<<4,E!==0&&(M-=4,w=E),E=w<<2,E!==0&&(M-=2,w=E),M-(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)}}I.MIN_VALUE_32_BITS=-2147483648,I.MAX_VALUE=Number.MAX_SAFE_INTEGER;class L{constructor(w,E){w===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=w,E==null?this.bits=L.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=L.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 M=this.bits;let z=Math.floor(w/32),W=M[z];W&=~((1<<(w&31))-1);const J=M.length;for(;W===0;){if(++z===J)return E;W=M[z]}const de=z*32+I.numberOfTrailingZeros(W);return de>E?E:de}getNextUnset(w){const E=this.size;if(w>=E)return E;const M=this.bits;let z=Math.floor(w/32),W=~M[z];W&=~((1<<(w&31))-1);const J=M.length;for(;W===0;){if(++z===J)return E;W=~M[z]}const de=z*32+I.numberOfTrailingZeros(W);return de>E?E:de}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 M=Math.floor(w/32),z=Math.floor(E/32),W=this.bits;for(let J=M;J<=z;J++){const de=J>M?0:w&31,De=(2<<(J<z?31:E&31))-(1<<de);W[J]|=De}}clear(){const w=this.bits.length,E=this.bits;for(let M=0;M<w;M++)E[M]=0}isRange(w,E,M){if(E<w||w<0||E>this.size)throw new f;if(E===w)return!0;E--;const z=Math.floor(w/32),W=Math.floor(E/32),J=this.bits;for(let de=z;de<=W;de++){const Ee=de>z?0:w&31,ot=(2<<(de<W?31:E&31))-(1<<Ee)&4294967295;if((J[de]&ot)!==(M?ot: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 M=E;M>0;M--)this.appendBit((w>>M-1&1)===1)}appendBitArray(w){const E=w.size;this.ensureCapacity(this.size+E);for(let M=0;M<E;M++)this.appendBit(w.get(M))}xor(w){if(this.size!==w.size)throw new f("Sizes don't match");const E=this.bits;for(let M=0,z=E.length;M<z;M++)E[M]^=w.bits[M]}toBytes(w,E,M,z){for(let W=0;W<z;W++){let J=0;for(let de=0;de<8;de++)this.get(w)&&(J|=1<<7-de),w++;E[M+W]=J}}getBitArray(){return this.bits}reverse(){const w=new Int32Array(this.bits.length),E=Math.floor((this.size-1)/32),M=E+1,z=this.bits;for(let W=0;W<M;W++){let J=z[W];J=J>>1&1431655765|(J&1431655765)<<1,J=J>>2&858993459|(J&858993459)<<2,J=J>>4&252645135|(J&252645135)<<4,J=J>>8&16711935|(J&16711935)<<8,J=J>>16&65535|(J&65535)<<16,w[E-W]=J}if(this.size!==M*32){const W=M*32-this.size;let J=w[0]>>>W;for(let de=1;de<M;de++){const Ee=w[de];J|=Ee<<32-W,w[de-1]=J,J=Ee>>>W}w[M-1]=J}this.bits=w}static makeArray(w){return new Int32Array(Math.floor((w+31)/32))}equals(w){if(!(w instanceof L))return!1;const E=w;return this.size===E.size&&T.equals(this.bits,E.bits)}hashCode(){return 31*this.size+T.hashCode(this.bits)}toString(){let w="";for(let E=0,M=this.size;E<M;E++)E&7||(w+=" "),w+=this.get(E)?"X":".";return w}clone(){return new L(this.size,this.bits.slice())}}var F;(function(St){St[St.OTHER=0]="OTHER",St[St.PURE_BARCODE=1]="PURE_BARCODE",St[St.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",St[St.TRY_HARDER=3]="TRY_HARDER",St[St.CHARACTER_SET=4]="CHARACTER_SET",St[St.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",St[St.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",St[St.ASSUME_GS1=7]="ASSUME_GS1",St[St.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",St[St.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",St[St.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(F||(F={}));var $=F;class O extends u{static getFormatInstance(){return new O}}O.kind="FormatException";var U;(function(St){St[St.Cp437=0]="Cp437",St[St.ISO8859_1=1]="ISO8859_1",St[St.ISO8859_2=2]="ISO8859_2",St[St.ISO8859_3=3]="ISO8859_3",St[St.ISO8859_4=4]="ISO8859_4",St[St.ISO8859_5=5]="ISO8859_5",St[St.ISO8859_6=6]="ISO8859_6",St[St.ISO8859_7=7]="ISO8859_7",St[St.ISO8859_8=8]="ISO8859_8",St[St.ISO8859_9=9]="ISO8859_9",St[St.ISO8859_10=10]="ISO8859_10",St[St.ISO8859_11=11]="ISO8859_11",St[St.ISO8859_13=12]="ISO8859_13",St[St.ISO8859_14=13]="ISO8859_14",St[St.ISO8859_15=14]="ISO8859_15",St[St.ISO8859_16=15]="ISO8859_16",St[St.SJIS=16]="SJIS",St[St.Cp1250=17]="Cp1250",St[St.Cp1251=18]="Cp1251",St[St.Cp1252=19]="Cp1252",St[St.Cp1256=20]="Cp1256",St[St.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",St[St.UTF8=22]="UTF8",St[St.ASCII=23]="ASCII",St[St.Big5=24]="Big5",St[St.GB18030=25]="GB18030",St[St.EUC_KR=26]="EUC_KR"})(U||(U={}));class Y{constructor(w,E,M,...z){this.valueIdentifier=w,this.name=M,typeof E=="number"?this.values=Int32Array.from([E]):this.values=E,this.otherEncodingNames=z,Y.VALUE_IDENTIFIER_TO_ECI.set(w,this),Y.NAME_TO_ECI.set(M,this);const W=this.values;for(let J=0,de=W.length;J!==de;J++){const Ee=W[J];Y.VALUES_TO_ECI.set(Ee,this)}for(const J of z)Y.NAME_TO_ECI.set(J,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(w){if(w<0||w>=900)throw new O("incorect value");const E=Y.VALUES_TO_ECI.get(w);if(E===void 0)throw new O("incorect value");return E}static getCharacterSetECIByName(w){const E=Y.NAME_TO_ECI.get(w);if(E===void 0)throw new O("incorect value");return E}equals(w){if(!(w instanceof Y))return!1;const E=w;return this.getName()===E.getName()}}Y.VALUE_IDENTIFIER_TO_ECI=new Map,Y.VALUES_TO_ECI=new Map,Y.NAME_TO_ECI=new Map,Y.Cp437=new Y(U.Cp437,Int32Array.from([0,2]),"Cp437"),Y.ISO8859_1=new Y(U.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),Y.ISO8859_2=new Y(U.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),Y.ISO8859_3=new Y(U.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),Y.ISO8859_4=new Y(U.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),Y.ISO8859_5=new Y(U.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),Y.ISO8859_6=new Y(U.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),Y.ISO8859_7=new Y(U.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),Y.ISO8859_8=new Y(U.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),Y.ISO8859_9=new Y(U.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),Y.ISO8859_10=new Y(U.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),Y.ISO8859_11=new Y(U.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),Y.ISO8859_13=new Y(U.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),Y.ISO8859_14=new Y(U.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),Y.ISO8859_15=new Y(U.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),Y.ISO8859_16=new Y(U.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),Y.SJIS=new Y(U.SJIS,20,"SJIS","Shift_JIS"),Y.Cp1250=new Y(U.Cp1250,21,"Cp1250","windows-1250"),Y.Cp1251=new Y(U.Cp1251,22,"Cp1251","windows-1251"),Y.Cp1252=new Y(U.Cp1252,23,"Cp1252","windows-1252"),Y.Cp1256=new Y(U.Cp1256,24,"Cp1256","windows-1256"),Y.UnicodeBigUnmarked=new Y(U.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),Y.UTF8=new Y(U.UTF8,26,"UTF8","UTF-8"),Y.ASCII=new Y(U.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),Y.Big5=new Y(U.Big5,28,"Big5"),Y.GB18030=new Y(U.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),Y.EUC_KR=new Y(U.EUC_KR,30,"EUC_KR","EUC-KR");class re extends u{}re.kind="UnsupportedOperationException";class Q{static decode(w,E){const M=this.encodingName(E);return this.customDecoder?this.customDecoder(w,M):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(M)?this.decodeFallback(w,M):new TextDecoder(M).decode(w)}static shouldDecodeOnFallback(w){return!Q.isBrowser()&&w==="ISO-8859-1"}static encode(w,E){const M=this.encodingName(E);return this.customEncoder?this.customEncoder(w,M):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 Y?w:Y.getCharacterSetECIByName(w)}static decodeFallback(w,E){const M=this.encodingCharacterSet(E);if(Q.isDecodeFallbackSupported(M)){let z="";for(let W=0,J=w.length;W<J;W++){let de=w[W].toString(16);de.length<2&&(de="0"+de),z+="%"+de}return decodeURIComponent(z)}if(M.equals(Y.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(w.buffer));throw new re(`Encoding ${this.encodingName(E)} not supported by fallback.`)}static isDecodeFallbackSupported(w){return w.equals(Y.UTF8)||w.equals(Y.ISO8859_1)||w.equals(Y.ASCII)}static encodeFallback(w){const M=btoa(unescape(encodeURIComponent(w))).split(""),z=[];for(let W=0;W<M.length;W++)z.push(M[W].charCodeAt(0));return new Uint8Array(z)}}class q{static castAsNonUtf8Char(w,E=null){const M=E?E.getName():this.ISO88591;return Q.decode(new Uint8Array([w]),M)}static guessEncoding(w,E){if(E!=null&&E.get($.CHARACTER_SET)!==void 0)return E.get($.CHARACTER_SET).toString();const M=w.length;let z=!0,W=!0,J=!0,de=0,Ee=0,De=0,ot=0,_t=0,zt=0,gn=0,Tt=0,Zt=0,sn=0,$n=0;const Cr=w.length>3&&w[0]===239&&w[1]===187&&w[2]===191;for(let kr=0;kr<M&&(z||W||J);kr++){const Pr=w[kr]&255;J&&(de>0?Pr&128?de--:J=!1:Pr&128&&(Pr&64?(de++,Pr&32?(de++,Pr&16?(de++,Pr&8?J=!1:ot++):De++):Ee++):J=!1)),z&&(Pr>127&&Pr<160?z=!1:Pr>159&&(Pr<192||Pr===215||Pr===247)&&$n++),W&&(_t>0?Pr<64||Pr===127||Pr>252?W=!1:_t--:Pr===128||Pr===160||Pr>239?W=!1:Pr>160&&Pr<224?(zt++,Tt=0,gn++,gn>Zt&&(Zt=gn)):Pr>127?(_t++,gn=0,Tt++,Tt>sn&&(sn=Tt)):(gn=0,Tt=0))}return J&&de>0&&(J=!1),W&&_t>0&&(W=!1),J&&(Cr||Ee+De+ot>0)?q.UTF8:W&&(q.ASSUME_SHIFT_JIS||Zt>=3||sn>=3)?q.SHIFT_JIS:z&&W?Zt===2&&zt===2||$n*10>=M?q.SHIFT_JIS:q.ISO88591:z?q.ISO88591:W?q.SHIFT_JIS:J?q.UTF8:q.PLATFORM_DEFAULT_ENCODING}static format(w,...E){let M=-1;function z(J,de,Ee,De,ot,_t){if(J==="%%")return"%";if(E[++M]===void 0)return;J=De?parseInt(De.substr(1)):void 0;let zt=ot?parseInt(ot.substr(1)):void 0,gn;switch(_t){case"s":gn=E[M];break;case"c":gn=E[M][0];break;case"f":gn=parseFloat(E[M]).toFixed(J);break;case"p":gn=parseFloat(E[M]).toPrecision(J);break;case"e":gn=parseFloat(E[M]).toExponential(J);break;case"x":gn=parseInt(E[M]).toString(zt||16);break;case"d":gn=parseFloat(parseInt(E[M],zt||10).toPrecision(J)).toFixed(0);break}gn=typeof gn=="object"?JSON.stringify(gn):(+gn).toString(zt);let Tt=parseInt(Ee),Zt=Ee&&Ee[0]+""=="0"?"0":" ";for(;gn.length<Tt;)gn=de!==void 0?gn+Zt:Zt+gn;return gn}let W=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return w.replace(W,z)}static getBytes(w,E){return Q.encode(w,E)}static getCharCode(w,E=0){return w.charCodeAt(E)}static getCharAt(w){return String.fromCharCode(w)}}q.SHIFT_JIS=Y.SJIS.getName(),q.GB2312="GB2312",q.ISO88591=Y.ISO8859_1.getName(),q.EUC_JP="EUC_JP",q.UTF8=Y.UTF8.getName(),q.PLATFORM_DEFAULT_ENCODING=q.UTF8,q.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+=q.castAsNonUtf8Char(w,this.encoding):this.value+=String.fromCharCode(w),this}appendChars(w,E,M){for(let z=E;E<E+M;z++)this.append(w[z]);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,M,z){if(this.width=w,this.height=E,this.rowSize=M,this.bits=z,E==null&&(E=w),this.height=E,w<1||E<1)throw new f("Both dimensions must be greater than 0");M==null&&(M=Math.floor((w+31)/32)),this.rowSize=M,z==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(w){const E=w.length,M=w[0].length,z=new fe(M,E);for(let W=0;W<E;W++){const J=w[W];for(let de=0;de<M;de++)J[de]&&z.set(de,W)}return z}static parseFromString(w,E,M){if(w===null)throw new f("stringRepresentation cannot be null");const z=new Array(w.length);let W=0,J=0,de=-1,Ee=0,De=0;for(;De<w.length;)if(w.charAt(De)===`
`||w.charAt(De)==="\r"){if(W>J){if(de===-1)de=W-J;else if(W-J!==de)throw new f("row lengths do not match");J=W,Ee++}De++}else if(w.substring(De,De+E.length)===E)De+=E.length,z[W]=!0,W++;else if(w.substring(De,De+M.length)===M)De+=M.length,z[W]=!1,W++;else throw new f("illegal character encountered: "+w.substring(De));if(W>J){if(de===-1)de=W-J;else if(W-J!==de)throw new f("row lengths do not match");Ee++}const ot=new fe(de,Ee);for(let _t=0;_t<W;_t++)z[_t]&&ot.set(Math.floor(_t%de),Math.floor(_t/de));return ot}get(w,E){const M=E*this.rowSize+Math.floor(w/32);return(this.bits[M]>>>(w&31)&1)!==0}set(w,E){const M=E*this.rowSize+Math.floor(w/32);this.bits[M]|=1<<(w&31)&4294967295}unset(w,E){const M=E*this.rowSize+Math.floor(w/32);this.bits[M]&=~(1<<(w&31)&4294967295)}flip(w,E){const M=E*this.rowSize+Math.floor(w/32);this.bits[M]^=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 L(Math.floor(this.width/32)+1),M=this.rowSize,z=this.bits;for(let W=0,J=this.height;W<J;W++){const de=W*M,Ee=w.getRow(W,E).getBitArray();for(let De=0;De<M;De++)z[de+De]^=Ee[De]}}clear(){const w=this.bits,E=w.length;for(let M=0;M<E;M++)w[M]=0}setRegion(w,E,M,z){if(E<0||w<0)throw new f("Left and top must be nonnegative");if(z<1||M<1)throw new f("Height and width must be at least 1");const W=w+M,J=E+z;if(J>this.height||W>this.width)throw new f("The region must fit inside the matrix");const de=this.rowSize,Ee=this.bits;for(let De=E;De<J;De++){const ot=De*de;for(let _t=w;_t<W;_t++)Ee[ot+Math.floor(_t/32)]|=1<<(_t&31)&4294967295}}getRow(w,E){E==null||E.getSize()<this.width?E=new L(this.width):E.clear();const M=this.rowSize,z=this.bits,W=w*M;for(let J=0;J<M;J++)E.setBulk(J*32,z[W+J]);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 M=new L(w),z=new L(w);for(let W=0,J=Math.floor((E+1)/2);W<J;W++)M=this.getRow(W,M),z=this.getRow(E-1-W,z),M.reverse(),z.reverse(),this.setRow(W,z),this.setRow(E-1-W,M)}getEnclosingRectangle(){const w=this.width,E=this.height,M=this.rowSize,z=this.bits;let W=w,J=E,de=-1,Ee=-1;for(let De=0;De<E;De++)for(let ot=0;ot<M;ot++){const _t=z[De*M+ot];if(_t!==0){if(De<J&&(J=De),De>Ee&&(Ee=De),ot*32<W){let zt=0;for(;!(_t<<31-zt&4294967295);)zt++;ot*32+zt<W&&(W=ot*32+zt)}if(ot*32+31>de){let zt=31;for(;!(_t>>>zt);)zt--;ot*32+zt>de&&(de=ot*32+zt)}}}return de<W||Ee<J?null:Int32Array.from([W,J,de-W+1,Ee-J+1])}getTopLeftOnBit(){const w=this.rowSize,E=this.bits;let M=0;for(;M<E.length&&E[M]===0;)M++;if(M===E.length)return null;const z=M/w;let W=M%w*32;const J=E[M];let de=0;for(;!(J<<31-de&4294967295);)de++;return W+=de,Int32Array.from([W,z])}getBottomRightOnBit(){const w=this.rowSize,E=this.bits;let M=E.length-1;for(;M>=0&&E[M]===0;)M--;if(M<0)return null;const z=Math.floor(M/w);let W=Math.floor(M%w)*32;const J=E[M];let de=31;for(;!(J>>>de);)de--;return W+=de,Int32Array.from([W,z])}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&&T.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+T.hashCode(this.bits),w}toString(w="X ",E=" ",M=`
`){return this.buildToString(w,E,M)}buildToString(w,E,M){let z=new te;for(let W=0,J=this.height;W<J;W++){for(let de=0,Ee=this.width;de<Ee;de++)z.append(this.get(de,W)?w:E);z.append(M)}return z.toString()}clone(){return new fe(this.width,this.height,this.rowSize,this.bits.slice())}}class G extends u{static getNotFoundInstance(){return new G}}G.kind="NotFoundException";class ie extends y{constructor(w){super(w),this.luminances=ie.EMPTY,this.buckets=new Int32Array(ie.LUMINANCE_BUCKETS)}getBlackRow(w,E){const M=this.getLuminanceSource(),z=M.getWidth();E==null||E.getSize()<z?E=new L(z):E.clear(),this.initArrays(z);const W=M.getRow(w,this.luminances),J=this.buckets;for(let Ee=0;Ee<z;Ee++)J[(W[Ee]&255)>>ie.LUMINANCE_SHIFT]++;const de=ie.estimateBlackPoint(J);if(z<3)for(let Ee=0;Ee<z;Ee++)(W[Ee]&255)<de&&E.set(Ee);else{let Ee=W[0]&255,De=W[1]&255;for(let ot=1;ot<z-1;ot++){const _t=W[ot+1]&255;(De*4-Ee-_t)/2<de&&E.set(ot),Ee=De,De=_t}}return E}getBlackMatrix(){const w=this.getLuminanceSource(),E=w.getWidth(),M=w.getHeight(),z=new fe(E,M);this.initArrays(E);const W=this.buckets;for(let Ee=1;Ee<5;Ee++){const De=Math.floor(M*Ee/5),ot=w.getRow(De,this.luminances),_t=Math.floor(E*4/5);for(let zt=Math.floor(E/5);zt<_t;zt++){const gn=ot[zt]&255;W[gn>>ie.LUMINANCE_SHIFT]++}}const J=ie.estimateBlackPoint(W),de=w.getMatrix();for(let Ee=0;Ee<M;Ee++){const De=Ee*E;for(let ot=0;ot<E;ot++)(de[De+ot]&255)<J&&z.set(ot,Ee)}return z}createBinarizer(w){return new ie(w)}initArrays(w){this.luminances.length<w&&(this.luminances=new Uint8ClampedArray(w));const E=this.buckets;for(let M=0;M<ie.LUMINANCE_BUCKETS;M++)E[M]=0}static estimateBlackPoint(w){const E=w.length;let M=0,z=0,W=0;for(let ot=0;ot<E;ot++)w[ot]>W&&(z=ot,W=w[ot]),w[ot]>M&&(M=w[ot]);let J=0,de=0;for(let ot=0;ot<E;ot++){const _t=ot-z,zt=w[ot]*_t*_t;zt>de&&(J=ot,de=zt)}if(z>J){const ot=z;z=J,J=ot}if(J-z<=E/16)throw new G;let Ee=J-1,De=-1;for(let ot=J-1;ot>z;ot--){const _t=ot-z,zt=_t*_t*(J-ot)*(M-w[ot]);zt>De&&(Ee=ot,De=zt)}return Ee<<ie.LUMINANCE_SHIFT}}ie.LUMINANCE_BITS=5,ie.LUMINANCE_SHIFT=8-ie.LUMINANCE_BITS,ie.LUMINANCE_BUCKETS=1<<ie.LUMINANCE_BITS,ie.EMPTY=Uint8ClampedArray.from([0]);class oe extends ie{constructor(w){super(w),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const w=this.getLuminanceSource(),E=w.getWidth(),M=w.getHeight();if(E>=oe.MINIMUM_DIMENSION&&M>=oe.MINIMUM_DIMENSION){const z=w.getMatrix();let W=E>>oe.BLOCK_SIZE_POWER;E&oe.BLOCK_SIZE_MASK&&W++;let J=M>>oe.BLOCK_SIZE_POWER;M&oe.BLOCK_SIZE_MASK&&J++;const de=oe.calculateBlackPoints(z,W,J,E,M),Ee=new fe(E,M);oe.calculateThresholdForBlock(z,W,J,E,M,de,Ee),this.matrix=Ee}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(w){return new oe(w)}static calculateThresholdForBlock(w,E,M,z,W,J,de){const Ee=W-oe.BLOCK_SIZE,De=z-oe.BLOCK_SIZE;for(let ot=0;ot<M;ot++){let _t=ot<<oe.BLOCK_SIZE_POWER;_t>Ee&&(_t=Ee);const zt=oe.cap(ot,2,M-3);for(let gn=0;gn<E;gn++){let Tt=gn<<oe.BLOCK_SIZE_POWER;Tt>De&&(Tt=De);const Zt=oe.cap(gn,2,E-3);let sn=0;for(let Cr=-2;Cr<=2;Cr++){const kr=J[zt+Cr];sn+=kr[Zt-2]+kr[Zt-1]+kr[Zt]+kr[Zt+1]+kr[Zt+2]}const $n=sn/25;oe.thresholdBlock(w,Tt,_t,$n,z,de)}}}static cap(w,E,M){return w<E?E:w>M?M:w}static thresholdBlock(w,E,M,z,W,J){for(let de=0,Ee=M*W+E;de<oe.BLOCK_SIZE;de++,Ee+=W)for(let De=0;De<oe.BLOCK_SIZE;De++)(w[Ee+De]&255)<=z&&J.set(E+De,M+de)}static calculateBlackPoints(w,E,M,z,W){const J=W-oe.BLOCK_SIZE,de=z-oe.BLOCK_SIZE,Ee=new Array(M);for(let De=0;De<M;De++){Ee[De]=new Int32Array(E);let ot=De<<oe.BLOCK_SIZE_POWER;ot>J&&(ot=J);for(let _t=0;_t<E;_t++){let zt=_t<<oe.BLOCK_SIZE_POWER;zt>de&&(zt=de);let gn=0,Tt=255,Zt=0;for(let $n=0,Cr=ot*z+zt;$n<oe.BLOCK_SIZE;$n++,Cr+=z){for(let kr=0;kr<oe.BLOCK_SIZE;kr++){const Pr=w[Cr+kr]&255;gn+=Pr,Pr<Tt&&(Tt=Pr),Pr>Zt&&(Zt=Pr)}if(Zt-Tt>oe.MIN_DYNAMIC_RANGE)for($n++,Cr+=z;$n<oe.BLOCK_SIZE;$n++,Cr+=z)for(let kr=0;kr<oe.BLOCK_SIZE;kr++)gn+=w[Cr+kr]&255}let sn=gn>>oe.BLOCK_SIZE_POWER*2;if(Zt-Tt<=oe.MIN_DYNAMIC_RANGE&&(sn=Tt/2,De>0&&_t>0)){const $n=(Ee[De-1][_t]+2*Ee[De][_t-1]+Ee[De-1][_t-1])/4;Tt<$n&&(sn=$n)}Ee[De][_t]=sn}}return Ee}}oe.BLOCK_SIZE_POWER=3,oe.BLOCK_SIZE=1<<oe.BLOCK_SIZE_POWER,oe.BLOCK_SIZE_MASK=oe.BLOCK_SIZE-1,oe.MINIMUM_DIMENSION=oe.BLOCK_SIZE*5,oe.MIN_DYNAMIC_RANGE=24;class K{constructor(w,E){this.width=w,this.height=E}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(w,E,M,z){throw new re("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new re("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new re("This luminance source does not support rotation by 45 degrees.")}toString(){const w=new Uint8ClampedArray(this.width);let E=new te;for(let M=0;M<this.height;M++){const z=this.getRow(M,w);for(let W=0;W<this.width;W++){const J=z[W]&255;let de;J<64?de="#":J<128?de="+":J<192?de=".":de=" ",E.append(de)}E.append(`
`)}return E.toString()}}class H extends K{constructor(w){super(w.getWidth(),w.getHeight()),this.delegate=w}getRow(w,E){const M=this.delegate.getRow(w,E),z=this.getWidth();for(let W=0;W<z;W++)M[W]=255-(M[W]&255);return M}getMatrix(){const w=this.delegate.getMatrix(),E=this.getWidth()*this.getHeight(),M=new Uint8ClampedArray(E);for(let z=0;z<E;z++)M[z]=255-(w[z]&255);return M}isCropSupported(){return this.delegate.isCropSupported()}crop(w,E,M,z){return new H(this.delegate.crop(w,E,M,z))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new H(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new H(this.delegate.rotateCounterClockwise45())}}class ee extends K{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,M){const z=new Uint8ClampedArray(E*M);for(let W=0,J=0,de=w.length;W<de;W+=4,J++){let Ee;if(w[W+3]===0)Ee=255;else{const ot=w[W],_t=w[W+1],zt=w[W+2];Ee=306*ot+601*_t+117*zt+512>>10}z[J]=Ee}return z}getRow(w,E){if(w<0||w>=this.getHeight())throw new f("Requested row is outside the image: "+w);const M=this.getWidth(),z=w*M;return E===null?E=this.buffer.slice(z,z+M):(E.length<M&&(E=new Uint8ClampedArray(M)),E.set(this.buffer.slice(z,z+M))),E}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(w,E,M,z){return super.crop(w,E,M,z),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(),M=E.getContext("2d"),z=w*ee.DEGREE_TO_RADIANS,W=this.canvas.width,J=this.canvas.height,de=Math.ceil(Math.abs(Math.cos(z))*W+Math.abs(Math.sin(z))*J),Ee=Math.ceil(Math.abs(Math.sin(z))*W+Math.abs(Math.cos(z))*J);return E.width=de,E.height=Ee,M.translate(de/2,Ee/2),M.rotate(z),M.drawImage(this.canvas,W/-2,J/-2),this.buffer=ee.makeBufferFromCanvasImageData(E),this}invert(){return new H(this)}}ee.DEGREE_TO_RADIANS=Math.PI/180;class se{constructor(w,E,M){this.deviceId=w,this.label=E,this.kind="videoinput",this.groupId=M||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var pe=(globalThis||Lu||self||window||void 0)&&(globalThis||Lu||self||window||void 0).__awaiter||function(St,w,E,M){function z(W){return W instanceof E?W:new E(function(J){J(W)})}return new(E||(E=Promise))(function(W,J){function de(ot){try{De(M.next(ot))}catch(_t){J(_t)}}function Ee(ot){try{De(M.throw(ot))}catch(_t){J(_t)}}function De(ot){ot.done?W(ot.value):z(ot.value).then(de,Ee)}De((M=M.apply(St,w||[])).next())})};class Se{constructor(w,E=500,M){this.reader=w,this.timeBetweenScansMillis=E,this._hints=M,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 pe(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 M of w){const z=M.kind==="video"?"videoinput":M.kind;if(z!=="videoinput")continue;const W=M.deviceId||M.id,J=M.label||`Video device ${E.length+1}`,de=M.groupId,Ee={deviceId:W,label:J,kind:z,groupId:de};E.push(Ee)}return E})}getVideoInputDevices(){return pe(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(E=>new se(E.deviceId,E.label))})}findDeviceById(w){return pe(this,void 0,void 0,function*(){const E=yield this.listVideoInputDevices();return E?E.find(M=>M.deviceId===w):null})}decodeFromInputVideoDevice(w,E){return pe(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(w,E)})}decodeOnceFromVideoDevice(w,E){return pe(this,void 0,void 0,function*(){this.reset();let M;w?M={deviceId:{exact:w}}:M={facingMode:"environment"};const z={video:M};return yield this.decodeOnceFromConstraints(z,E)})}decodeOnceFromConstraints(w,E){return pe(this,void 0,void 0,function*(){const M=yield navigator.mediaDevices.getUserMedia(w);return yield this.decodeOnceFromStream(M,E)})}decodeOnceFromStream(w,E){return pe(this,void 0,void 0,function*(){this.reset();const M=yield this.attachStreamToVideo(w,E);return yield this.decodeOnce(M)})}decodeFromInputVideoDeviceContinuously(w,E,M){return pe(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(w,E,M)})}decodeFromVideoDevice(w,E,M){return pe(this,void 0,void 0,function*(){let z;w?z={deviceId:{exact:w}}:z={facingMode:"environment"};const W={video:z};return yield this.decodeFromConstraints(W,E,M)})}decodeFromConstraints(w,E,M){return pe(this,void 0,void 0,function*(){const z=yield navigator.mediaDevices.getUserMedia(w);return yield this.decodeFromStream(z,E,M)})}decodeFromStream(w,E,M){return pe(this,void 0,void 0,function*(){this.reset();const z=yield this.attachStreamToVideo(w,E);return yield this.decodeContinuously(z,M)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(w,E){return pe(this,void 0,void 0,function*(){const M=this.prepareVideoElement(E);return this.addVideoSource(M,w),this.videoElement=M,this.stream=w,yield this.playVideoOnLoadAsync(M),M})}playVideoOnLoadAsync(w){return new Promise((E,M)=>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 pe(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 M=document.getElementById(w);if(!M)throw new d(`element with id '${w}' not found`);if(M.nodeName.toLowerCase()!==E.toLowerCase())throw new d(`element with id '${w}' must be an ${E} element`);return M}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,M){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,M):this.decodeFromVideoElementContinuously(w,M)}decodeFromImageElement(w){if(!w)throw new d("An image element must be provided.");this.reset();const E=this.prepareImageElement(w);this.imageElement=E;let M;return this.isImageLoaded(E)?M=this.decodeOnce(E,!1,!0):M=this._decodeOnLoadImage(E),M}decodeFromVideoElement(w){const E=this._decodeFromVideoElementSetup(w);return this._decodeOnLoadVideo(E)}decodeFromVideoElementContinuously(w,E){const M=this._decodeFromVideoElementSetup(w);return this._decodeOnLoadVideoContinuously(M,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 M=this._decodeOnLoadImage(E);return E.src=w,M}decodeFromVideoUrl(w){if(!w)throw new d("An URL must be provided.");this.reset();const E=this.prepareVideoElement(),M=this.decodeFromVideoElement(E);return E.src=w,M}decodeFromVideoUrlContinuously(w,E){if(!w)throw new d("An URL must be provided.");this.reset();const M=this.prepareVideoElement(),z=this.decodeFromVideoElementContinuously(M,E);return M.src=w,z}_decodeOnLoadImage(w){return new Promise((E,M)=>{this.imageLoadedListener=()=>this.decodeOnce(w,!1,!0).then(E,M),w.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(w){return pe(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(w),yield this.decodeOnce(w)})}_decodeOnLoadVideoContinuously(w,E){return pe(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,M=!0){this._stopAsyncDecode=!1;const z=(W,J)=>{if(this._stopAsyncDecode){J(new G("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const de=this.decode(w);W(de)}catch(de){const Ee=E&&de instanceof G,ot=(de instanceof g||de instanceof O)&&M;if(Ee||ot)return setTimeout(z,this._timeBetweenDecodingAttempts,W,J);J(de)}};return new Promise((W,J)=>z(W,J))}decodeContinuously(w,E){this._stopContinuousDecode=!1;const M=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const z=this.decode(w);E(z,null),setTimeout(M,this.timeBetweenScansMillis)}catch(z){E(null,z);const W=z instanceof g||z instanceof O,J=z instanceof G;(W||J)&&setTimeout(M,this._timeBetweenDecodingAttempts)}};M()}decode(w){const E=this.createBinaryBitmap(w);return this.decodeBitmap(E)}_isHTMLVideoElement(w){return w.videoWidth!==0}drawFrameOnCanvas(w,E,M){E||(E={sx:0,sy:0,sWidth:w.videoWidth,sHeight:w.videoHeight,dx:0,dy:0,dWidth:w.videoWidth,dHeight:w.videoHeight}),M||(M=this.captureCanvasContext),M.drawImage(w,E.sx,E.sy,E.sWidth,E.sHeight,E.dx,E.dy,E.dWidth,E.dHeight)}drawImageOnCanvas(w,E,M=this.captureCanvasContext){E||(E={sx:0,sy:0,sWidth:w.naturalWidth,sHeight:w.naturalHeight,dx:0,dy:0,dWidth:w.naturalWidth,dHeight:w.naturalHeight}),M||(M=this.captureCanvasContext),M.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),M=new ee(E),z=new oe(M);return new x(z)}getCaptureCanvasContext(w){if(!this.captureCanvasContext){const M=this.getCaptureCanvas(w).getContext("2d");this.captureCanvasContext=M}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 M,z;return typeof w<"u"&&(w instanceof HTMLVideoElement?(M=w.videoWidth,z=w.videoHeight):w instanceof HTMLImageElement&&(M=w.naturalWidth||w.width,z=w.naturalHeight||w.height)),E.style.width=M+"px",E.style.height=z+"px",E.width=M,E.height=z,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 ge{constructor(w,E,M=E==null?0:8*E.length,z,W,J=v.currentTimeMillis()){this.text=w,this.rawBytes=E,this.numBits=M,this.resultPoints=z,this.format=W,this.timestamp=J,this.text=w,this.rawBytes=E,M==null?this.numBits=E==null?0:8*E.length:this.numBits=M,this.resultPoints=z,this.format=W,this.resultMetadata=null,J==null?this.timestamp=v.currentTimeMillis():this.timestamp=J}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 M=new Array(E.length+w.length);v.arraycopy(E,0,M,0,E.length),v.arraycopy(w,0,M,E.length,w.length),this.resultPoints=M}}getTimestamp(){return this.timestamp}toString(){return this.text}}var ve;(function(St){St[St.AZTEC=0]="AZTEC",St[St.CODABAR=1]="CODABAR",St[St.CODE_39=2]="CODE_39",St[St.CODE_93=3]="CODE_93",St[St.CODE_128=4]="CODE_128",St[St.DATA_MATRIX=5]="DATA_MATRIX",St[St.EAN_8=6]="EAN_8",St[St.EAN_13=7]="EAN_13",St[St.ITF=8]="ITF",St[St.MAXICODE=9]="MAXICODE",St[St.PDF_417=10]="PDF_417",St[St.QR_CODE=11]="QR_CODE",St[St.RSS_14=12]="RSS_14",St[St.RSS_EXPANDED=13]="RSS_EXPANDED",St[St.UPC_A=14]="UPC_A",St[St.UPC_E=15]="UPC_E",St[St.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(ve||(ve={}));var be=ve,we;(function(St){St[St.OTHER=0]="OTHER",St[St.ORIENTATION=1]="ORIENTATION",St[St.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",St[St.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",St[St.ISSUE_NUMBER=4]="ISSUE_NUMBER",St[St.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",St[St.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",St[St.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",St[St.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",St[St.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",St[St.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(we||(we={}));var je=we;class Fe{constructor(w,E,M,z,W=-1,J=-1){this.rawBytes=w,this.text=E,this.byteSegments=M,this.ecLevel=z,this.structuredAppendSequenceNumber=W,this.structuredAppendParity=J,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 M=E.length;if(M>1&&E[0]===0){let z=1;for(;z<M&&E[z]===0;)z++;z===M?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(M-z),v.arraycopy(E,z,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 M;if(w===1){M=0;for(let J=0,de=E.length;J!==de;J++){const Ee=E[J];M=Re.addOrSubtract(M,Ee)}return M}M=E[0];const z=E.length,W=this.field;for(let J=1;J<z;J++)M=Re.addOrSubtract(W.multiply(w,M),E[J]);return M}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,M=w.coefficients;if(E.length>M.length){const J=E;E=M,M=J}let z=new Int32Array(M.length);const W=M.length-E.length;v.arraycopy(M,0,z,0,W);for(let J=W;J<M.length;J++)z[J]=Re.addOrSubtract(E[J-W],M[J]);return new Qe(this.field,z)}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,M=E.length,z=w.coefficients,W=z.length,J=new Int32Array(M+W-1),de=this.field;for(let Ee=0;Ee<M;Ee++){const De=E[Ee];for(let ot=0;ot<W;ot++)J[Ee+ot]=Re.addOrSubtract(J[Ee+ot],de.multiply(De,z[ot]))}return new Qe(de,J)}multiplyScalar(w){if(w===0)return this.field.getZero();if(w===1)return this;const E=this.coefficients.length,M=this.field,z=new Int32Array(E),W=this.coefficients;for(let J=0;J<E;J++)z[J]=M.multiply(W[J],w);return new Qe(M,z)}multiplyByMonomial(w,E){if(w<0)throw new f;if(E===0)return this.field.getZero();const M=this.coefficients,z=M.length,W=new Int32Array(z+w),J=this.field;for(let de=0;de<z;de++)W[de]=J.multiply(M[de],E);return new Qe(J,W)}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 M=E.getZero(),z=this;const W=w.getCoefficient(w.getDegree()),J=E.inverse(W);for(;z.getDegree()>=w.getDegree()&&!z.isZero();){const de=z.getDegree()-w.getDegree(),Ee=E.multiply(z.getCoefficient(z.getDegree()),J),De=w.multiplyByMonomial(de,Ee),ot=E.buildMonomial(de,Ee);M=M.addOrSubtract(ot),z=z.addOrSubtract(De)}return[M,z]}toString(){let w="";for(let E=this.getDegree();E>=0;E--){let M=this.getCoefficient(E);if(M!==0){if(M<0?(w+=" - ",M=-M):w.length>0&&(w+=" + "),E===0||M!==1){const z=this.field.log(M);z===0?w+="1":z===1?w+="a":(w+="a^",w+=z)}E!==0&&(E===1?w+="x":(w+="x^",w+=E))}}return w}}class Ye extends u{}Ye.kind="ArithmeticException";class dt extends Re{constructor(w,E,M){super(),this.primitive=w,this.size=E,this.generatorBase=M;const z=new Int32Array(E);let W=1;for(let de=0;de<E;de++)z[de]=W,W*=2,W>=E&&(W^=w,W&=E-1);this.expTable=z;const J=new Int32Array(E);for(let de=0;de<E-1;de++)J[z[de]]=de;this.logTable=J,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 M=new Int32Array(w+1);return M[0]=E,new Qe(this,M)}inverse(w){if(w===0)throw new Ye;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"+I.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 st extends u{}st.kind="ReedSolomonException";class at extends u{}at.kind="IllegalStateException";class He{constructor(w){this.field=w}decode(w,E){const M=this.field,z=new Qe(M,w),W=new Int32Array(E);let J=!0;for(let gn=0;gn<E;gn++){const Tt=z.evaluateAt(M.exp(gn+M.getGeneratorBase()));W[W.length-1-gn]=Tt,Tt!==0&&(J=!1)}if(J)return;const de=new Qe(M,W),Ee=this.runEuclideanAlgorithm(M.buildMonomial(E,1),de,E),De=Ee[0],ot=Ee[1],_t=this.findErrorLocations(De),zt=this.findErrorMagnitudes(ot,_t);for(let gn=0;gn<_t.length;gn++){const Tt=w.length-1-M.log(_t[gn]);if(Tt<0)throw new st("Bad error location");w[Tt]=dt.addOrSubtract(w[Tt],zt[gn])}}runEuclideanAlgorithm(w,E,M){if(w.getDegree()<E.getDegree()){const gn=w;w=E,E=gn}const z=this.field;let W=w,J=E,de=z.getZero(),Ee=z.getOne();for(;J.getDegree()>=(M/2|0);){let gn=W,Tt=de;if(W=J,de=Ee,W.isZero())throw new st("r_{i-1} was zero");J=gn;let Zt=z.getZero();const sn=W.getCoefficient(W.getDegree()),$n=z.inverse(sn);for(;J.getDegree()>=W.getDegree()&&!J.isZero();){const Cr=J.getDegree()-W.getDegree(),kr=z.multiply(J.getCoefficient(J.getDegree()),$n);Zt=Zt.addOrSubtract(z.buildMonomial(Cr,kr)),J=J.addOrSubtract(W.multiplyByMonomial(Cr,kr))}if(Ee=Zt.multiply(de).addOrSubtract(Tt),J.getDegree()>=W.getDegree())throw new at("Division algorithm failed to reduce polynomial?")}const De=Ee.getCoefficient(0);if(De===0)throw new st("sigmaTilde(0) was zero");const ot=z.inverse(De),_t=Ee.multiplyScalar(ot),zt=J.multiplyScalar(ot);return[_t,zt]}findErrorLocations(w){const E=w.getDegree();if(E===1)return Int32Array.from([w.getCoefficient(1)]);const M=new Int32Array(E);let z=0;const W=this.field;for(let J=1;J<W.getSize()&&z<E;J++)w.evaluateAt(J)===0&&(M[z]=W.inverse(J),z++);if(z!==E)throw new st("Error locator degree does not match number of roots");return M}findErrorMagnitudes(w,E){const M=E.length,z=new Int32Array(M),W=this.field;for(let J=0;J<M;J++){const de=W.inverse(E[J]);let Ee=1;for(let De=0;De<M;De++)if(J!==De){const ot=W.multiply(E[De],de),_t=ot&1?ot&-2:ot|1;Ee=W.multiply(Ee,_t)}z[J]=W.multiply(w.evaluateAt(de),W.inverse(Ee)),W.getGeneratorBase()!==0&&(z[J]=W.multiply(z[J],de))}return z}}var qe;(function(St){St[St.UPPER=0]="UPPER",St[St.LOWER=1]="LOWER",St[St.MIXED=2]="MIXED",St[St.DIGIT=3]="DIGIT",St[St.PUNCT=4]="PUNCT",St[St.BINARY=5]="BINARY"})(qe||(qe={}));class vt{decode(w){this.ddata=w;let E=w.getBits(),M=this.extractBits(E),z=this.correctBits(M),W=vt.convertBoolArrayToByteArray(z),J=vt.getEncodedData(z),de=new Fe(W,J,null,null);return de.setNumBits(z.length),de}static highLevelDecode(w){return this.getEncodedData(w)}static getEncodedData(w){let E=w.length,M=qe.UPPER,z=qe.UPPER,W="",J=0;for(;J<E;)if(z===qe.BINARY){if(E-J<5)break;let de=vt.readCode(w,J,5);if(J+=5,de===0){if(E-J<11)break;de=vt.readCode(w,J,11)+31,J+=11}for(let Ee=0;Ee<de;Ee++){if(E-J<8){J=E;break}const De=vt.readCode(w,J,8);W+=q.castAsNonUtf8Char(De),J+=8}z=M}else{let de=z===qe.DIGIT?4:5;if(E-J<de)break;let Ee=vt.readCode(w,J,de);J+=de;let De=vt.getCharacter(z,Ee);De.startsWith("CTRL_")?(M=z,z=vt.getTable(De.charAt(5)),De.charAt(6)==="L"&&(M=z)):(W+=De,z=M)}return W}static getTable(w){switch(w){case"L":return qe.LOWER;case"P":return qe.PUNCT;case"M":return qe.MIXED;case"D":return qe.DIGIT;case"B":return qe.BINARY;case"U":default:return qe.UPPER}}static getCharacter(w,E){switch(w){case qe.UPPER:return vt.UPPER_TABLE[E];case qe.LOWER:return vt.LOWER_TABLE[E];case qe.MIXED:return vt.MIXED_TABLE[E];case qe.PUNCT:return vt.PUNCT_TABLE[E];case qe.DIGIT:return vt.DIGIT_TABLE[E];default:throw new at("Bad table")}}correctBits(w){let E,M;this.ddata.getNbLayers()<=2?(M=6,E=dt.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(M=8,E=dt.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(M=10,E=dt.AZTEC_DATA_10):(M=12,E=dt.AZTEC_DATA_12);let z=this.ddata.getNbDatablocks(),W=w.length/M;if(W<z)throw new O;let J=w.length%M,de=new Int32Array(W);for(let zt=0;zt<W;zt++,J+=M)de[zt]=vt.readCode(w,J,M);try{new He(E).decode(de,W-z)}catch(zt){throw new O(zt)}let Ee=(1<<M)-1,De=0;for(let zt=0;zt<z;zt++){let gn=de[zt];if(gn===0||gn===Ee)throw new O;(gn===1||gn===Ee-1)&&De++}let ot=new Array(z*M-De),_t=0;for(let zt=0;zt<z;zt++){let gn=de[zt];if(gn===1||gn===Ee-1)ot.fill(gn>1,_t,_t+M-1),_t+=M-1;else for(let Tt=M-1;Tt>=0;--Tt)ot[_t++]=(gn&1<<Tt)!==0}return ot}extractBits(w){let E=this.ddata.isCompact(),M=this.ddata.getNbLayers(),z=(E?11:14)+M*4,W=new Int32Array(z),J=new Array(this.totalBitsInLayer(M,E));if(E)for(let de=0;de<W.length;de++)W[de]=de;else{let de=z+1+2*I.truncDivision(I.truncDivision(z,2)-1,15),Ee=z/2,De=I.truncDivision(de,2);for(let ot=0;ot<Ee;ot++){let _t=ot+I.truncDivision(ot,15);W[Ee-ot-1]=De-_t-1,W[Ee+ot]=De+_t+1}}for(let de=0,Ee=0;de<M;de++){let De=(M-de)*4+(E?9:12),ot=de*2,_t=z-1-ot;for(let zt=0;zt<De;zt++){let gn=zt*2;for(let Tt=0;Tt<2;Tt++)J[Ee+gn+Tt]=w.get(W[ot+Tt],W[ot+zt]),J[Ee+2*De+gn+Tt]=w.get(W[ot+zt],W[_t-Tt]),J[Ee+4*De+gn+Tt]=w.get(W[_t-Tt],W[_t-zt]),J[Ee+6*De+gn+Tt]=w.get(W[_t-zt],W[ot+Tt])}Ee+=De*8}return J}static readCode(w,E,M){let z=0;for(let W=E;W<E+M;W++)z<<=1,w[W]&&(z|=1);return z}static readByte(w,E){let M=w.length-E;return M>=8?vt.readCode(w,E,8):vt.readCode(w,E,M)<<8-M}static convertBoolArrayToByteArray(w){let E=new Uint8Array((w.length+7)/8);for(let M=0;M<E.length;M++)E[M]=vt.readByte(w,8*M);return E}totalBitsInLayer(w,E){return((E?88:112)+16*w)*w}}vt.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"],vt.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"],vt.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"],vt.PUNCT_TABLE=["","\r",`\r
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],vt.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class yt{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,M,z){const W=w-M,J=E-z;return Math.sqrt(W*W+J*J)}static sum(w){let E=0;for(let M=0,z=w.length;M!==z;M++){const W=w[M];E+=W}return E}}class Kt{static floatToIntBits(w){return w}}Kt.MAX_VALUE=Number.MAX_SAFE_INTEGER;class jt{constructor(w,E){this.x=w,this.y=E}getX(){return this.x}getY(){return this.y}equals(w){if(w instanceof jt){const E=w;return this.x===E.x&&this.y===E.y}return!1}hashCode(){return 31*Kt.floatToIntBits(this.x)+Kt.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(w){const E=this.distance(w[0],w[1]),M=this.distance(w[1],w[2]),z=this.distance(w[0],w[2]);let W,J,de;if(M>=E&&M>=z?(J=w[0],W=w[1],de=w[2]):z>=M&&z>=E?(J=w[1],W=w[0],de=w[2]):(J=w[2],W=w[0],de=w[1]),this.crossProductZ(W,J,de)<0){const Ee=W;W=de,de=Ee}w[0]=W,w[1]=J,w[2]=de}static distance(w,E){return yt.distance(w.x,w.y,E.x,E.y)}static crossProductZ(w,E,M){const z=E.x,W=E.y;return(M.x-z)*(w.y-W)-(M.y-W)*(w.x-z)}}class un{constructor(w,E){this.bits=w,this.points=E}getBits(){return this.bits}getPoints(){return this.points}}class vn extends un{constructor(w,E,M,z,W){super(w,E),this.compact=M,this.nbDatablocks=z,this.nbLayers=W}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Hn{constructor(w,E,M,z){this.image=w,this.height=w.getHeight(),this.width=w.getWidth(),E==null&&(E=Hn.INIT_SIZE),M==null&&(M=w.getWidth()/2|0),z==null&&(z=w.getHeight()/2|0);const W=E/2|0;if(this.leftInit=M-W,this.rightInit=M+W,this.upInit=z-W,this.downInit=z+W,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new G}detect(){let w=this.leftInit,E=this.rightInit,M=this.upInit,z=this.downInit,W=!1,J=!0,de=!1,Ee=!1,De=!1,ot=!1,_t=!1;const zt=this.width,gn=this.height;for(;J;){J=!1;let Tt=!0;for(;(Tt||!Ee)&&E<zt;)Tt=this.containsBlackPoint(M,z,E,!1),Tt?(E++,J=!0,Ee=!0):Ee||E++;if(E>=zt){W=!0;break}let Zt=!0;for(;(Zt||!De)&&z<gn;)Zt=this.containsBlackPoint(w,E,z,!0),Zt?(z++,J=!0,De=!0):De||z++;if(z>=gn){W=!0;break}let sn=!0;for(;(sn||!ot)&&w>=0;)sn=this.containsBlackPoint(M,z,w,!1),sn?(w--,J=!0,ot=!0):ot||w--;if(w<0){W=!0;break}let $n=!0;for(;($n||!_t)&&M>=0;)$n=this.containsBlackPoint(w,E,M,!0),$n?(M--,J=!0,_t=!0):_t||M--;if(M<0){W=!0;break}J&&(de=!0)}if(!W&&de){const Tt=E-w;let Zt=null;for(let kr=1;Zt===null&&kr<Tt;kr++)Zt=this.getBlackPointOnSegment(w,z-kr,w+kr,z);if(Zt==null)throw new G;let sn=null;for(let kr=1;sn===null&&kr<Tt;kr++)sn=this.getBlackPointOnSegment(w,M+kr,w+kr,M);if(sn==null)throw new G;let $n=null;for(let kr=1;$n===null&&kr<Tt;kr++)$n=this.getBlackPointOnSegment(E,M+kr,E-kr,M);if($n==null)throw new G;let Cr=null;for(let kr=1;Cr===null&&kr<Tt;kr++)Cr=this.getBlackPointOnSegment(E,z-kr,E-kr,z);if(Cr==null)throw new G;return this.centerEdges(Cr,Zt,$n,sn)}else throw new G}getBlackPointOnSegment(w,E,M,z){const W=yt.round(yt.distance(w,E,M,z)),J=(M-w)/W,de=(z-E)/W,Ee=this.image;for(let De=0;De<W;De++){const ot=yt.round(w+De*J),_t=yt.round(E+De*de);if(Ee.get(ot,_t))return new jt(ot,_t)}return null}centerEdges(w,E,M,z){const W=w.getX(),J=w.getY(),de=E.getX(),Ee=E.getY(),De=M.getX(),ot=M.getY(),_t=z.getX(),zt=z.getY(),gn=Hn.CORR;return W<this.width/2?[new jt(_t-gn,zt+gn),new jt(de+gn,Ee+gn),new jt(De-gn,ot-gn),new jt(W+gn,J-gn)]:[new jt(_t+gn,zt+gn),new jt(de+gn,Ee-gn),new jt(De-gn,ot+gn),new jt(W-gn,J-gn)]}containsBlackPoint(w,E,M,z){const W=this.image;if(z){for(let J=w;J<=E;J++)if(W.get(J,M))return!0}else for(let J=w;J<=E;J++)if(W.get(M,J))return!0;return!1}}Hn.INIT_SIZE=10,Hn.CORR=1;class ln{static checkAndNudgePoints(w,E){const M=w.getWidth(),z=w.getHeight();let W=!0;for(let J=0;J<E.length&&W;J+=2){const de=Math.floor(E[J]),Ee=Math.floor(E[J+1]);if(de<-1||de>M||Ee<-1||Ee>z)throw new G;W=!1,de===-1?(E[J]=0,W=!0):de===M&&(E[J]=M-1,W=!0),Ee===-1?(E[J+1]=0,W=!0):Ee===z&&(E[J+1]=z-1,W=!0)}W=!0;for(let J=E.length-2;J>=0&&W;J-=2){const de=Math.floor(E[J]),Ee=Math.floor(E[J+1]);if(de<-1||de>M||Ee<-1||Ee>z)throw new G;W=!1,de===-1?(E[J]=0,W=!0):de===M&&(E[J]=M-1,W=!0),Ee===-1?(E[J+1]=0,W=!0):Ee===z&&(E[J+1]=z-1,W=!0)}}}class Nn{constructor(w,E,M,z,W,J,de,Ee,De){this.a11=w,this.a21=E,this.a31=M,this.a12=z,this.a22=W,this.a32=J,this.a13=de,this.a23=Ee,this.a33=De}static quadrilateralToQuadrilateral(w,E,M,z,W,J,de,Ee,De,ot,_t,zt,gn,Tt,Zt,sn){const $n=Nn.quadrilateralToSquare(w,E,M,z,W,J,de,Ee);return Nn.squareToQuadrilateral(De,ot,_t,zt,gn,Tt,Zt,sn).times($n)}transformPoints(w){const E=w.length,M=this.a11,z=this.a12,W=this.a13,J=this.a21,de=this.a22,Ee=this.a23,De=this.a31,ot=this.a32,_t=this.a33;for(let zt=0;zt<E;zt+=2){const gn=w[zt],Tt=w[zt+1],Zt=W*gn+Ee*Tt+_t;w[zt]=(M*gn+J*Tt+De)/Zt,w[zt+1]=(z*gn+de*Tt+ot)/Zt}}transformPointsWithValues(w,E){const M=this.a11,z=this.a12,W=this.a13,J=this.a21,de=this.a22,Ee=this.a23,De=this.a31,ot=this.a32,_t=this.a33,zt=w.length;for(let gn=0;gn<zt;gn++){const Tt=w[gn],Zt=E[gn],sn=W*Tt+Ee*Zt+_t;w[gn]=(M*Tt+J*Zt+De)/sn,E[gn]=(z*Tt+de*Zt+ot)/sn}}static squareToQuadrilateral(w,E,M,z,W,J,de,Ee){const De=w-M+W-de,ot=E-z+J-Ee;if(De===0&&ot===0)return new Nn(M-w,W-M,w,z-E,J-z,E,0,0,1);{const _t=M-W,zt=de-W,gn=z-J,Tt=Ee-J,Zt=_t*Tt-zt*gn,sn=(De*Tt-zt*ot)/Zt,$n=(_t*ot-De*gn)/Zt;return new Nn(M-w+sn*M,de-w+$n*de,w,z-E+sn*z,Ee-E+$n*Ee,E,sn,$n,1)}}static quadrilateralToSquare(w,E,M,z,W,J,de,Ee){return Nn.squareToQuadrilateral(w,E,M,z,W,J,de,Ee).buildAdjoint()}buildAdjoint(){return new Nn(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 Nn(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 dn extends ln{sampleGrid(w,E,M,z,W,J,de,Ee,De,ot,_t,zt,gn,Tt,Zt,sn,$n,Cr,kr){const Pr=Nn.quadrilateralToQuadrilateral(z,W,J,de,Ee,De,ot,_t,zt,gn,Tt,Zt,sn,$n,Cr,kr);return this.sampleGridWithTransform(w,E,M,Pr)}sampleGridWithTransform(w,E,M,z){if(E<=0||M<=0)throw new G;const W=new fe(E,M),J=new Float32Array(2*E);for(let de=0;de<M;de++){const Ee=J.length,De=de+.5;for(let ot=0;ot<Ee;ot+=2)J[ot]=ot/2+.5,J[ot+1]=De;z.transformPoints(J),ln.checkAndNudgePoints(w,J);try{for(let ot=0;ot<Ee;ot+=2)w.get(Math.floor(J[ot]),Math.floor(J[ot+1]))&&W.set(ot/2,de)}catch{throw new G}}return W}}class rt{static setGridSampler(w){rt.gridSampler=w}static getInstance(){return rt.gridSampler}}rt.gridSampler=new dn;class nt{constructor(w,E){this.x=w,this.y=E}toResultPoint(){return new jt(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Ut{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(),M=this.getBullsEyeCorners(E);if(w){let J=M[0];M[0]=M[2],M[2]=J}this.extractParameters(M);let z=this.sampleGrid(this.image,M[this.shift%4],M[(this.shift+1)%4],M[(this.shift+2)%4],M[(this.shift+3)%4]),W=this.getMatrixCornerPoints(M);return new vn(z,W,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 G;let E=2*this.nbCenterLayers,M=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(M,E);let z=0;for(let J=0;J<4;J++){let de=M[(this.shift+J)%4];this.compact?(z<<=7,z+=de>>1&127):(z<<=10,z+=(de>>2&992)+(de>>1&31))}let W=this.getCorrectedParameterData(z,this.compact);this.compact?(this.nbLayers=(W>>6)+1,this.nbDataBlocks=(W&63)+1):(this.nbLayers=(W>>11)+1,this.nbDataBlocks=(W&2047)+1)}getRotation(w,E){let M=0;w.forEach((z,W,J)=>{let de=(z>>E-2<<1)+(z&1);M=(M<<3)+de}),M=((M&1)<<11)+(M>>1);for(let z=0;z<4;z++)if(I.bitCount(M^this.EXPECTED_CORNER_BITS[z])<=2)return z;throw new G}getCorrectedParameterData(w,E){let M,z;E?(M=7,z=2):(M=10,z=4);let W=M-z,J=new Int32Array(M);for(let Ee=M-1;Ee>=0;--Ee)J[Ee]=w&15,w>>=4;try{new He(dt.AZTEC_PARAM).decode(J,W)}catch{throw new G}let de=0;for(let Ee=0;Ee<z;Ee++)de=(de<<4)+J[Ee];return de}getBullsEyeCorners(w){let E=w,M=w,z=w,W=w,J=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let _t=this.getFirstDifferent(E,J,1,-1),zt=this.getFirstDifferent(M,J,1,1),gn=this.getFirstDifferent(z,J,-1,1),Tt=this.getFirstDifferent(W,J,-1,-1);if(this.nbCenterLayers>2){let Zt=this.distancePoint(Tt,_t)*this.nbCenterLayers/(this.distancePoint(W,E)*(this.nbCenterLayers+2));if(Zt<.75||Zt>1.25||!this.isWhiteOrBlackRectangle(_t,zt,gn,Tt))break}E=_t,M=zt,z=gn,W=Tt,J=!J}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new G;this.compact=this.nbCenterLayers===5;let de=new jt(E.getX()+.5,E.getY()-.5),Ee=new jt(M.getX()+.5,M.getY()+.5),De=new jt(z.getX()-.5,z.getY()+.5),ot=new jt(W.getX()-.5,W.getY()-.5);return this.expandSquare([de,Ee,De,ot],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let w,E,M,z;try{let de=new Hn(this.image).detect();w=de[0],E=de[1],M=de[2],z=de[3]}catch{let Ee=this.image.getWidth()/2,De=this.image.getHeight()/2;w=this.getFirstDifferent(new nt(Ee+7,De-7),!1,1,-1).toResultPoint(),E=this.getFirstDifferent(new nt(Ee+7,De+7),!1,1,1).toResultPoint(),M=this.getFirstDifferent(new nt(Ee-7,De+7),!1,-1,1).toResultPoint(),z=this.getFirstDifferent(new nt(Ee-7,De-7),!1,-1,-1).toResultPoint()}let W=yt.round((w.getX()+z.getX()+E.getX()+M.getX())/4),J=yt.round((w.getY()+z.getY()+E.getY()+M.getY())/4);try{let de=new Hn(this.image,15,W,J).detect();w=de[0],E=de[1],M=de[2],z=de[3]}catch{w=this.getFirstDifferent(new nt(W+7,J-7),!1,1,-1).toResultPoint(),E=this.getFirstDifferent(new nt(W+7,J+7),!1,1,1).toResultPoint(),M=this.getFirstDifferent(new nt(W-7,J+7),!1,-1,1).toResultPoint(),z=this.getFirstDifferent(new nt(W-7,J-7),!1,-1,-1).toResultPoint()}return W=yt.round((w.getX()+z.getX()+E.getX()+M.getX())/4),J=yt.round((w.getY()+z.getY()+E.getY()+M.getY())/4),new nt(W,J)}getMatrixCornerPoints(w){return this.expandSquare(w,2*this.nbCenterLayers,this.getDimension())}sampleGrid(w,E,M,z,W){let J=rt.getInstance(),de=this.getDimension(),Ee=de/2-this.nbCenterLayers,De=de/2+this.nbCenterLayers;return J.sampleGrid(w,de,de,Ee,Ee,De,Ee,De,De,Ee,De,E.getX(),E.getY(),M.getX(),M.getY(),z.getX(),z.getY(),W.getX(),W.getY())}sampleLine(w,E,M){let z=0,W=this.distanceResultPoint(w,E),J=W/M,de=w.getX(),Ee=w.getY(),De=J*(E.getX()-w.getX())/W,ot=J*(E.getY()-w.getY())/W;for(let _t=0;_t<M;_t++)this.image.get(yt.round(de+_t*De),yt.round(Ee+_t*ot))&&(z|=1<<M-_t-1);return z}isWhiteOrBlackRectangle(w,E,M,z){let W=3;w=new nt(w.getX()-W,w.getY()+W),E=new nt(E.getX()-W,E.getY()-W),M=new nt(M.getX()+W,M.getY()-W),z=new nt(z.getX()+W,z.getY()+W);let J=this.getColor(z,w);if(J===0)return!1;let de=this.getColor(w,E);return de!==J||(de=this.getColor(E,M),de!==J)?!1:(de=this.getColor(M,z),de===J)}getColor(w,E){let M=this.distancePoint(w,E),z=(E.getX()-w.getX())/M,W=(E.getY()-w.getY())/M,J=0,de=w.getX(),Ee=w.getY(),De=this.image.get(w.getX(),w.getY()),ot=Math.ceil(M);for(let zt=0;zt<ot;zt++)de+=z,Ee+=W,this.image.get(yt.round(de),yt.round(Ee))!==De&&J++;let _t=J/M;return _t>.1&&_t<.9?0:_t<=.1===De?1:-1}getFirstDifferent(w,E,M,z){let W=w.getX()+M,J=w.getY()+z;for(;this.isValid(W,J)&&this.image.get(W,J)===E;)W+=M,J+=z;for(W-=M,J-=z;this.isValid(W,J)&&this.image.get(W,J)===E;)W+=M;for(W-=M;this.isValid(W,J)&&this.image.get(W,J)===E;)J+=z;return J-=z,new nt(W,J)}expandSquare(w,E,M){let z=M/(2*E),W=w[0].getX()-w[2].getX(),J=w[0].getY()-w[2].getY(),de=(w[0].getX()+w[2].getX())/2,Ee=(w[0].getY()+w[2].getY())/2,De=new jt(de+z*W,Ee+z*J),ot=new jt(de-z*W,Ee-z*J);W=w[1].getX()-w[3].getX(),J=w[1].getY()-w[3].getY(),de=(w[1].getX()+w[3].getX())/2,Ee=(w[1].getY()+w[3].getY())/2;let _t=new jt(de+z*W,Ee+z*J),zt=new jt(de-z*W,Ee-z*J);return[De,_t,ot,zt]}isValid(w,E){return w>=0&&w<this.image.getWidth()&&E>0&&E<this.image.getHeight()}isValidPoint(w){let E=yt.round(w.getX()),M=yt.round(w.getY());return this.isValid(E,M)}distancePoint(w,E){return yt.distance(w.getX(),w.getY(),E.getX(),E.getY())}distanceResultPoint(w,E){return yt.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*(I.truncDivision(this.nbLayers-4,8)+1)+15}}class wn{decode(w,E=null){let M=null,z=new Ut(w.getBlackMatrix()),W=null,J=null;try{let ot=z.detectMirror(!1);W=ot.getPoints(),this.reportFoundResultPoints(E,W),J=new vt().decode(ot)}catch(ot){M=ot}if(J==null)try{let ot=z.detectMirror(!0);W=ot.getPoints(),this.reportFoundResultPoints(E,W),J=new vt().decode(ot)}catch(ot){throw M??ot}let de=new ge(J.getText(),J.getRawBytes(),J.getNumBits(),W,be.AZTEC,v.currentTimeMillis()),Ee=J.getByteSegments();Ee!=null&&de.putMetadata(je.BYTE_SEGMENTS,Ee);let De=J.getECLevel();return De!=null&&de.putMetadata(je.ERROR_CORRECTION_LEVEL,De),de}reportFoundResultPoints(w,E){if(w!=null){let M=w.get($.NEED_RESULT_POINT_CALLBACK);M!=null&&E.forEach((z,W,J)=>{M.foundPossibleResultPoint(z)})}}reset(){}}class Jt extends Se{constructor(w=500){super(new wn,w)}}class Vt{decode(w,E){try{return this.doDecode(w,E)}catch{if(E&&E.get($.TRY_HARDER)===!0&&w.isRotateSupported()){const W=w.rotateCounterClockwise(),J=this.doDecode(W,E),de=J.getResultMetadata();let Ee=270;de!==null&&de.get(je.ORIENTATION)===!0&&(Ee=Ee+de.get(je.ORIENTATION)%360),J.putMetadata(je.ORIENTATION,Ee);const De=J.getResultPoints();if(De!==null){const ot=W.getHeight();for(let _t=0;_t<De.length;_t++)De[_t]=new jt(ot-De[_t].getY()-1,De[_t].getX())}return J}else throw new G}}reset(){}doDecode(w,E){const M=w.getWidth(),z=w.getHeight();let W=new L(M);const J=E&&E.get($.TRY_HARDER)===!0,de=Math.max(1,z>>(J?8:5));let Ee;J?Ee=z:Ee=15;const De=Math.trunc(z/2);for(let ot=0;ot<Ee;ot++){const _t=Math.trunc((ot+1)/2),zt=(ot&1)===0,gn=De+de*(zt?_t:-_t);if(gn<0||gn>=z)break;try{W=w.getBlackRow(gn,W)}catch{continue}for(let Tt=0;Tt<2;Tt++){if(Tt===1&&(W.reverse(),E&&E.get($.NEED_RESULT_POINT_CALLBACK)===!0)){const Zt=new Map;E.forEach((sn,$n)=>Zt.set($n,sn)),Zt.delete($.NEED_RESULT_POINT_CALLBACK),E=Zt}try{const Zt=this.decodeRow(gn,W,E);if(Tt===1){Zt.putMetadata(je.ORIENTATION,180);const sn=Zt.getResultPoints();sn!==null&&(sn[0]=new jt(M-sn[0].getX()-1,sn[0].getY()),sn[1]=new jt(M-sn[1].getX()-1,sn[1].getY()))}return Zt}catch{}}}throw new G}static recordPattern(w,E,M){const z=M.length;for(let De=0;De<z;De++)M[De]=0;const W=w.getSize();if(E>=W)throw new G;let J=!w.get(E),de=0,Ee=E;for(;Ee<W;){if(w.get(Ee)!==J)M[de]++;else{if(++de===z)break;M[de]=1,J=!J}Ee++}if(!(de===z||de===z-1&&Ee===W))throw new G}static recordPatternInReverse(w,E,M){let z=M.length,W=w.get(E);for(;E>0&&z>=0;)w.get(--E)!==W&&(z--,W=!W);if(z>=0)throw new G;Vt.recordPattern(w,E+1,M)}static patternMatchVariance(w,E,M){const z=w.length;let W=0,J=0;for(let De=0;De<z;De++)W+=w[De],J+=E[De];if(W<J)return Number.POSITIVE_INFINITY;const de=W/J;M*=de;let Ee=0;for(let De=0;De<z;De++){const ot=w[De],_t=E[De]*de,zt=ot>_t?ot-_t:_t-ot;if(zt>M)return Number.POSITIVE_INFINITY;Ee+=zt}return Ee/W}}class xt extends Vt{static findStartPattern(w){const E=w.getSize(),M=w.getNextSet(0);let z=0,W=Int32Array.from([0,0,0,0,0,0]),J=M,de=!1;const Ee=6;for(let De=M;De<E;De++)if(w.get(De)!==de)W[z]++;else{if(z===Ee-1){let ot=xt.MAX_AVG_VARIANCE,_t=-1;for(let zt=xt.CODE_START_A;zt<=xt.CODE_START_C;zt++){const gn=Vt.patternMatchVariance(W,xt.CODE_PATTERNS[zt],xt.MAX_INDIVIDUAL_VARIANCE);gn<ot&&(ot=gn,_t=zt)}if(_t>=0&&w.isRange(Math.max(0,J-(De-J)/2),J,!1))return Int32Array.from([J,De,_t]);J+=W[0]+W[1],W=W.slice(2,W.length-1),W[z-1]=0,W[z]=0,z--}else z++;W[z]=1,de=!de}throw new G}static decodeCode(w,E,M){Vt.recordPattern(w,M,E);let z=xt.MAX_AVG_VARIANCE,W=-1;for(let J=0;J<xt.CODE_PATTERNS.length;J++){const de=xt.CODE_PATTERNS[J],Ee=this.patternMatchVariance(E,de,xt.MAX_INDIVIDUAL_VARIANCE);Ee<z&&(z=Ee,W=J)}if(W>=0)return W;throw new G}decodeRow(w,E,M){const z=M&&M.get($.ASSUME_GS1)===!0,W=xt.findStartPattern(E),J=W[2];let de=0;const Ee=new Uint8Array(20);Ee[de++]=J;let De;switch(J){case xt.CODE_START_A:De=xt.CODE_CODE_A;break;case xt.CODE_START_B:De=xt.CODE_CODE_B;break;case xt.CODE_START_C:De=xt.CODE_CODE_C;break;default:throw new O}let ot=!1,_t=!1,zt="",gn=W[0],Tt=W[1];const Zt=Int32Array.from([0,0,0,0,0,0]);let sn=0,$n=0,Cr=J,kr=0,Pr=!0,Is=!1,ni=!1;for(;!ot;){const Mi=_t;switch(_t=!1,sn=$n,$n=xt.decodeCode(E,Zt,Tt),Ee[de++]=$n,$n!==xt.CODE_STOP&&(Pr=!0),$n!==xt.CODE_STOP&&(kr++,Cr+=kr*$n),gn=Tt,Tt+=Zt.reduce((Rm,G1)=>Rm+G1,0),$n){case xt.CODE_START_A:case xt.CODE_START_B:case xt.CODE_START_C:throw new O}switch(De){case xt.CODE_CODE_A:if($n<64)ni===Is?zt+=String.fromCharCode(32+$n):zt+=String.fromCharCode(32+$n+128),ni=!1;else if($n<96)ni===Is?zt+=String.fromCharCode($n-64):zt+=String.fromCharCode($n+64),ni=!1;else switch($n!==xt.CODE_STOP&&(Pr=!1),$n){case xt.CODE_FNC_1:z&&(zt.length===0?zt+="]C1":zt+="");break;case xt.CODE_FNC_2:case xt.CODE_FNC_3:break;case xt.CODE_FNC_4_A:!Is&&ni?(Is=!0,ni=!1):Is&&ni?(Is=!1,ni=!1):ni=!0;break;case xt.CODE_SHIFT:_t=!0,De=xt.CODE_CODE_B;break;case xt.CODE_CODE_B:De=xt.CODE_CODE_B;break;case xt.CODE_CODE_C:De=xt.CODE_CODE_C;break;case xt.CODE_STOP:ot=!0;break}break;case xt.CODE_CODE_B:if($n<96)ni===Is?zt+=String.fromCharCode(32+$n):zt+=String.fromCharCode(32+$n+128),ni=!1;else switch($n!==xt.CODE_STOP&&(Pr=!1),$n){case xt.CODE_FNC_1:z&&(zt.length===0?zt+="]C1":zt+="");break;case xt.CODE_FNC_2:case xt.CODE_FNC_3:break;case xt.CODE_FNC_4_B:!Is&&ni?(Is=!0,ni=!1):Is&&ni?(Is=!1,ni=!1):ni=!0;break;case xt.CODE_SHIFT:_t=!0,De=xt.CODE_CODE_A;break;case xt.CODE_CODE_A:De=xt.CODE_CODE_A;break;case xt.CODE_CODE_C:De=xt.CODE_CODE_C;break;case xt.CODE_STOP:ot=!0;break}break;case xt.CODE_CODE_C:if($n<100)$n<10&&(zt+="0"),zt+=$n;else switch($n!==xt.CODE_STOP&&(Pr=!1),$n){case xt.CODE_FNC_1:z&&(zt.length===0?zt+="]C1":zt+="");break;case xt.CODE_CODE_A:De=xt.CODE_CODE_A;break;case xt.CODE_CODE_B:De=xt.CODE_CODE_B;break;case xt.CODE_STOP:ot=!0;break}break}Mi&&(De=De===xt.CODE_CODE_A?xt.CODE_CODE_B:xt.CODE_CODE_A)}const xc=Tt-gn;if(Tt=E.getNextUnset(Tt),!E.isRange(Tt,Math.min(E.getSize(),Tt+(Tt-gn)/2),!1))throw new G;if(Cr-=kr*sn,Cr%103!==sn)throw new g;const ao=zt.length;if(ao===0)throw new G;ao>0&&Pr&&(De===xt.CODE_CODE_C?zt=zt.substring(0,ao-2):zt=zt.substring(0,ao-1));const oo=(W[1]+W[0])/2,ga=gn+xc/2,Ia=Ee.length,Qo=new Uint8Array(Ia);for(let Mi=0;Mi<Ia;Mi++)Qo[Mi]=Ee[Mi];const kd=[new jt(oo,w),new jt(ga,w)];return new ge(zt,Qo,0,kd,be.CODE_128,new Date().getTime())}}xt.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])],xt.MAX_AVG_VARIANCE=.25,xt.MAX_INDIVIDUAL_VARIANCE=.7,xt.CODE_SHIFT=98,xt.CODE_CODE_C=99,xt.CODE_CODE_B=100,xt.CODE_CODE_A=101,xt.CODE_FNC_1=102,xt.CODE_FNC_2=97,xt.CODE_FNC_3=96,xt.CODE_FNC_4_A=101,xt.CODE_FNC_4_B=100,xt.CODE_START_A=103,xt.CODE_START_B=104,xt.CODE_START_C=105,xt.CODE_STOP=106;class We extends Vt{constructor(w=!1,E=!1){super(),this.usingCheckDigit=w,this.extendedMode=E,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(w,E,M){let z=this.counters;z.fill(0),this.decodeRowResult="";let W=We.findAsteriskPattern(E,z),J=E.getNextSet(W[1]),de=E.getSize(),Ee,De;do{We.recordPattern(E,J,z);let Zt=We.toNarrowWidePattern(z);if(Zt<0)throw new G;Ee=We.patternToChar(Zt),this.decodeRowResult+=Ee,De=J;for(let sn of z)J+=sn;J=E.getNextSet(J)}while(Ee!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let ot=0;for(let Zt of z)ot+=Zt;let _t=J-De-ot;if(J!==de&&_t*2<ot)throw new G;if(this.usingCheckDigit){let Zt=this.decodeRowResult.length-1,sn=0;for(let $n=0;$n<Zt;$n++)sn+=We.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt($n));if(this.decodeRowResult.charAt(Zt)!==We.ALPHABET_STRING.charAt(sn%43))throw new g;this.decodeRowResult=this.decodeRowResult.substring(0,Zt)}if(this.decodeRowResult.length===0)throw new G;let zt;this.extendedMode?zt=We.decodeExtended(this.decodeRowResult):zt=this.decodeRowResult;let gn=(W[1]+W[0])/2,Tt=De+ot/2;return new ge(zt,null,0,[new jt(gn,w),new jt(Tt,w)],be.CODE_39,new Date().getTime())}static findAsteriskPattern(w,E){let M=w.getSize(),z=w.getNextSet(0),W=0,J=z,de=!1,Ee=E.length;for(let De=z;De<M;De++)if(w.get(De)!==de)E[W]++;else{if(W===Ee-1){if(this.toNarrowWidePattern(E)===We.ASTERISK_ENCODING&&w.isRange(Math.max(0,J-Math.floor((De-J)/2)),J,!1))return[J,De];J+=E[0]+E[1],E.copyWithin(0,2,2+W-1),E[W-1]=0,E[W]=0,W--}else W++;E[W]=1,de=!de}throw new G}static toNarrowWidePattern(w){let E=w.length,M=0,z;do{let W=2147483647;for(let Ee of w)Ee<W&&Ee>M&&(W=Ee);M=W,z=0;let J=0,de=0;for(let Ee=0;Ee<E;Ee++){let De=w[Ee];De>M&&(de|=1<<E-1-Ee,z++,J+=De)}if(z===3){for(let Ee=0;Ee<E&&z>0;Ee++){let De=w[Ee];if(De>M&&(z--,De*2>=J))return-1}return de}}while(z>3);return-1}static patternToChar(w){for(let E=0;E<We.CHARACTER_ENCODINGS.length;E++)if(We.CHARACTER_ENCODINGS[E]===w)return We.ALPHABET_STRING.charAt(E);if(w===We.ASTERISK_ENCODING)return"*";throw new G}static decodeExtended(w){let E=w.length,M="";for(let z=0;z<E;z++){let W=w.charAt(z);if(W==="+"||W==="$"||W==="%"||W==="/"){let J=w.charAt(z+1),de="\0";switch(W){case"+":if(J>="A"&&J<="Z")de=String.fromCharCode(J.charCodeAt(0)+32);else throw new O;break;case"$":if(J>="A"&&J<="Z")de=String.fromCharCode(J.charCodeAt(0)-64);else throw new O;break;case"%":if(J>="A"&&J<="E")de=String.fromCharCode(J.charCodeAt(0)-38);else if(J>="F"&&J<="J")de=String.fromCharCode(J.charCodeAt(0)-11);else if(J>="K"&&J<="O")de=String.fromCharCode(J.charCodeAt(0)+16);else if(J>="P"&&J<="T")de=String.fromCharCode(J.charCodeAt(0)+43);else if(J==="U")de="\0";else if(J==="V")de="@";else if(J==="W")de="`";else if(J==="X"||J==="Y"||J==="Z")de="";else throw new O;break;case"/":if(J>="A"&&J<="O")de=String.fromCharCode(J.charCodeAt(0)-32);else if(J==="Z")de=":";else throw new O;break}M+=de,z++}else M+=W}return M}}We.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",We.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],We.ASTERISK_ENCODING=148;class Pt extends Vt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(w,E,M){let z=this.decodeStart(E),W=this.decodeEnd(E),J=new te;Pt.decodeMiddle(E,z[1],W[0],J);let de=J.toString(),Ee=null;M!=null&&(Ee=M.get($.ALLOWED_LENGTHS)),Ee==null&&(Ee=Pt.DEFAULT_ALLOWED_LENGTHS);let De=de.length,ot=!1,_t=0;for(let Tt of Ee){if(De===Tt){ot=!0;break}Tt>_t&&(_t=Tt)}if(!ot&&De>_t&&(ot=!0),!ot)throw new O;const zt=[new jt(z[1],w),new jt(W[0],w)];return new ge(de,null,0,zt,be.ITF,new Date().getTime())}static decodeMiddle(w,E,M,z){let W=new Int32Array(10),J=new Int32Array(5),de=new Int32Array(5);for(W.fill(0),J.fill(0),de.fill(0);E<M;){Vt.recordPattern(w,E,W);for(let De=0;De<5;De++){let ot=2*De;J[De]=W[ot],de[De]=W[ot+1]}let Ee=Pt.decodeDigit(J);z.append(Ee.toString()),Ee=this.decodeDigit(de),z.append(Ee.toString()),W.forEach(function(De){E+=De})}}decodeStart(w){let E=Pt.skipWhiteSpace(w),M=Pt.findGuardPattern(w,E,Pt.START_PATTERN);return this.narrowLineWidth=(M[1]-M[0])/4,this.validateQuietZone(w,M[0]),M}validateQuietZone(w,E){let M=this.narrowLineWidth*10;M=M<E?M:E;for(let z=E-1;M>0&&z>=0&&!w.get(z);z--)M--;if(M!==0)throw new G}static skipWhiteSpace(w){const E=w.getSize(),M=w.getNextSet(0);if(M===E)throw new G;return M}decodeEnd(w){w.reverse();try{let E=Pt.skipWhiteSpace(w),M;try{M=Pt.findGuardPattern(w,E,Pt.END_PATTERN_REVERSED[0])}catch(W){W instanceof G&&(M=Pt.findGuardPattern(w,E,Pt.END_PATTERN_REVERSED[1]))}this.validateQuietZone(w,M[0]);let z=M[0];return M[0]=w.getSize()-M[1],M[1]=w.getSize()-z,M}finally{w.reverse()}}static findGuardPattern(w,E,M){let z=M.length,W=new Int32Array(z),J=w.getSize(),de=!1,Ee=0,De=E;W.fill(0);for(let ot=E;ot<J;ot++)if(w.get(ot)!==de)W[Ee]++;else{if(Ee===z-1){if(Vt.patternMatchVariance(W,M,Pt.MAX_INDIVIDUAL_VARIANCE)<Pt.MAX_AVG_VARIANCE)return[De,ot];De+=W[0]+W[1],v.arraycopy(W,2,W,0,Ee-1),W[Ee-1]=0,W[Ee]=0,Ee--}else Ee++;W[Ee]=1,de=!de}throw new G}static decodeDigit(w){let E=Pt.MAX_AVG_VARIANCE,M=-1,z=Pt.PATTERNS.length;for(let W=0;W<z;W++){let J=Pt.PATTERNS[W],de=Vt.patternMatchVariance(w,J,Pt.MAX_INDIVIDUAL_VARIANCE);de<E?(E=de,M=W):de===E&&(M=-1)}if(M>=0)return M%10;throw new G}}Pt.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])],Pt.MAX_AVG_VARIANCE=.38,Pt.MAX_INDIVIDUAL_VARIANCE=.5,Pt.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Pt.START_PATTERN=Int32Array.from([1,1,1,1]),Pt.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class Ke extends Vt{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(w){let E=!1,M,z=0,W=Int32Array.from([0,0,0]);for(;!E;){W=Int32Array.from([0,0,0]),M=Ke.findGuardPattern(w,z,!1,this.START_END_PATTERN,W);let J=M[0];z=M[1];let de=J-(z-J);de>=0&&(E=w.isRange(de,J,!1))}return M}static checkChecksum(w){return Ke.checkStandardUPCEANChecksum(w)}static checkStandardUPCEANChecksum(w){let E=w.length;if(E===0)return!1;let M=parseInt(w.charAt(E-1),10);return Ke.getStandardUPCEANChecksum(w.substring(0,E-1))===M}static getStandardUPCEANChecksum(w){let E=w.length,M=0;for(let z=E-1;z>=0;z-=2){let W=w.charAt(z).charCodeAt(0)-48;if(W<0||W>9)throw new O;M+=W}M*=3;for(let z=E-2;z>=0;z-=2){let W=w.charAt(z).charCodeAt(0)-48;if(W<0||W>9)throw new O;M+=W}return(1e3-M)%10}static decodeEnd(w,E){return Ke.findGuardPattern(w,E,!1,Ke.START_END_PATTERN,new Int32Array(Ke.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(w,E,M,z){return this.findGuardPattern(w,E,M,z,new Int32Array(z.length))}static findGuardPattern(w,E,M,z,W){let J=w.getSize();E=M?w.getNextUnset(E):w.getNextSet(E);let de=0,Ee=E,De=z.length,ot=M;for(let _t=E;_t<J;_t++)if(w.get(_t)!==ot)W[de]++;else{if(de===De-1){if(Vt.patternMatchVariance(W,z,Ke.MAX_INDIVIDUAL_VARIANCE)<Ke.MAX_AVG_VARIANCE)return Int32Array.from([Ee,_t]);Ee+=W[0]+W[1];let zt=W.slice(2,W.length-1);for(let gn=0;gn<de-1;gn++)W[gn]=zt[gn];W[de-1]=0,W[de]=0,de--}else de++;W[de]=1,ot=!ot}throw new G}static decodeDigit(w,E,M,z){this.recordPattern(w,M,E);let W=this.MAX_AVG_VARIANCE,J=-1,de=z.length;for(let Ee=0;Ee<de;Ee++){let De=z[Ee],ot=Vt.patternMatchVariance(E,De,Ke.MAX_INDIVIDUAL_VARIANCE);ot<W&&(W=ot,J=Ee)}if(J>=0)return J;throw new G}}Ke.MAX_AVG_VARIANCE=.48,Ke.MAX_INDIVIDUAL_VARIANCE=.7,Ke.START_END_PATTERN=Int32Array.from([1,1,1]),Ke.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Ke.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Ke.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 ct{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,M){let z=this.decodeRowStringBuffer,W=this.decodeMiddle(E,M,z),J=z.toString(),de=ct.parseExtensionString(J),Ee=[new jt((M[0]+M[1])/2,w),new jt(W,w)],De=new ge(J,null,0,Ee,be.UPC_EAN_EXTENSION,new Date().getTime());return de!=null&&De.putAllMetadata(de),De}decodeMiddle(w,E,M){let z=this.decodeMiddleCounters;z[0]=0,z[1]=0,z[2]=0,z[3]=0;let W=w.getSize(),J=E[1],de=0;for(let De=0;De<5&&J<W;De++){let ot=Ke.decodeDigit(w,z,J,Ke.L_AND_G_PATTERNS);M+=String.fromCharCode(48+ot%10);for(let _t of z)J+=_t;ot>=10&&(de|=1<<4-De),De!==4&&(J=w.getNextSet(J),J=w.getNextUnset(J))}if(M.length!==5)throw new G;let Ee=this.determineCheckDigit(de);if(ct.extensionChecksum(M.toString())!==Ee)throw new G;return J}static extensionChecksum(w){let E=w.length,M=0;for(let z=E-2;z>=0;z-=2)M+=w.charAt(z).charCodeAt(0)-48;M*=3;for(let z=E-1;z>=0;z-=2)M+=w.charAt(z).charCodeAt(0)-48;return M*=3,M%10}determineCheckDigit(w){for(let E=0;E<10;E++)if(w===this.CHECK_DIGIT_ENCODINGS[E])return E;throw new G}static parseExtensionString(w){if(w.length!==5)return null;let E=ct.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 M=parseInt(w.substring(1)),z=(M/100).toString(),W=M%100,J=W<10?"0"+W:W.toString();return E+z+"."+J}}class Nt{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(w,E,M){let z=this.decodeRowStringBuffer,W=this.decodeMiddle(E,M,z),J=z.toString(),de=Nt.parseExtensionString(J),Ee=[new jt((M[0]+M[1])/2,w),new jt(W,w)],De=new ge(J,null,0,Ee,be.UPC_EAN_EXTENSION,new Date().getTime());return de!=null&&De.putAllMetadata(de),De}decodeMiddle(w,E,M){let z=this.decodeMiddleCounters;z[0]=0,z[1]=0,z[2]=0,z[3]=0;let W=w.getSize(),J=E[1],de=0;for(let Ee=0;Ee<2&&J<W;Ee++){let De=Ke.decodeDigit(w,z,J,Ke.L_AND_G_PATTERNS);M+=String.fromCharCode(48+De%10);for(let ot of z)J+=ot;De>=10&&(de|=1<<1-Ee),Ee!==1&&(J=w.getNextSet(J),J=w.getNextUnset(J))}if(M.length!==2)throw new G;if(parseInt(M.toString())%4!==de)throw new G;return J}static parseExtensionString(w){return w.length!==2?null:new Map([[je.ISSUE_NUMBER,parseInt(w)]])}}class Ht{static decodeRow(w,E,M){let z=Ke.findGuardPattern(E,M,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new ct().decodeRow(w,E,z)}catch{return new Nt().decodeRow(w,E,z)}}}Ht.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Rt extends Ke{constructor(){super(),this.decodeRowStringBuffer="",Rt.L_AND_G_PATTERNS=Rt.L_PATTERNS.map(w=>Int32Array.from(w));for(let w=10;w<20;w++){let E=Rt.L_PATTERNS[w-10],M=new Int32Array(E.length);for(let z=0;z<E.length;z++)M[z]=E[E.length-z-1];Rt.L_AND_G_PATTERNS[w]=M}}decodeRow(w,E,M){let z=Rt.findStartGuardPattern(E),W=M==null?null:M.get($.NEED_RESULT_POINT_CALLBACK);if(W!=null){const Pr=new jt((z[0]+z[1])/2,w);W.foundPossibleResultPoint(Pr)}let J=this.decodeMiddle(E,z,this.decodeRowStringBuffer),de=J.rowOffset,Ee=J.resultString;if(W!=null){const Pr=new jt(de,w);W.foundPossibleResultPoint(Pr)}let De=this.decodeEnd(E,de);if(W!=null){const Pr=new jt((De[0]+De[1])/2,w);W.foundPossibleResultPoint(Pr)}let ot=De[1],_t=ot+(ot-De[0]);if(_t>=E.getSize()||!E.isRange(ot,_t,!1))throw new G;let zt=Ee.toString();if(zt.length<8)throw new O;if(!Rt.checkChecksum(zt))throw new g;let gn=(z[1]+z[0])/2,Tt=(De[1]+De[0])/2,Zt=this.getBarcodeFormat(),sn=[new jt(gn,w),new jt(Tt,w)],$n=new ge(zt,null,0,sn,Zt,new Date().getTime()),Cr=0;try{let Pr=Ht.decodeRow(w,E,De[1]);$n.putMetadata(je.UPC_EAN_EXTENSION,Pr.getText()),$n.putAllMetadata(Pr.getResultMetadata()),$n.addResultPoints(Pr.getResultPoints()),Cr=Pr.getText().length}catch{}let kr=M==null?null:M.get($.ALLOWED_EAN_EXTENSIONS);if(kr!=null){let Pr=!1;for(let Is in kr)if(Cr.toString()===Is){Pr=!0;break}if(!Pr)throw new G}return $n}decodeEnd(w,E){return Rt.findGuardPattern(w,E,!1,Rt.START_END_PATTERN,new Int32Array(Rt.START_END_PATTERN.length).fill(0))}static checkChecksum(w){return Rt.checkStandardUPCEANChecksum(w)}static checkStandardUPCEANChecksum(w){let E=w.length;if(E===0)return!1;let M=parseInt(w.charAt(E-1),10);return Rt.getStandardUPCEANChecksum(w.substring(0,E-1))===M}static getStandardUPCEANChecksum(w){let E=w.length,M=0;for(let z=E-1;z>=0;z-=2){let W=w.charAt(z).charCodeAt(0)-48;if(W<0||W>9)throw new O;M+=W}M*=3;for(let z=E-2;z>=0;z-=2){let W=w.charAt(z).charCodeAt(0)-48;if(W<0||W>9)throw new O;M+=W}return(1e3-M)%10}}class hn extends Rt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(w,E,M){let z=this.decodeMiddleCounters;z[0]=0,z[1]=0,z[2]=0,z[3]=0;let W=w.getSize(),J=E[1],de=0;for(let De=0;De<6&&J<W;De++){let ot=Rt.decodeDigit(w,z,J,Rt.L_AND_G_PATTERNS);M+=String.fromCharCode(48+ot%10);for(let _t of z)J+=_t;ot>=10&&(de|=1<<5-De)}M=hn.determineFirstDigit(M,de),J=Rt.findGuardPattern(w,J,!0,Rt.MIDDLE_PATTERN,new Int32Array(Rt.MIDDLE_PATTERN.length).fill(0))[1];for(let De=0;De<6&&J<W;De++){let ot=Rt.decodeDigit(w,z,J,Rt.L_PATTERNS);M+=String.fromCharCode(48+ot);for(let _t of z)J+=_t}return{rowOffset:J,resultString:M}}getBarcodeFormat(){return be.EAN_13}static determineFirstDigit(w,E){for(let M=0;M<10;M++)if(E===this.FIRST_DIGIT_ENCODINGS[M])return w=String.fromCharCode(48+M)+w,w;throw new G}}hn.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class yn extends Rt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(w,E,M){const z=this.decodeMiddleCounters;z[0]=0,z[1]=0,z[2]=0,z[3]=0;let W=w.getSize(),J=E[1];for(let Ee=0;Ee<4&&J<W;Ee++){let De=Rt.decodeDigit(w,z,J,Rt.L_PATTERNS);M+=String.fromCharCode(48+De);for(let ot of z)J+=ot}J=Rt.findGuardPattern(w,J,!0,Rt.MIDDLE_PATTERN,new Int32Array(Rt.MIDDLE_PATTERN.length).fill(0))[1];for(let Ee=0;Ee<4&&J<W;Ee++){let De=Rt.decodeDigit(w,z,J,Rt.L_PATTERNS);M+=String.fromCharCode(48+De);for(let ot of z)J+=ot}return{rowOffset:J,resultString:M}}getBarcodeFormat(){return be.EAN_8}}class Cn extends Rt{constructor(){super(...arguments),this.ean13Reader=new hn}getBarcodeFormat(){return be.UPC_A}decode(w,E){return this.maybeReturnResult(this.ean13Reader.decode(w))}decodeRow(w,E,M){return this.maybeReturnResult(this.ean13Reader.decodeRow(w,E,M))}decodeMiddle(w,E,M){return this.ean13Reader.decodeMiddle(w,E,M)}maybeReturnResult(w){let E=w.getText();if(E.charAt(0)==="0"){let M=new ge(E.substring(1),null,null,w.getResultPoints(),be.UPC_A);return w.getResultMetadata()!=null&&M.putAllMetadata(w.getResultMetadata()),M}else throw new G}reset(){this.ean13Reader.reset()}}class En extends Rt{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(w,E,M){const z=this.decodeMiddleCounters.map(De=>De);z[0]=0,z[1]=0,z[2]=0,z[3]=0;const W=w.getSize();let J=E[1],de=0;for(let De=0;De<6&&J<W;De++){const ot=En.decodeDigit(w,z,J,En.L_AND_G_PATTERNS);M+=String.fromCharCode(48+ot%10);for(let _t of z)J+=_t;ot>=10&&(de|=1<<5-De)}let Ee=En.determineNumSysAndCheckDigit(M,de);return{rowOffset:J,resultString:Ee}}decodeEnd(w,E){return En.findGuardPatternWithoutCounters(w,E,!0,En.MIDDLE_END_PATTERN)}checkChecksum(w){return Rt.checkChecksum(En.convertUPCEtoUPCA(w))}static determineNumSysAndCheckDigit(w,E){for(let M=0;M<=1;M++)for(let z=0;z<10;z++)if(E===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[M][z]){let W=String.fromCharCode(48+M),J=String.fromCharCode(48+z);return W+w+J}throw G.getNotFoundInstance()}getBarcodeFormat(){return be.UPC_E}static convertUPCEtoUPCA(w){const E=w.slice(1,7).split("").map(W=>W.charCodeAt(0)),M=new te;M.append(w.charAt(0));let z=E[5];switch(z){case 0:case 1:case 2:M.appendChars(E,0,2),M.append(z),M.append("0000"),M.appendChars(E,2,3);break;case 3:M.appendChars(E,0,3),M.append("00000"),M.appendChars(E,3,2);break;case 4:M.appendChars(E,0,4),M.append("00000"),M.append(E[4]);break;default:M.appendChars(E,0,5),M.append("0000"),M.append(z);break}return w.length>=8&&M.append(w.charAt(7)),M.toString()}}En.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),En.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 Rn extends Vt{constructor(w){super();let E=w==null?null:w.get($.POSSIBLE_FORMATS),M=[];r(E)?(M.push(new hn),M.push(new Cn),M.push(new yn),M.push(new En)):(E.indexOf(be.EAN_13)>-1&&M.push(new hn),E.indexOf(be.UPC_A)>-1&&M.push(new Cn),E.indexOf(be.EAN_8)>-1&&M.push(new yn),E.indexOf(be.UPC_E)>-1&&M.push(new En)),this.readers=M}decodeRow(w,E,M){for(let z of this.readers)try{const W=z.decodeRow(w,E,M),J=W.getBarcodeFormat()===be.EAN_13&&W.getText().charAt(0)==="0",de=M==null?null:M.get($.POSSIBLE_FORMATS),Ee=de==null||de.includes(be.UPC_A);if(J&&Ee){const De=W.getRawBytes(),ot=new ge(W.getText().substring(1),De,De?De.length:null,W.getResultPoints(),be.UPC_A);return ot.putAllMetadata(W.getResultMetadata()),ot}return W}catch{}throw new G}reset(){for(let w of this.readers)w.reset()}}class Mn extends Vt{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 M=0;M<E.length;M++)if(Vt.patternMatchVariance(w,E[M],Mn.MAX_INDIVIDUAL_VARIANCE)<Mn.MAX_AVG_VARIANCE)return M;throw new G}static count(w){return yt.sum(new Int32Array(w))}static increment(w,E){let M=0,z=E[0];for(let W=1;W<w.length;W++)E[W]>z&&(z=E[W],M=W);w[M]++}static decrement(w,E){let M=0,z=E[0];for(let W=1;W<w.length;W++)E[W]<z&&(z=E[W],M=W);w[M]--}static isFinderPattern(w){let E=w[0]+w[1],M=E+w[2]+w[3],z=E/M;if(z>=Mn.MIN_FINDER_PATTERN_RATIO&&z<=Mn.MAX_FINDER_PATTERN_RATIO){let W=Number.MAX_SAFE_INTEGER,J=Number.MIN_SAFE_INTEGER;for(let de of w)de>J&&(J=de),de<W&&(W=de);return J<10*W}return!1}}Mn.MAX_AVG_VARIANCE=.2,Mn.MAX_INDIVIDUAL_VARIANCE=.45,Mn.MIN_FINDER_PATTERN_RATIO=9.5/12,Mn.MAX_FINDER_PATTERN_RATIO=12.5/14;class Yn{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 Yn))return!1;const E=w;return this.value===E.value&&this.checksumPortion===E.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Zn{constructor(w,E,M,z,W){this.value=w,this.startEnd=E,this.value=w,this.startEnd=E,this.resultPoints=new Array,this.resultPoints.push(new jt(M,W)),this.resultPoints.push(new jt(z,W))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(w){if(!(w instanceof Zn))return!1;const E=w;return this.value===E.value}hashCode(){return this.value}}class Vn{constructor(){}static getRSSvalue(w,E,M){let z=0;for(let Ee of w)z+=Ee;let W=0,J=0,de=w.length;for(let Ee=0;Ee<de-1;Ee++){let De;for(De=1,J|=1<<Ee;De<w[Ee];De++,J&=~(1<<Ee)){let ot=Vn.combins(z-De-1,de-Ee-2);if(M&&J===0&&z-De-(de-Ee-1)>=de-Ee-1&&(ot-=Vn.combins(z-De-(de-Ee),de-Ee-2)),de-Ee-1>1){let _t=0;for(let zt=z-De-(de-Ee-2);zt>E;zt--)_t+=Vn.combins(z-De-zt-1,de-Ee-3);ot-=_t*(de-1-Ee)}else z-De>E&&ot--;W+=ot}z-=De}return W}static combins(w,E){let M,z;w-E>E?(z=E,M=w-E):(z=w-E,M=E);let W=1,J=1;for(let de=w;de>M;de--)W*=de,J<=z&&(W/=J,J++);for(;J<=z;)W/=J,J++;return W}}class tr{static buildBitArray(w){let E=w.length*2-1;w[w.length-1].getRightChar()==null&&(E-=1);let M=12*E,z=new L(M),W=0,de=w[0].getRightChar().getValue();for(let Ee=11;Ee>=0;--Ee)de&1<<Ee&&z.set(W),W++;for(let Ee=1;Ee<w.length;++Ee){let De=w[Ee],ot=De.getLeftChar().getValue();for(let _t=11;_t>=0;--_t)ot&1<<_t&&z.set(W),W++;if(De.getRightChar()!=null){let _t=De.getRightChar().getValue();for(let zt=11;zt>=0;--zt)_t&1<<zt&&z.set(W),W++}}return z}}class Sn{constructor(w,E){E?this.decodedInformation=null:(this.finished=w,this.decodedInformation=E)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class ze{constructor(w){this.newPosition=w}getNewPosition(){return this.newPosition}}class xe extends ze{constructor(w,E){super(w),this.value=E}getValue(){return this.value}isFNC1(){return this.value===xe.FNC1}}xe.FNC1="$";class Ge extends ze{constructor(w,E,M){super(w),M?(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 _e extends ze{constructor(w,E,M){if(super(w),E<0||E>10||M<0||M>10)throw new O;this.firstDigit=E,this.secondDigit=M}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===_e.FNC1}isSecondDigitFNC1(){return this.secondDigit===_e.FNC1}isAnyFNC1(){return this.firstDigit===_e.FNC1||this.secondDigit===_e.FNC1}}_e.FNC1=10;class Be{constructor(){}static parseFieldsInGeneralPurpose(w){if(!w)return null;if(w.length<2)throw new G;let E=w.substring(0,2);for(let W of Be.TWO_DIGIT_DATA_LENGTH)if(W[0]===E)return W[1]===Be.VARIABLE_LENGTH?Be.processVariableAI(2,W[2],w):Be.processFixedAI(2,W[1],w);if(w.length<3)throw new G;let M=w.substring(0,3);for(let W of Be.THREE_DIGIT_DATA_LENGTH)if(W[0]===M)return W[1]===Be.VARIABLE_LENGTH?Be.processVariableAI(3,W[2],w):Be.processFixedAI(3,W[1],w);for(let W of Be.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(W[0]===M)return W[1]===Be.VARIABLE_LENGTH?Be.processVariableAI(4,W[2],w):Be.processFixedAI(4,W[1],w);if(w.length<4)throw new G;let z=w.substring(0,4);for(let W of Be.FOUR_DIGIT_DATA_LENGTH)if(W[0]===z)return W[1]===Be.VARIABLE_LENGTH?Be.processVariableAI(4,W[2],w):Be.processFixedAI(4,W[1],w);throw new G}static processFixedAI(w,E,M){if(M.length<w)throw new G;let z=M.substring(0,w);if(M.length<w+E)throw new G;let W=M.substring(w,w+E),J=M.substring(w+E),de="("+z+")"+W,Ee=Be.parseFieldsInGeneralPurpose(J);return Ee==null?de:de+Ee}static processVariableAI(w,E,M){let z=M.substring(0,w),W;M.length<w+E?W=M.length:W=w+E;let J=M.substring(w,W),de=M.substring(W),Ee="("+z+")"+J,De=Be.parseFieldsInGeneralPurpose(de);return De==null?Ee:Ee+De}}Be.VARIABLE_LENGTH=[],Be.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Be.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Be.VARIABLE_LENGTH,20],["22",Be.VARIABLE_LENGTH,29],["30",Be.VARIABLE_LENGTH,8],["37",Be.VARIABLE_LENGTH,8],["90",Be.VARIABLE_LENGTH,30],["91",Be.VARIABLE_LENGTH,30],["92",Be.VARIABLE_LENGTH,30],["93",Be.VARIABLE_LENGTH,30],["94",Be.VARIABLE_LENGTH,30],["95",Be.VARIABLE_LENGTH,30],["96",Be.VARIABLE_LENGTH,30],["97",Be.VARIABLE_LENGTH,3],["98",Be.VARIABLE_LENGTH,30],["99",Be.VARIABLE_LENGTH,30]],Be.THREE_DIGIT_DATA_LENGTH=[["240",Be.VARIABLE_LENGTH,30],["241",Be.VARIABLE_LENGTH,30],["242",Be.VARIABLE_LENGTH,6],["250",Be.VARIABLE_LENGTH,30],["251",Be.VARIABLE_LENGTH,30],["253",Be.VARIABLE_LENGTH,17],["254",Be.VARIABLE_LENGTH,20],["400",Be.VARIABLE_LENGTH,30],["401",Be.VARIABLE_LENGTH,30],["402",17],["403",Be.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Be.VARIABLE_LENGTH,20],["421",Be.VARIABLE_LENGTH,15],["422",3],["423",Be.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Be.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",Be.VARIABLE_LENGTH,15],["391",Be.VARIABLE_LENGTH,18],["392",Be.VARIABLE_LENGTH,15],["393",Be.VARIABLE_LENGTH,18],["703",Be.VARIABLE_LENGTH,30]],Be.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Be.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Be.VARIABLE_LENGTH,20],["8003",Be.VARIABLE_LENGTH,30],["8004",Be.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Be.VARIABLE_LENGTH,30],["8008",Be.VARIABLE_LENGTH,12],["8018",18],["8020",Be.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Be.VARIABLE_LENGTH,70],["8200",Be.VARIABLE_LENGTH,70]];class qt{constructor(w){this.buffer=new te,this.information=w}decodeAllCodes(w,E){let M=E,z=null;do{let W=this.decodeGeneralPurposeField(M,z),J=Be.parseFieldsInGeneralPurpose(W.getNewString());if(J!=null&&w.append(J),W.isRemaining()?z=""+W.getRemainingValue():z=null,M===W.getNewPosition())break;M=W.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 W=this.extractNumericValueFromBitArray(w,4);return W===0?new _e(this.information.getSize(),_e.FNC1,_e.FNC1):new _e(this.information.getSize(),W-1,_e.FNC1)}let E=this.extractNumericValueFromBitArray(w,7),M=(E-8)/11,z=(E-8)%11;return new _e(w+7,M,z)}extractNumericValueFromBitArray(w,E){return qt.extractNumericValueFromBitArray(this.information,w,E)}static extractNumericValueFromBitArray(w,E,M){let z=0;for(let W=0;W<M;++W)w.get(E+W)&&(z|=1<<M-W-1);return z}decodeGeneralPurposeField(w,E){this.buffer.setLengthToZero(),E!=null&&this.buffer.append(E),this.current.setPosition(w);let M=this.parseBlocks();return M!=null&&M.isRemaining()?new Ge(this.current.getPosition(),this.buffer.toString(),M.getRemainingValue()):new Ge(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let w,E;do{let M=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()),!(M!==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 Ge(this.current.getPosition(),this.buffer.toString()):E=new Ge(this.current.getPosition(),this.buffer.toString(),w.getSecondDigit()),new Sn(!0,E)}if(this.buffer.append(w.getFirstDigit()),w.isSecondDigitFNC1()){let E=new Ge(this.current.getPosition(),this.buffer.toString());return new Sn(!0,E)}this.buffer.append(w.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Sn(!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 Ge(this.current.getPosition(),this.buffer.toString());return new Sn(!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 Sn(!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 Ge(this.current.getPosition(),this.buffer.toString());return new Sn(!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 Sn(!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 M=this.extractNumericValueFromBitArray(w,7);if(M>=64&&M<116)return!0;if(w+8>this.information.getSize())return!1;let z=this.extractNumericValueFromBitArray(w,8);return z>=232&&z<253}decodeIsoIec646(w){let E=this.extractNumericValueFromBitArray(w,5);if(E===15)return new xe(w+5,xe.FNC1);if(E>=5&&E<15)return new xe(w+5,"0"+(E-5));let M=this.extractNumericValueFromBitArray(w,7);if(M>=64&&M<90)return new xe(w+7,""+(M+1));if(M>=90&&M<116)return new xe(w+7,""+(M+7));let z=this.extractNumericValueFromBitArray(w,8),W;switch(z){case 232:W="!";break;case 233:W='"';break;case 234:W="%";break;case 235:W="&";break;case 236:W="'";break;case 237:W="(";break;case 238:W=")";break;case 239:W="*";break;case 240:W="+";break;case 241:W=",";break;case 242:W="-";break;case 243:W=".";break;case 244:W="/";break;case 245:W=":";break;case 246:W=";";break;case 247:W="<";break;case 248:W="=";break;case 249:W=">";break;case 250:W="?";break;case 251:W="_";break;case 252:W=" ";break;default:throw new O}return new xe(w+8,W)}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 M=this.extractNumericValueFromBitArray(w,6);return M>=16&&M<63}decodeAlphanumeric(w){let E=this.extractNumericValueFromBitArray(w,5);if(E===15)return new xe(w+5,xe.FNC1);if(E>=5&&E<15)return new xe(w+5,"0"+(E-5));let M=this.extractNumericValueFromBitArray(w,6);if(M>=32&&M<58)return new xe(w+6,""+(M+33));let z;switch(M){case 58:z="*";break;case 59:z=",";break;case 60:z="-";break;case 61:z=".";break;case 62:z="/";break;default:throw new at("Decoding invalid alphanumeric value: "+M)}return new xe(w+6,z)}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 It{constructor(w){this.information=w,this.generalDecoder=new qt(w)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class mt extends It{constructor(w){super(w)}encodeCompressedGtin(w,E){w.append("(01)");let M=w.length();w.append("9"),this.encodeCompressedGtinWithoutAI(w,E,M)}encodeCompressedGtinWithoutAI(w,E,M){for(let z=0;z<4;++z){let W=this.getGeneralDecoder().extractNumericValueFromBitArray(E+10*z,10);W/100===0&&w.append("0"),W/10===0&&w.append("0"),w.append(W)}mt.appendCheckDigit(w,M)}static appendCheckDigit(w,E){let M=0;for(let z=0;z<13;z++){let W=w.charAt(z+E).charCodeAt(0)-48;M+=z&1?W:3*W}M=10-M%10,M===10&&(M=0),w.append(M)}}mt.GTIN_SIZE=40;class Ft extends mt{constructor(w){super(w)}parseInformation(){let w=new te;w.append("(01)");let E=w.length(),M=this.getGeneralDecoder().extractNumericValueFromBitArray(Ft.HEADER_SIZE,4);return w.append(M),this.encodeCompressedGtinWithoutAI(w,Ft.HEADER_SIZE+4,E),this.getGeneralDecoder().decodeAllCodes(w,Ft.HEADER_SIZE+44)}}Ft.HEADER_SIZE=4;class Tn extends It{constructor(w){super(w)}parseInformation(){let w=new te;return this.getGeneralDecoder().decodeAllCodes(w,Tn.HEADER_SIZE)}}Tn.HEADER_SIZE=5;class kn extends mt{constructor(w){super(w)}encodeCompressedWeight(w,E,M){let z=this.getGeneralDecoder().extractNumericValueFromBitArray(E,M);this.addWeightCode(w,z);let W=this.checkWeight(z),J=1e5;for(let de=0;de<5;++de)W/J===0&&w.append("0"),J/=10;w.append(W)}}class Gt extends kn{constructor(w){super(w)}parseInformation(){if(this.getInformation().getSize()!=Gt.HEADER_SIZE+kn.GTIN_SIZE+Gt.WEIGHT_SIZE)throw new G;let w=new te;return this.encodeCompressedGtin(w,Gt.HEADER_SIZE),this.encodeCompressedWeight(w,Gt.HEADER_SIZE+kn.GTIN_SIZE,Gt.WEIGHT_SIZE),w.toString()}}Gt.HEADER_SIZE=5,Gt.WEIGHT_SIZE=15;class mn extends Gt{constructor(w){super(w)}addWeightCode(w,E){w.append("(3103)")}checkWeight(w){return w}}class gt extends Gt{constructor(w){super(w)}addWeightCode(w,E){E<1e4?w.append("(3202)"):w.append("(3203)")}checkWeight(w){return w<1e4?w:w-1e4}}class Wt extends mt{constructor(w){super(w)}parseInformation(){if(this.getInformation().getSize()<Wt.HEADER_SIZE+mt.GTIN_SIZE)throw new G;let w=new te;this.encodeCompressedGtin(w,Wt.HEADER_SIZE);let E=this.getGeneralDecoder().extractNumericValueFromBitArray(Wt.HEADER_SIZE+mt.GTIN_SIZE,Wt.LAST_DIGIT_SIZE);w.append("(392"),w.append(E),w.append(")");let M=this.getGeneralDecoder().decodeGeneralPurposeField(Wt.HEADER_SIZE+mt.GTIN_SIZE+Wt.LAST_DIGIT_SIZE,null);return w.append(M.getNewString()),w.toString()}}Wt.HEADER_SIZE=8,Wt.LAST_DIGIT_SIZE=2;class jn extends mt{constructor(w){super(w)}parseInformation(){if(this.getInformation().getSize()<jn.HEADER_SIZE+mt.GTIN_SIZE)throw new G;let w=new te;this.encodeCompressedGtin(w,jn.HEADER_SIZE);let E=this.getGeneralDecoder().extractNumericValueFromBitArray(jn.HEADER_SIZE+mt.GTIN_SIZE,jn.LAST_DIGIT_SIZE);w.append("(393"),w.append(E),w.append(")");let M=this.getGeneralDecoder().extractNumericValueFromBitArray(jn.HEADER_SIZE+mt.GTIN_SIZE+jn.LAST_DIGIT_SIZE,jn.FIRST_THREE_DIGITS_SIZE);M/100==0&&w.append("0"),M/10==0&&w.append("0"),w.append(M);let z=this.getGeneralDecoder().decodeGeneralPurposeField(jn.HEADER_SIZE+mt.GTIN_SIZE+jn.LAST_DIGIT_SIZE+jn.FIRST_THREE_DIGITS_SIZE,null);return w.append(z.getNewString()),w.toString()}}jn.HEADER_SIZE=8,jn.LAST_DIGIT_SIZE=2,jn.FIRST_THREE_DIGITS_SIZE=10;class kt extends kn{constructor(w,E,M){super(w),this.dateCode=M,this.firstAIdigits=E}parseInformation(){if(this.getInformation().getSize()!=kt.HEADER_SIZE+kt.GTIN_SIZE+kt.WEIGHT_SIZE+kt.DATE_SIZE)throw new G;let w=new te;return this.encodeCompressedGtin(w,kt.HEADER_SIZE),this.encodeCompressedWeight(w,kt.HEADER_SIZE+kt.GTIN_SIZE,kt.WEIGHT_SIZE),this.encodeCompressedDate(w,kt.HEADER_SIZE+kt.GTIN_SIZE+kt.WEIGHT_SIZE),w.toString()}encodeCompressedDate(w,E){let M=this.getGeneralDecoder().extractNumericValueFromBitArray(E,kt.DATE_SIZE);if(M==38400)return;w.append("("),w.append(this.dateCode),w.append(")");let z=M%32;M/=32;let W=M%12+1;M/=12;let J=M;J/10==0&&w.append("0"),w.append(J),W/10==0&&w.append("0"),w.append(W),z/10==0&&w.append("0"),w.append(z)}addWeightCode(w,E){w.append("("),w.append(this.firstAIdigits),w.append(E/1e5),w.append(")")}checkWeight(w){return w%1e5}}kt.HEADER_SIZE=8,kt.WEIGHT_SIZE=20,kt.DATE_SIZE=16;function cn(St){try{if(St.get(1))return new Ft(St);if(!St.get(2))return new Tn(St);switch(qt.extractNumericValueFromBitArray(St,1,4)){case 4:return new mn(St);case 5:return new gt(St)}switch(qt.extractNumericValueFromBitArray(St,1,5)){case 12:return new Wt(St);case 13:return new jn(St)}switch(qt.extractNumericValueFromBitArray(St,1,7)){case 56:return new kt(St,"310","11");case 57:return new kt(St,"320","11");case 58:return new kt(St,"310","13");case 59:return new kt(St,"320","13");case 60:return new kt(St,"310","15");case 61:return new kt(St,"320","15");case 62:return new kt(St,"310","17");case 63:return new kt(St,"320","17")}}catch(w){throw console.log(w),new at("unknown decoder: "+St)}}class Ce{constructor(w,E,M,z){this.leftchar=w,this.rightchar=E,this.finderpattern=M,this.maybeLast=z}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 Ce?Ce.equalsOrNull(w.leftchar,E.leftchar)&&Ce.equalsOrNull(w.rightchar,E.rightchar)&&Ce.equalsOrNull(w.finderpattern,E.finderpattern):!1}static equalsOrNull(w,E){return w===null?E===null:Ce.equals(w,E)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class m{constructor(w,E,M){this.pairs=w,this.rowNumber=E,this.wasReversed=M}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 m?this.checkEqualitity(w,E)&&w.wasReversed===E.wasReversed:!1}checkEqualitity(w,E){if(!w||!E)return;let M;return w.forEach((z,W)=>{E.forEach(J=>{z.getLeftChar().getValue()===J.getLeftChar().getValue()&&z.getRightChar().getValue()===J.getRightChar().getValue()&&z.getFinderPatter().getValue()===J.getFinderPatter().getValue()&&(M=!0)})}),M}}class p extends Mn{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,M){this.pairs.length=0,this.startFromEven=!1;try{return p.constructResult(this.decodeRow2pairs(w,E))}catch(z){this.verbose&&console.log(z)}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 M=!1;for(;!M;)try{this.pairs.push(this.retrieveNextPair(E,this.pairs,w))}catch(W){if(W instanceof G){if(!this.pairs.length)throw new G;M=!0}}if(this.checkChecksum())return this.pairs;let z;if(this.rows.length?z=!0:z=!1,this.storeRow(w,!1),z){let W=this.checkRowsBoolean(!1);if(W!=null||(W=this.checkRowsBoolean(!0),W!=null))return W}throw new G}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(M){this.verbose&&console.log(M)}return w&&(this.rows=this.rows.reverse()),E}checkRows(w,E){for(let M=E;M<this.rows.length;M++){let z=this.rows[M];this.pairs.length=0;for(let J of w)this.pairs.push(J.getPairs());if(this.pairs.push(z.getPairs()),!p.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let W=new Array(w);W.push(z);try{return this.checkRows(W,M+1)}catch(J){this.verbose&&console.log(J)}}throw new G}static isValidSequence(w){for(let E of p.FINDER_PATTERN_SEQUENCES){if(w.length>E.length)continue;let M=!0;for(let z=0;z<w.length;z++)if(w[z].getFinderPattern().getValue()!=E[z]){M=!1;break}if(M)return!0}return!1}storeRow(w,E){let M=0,z=!1,W=!1;for(;M<this.rows.length;){let J=this.rows[M];if(J.getRowNumber()>w){W=J.isEquivalent(this.pairs);break}z=J.isEquivalent(this.pairs),M++}W||z||p.isPartialRow(this.pairs,this.rows)||(this.rows.push(M,new m(this.pairs,w,E)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(w,E){for(let M of E)if(M.getPairs().length!==w.length){for(let z of M.getPairs())for(let W of w)if(Ce.equals(z,W))break}}static isPartialRow(w,E){for(let M of E){let z=!0;for(let W of w){let J=!1;for(let de of M.getPairs())if(W.equals(de)){J=!0;break}if(!J){z=!1;break}}if(z)return!0}return!1}getRows(){return this.rows}static constructResult(w){let E=tr.buildBitArray(w),z=cn(E).parseInformation(),W=w[0].getFinderPattern().getResultPoints(),J=w[w.length-1].getFinderPattern().getResultPoints(),de=[W[0],W[1],J[0],J[1]];return new ge(z,null,null,de,be.RSS_EXPANDED,null)}checkChecksum(){let w=this.pairs.get(0),E=w.getLeftChar(),M=w.getRightChar();if(M==null)return!1;let z=M.getChecksumPortion(),W=2;for(let de=1;de<this.pairs.size();++de){let Ee=this.pairs.get(de);z+=Ee.getLeftChar().getChecksumPortion(),W++;let De=Ee.getRightChar();De!=null&&(z+=De.getChecksumPortion(),W++)}return z%=211,211*(W-4)+z==E.getValue()}static getNextSecondBar(w,E){let M;return w.get(E)?(M=w.getNextUnset(E),M=w.getNextSet(M)):(M=w.getNextSet(E),M=w.getNextUnset(M)),M}retrieveNextPair(w,E,M){let z=E.length%2==0;this.startFromEven&&(z=!z);let W,J=!0,de=-1;do this.findNextPair(w,E,de),W=this.parseFoundFinderPattern(w,M,z),W==null?de=p.getNextSecondBar(w,this.startEnd[0]):J=!1;while(J);let Ee=this.decodeDataCharacter(w,W,z,!0);if(!this.isEmptyPair(E)&&E[E.length-1].mustBeLast())throw new G;let De;try{De=this.decodeDataCharacter(w,W,z,!1)}catch(ot){De=null,this.verbose&&console.log(ot)}return new Ce(Ee,De,W,!0)}isEmptyPair(w){return w.length===0}findNextPair(w,E,M){let z=this.getDecodeFinderCounters();z[0]=0,z[1]=0,z[2]=0,z[3]=0;let W=w.getSize(),J;M>=0?J=M:this.isEmptyPair(E)?J=0:J=E[E.length-1].getFinderPattern().getStartEnd()[1];let de=E.length%2!=0;this.startFromEven&&(de=!de);let Ee=!1;for(;J<W&&(Ee=!w.get(J),!!Ee);)J++;let De=0,ot=J;for(let _t=J;_t<W;_t++)if(w.get(_t)!=Ee)z[De]++;else{if(De==3){if(de&&p.reverseCounters(z),p.isFinderPattern(z)){this.startEnd[0]=ot,this.startEnd[1]=_t;return}de&&p.reverseCounters(z),ot+=z[0]+z[1],z[0]=z[2],z[1]=z[3],z[2]=0,z[3]=0,De--}else De++;z[De]=1,Ee=!Ee}throw new G}static reverseCounters(w){let E=w.length;for(let M=0;M<E/2;++M){let z=w[M];w[M]=w[E-M-1],w[E-M-1]=z}}parseFoundFinderPattern(w,E,M){let z,W,J;if(M){let De=this.startEnd[0]-1;for(;De>=0&&!w.get(De);)De--;De++,z=this.startEnd[0]-De,W=De,J=this.startEnd[1]}else W=this.startEnd[0],J=w.getNextUnset(this.startEnd[1]+1),z=J-this.startEnd[1];let de=this.getDecodeFinderCounters();v.arraycopy(de,0,de,1,de.length-1),de[0]=z;let Ee;try{Ee=this.parseFinderValue(de,p.FINDER_PATTERNS)}catch{return null}return new Zn(Ee,[W,J],W,J,E)}decodeDataCharacter(w,E,M,z){let W=this.getDataCharacterCounters();for(let ga=0;ga<W.length;ga++)W[ga]=0;if(z)p.recordPatternInReverse(w,E.getStartEnd()[0],W);else{p.recordPattern(w,E.getStartEnd()[1],W);for(let ga=0,Ia=W.length-1;ga<Ia;ga++,Ia--){let Qo=W[ga];W[ga]=W[Ia],W[Ia]=Qo}}let J=17,de=yt.sum(new Int32Array(W))/J,Ee=(E.getStartEnd()[1]-E.getStartEnd()[0])/15;if(Math.abs(de-Ee)/Ee>.3)throw new G;let De=this.getOddCounts(),ot=this.getEvenCounts(),_t=this.getOddRoundingErrors(),zt=this.getEvenRoundingErrors();for(let ga=0;ga<W.length;ga++){let Ia=1*W[ga]/de,Qo=Ia+.5;if(Qo<1){if(Ia<.3)throw new G;Qo=1}else if(Qo>8){if(Ia>8.7)throw new G;Qo=8}let kd=ga/2;ga&1?(ot[kd]=Qo,zt[kd]=Ia-Qo):(De[kd]=Qo,_t[kd]=Ia-Qo)}this.adjustOddEvenCounts(J);let gn=4*E.getValue()+(M?0:2)+(z?0:1)-1,Tt=0,Zt=0;for(let ga=De.length-1;ga>=0;ga--){if(p.isNotA1left(E,M,z)){let Ia=p.WEIGHTS[gn][2*ga];Zt+=De[ga]*Ia}Tt+=De[ga]}let sn=0;for(let ga=ot.length-1;ga>=0;ga--)if(p.isNotA1left(E,M,z)){let Ia=p.WEIGHTS[gn][2*ga+1];sn+=ot[ga]*Ia}let $n=Zt+sn;if(Tt&1||Tt>13||Tt<4)throw new G;let Cr=(13-Tt)/2,kr=p.SYMBOL_WIDEST[Cr],Pr=9-kr,Is=Vn.getRSSvalue(De,kr,!0),ni=Vn.getRSSvalue(ot,Pr,!1),xc=p.EVEN_TOTAL_SUBSET[Cr],ao=p.GSUM[Cr],oo=Is*xc+ni+ao;return new Yn(oo,$n)}static isNotA1left(w,E,M){return!(w.getValue()==0&&E&&M)}adjustOddEvenCounts(w){let E=yt.sum(new Int32Array(this.getOddCounts())),M=yt.sum(new Int32Array(this.getEvenCounts())),z=!1,W=!1;E>13?W=!0:E<4&&(z=!0);let J=!1,de=!1;M>13?de=!0:M<4&&(J=!0);let Ee=E+M-w,De=(E&1)==1,ot=(M&1)==0;if(Ee==1)if(De){if(ot)throw new G;W=!0}else{if(!ot)throw new G;de=!0}else if(Ee==-1)if(De){if(ot)throw new G;z=!0}else{if(!ot)throw new G;J=!0}else if(Ee==0){if(De){if(!ot)throw new G;E<M?(z=!0,de=!0):(W=!0,J=!0)}else if(ot)throw new G}else throw new G;if(z){if(W)throw new G;p.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(W&&p.decrement(this.getOddCounts(),this.getOddRoundingErrors()),J){if(de)throw new G;p.increment(this.getEvenCounts(),this.getOddRoundingErrors())}de&&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 N extends Yn{constructor(w,E,M){super(w,E),this.count=0,this.finderPattern=M}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class A extends Mn{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(w,E,M){const z=this.decodePair(E,!1,w,M);A.addOrTally(this.possibleLeftPairs,z),E.reverse();let W=this.decodePair(E,!0,w,M);A.addOrTally(this.possibleRightPairs,W),E.reverse();for(let J of this.possibleLeftPairs)if(J.getCount()>1){for(let de of this.possibleRightPairs)if(de.getCount()>1&&A.checkChecksum(J,de))return A.constructResult(J,de)}throw new G}static addOrTally(w,E){if(E==null)return;let M=!1;for(let z of w)if(z.getValue()===E.getValue()){z.incrementCount(),M=!0;break}M||w.push(E)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(w,E){let M=4537077*w.getValue()+E.getValue(),z=new String(M).toString(),W=new te;for(let De=13-z.length;De>0;De--)W.append("0");W.append(z);let J=0;for(let De=0;De<13;De++){let ot=W.charAt(De).charCodeAt(0)-48;J+=De&1?ot:3*ot}J=10-J%10,J===10&&(J=0),W.append(J.toString());let de=w.getFinderPattern().getResultPoints(),Ee=E.getFinderPattern().getResultPoints();return new ge(W.toString(),null,0,[de[0],de[1],Ee[0],Ee[1]],be.RSS_14,new Date().getTime())}static checkChecksum(w,E){let M=(w.getChecksumPortion()+16*E.getChecksumPortion())%79,z=9*w.getFinderPattern().getValue()+E.getFinderPattern().getValue();return z>72&&z--,z>8&&z--,M===z}decodePair(w,E,M,z){try{let W=this.findFinderPattern(w,E),J=this.parseFoundFinderPattern(w,M,E,W),de=z==null?null:z.get($.NEED_RESULT_POINT_CALLBACK);if(de!=null){let ot=(W[0]+W[1])/2;E&&(ot=w.getSize()-1-ot),de.foundPossibleResultPoint(new jt(ot,M))}let Ee=this.decodeDataCharacter(w,J,!0),De=this.decodeDataCharacter(w,J,!1);return new N(1597*Ee.getValue()+De.getValue(),Ee.getChecksumPortion()+4*De.getChecksumPortion(),J)}catch{return null}}decodeDataCharacter(w,E,M){let z=this.getDataCharacterCounters();for(let sn=0;sn<z.length;sn++)z[sn]=0;if(M)Vt.recordPatternInReverse(w,E.getStartEnd()[0],z);else{Vt.recordPattern(w,E.getStartEnd()[1]+1,z);for(let sn=0,$n=z.length-1;sn<$n;sn++,$n--){let Cr=z[sn];z[sn]=z[$n],z[$n]=Cr}}let W=M?16:15,J=yt.sum(new Int32Array(z))/W,de=this.getOddCounts(),Ee=this.getEvenCounts(),De=this.getOddRoundingErrors(),ot=this.getEvenRoundingErrors();for(let sn=0;sn<z.length;sn++){let $n=z[sn]/J,Cr=Math.floor($n+.5);Cr<1?Cr=1:Cr>8&&(Cr=8);let kr=Math.floor(sn/2);sn&1?(Ee[kr]=Cr,ot[kr]=$n-Cr):(de[kr]=Cr,De[kr]=$n-Cr)}this.adjustOddEvenCounts(M,W);let _t=0,zt=0;for(let sn=de.length-1;sn>=0;sn--)zt*=9,zt+=de[sn],_t+=de[sn];let gn=0,Tt=0;for(let sn=Ee.length-1;sn>=0;sn--)gn*=9,gn+=Ee[sn],Tt+=Ee[sn];let Zt=zt+3*gn;if(M){if(_t&1||_t>12||_t<4)throw new G;let sn=(12-_t)/2,$n=A.OUTSIDE_ODD_WIDEST[sn],Cr=9-$n,kr=Vn.getRSSvalue(de,$n,!1),Pr=Vn.getRSSvalue(Ee,Cr,!0),Is=A.OUTSIDE_EVEN_TOTAL_SUBSET[sn],ni=A.OUTSIDE_GSUM[sn];return new Yn(kr*Is+Pr+ni,Zt)}else{if(Tt&1||Tt>10||Tt<4)throw new G;let sn=(10-Tt)/2,$n=A.INSIDE_ODD_WIDEST[sn],Cr=9-$n,kr=Vn.getRSSvalue(de,$n,!0),Pr=Vn.getRSSvalue(Ee,Cr,!1),Is=A.INSIDE_ODD_TOTAL_SUBSET[sn],ni=A.INSIDE_GSUM[sn];return new Yn(Pr*Is+kr+ni,Zt)}}findFinderPattern(w,E){let M=this.getDecodeFinderCounters();M[0]=0,M[1]=0,M[2]=0,M[3]=0;let z=w.getSize(),W=!1,J=0;for(;J<z&&(W=!w.get(J),E!==W);)J++;let de=0,Ee=J;for(let De=J;De<z;De++)if(w.get(De)!==W)M[de]++;else{if(de===3){if(Mn.isFinderPattern(M))return[Ee,De];Ee+=M[0]+M[1],M[0]=M[2],M[1]=M[3],M[2]=0,M[3]=0,de--}else de++;M[de]=1,W=!W}throw new G}parseFoundFinderPattern(w,E,M,z){let W=w.get(z[0]),J=z[0]-1;for(;J>=0&&W!==w.get(J);)J--;J++;const de=z[0]-J,Ee=this.getDecodeFinderCounters(),De=new Int32Array(Ee.length);v.arraycopy(Ee,0,De,1,Ee.length-1),De[0]=de;const ot=this.parseFinderValue(De,A.FINDER_PATTERNS);let _t=J,zt=z[1];return M&&(_t=w.getSize()-1-_t,zt=w.getSize()-1-zt),new Zn(ot,[J,z[1]],_t,zt,E)}adjustOddEvenCounts(w,E){let M=yt.sum(new Int32Array(this.getOddCounts())),z=yt.sum(new Int32Array(this.getEvenCounts())),W=!1,J=!1,de=!1,Ee=!1;w?(M>12?J=!0:M<4&&(W=!0),z>12?Ee=!0:z<4&&(de=!0)):(M>11?J=!0:M<5&&(W=!0),z>10?Ee=!0:z<4&&(de=!0));let De=M+z-E,ot=(M&1)===(w?1:0),_t=(z&1)===1;if(De===1)if(ot){if(_t)throw new G;J=!0}else{if(!_t)throw new G;Ee=!0}else if(De===-1)if(ot){if(_t)throw new G;W=!0}else{if(!_t)throw new G;de=!0}else if(De===0){if(ot){if(!_t)throw new G;M<z?(W=!0,Ee=!0):(J=!0,de=!0)}else if(_t)throw new G}else throw new G;if(W){if(J)throw new G;Mn.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(J&&Mn.decrement(this.getOddCounts(),this.getOddRoundingErrors()),de){if(Ee)throw new G;Mn.increment(this.getEvenCounts(),this.getOddRoundingErrors())}Ee&&Mn.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}A.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],A.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],A.OUTSIDE_GSUM=[0,161,961,2015,2715],A.INSIDE_GSUM=[0,336,1036,1516],A.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],A.INSIDE_ODD_WIDEST=[2,4,6,8],A.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 Vt{constructor(w,E){super(),this.readers=[],this.verbose=E===!0;const M=w?w.get($.POSSIBLE_FORMATS):null,z=w&&w.get($.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;M?((M.includes(be.EAN_13)||M.includes(be.UPC_A)||M.includes(be.EAN_8)||M.includes(be.UPC_E))&&this.readers.push(new Rn(w)),M.includes(be.CODE_39)&&this.readers.push(new We(z)),M.includes(be.CODE_128)&&this.readers.push(new xt),M.includes(be.ITF)&&this.readers.push(new Pt),M.includes(be.RSS_14)&&this.readers.push(new A),M.includes(be.RSS_EXPANDED)&&this.readers.push(new p(this.verbose))):(this.readers.push(new Rn(w)),this.readers.push(new We),this.readers.push(new Rn(w)),this.readers.push(new xt),this.readers.push(new Pt),this.readers.push(new A),this.readers.push(new p(this.verbose)))}decodeRow(w,E,M){for(let z=0;z<this.readers.length;z++)try{return this.readers[z].decodeRow(w,E,M)}catch{}throw new G}reset(){this.readers.forEach(w=>w.reset())}}class P extends Se{constructor(w=500,E){super(new k(E),w,E)}}class D{constructor(w,E,M){this.ecCodewords=w,this.ecBlocks=[E],M&&this.ecBlocks.push(M)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class V{constructor(w,E){this.count=w,this.dataCodewords=E}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Z{constructor(w,E,M,z,W,J){this.versionNumber=w,this.symbolSizeRows=E,this.symbolSizeColumns=M,this.dataRegionSizeRows=z,this.dataRegionSizeColumns=W,this.ecBlocks=J;let de=0;const Ee=J.getECCodewords(),De=J.getECBlocks();for(let ot of De)de+=ot.getCount()*(ot.getDataCodewords()+Ee);this.totalCodewords=de}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 O;for(let M of Z.VERSIONS)if(M.symbolSizeRows===w&&M.symbolSizeColumns===E)return M;throw new O}toString(){return""+this.versionNumber}static buildVersions(){return[new Z(1,10,10,8,8,new D(5,new V(1,3))),new Z(2,12,12,10,10,new D(7,new V(1,5))),new Z(3,14,14,12,12,new D(10,new V(1,8))),new Z(4,16,16,14,14,new D(12,new V(1,12))),new Z(5,18,18,16,16,new D(14,new V(1,18))),new Z(6,20,20,18,18,new D(18,new V(1,22))),new Z(7,22,22,20,20,new D(20,new V(1,30))),new Z(8,24,24,22,22,new D(24,new V(1,36))),new Z(9,26,26,24,24,new D(28,new V(1,44))),new Z(10,32,32,14,14,new D(36,new V(1,62))),new Z(11,36,36,16,16,new D(42,new V(1,86))),new Z(12,40,40,18,18,new D(48,new V(1,114))),new Z(13,44,44,20,20,new D(56,new V(1,144))),new Z(14,48,48,22,22,new D(68,new V(1,174))),new Z(15,52,52,24,24,new D(42,new V(2,102))),new Z(16,64,64,14,14,new D(56,new V(2,140))),new Z(17,72,72,16,16,new D(36,new V(4,92))),new Z(18,80,80,18,18,new D(48,new V(4,114))),new Z(19,88,88,20,20,new D(56,new V(4,144))),new Z(20,96,96,22,22,new D(68,new V(4,174))),new Z(21,104,104,24,24,new D(56,new V(6,136))),new Z(22,120,120,18,18,new D(68,new V(6,175))),new Z(23,132,132,20,20,new D(62,new V(8,163))),new Z(24,144,144,22,22,new D(62,new V(8,156),new V(2,155))),new Z(25,8,18,6,16,new D(7,new V(1,5))),new Z(26,8,32,6,14,new D(11,new V(1,10))),new Z(27,12,26,10,24,new D(14,new V(1,16))),new Z(28,12,36,10,16,new D(18,new V(1,22))),new Z(29,16,36,14,16,new D(24,new V(1,32))),new Z(30,16,48,14,22,new D(28,new V(1,49)))]}}Z.VERSIONS=Z.buildVersions();class ce{constructor(w){const E=w.getHeight();if(E<8||E>144||E&1)throw new O;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(),M=w.getWidth();return Z.getVersionForDimensions(E,M)}readCodewords(){const w=new Int8Array(this.version.getTotalCodewords());let E=0,M=4,z=0;const W=this.mappingBitMatrix.getHeight(),J=this.mappingBitMatrix.getWidth();let de=!1,Ee=!1,De=!1,ot=!1;do if(M===W&&z===0&&!de)w[E++]=this.readCorner1(W,J)&255,M-=2,z+=2,de=!0;else if(M===W-2&&z===0&&J&3&&!Ee)w[E++]=this.readCorner2(W,J)&255,M-=2,z+=2,Ee=!0;else if(M===W+4&&z===2&&!(J&7)&&!De)w[E++]=this.readCorner3(W,J)&255,M-=2,z+=2,De=!0;else if(M===W-2&&z===0&&(J&7)===4&&!ot)w[E++]=this.readCorner4(W,J)&255,M-=2,z+=2,ot=!0;else{do M<W&&z>=0&&!this.readMappingMatrix.get(z,M)&&(w[E++]=this.readUtah(M,z,W,J)&255),M-=2,z+=2;while(M>=0&&z<J);M+=1,z+=3;do M>=0&&z<J&&!this.readMappingMatrix.get(z,M)&&(w[E++]=this.readUtah(M,z,W,J)&255),M+=2,z-=2;while(M<W&&z>=0);M+=3,z+=1}while(M<W||z<J);if(E!==this.version.getTotalCodewords())throw new O;return w}readModule(w,E,M,z){return w<0&&(w+=M,E+=4-(M+4&7)),E<0&&(E+=z,w+=4-(z+4&7)),this.readMappingMatrix.set(E,w),this.mappingBitMatrix.get(E,w)}readUtah(w,E,M,z){let W=0;return this.readModule(w-2,E-2,M,z)&&(W|=1),W<<=1,this.readModule(w-2,E-1,M,z)&&(W|=1),W<<=1,this.readModule(w-1,E-2,M,z)&&(W|=1),W<<=1,this.readModule(w-1,E-1,M,z)&&(W|=1),W<<=1,this.readModule(w-1,E,M,z)&&(W|=1),W<<=1,this.readModule(w,E-2,M,z)&&(W|=1),W<<=1,this.readModule(w,E-1,M,z)&&(W|=1),W<<=1,this.readModule(w,E,M,z)&&(W|=1),W}readCorner1(w,E){let M=0;return this.readModule(w-1,0,w,E)&&(M|=1),M<<=1,this.readModule(w-1,1,w,E)&&(M|=1),M<<=1,this.readModule(w-1,2,w,E)&&(M|=1),M<<=1,this.readModule(0,E-2,w,E)&&(M|=1),M<<=1,this.readModule(0,E-1,w,E)&&(M|=1),M<<=1,this.readModule(1,E-1,w,E)&&(M|=1),M<<=1,this.readModule(2,E-1,w,E)&&(M|=1),M<<=1,this.readModule(3,E-1,w,E)&&(M|=1),M}readCorner2(w,E){let M=0;return this.readModule(w-3,0,w,E)&&(M|=1),M<<=1,this.readModule(w-2,0,w,E)&&(M|=1),M<<=1,this.readModule(w-1,0,w,E)&&(M|=1),M<<=1,this.readModule(0,E-4,w,E)&&(M|=1),M<<=1,this.readModule(0,E-3,w,E)&&(M|=1),M<<=1,this.readModule(0,E-2,w,E)&&(M|=1),M<<=1,this.readModule(0,E-1,w,E)&&(M|=1),M<<=1,this.readModule(1,E-1,w,E)&&(M|=1),M}readCorner3(w,E){let M=0;return this.readModule(w-1,0,w,E)&&(M|=1),M<<=1,this.readModule(w-1,E-1,w,E)&&(M|=1),M<<=1,this.readModule(0,E-3,w,E)&&(M|=1),M<<=1,this.readModule(0,E-2,w,E)&&(M|=1),M<<=1,this.readModule(0,E-1,w,E)&&(M|=1),M<<=1,this.readModule(1,E-3,w,E)&&(M|=1),M<<=1,this.readModule(1,E-2,w,E)&&(M|=1),M<<=1,this.readModule(1,E-1,w,E)&&(M|=1),M}readCorner4(w,E){let M=0;return this.readModule(w-3,0,w,E)&&(M|=1),M<<=1,this.readModule(w-2,0,w,E)&&(M|=1),M<<=1,this.readModule(w-1,0,w,E)&&(M|=1),M<<=1,this.readModule(0,E-2,w,E)&&(M|=1),M<<=1,this.readModule(0,E-1,w,E)&&(M|=1),M<<=1,this.readModule(1,E-1,w,E)&&(M|=1),M<<=1,this.readModule(2,E-1,w,E)&&(M|=1),M<<=1,this.readModule(3,E-1,w,E)&&(M|=1),M}extractDataRegion(w){const E=this.version.getSymbolSizeRows(),M=this.version.getSymbolSizeColumns();if(w.getHeight()!==E)throw new f("Dimension of bitMatrix must match the version size");const z=this.version.getDataRegionSizeRows(),W=this.version.getDataRegionSizeColumns(),J=E/z|0,de=M/W|0,Ee=J*z,De=de*W,ot=new fe(De,Ee);for(let _t=0;_t<J;++_t){const zt=_t*z;for(let gn=0;gn<de;++gn){const Tt=gn*W;for(let Zt=0;Zt<z;++Zt){const sn=_t*(z+2)+1+Zt,$n=zt+Zt;for(let Cr=0;Cr<W;++Cr){const kr=gn*(W+2)+1+Cr;if(w.get(kr,sn)){const Pr=Tt+Cr;ot.set(Pr,$n)}}}}}return ot}}class ue{constructor(w,E){this.numDataCodewords=w,this.codewords=E}static getDataBlocks(w,E){const M=E.getECBlocks();let z=0;const W=M.getECBlocks();for(let Zt of W)z+=Zt.getCount();const J=new Array(z);let de=0;for(let Zt of W)for(let sn=0;sn<Zt.getCount();sn++){const $n=Zt.getDataCodewords(),Cr=M.getECCodewords()+$n;J[de++]=new ue($n,new Uint8Array(Cr))}const De=J[0].codewords.length-M.getECCodewords(),ot=De-1;let _t=0;for(let Zt=0;Zt<ot;Zt++)for(let sn=0;sn<de;sn++)J[sn].codewords[Zt]=w[_t++];const zt=E.getVersionNumber()===24,gn=zt?8:de;for(let Zt=0;Zt<gn;Zt++)J[Zt].codewords[De-1]=w[_t++];const Tt=J[0].codewords.length;for(let Zt=De;Zt<Tt;Zt++)for(let sn=0;sn<de;sn++){const $n=zt?(sn+8)%de:sn,Cr=zt&&$n>7?Zt-1:Zt;J[$n].codewords[Cr]=w[_t++]}if(_t!==w.length)throw new f;return J}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class me{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,M=this.bitOffset,z=this.byteOffset;const W=this.bytes;if(M>0){const J=8-M,de=w<J?w:J,Ee=J-de,De=255>>8-de<<Ee;E=(W[z]&De)>>Ee,w-=de,M+=de,M===8&&(M=0,z++)}if(w>0){for(;w>=8;)E=E<<8|W[z]&255,z++,w-=8;if(w>0){const J=8-w,de=255>>J<<J;E=E<<w|(W[z]&de)>>J,M+=w}}return this.bitOffset=M,this.byteOffset=z,E}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Ne;(function(St){St[St.PAD_ENCODE=0]="PAD_ENCODE",St[St.ASCII_ENCODE=1]="ASCII_ENCODE",St[St.C40_ENCODE=2]="C40_ENCODE",St[St.TEXT_ENCODE=3]="TEXT_ENCODE",St[St.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",St[St.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",St[St.BASE256_ENCODE=6]="BASE256_ENCODE"})(Ne||(Ne={}));class Ie{static decode(w){const E=new me(w),M=new te,z=new te,W=new Array;let J=Ne.ASCII_ENCODE;do if(J===Ne.ASCII_ENCODE)J=this.decodeAsciiSegment(E,M,z);else{switch(J){case Ne.C40_ENCODE:this.decodeC40Segment(E,M);break;case Ne.TEXT_ENCODE:this.decodeTextSegment(E,M);break;case Ne.ANSIX12_ENCODE:this.decodeAnsiX12Segment(E,M);break;case Ne.EDIFACT_ENCODE:this.decodeEdifactSegment(E,M);break;case Ne.BASE256_ENCODE:this.decodeBase256Segment(E,M,W);break;default:throw new O}J=Ne.ASCII_ENCODE}while(J!==Ne.PAD_ENCODE&&E.available()>0);return z.length()>0&&M.append(z.toString()),new Fe(w,M.toString(),W.length===0?null:W,null)}static decodeAsciiSegment(w,E,M){let z=!1;do{let W=w.readBits(8);if(W===0)throw new O;if(W<=128)return z&&(W+=128),E.append(String.fromCharCode(W-1)),Ne.ASCII_ENCODE;if(W===129)return Ne.PAD_ENCODE;if(W<=229){const J=W-130;J<10&&E.append("0"),E.append(""+J)}else switch(W){case 230:return Ne.C40_ENCODE;case 231:return Ne.BASE256_ENCODE;case 232:E.append("");break;case 233:case 234:break;case 235:z=!0;break;case 236:E.append("[)>05"),M.insert(0,"");break;case 237:E.append("[)>06"),M.insert(0,"");break;case 238:return Ne.ANSIX12_ENCODE;case 239:return Ne.TEXT_ENCODE;case 240:return Ne.EDIFACT_ENCODE;case 241:break;default:if(W!==254||w.available()!==0)throw new O;break}}while(w.available()>0);return Ne.ASCII_ENCODE}static decodeC40Segment(w,E){let M=!1;const z=[];let W=0;do{if(w.available()===8)return;const J=w.readBits(8);if(J===254)return;this.parseTwoBytes(J,w.readBits(8),z);for(let de=0;de<3;de++){const Ee=z[de];switch(W){case 0:if(Ee<3)W=Ee+1;else if(Ee<this.C40_BASIC_SET_CHARS.length){const De=this.C40_BASIC_SET_CHARS[Ee];M?(E.append(String.fromCharCode(De.charCodeAt(0)+128)),M=!1):E.append(De)}else throw new O;break;case 1:M?(E.append(String.fromCharCode(Ee+128)),M=!1):E.append(String.fromCharCode(Ee)),W=0;break;case 2:if(Ee<this.C40_SHIFT2_SET_CHARS.length){const De=this.C40_SHIFT2_SET_CHARS[Ee];M?(E.append(String.fromCharCode(De.charCodeAt(0)+128)),M=!1):E.append(De)}else switch(Ee){case 27:E.append("");break;case 30:M=!0;break;default:throw new O}W=0;break;case 3:M?(E.append(String.fromCharCode(Ee+224)),M=!1):E.append(String.fromCharCode(Ee+96)),W=0;break;default:throw new O}}}while(w.available()>0)}static decodeTextSegment(w,E){let M=!1,z=[],W=0;do{if(w.available()===8)return;const J=w.readBits(8);if(J===254)return;this.parseTwoBytes(J,w.readBits(8),z);for(let de=0;de<3;de++){const Ee=z[de];switch(W){case 0:if(Ee<3)W=Ee+1;else if(Ee<this.TEXT_BASIC_SET_CHARS.length){const De=this.TEXT_BASIC_SET_CHARS[Ee];M?(E.append(String.fromCharCode(De.charCodeAt(0)+128)),M=!1):E.append(De)}else throw new O;break;case 1:M?(E.append(String.fromCharCode(Ee+128)),M=!1):E.append(String.fromCharCode(Ee)),W=0;break;case 2:if(Ee<this.TEXT_SHIFT2_SET_CHARS.length){const De=this.TEXT_SHIFT2_SET_CHARS[Ee];M?(E.append(String.fromCharCode(De.charCodeAt(0)+128)),M=!1):E.append(De)}else switch(Ee){case 27:E.append("");break;case 30:M=!0;break;default:throw new O}W=0;break;case 3:if(Ee<this.TEXT_SHIFT3_SET_CHARS.length){const De=this.TEXT_SHIFT3_SET_CHARS[Ee];M?(E.append(String.fromCharCode(De.charCodeAt(0)+128)),M=!1):E.append(De),W=0}else throw new O;break;default:throw new O}}}while(w.available()>0)}static decodeAnsiX12Segment(w,E){const M=[];do{if(w.available()===8)return;const z=w.readBits(8);if(z===254)return;this.parseTwoBytes(z,w.readBits(8),M);for(let W=0;W<3;W++){const J=M[W];switch(J){case 0:E.append("\r");break;case 1:E.append("*");break;case 2:E.append(">");break;case 3:E.append(" ");break;default:if(J<14)E.append(String.fromCharCode(J+44));else if(J<40)E.append(String.fromCharCode(J+51));else throw new O;break}}}while(w.available()>0)}static parseTwoBytes(w,E,M){let z=(w<<8)+E-1,W=Math.floor(z/1600);M[0]=W,z-=W*1600,W=Math.floor(z/40),M[1]=W,M[2]=z-W*40}static decodeEdifactSegment(w,E){do{if(w.available()<=16)return;for(let M=0;M<4;M++){let z=w.readBits(6);if(z===31){const W=8-w.getBitOffset();W!==8&&w.readBits(W);return}z&32||(z|=64),E.append(String.fromCharCode(z))}}while(w.available()>0)}static decodeBase256Segment(w,E,M){let z=1+w.getByteOffset();const W=this.unrandomize255State(w.readBits(8),z++);let J;if(W===0?J=w.available()/8|0:W<250?J=W:J=250*(W-249)+this.unrandomize255State(w.readBits(8),z++),J<0)throw new O;const de=new Uint8Array(J);for(let Ee=0;Ee<J;Ee++){if(w.available()<8)throw new O;de[Ee]=this.unrandomize255State(w.readBits(8),z++)}M.push(de);try{E.append(Q.decode(de,q.ISO88591))}catch(Ee){throw new at("Platform does not support required encoding: "+Ee.message)}}static unrandomize255State(w,E){const M=149*E%255+1,z=w-M;return z>=0?z:z+256}}Ie.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"],Ie.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Ie.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"],Ie.TEXT_SHIFT2_SET_CHARS=Ie.C40_SHIFT2_SET_CHARS,Ie.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 Le{constructor(){this.rsDecoder=new He(dt.DATA_MATRIX_FIELD_256)}decode(w){const E=new ce(w),M=E.getVersion(),z=E.readCodewords(),W=ue.getDataBlocks(z,M);let J=0;for(let De of W)J+=De.getNumDataCodewords();const de=new Uint8Array(J),Ee=W.length;for(let De=0;De<Ee;De++){const ot=W[De],_t=ot.getCodewords(),zt=ot.getNumDataCodewords();this.correctErrors(_t,zt);for(let gn=0;gn<zt;gn++)de[gn*Ee+De]=_t[gn]}return Ie.decode(de)}correctErrors(w,E){const M=new Int32Array(w);try{this.rsDecoder.decode(M,w.length-E)}catch{throw new g}for(let z=0;z<E;z++)w[z]=M[z]}}class Xe{constructor(w){this.image=w,this.rectangleDetector=new Hn(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 G;E=this.shiftToModuleCenter(E);const M=E[0],z=E[1],W=E[2],J=E[3];let de=this.transitionsBetween(M,J)+1,Ee=this.transitionsBetween(W,J)+1;(de&1)===1&&(de+=1),(Ee&1)===1&&(Ee+=1),4*de<7*Ee&&4*Ee<7*de&&(de=Ee=Math.max(de,Ee));let De=Xe.sampleGrid(this.image,M,z,W,J,de,Ee);return new un(De,[M,z,W,J])}static shiftPoint(w,E,M){let z=(E.getX()-w.getX())/(M+1),W=(E.getY()-w.getY())/(M+1);return new jt(w.getX()+z,w.getY()+W)}static moveAway(w,E,M){let z=w.getX(),W=w.getY();return z<E?z-=1:z+=1,W<M?W-=1:W+=1,new jt(z,W)}detectSolid1(w){let E=w[0],M=w[1],z=w[3],W=w[2],J=this.transitionsBetween(E,M),de=this.transitionsBetween(M,z),Ee=this.transitionsBetween(z,W),De=this.transitionsBetween(W,E),ot=J,_t=[W,E,M,z];return ot>de&&(ot=de,_t[0]=E,_t[1]=M,_t[2]=z,_t[3]=W),ot>Ee&&(ot=Ee,_t[0]=M,_t[1]=z,_t[2]=W,_t[3]=E),ot>De&&(_t[0]=z,_t[1]=W,_t[2]=E,_t[3]=M),_t}detectSolid2(w){let E=w[0],M=w[1],z=w[2],W=w[3],J=this.transitionsBetween(E,W),de=Xe.shiftPoint(M,z,(J+1)*4),Ee=Xe.shiftPoint(z,M,(J+1)*4),De=this.transitionsBetween(de,E),ot=this.transitionsBetween(Ee,W);return De<ot?(w[0]=E,w[1]=M,w[2]=z,w[3]=W):(w[0]=M,w[1]=z,w[2]=W,w[3]=E),w}correctTopRight(w){let E=w[0],M=w[1],z=w[2],W=w[3],J=this.transitionsBetween(E,W),de=this.transitionsBetween(M,W),Ee=Xe.shiftPoint(E,M,(de+1)*4),De=Xe.shiftPoint(z,M,(J+1)*4);J=this.transitionsBetween(Ee,W),de=this.transitionsBetween(De,W);let ot=new jt(W.getX()+(z.getX()-M.getX())/(J+1),W.getY()+(z.getY()-M.getY())/(J+1)),_t=new jt(W.getX()+(E.getX()-M.getX())/(de+1),W.getY()+(E.getY()-M.getY())/(de+1));if(!this.isValid(ot))return this.isValid(_t)?_t:null;if(!this.isValid(_t))return ot;let zt=this.transitionsBetween(Ee,ot)+this.transitionsBetween(De,ot),gn=this.transitionsBetween(Ee,_t)+this.transitionsBetween(De,_t);return zt>gn?ot:_t}shiftToModuleCenter(w){let E=w[0],M=w[1],z=w[2],W=w[3],J=this.transitionsBetween(E,W)+1,de=this.transitionsBetween(z,W)+1,Ee=Xe.shiftPoint(E,M,de*4),De=Xe.shiftPoint(z,M,J*4);J=this.transitionsBetween(Ee,W)+1,de=this.transitionsBetween(De,W)+1,(J&1)===1&&(J+=1),(de&1)===1&&(de+=1);let ot=(E.getX()+M.getX()+z.getX()+W.getX())/4,_t=(E.getY()+M.getY()+z.getY()+W.getY())/4;E=Xe.moveAway(E,ot,_t),M=Xe.moveAway(M,ot,_t),z=Xe.moveAway(z,ot,_t),W=Xe.moveAway(W,ot,_t);let zt,gn;return Ee=Xe.shiftPoint(E,M,de*4),Ee=Xe.shiftPoint(Ee,W,J*4),zt=Xe.shiftPoint(M,E,de*4),zt=Xe.shiftPoint(zt,z,J*4),De=Xe.shiftPoint(z,W,de*4),De=Xe.shiftPoint(De,M,J*4),gn=Xe.shiftPoint(W,z,de*4),gn=Xe.shiftPoint(gn,E,J*4),[Ee,zt,De,gn]}isValid(w){return w.getX()>=0&&w.getX()<this.image.getWidth()&&w.getY()>0&&w.getY()<this.image.getHeight()}static sampleGrid(w,E,M,z,W,J,de){return rt.getInstance().sampleGrid(w,J,de,.5,.5,J-.5,.5,J-.5,de-.5,.5,de-.5,E.getX(),E.getY(),W.getX(),W.getY(),z.getX(),z.getY(),M.getX(),M.getY())}transitionsBetween(w,E){let M=Math.trunc(w.getX()),z=Math.trunc(w.getY()),W=Math.trunc(E.getX()),J=Math.trunc(E.getY()),de=Math.abs(J-z)>Math.abs(W-M);if(de){let Zt=M;M=z,z=Zt,Zt=W,W=J,J=Zt}let Ee=Math.abs(W-M),De=Math.abs(J-z),ot=-Ee/2,_t=z<J?1:-1,zt=M<W?1:-1,gn=0,Tt=this.image.get(de?z:M,de?M:z);for(let Zt=M,sn=z;Zt!==W;Zt+=zt){let $n=this.image.get(de?sn:Zt,de?Zt:sn);if($n!==Tt&&(gn++,Tt=$n),ot+=De,ot>0){if(sn===J)break;sn+=_t,ot-=Ee}}return gn}}class Oe{constructor(){this.decoder=new Le}decode(w,E=null){let M,z;if(E!=null&&E.has($.PURE_BARCODE)){const De=Oe.extractPureBits(w.getBlackMatrix());M=this.decoder.decode(De),z=Oe.NO_POINTS}else{const De=new Xe(w.getBlackMatrix()).detect();M=this.decoder.decode(De.getBits()),z=De.getPoints()}const W=M.getRawBytes(),J=new ge(M.getText(),W,8*W.length,z,be.DATA_MATRIX,v.currentTimeMillis()),de=M.getByteSegments();de!=null&&J.putMetadata(je.BYTE_SEGMENTS,de);const Ee=M.getECLevel();return Ee!=null&&J.putMetadata(je.ERROR_CORRECTION_LEVEL,Ee),J}reset(){}static extractPureBits(w){const E=w.getTopLeftOnBit(),M=w.getBottomRightOnBit();if(E==null||M==null)throw new G;const z=this.moduleSize(E,w);let W=E[1];const J=M[1];let de=E[0];const De=(M[0]-de+1)/z,ot=(J-W+1)/z;if(De<=0||ot<=0)throw new G;const _t=z/2;W+=_t,de+=_t;const zt=new fe(De,ot);for(let gn=0;gn<ot;gn++){const Tt=W+gn*z;for(let Zt=0;Zt<De;Zt++)w.get(de+Zt*z,Tt)&&zt.set(Zt,gn)}return zt}static moduleSize(w,E){const M=E.getWidth();let z=w[0];const W=w[1];for(;z<M&&E.get(z,W);)z++;if(z===M)throw new G;const J=z-w[0];if(J===0)throw new G;return J}}Oe.NO_POINTS=[];class $e extends Se{constructor(w=500){super(new Oe,w)}}var ae;(function(St){St[St.L=0]="L",St[St.M=1]="M",St[St.Q=2]="Q",St[St.H=3]="H"})(ae||(ae={}));class he{constructor(w,E,M){this.value=w,this.stringValue=E,this.bits=M,he.FOR_BITS.set(M,this),he.FOR_VALUE.set(w,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(w){switch(w){case"L":return he.L;case"M":return he.M;case"Q":return he.Q;case"H":return he.H;default:throw new d(w+"not available")}}toString(){return this.stringValue}equals(w){if(!(w instanceof he))return!1;const E=w;return this.value===E.value}static forBits(w){if(w<0||w>=he.FOR_BITS.size)throw new f;return he.FOR_BITS.get(w)}}he.FOR_BITS=new Map,he.FOR_VALUE=new Map,he.L=new he(ae.L,"L",1),he.M=new he(ae.M,"M",0),he.Q=new he(ae.Q,"Q",3),he.H=new he(ae.H,"H",2);class Pe{constructor(w){this.errorCorrectionLevel=he.forBits(w>>3&3),this.dataMask=w&7}static numBitsDiffering(w,E){return I.bitCount(w^E)}static decodeFormatInformation(w,E){const M=Pe.doDecodeFormatInformation(w,E);return M!==null?M:Pe.doDecodeFormatInformation(w^Pe.FORMAT_INFO_MASK_QR,E^Pe.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(w,E){let M=Number.MAX_SAFE_INTEGER,z=0;for(const W of Pe.FORMAT_INFO_DECODE_LOOKUP){const J=W[0];if(J===w||J===E)return new Pe(W[1]);let de=Pe.numBitsDiffering(w,J);de<M&&(z=W[1],M=de),w!==E&&(de=Pe.numBitsDiffering(E,J),de<M&&(z=W[1],M=de))}return M<=3?new Pe(z):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(w){if(!(w instanceof Pe))return!1;const E=w;return this.errorCorrectionLevel===E.errorCorrectionLevel&&this.dataMask===E.dataMask}}Pe.FORMAT_INFO_MASK_QR=21522,Pe.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 Ve{constructor(w,...E){this.ecCodewordsPerBlock=w,this.ecBlocks=E}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let w=0;const E=this.ecBlocks;for(const M of E)w+=M.getCount();return w}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class Te{constructor(w,E){this.count=w,this.dataCodewords=E}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ze{constructor(w,E,...M){this.versionNumber=w,this.alignmentPatternCenters=E,this.ecBlocks=M;let z=0;const W=M[0].getECCodewordsPerBlock(),J=M[0].getECBlocks();for(const de of J)z+=de.getCount()*(de.getDataCodewords()+W);this.totalCodewords=z}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 O;try{return this.getVersionForNumber((w-17)/4)}catch{throw new O}}static getVersionForNumber(w){if(w<1||w>40)throw new f;return Ze.VERSIONS[w-1]}static decodeVersionInformation(w){let E=Number.MAX_SAFE_INTEGER,M=0;for(let z=0;z<Ze.VERSION_DECODE_INFO.length;z++){const W=Ze.VERSION_DECODE_INFO[z];if(W===w)return Ze.getVersionForNumber(z+7);const J=Pe.numBitsDiffering(w,W);J<E&&(M=z+7,E=J)}return E<=3?Ze.getVersionForNumber(M):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 M=this.alignmentPatternCenters.length;for(let z=0;z<M;z++){const W=this.alignmentPatternCenters[z]-2;for(let J=0;J<M;J++)z===0&&(J===0||J===M-1)||z===M-1&&J===0||E.setRegion(this.alignmentPatternCenters[J]-2,W,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}}Ze.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]),Ze.VERSIONS=[new Ze(1,new Int32Array(0),new Ve(7,new Te(1,19)),new Ve(10,new Te(1,16)),new Ve(13,new Te(1,13)),new Ve(17,new Te(1,9))),new Ze(2,Int32Array.from([6,18]),new Ve(10,new Te(1,34)),new Ve(16,new Te(1,28)),new Ve(22,new Te(1,22)),new Ve(28,new Te(1,16))),new Ze(3,Int32Array.from([6,22]),new Ve(15,new Te(1,55)),new Ve(26,new Te(1,44)),new Ve(18,new Te(2,17)),new Ve(22,new Te(2,13))),new Ze(4,Int32Array.from([6,26]),new Ve(20,new Te(1,80)),new Ve(18,new Te(2,32)),new Ve(26,new Te(2,24)),new Ve(16,new Te(4,9))),new Ze(5,Int32Array.from([6,30]),new Ve(26,new Te(1,108)),new Ve(24,new Te(2,43)),new Ve(18,new Te(2,15),new Te(2,16)),new Ve(22,new Te(2,11),new Te(2,12))),new Ze(6,Int32Array.from([6,34]),new Ve(18,new Te(2,68)),new Ve(16,new Te(4,27)),new Ve(24,new Te(4,19)),new Ve(28,new Te(4,15))),new Ze(7,Int32Array.from([6,22,38]),new Ve(20,new Te(2,78)),new Ve(18,new Te(4,31)),new Ve(18,new Te(2,14),new Te(4,15)),new Ve(26,new Te(4,13),new Te(1,14))),new Ze(8,Int32Array.from([6,24,42]),new Ve(24,new Te(2,97)),new Ve(22,new Te(2,38),new Te(2,39)),new Ve(22,new Te(4,18),new Te(2,19)),new Ve(26,new Te(4,14),new Te(2,15))),new Ze(9,Int32Array.from([6,26,46]),new Ve(30,new Te(2,116)),new Ve(22,new Te(3,36),new Te(2,37)),new Ve(20,new Te(4,16),new Te(4,17)),new Ve(24,new Te(4,12),new Te(4,13))),new Ze(10,Int32Array.from([6,28,50]),new Ve(18,new Te(2,68),new Te(2,69)),new Ve(26,new Te(4,43),new Te(1,44)),new Ve(24,new Te(6,19),new Te(2,20)),new Ve(28,new Te(6,15),new Te(2,16))),new Ze(11,Int32Array.from([6,30,54]),new Ve(20,new Te(4,81)),new Ve(30,new Te(1,50),new Te(4,51)),new Ve(28,new Te(4,22),new Te(4,23)),new Ve(24,new Te(3,12),new Te(8,13))),new Ze(12,Int32Array.from([6,32,58]),new Ve(24,new Te(2,92),new Te(2,93)),new Ve(22,new Te(6,36),new Te(2,37)),new Ve(26,new Te(4,20),new Te(6,21)),new Ve(28,new Te(7,14),new Te(4,15))),new Ze(13,Int32Array.from([6,34,62]),new Ve(26,new Te(4,107)),new Ve(22,new Te(8,37),new Te(1,38)),new Ve(24,new Te(8,20),new Te(4,21)),new Ve(22,new Te(12,11),new Te(4,12))),new Ze(14,Int32Array.from([6,26,46,66]),new Ve(30,new Te(3,115),new Te(1,116)),new Ve(24,new Te(4,40),new Te(5,41)),new Ve(20,new Te(11,16),new Te(5,17)),new Ve(24,new Te(11,12),new Te(5,13))),new Ze(15,Int32Array.from([6,26,48,70]),new Ve(22,new Te(5,87),new Te(1,88)),new Ve(24,new Te(5,41),new Te(5,42)),new Ve(30,new Te(5,24),new Te(7,25)),new Ve(24,new Te(11,12),new Te(7,13))),new Ze(16,Int32Array.from([6,26,50,74]),new Ve(24,new Te(5,98),new Te(1,99)),new Ve(28,new Te(7,45),new Te(3,46)),new Ve(24,new Te(15,19),new Te(2,20)),new Ve(30,new Te(3,15),new Te(13,16))),new Ze(17,Int32Array.from([6,30,54,78]),new Ve(28,new Te(1,107),new Te(5,108)),new Ve(28,new Te(10,46),new Te(1,47)),new Ve(28,new Te(1,22),new Te(15,23)),new Ve(28,new Te(2,14),new Te(17,15))),new Ze(18,Int32Array.from([6,30,56,82]),new Ve(30,new Te(5,120),new Te(1,121)),new Ve(26,new Te(9,43),new Te(4,44)),new Ve(28,new Te(17,22),new Te(1,23)),new Ve(28,new Te(2,14),new Te(19,15))),new Ze(19,Int32Array.from([6,30,58,86]),new Ve(28,new Te(3,113),new Te(4,114)),new Ve(26,new Te(3,44),new Te(11,45)),new Ve(26,new Te(17,21),new Te(4,22)),new Ve(26,new Te(9,13),new Te(16,14))),new Ze(20,Int32Array.from([6,34,62,90]),new Ve(28,new Te(3,107),new Te(5,108)),new Ve(26,new Te(3,41),new Te(13,42)),new Ve(30,new Te(15,24),new Te(5,25)),new Ve(28,new Te(15,15),new Te(10,16))),new Ze(21,Int32Array.from([6,28,50,72,94]),new Ve(28,new Te(4,116),new Te(4,117)),new Ve(26,new Te(17,42)),new Ve(28,new Te(17,22),new Te(6,23)),new Ve(30,new Te(19,16),new Te(6,17))),new Ze(22,Int32Array.from([6,26,50,74,98]),new Ve(28,new Te(2,111),new Te(7,112)),new Ve(28,new Te(17,46)),new Ve(30,new Te(7,24),new Te(16,25)),new Ve(24,new Te(34,13))),new Ze(23,Int32Array.from([6,30,54,78,102]),new Ve(30,new Te(4,121),new Te(5,122)),new Ve(28,new Te(4,47),new Te(14,48)),new Ve(30,new Te(11,24),new Te(14,25)),new Ve(30,new Te(16,15),new Te(14,16))),new Ze(24,Int32Array.from([6,28,54,80,106]),new Ve(30,new Te(6,117),new Te(4,118)),new Ve(28,new Te(6,45),new Te(14,46)),new Ve(30,new Te(11,24),new Te(16,25)),new Ve(30,new Te(30,16),new Te(2,17))),new Ze(25,Int32Array.from([6,32,58,84,110]),new Ve(26,new Te(8,106),new Te(4,107)),new Ve(28,new Te(8,47),new Te(13,48)),new Ve(30,new Te(7,24),new Te(22,25)),new Ve(30,new Te(22,15),new Te(13,16))),new Ze(26,Int32Array.from([6,30,58,86,114]),new Ve(28,new Te(10,114),new Te(2,115)),new Ve(28,new Te(19,46),new Te(4,47)),new Ve(28,new Te(28,22),new Te(6,23)),new Ve(30,new Te(33,16),new Te(4,17))),new Ze(27,Int32Array.from([6,34,62,90,118]),new Ve(30,new Te(8,122),new Te(4,123)),new Ve(28,new Te(22,45),new Te(3,46)),new Ve(30,new Te(8,23),new Te(26,24)),new Ve(30,new Te(12,15),new Te(28,16))),new Ze(28,Int32Array.from([6,26,50,74,98,122]),new Ve(30,new Te(3,117),new Te(10,118)),new Ve(28,new Te(3,45),new Te(23,46)),new Ve(30,new Te(4,24),new Te(31,25)),new Ve(30,new Te(11,15),new Te(31,16))),new Ze(29,Int32Array.from([6,30,54,78,102,126]),new Ve(30,new Te(7,116),new Te(7,117)),new Ve(28,new Te(21,45),new Te(7,46)),new Ve(30,new Te(1,23),new Te(37,24)),new Ve(30,new Te(19,15),new Te(26,16))),new Ze(30,Int32Array.from([6,26,52,78,104,130]),new Ve(30,new Te(5,115),new Te(10,116)),new Ve(28,new Te(19,47),new Te(10,48)),new Ve(30,new Te(15,24),new Te(25,25)),new Ve(30,new Te(23,15),new Te(25,16))),new Ze(31,Int32Array.from([6,30,56,82,108,134]),new Ve(30,new Te(13,115),new Te(3,116)),new Ve(28,new Te(2,46),new Te(29,47)),new Ve(30,new Te(42,24),new Te(1,25)),new Ve(30,new Te(23,15),new Te(28,16))),new Ze(32,Int32Array.from([6,34,60,86,112,138]),new Ve(30,new Te(17,115)),new Ve(28,new Te(10,46),new Te(23,47)),new Ve(30,new Te(10,24),new Te(35,25)),new Ve(30,new Te(19,15),new Te(35,16))),new Ze(33,Int32Array.from([6,30,58,86,114,142]),new Ve(30,new Te(17,115),new Te(1,116)),new Ve(28,new Te(14,46),new Te(21,47)),new Ve(30,new Te(29,24),new Te(19,25)),new Ve(30,new Te(11,15),new Te(46,16))),new Ze(34,Int32Array.from([6,34,62,90,118,146]),new Ve(30,new Te(13,115),new Te(6,116)),new Ve(28,new Te(14,46),new Te(23,47)),new Ve(30,new Te(44,24),new Te(7,25)),new Ve(30,new Te(59,16),new Te(1,17))),new Ze(35,Int32Array.from([6,30,54,78,102,126,150]),new Ve(30,new Te(12,121),new Te(7,122)),new Ve(28,new Te(12,47),new Te(26,48)),new Ve(30,new Te(39,24),new Te(14,25)),new Ve(30,new Te(22,15),new Te(41,16))),new Ze(36,Int32Array.from([6,24,50,76,102,128,154]),new Ve(30,new Te(6,121),new Te(14,122)),new Ve(28,new Te(6,47),new Te(34,48)),new Ve(30,new Te(46,24),new Te(10,25)),new Ve(30,new Te(2,15),new Te(64,16))),new Ze(37,Int32Array.from([6,28,54,80,106,132,158]),new Ve(30,new Te(17,122),new Te(4,123)),new Ve(28,new Te(29,46),new Te(14,47)),new Ve(30,new Te(49,24),new Te(10,25)),new Ve(30,new Te(24,15),new Te(46,16))),new Ze(38,Int32Array.from([6,32,58,84,110,136,162]),new Ve(30,new Te(4,122),new Te(18,123)),new Ve(28,new Te(13,46),new Te(32,47)),new Ve(30,new Te(48,24),new Te(14,25)),new Ve(30,new Te(42,15),new Te(32,16))),new Ze(39,Int32Array.from([6,26,54,82,110,138,166]),new Ve(30,new Te(20,117),new Te(4,118)),new Ve(28,new Te(40,47),new Te(7,48)),new Ve(30,new Te(43,24),new Te(22,25)),new Ve(30,new Te(10,15),new Te(67,16))),new Ze(40,Int32Array.from([6,30,58,86,114,142,170]),new Ve(30,new Te(19,118),new Te(6,119)),new Ve(28,new Te(18,47),new Te(31,48)),new Ve(30,new Te(34,24),new Te(34,25)),new Ve(30,new Te(20,15),new Te(61,16)))];var it;(function(St){St[St.DATA_MASK_000=0]="DATA_MASK_000",St[St.DATA_MASK_001=1]="DATA_MASK_001",St[St.DATA_MASK_010=2]="DATA_MASK_010",St[St.DATA_MASK_011=3]="DATA_MASK_011",St[St.DATA_MASK_100=4]="DATA_MASK_100",St[St.DATA_MASK_101=5]="DATA_MASK_101",St[St.DATA_MASK_110=6]="DATA_MASK_110",St[St.DATA_MASK_111=7]="DATA_MASK_111"})(it||(it={}));class wt{constructor(w,E){this.value=w,this.isMasked=E}unmaskBitMatrix(w,E){for(let M=0;M<E;M++)for(let z=0;z<E;z++)this.isMasked(M,z)&&w.flip(z,M)}}wt.values=new Map([[it.DATA_MASK_000,new wt(it.DATA_MASK_000,(St,w)=>(St+w&1)===0)],[it.DATA_MASK_001,new wt(it.DATA_MASK_001,(St,w)=>(St&1)===0)],[it.DATA_MASK_010,new wt(it.DATA_MASK_010,(St,w)=>w%3===0)],[it.DATA_MASK_011,new wt(it.DATA_MASK_011,(St,w)=>(St+w)%3===0)],[it.DATA_MASK_100,new wt(it.DATA_MASK_100,(St,w)=>(Math.floor(St/2)+Math.floor(w/3)&1)===0)],[it.DATA_MASK_101,new wt(it.DATA_MASK_101,(St,w)=>St*w%6===0)],[it.DATA_MASK_110,new wt(it.DATA_MASK_110,(St,w)=>St*w%6<3)],[it.DATA_MASK_111,new wt(it.DATA_MASK_111,(St,w)=>(St+w+St*w%3&1)===0)]]);class Dt{constructor(w){const E=w.getHeight();if(E<21||(E&3)!==1)throw new O;this.bitMatrix=w}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let w=0;for(let W=0;W<6;W++)w=this.copyBit(W,8,w);w=this.copyBit(7,8,w),w=this.copyBit(8,8,w),w=this.copyBit(8,7,w);for(let W=5;W>=0;W--)w=this.copyBit(8,W,w);const E=this.bitMatrix.getHeight();let M=0;const z=E-7;for(let W=E-1;W>=z;W--)M=this.copyBit(8,W,M);for(let W=E-8;W<E;W++)M=this.copyBit(W,8,M);if(this.parsedFormatInfo=Pe.decodeFormatInformation(w,M),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new O}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 Ze.getVersionForNumber(E);let M=0;const z=w-11;for(let J=5;J>=0;J--)for(let de=w-9;de>=z;de--)M=this.copyBit(de,J,M);let W=Ze.decodeVersionInformation(M);if(W!==null&&W.getDimensionForVersion()===w)return this.parsedVersion=W,W;M=0;for(let J=5;J>=0;J--)for(let de=w-9;de>=z;de--)M=this.copyBit(J,de,M);if(W=Ze.decodeVersionInformation(M),W!==null&&W.getDimensionForVersion()===w)return this.parsedVersion=W,W;throw new O}copyBit(w,E,M){return(this.isMirror?this.bitMatrix.get(E,w):this.bitMatrix.get(w,E))?M<<1|1:M<<1}readCodewords(){const w=this.readFormatInformation(),E=this.readVersion(),M=wt.values.get(w.getDataMask()),z=this.bitMatrix.getHeight();M.unmaskBitMatrix(this.bitMatrix,z);const W=E.buildFunctionPattern();let J=!0;const de=new Uint8Array(E.getTotalCodewords());let Ee=0,De=0,ot=0;for(let _t=z-1;_t>0;_t-=2){_t===6&&_t--;for(let zt=0;zt<z;zt++){const gn=J?z-1-zt:zt;for(let Tt=0;Tt<2;Tt++)W.get(_t-Tt,gn)||(ot++,De<<=1,this.bitMatrix.get(_t-Tt,gn)&&(De|=1),ot===8&&(de[Ee++]=De,ot=0,De=0))}J=!J}if(Ee!==E.getTotalCodewords())throw new O;return de}remask(){if(this.parsedFormatInfo===null)return;const w=wt.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,M=w.getWidth();E<M;E++)for(let z=E+1,W=w.getHeight();z<W;z++)w.get(E,z)!==w.get(z,E)&&(w.flip(z,E),w.flip(E,z))}}class Qt{constructor(w,E){this.numDataCodewords=w,this.codewords=E}static getDataBlocks(w,E,M){if(w.length!==E.getTotalCodewords())throw new f;const z=E.getECBlocksForLevel(M);let W=0;const J=z.getECBlocks();for(const Tt of J)W+=Tt.getCount();const de=new Array(W);let Ee=0;for(const Tt of J)for(let Zt=0;Zt<Tt.getCount();Zt++){const sn=Tt.getDataCodewords(),$n=z.getECCodewordsPerBlock()+sn;de[Ee++]=new Qt(sn,new Uint8Array($n))}const De=de[0].codewords.length;let ot=de.length-1;for(;ot>=0&&de[ot].codewords.length!==De;)ot--;ot++;const _t=De-z.getECCodewordsPerBlock();let zt=0;for(let Tt=0;Tt<_t;Tt++)for(let Zt=0;Zt<Ee;Zt++)de[Zt].codewords[Tt]=w[zt++];for(let Tt=ot;Tt<Ee;Tt++)de[Tt].codewords[_t]=w[zt++];const gn=de[0].codewords.length;for(let Tt=_t;Tt<gn;Tt++)for(let Zt=0;Zt<Ee;Zt++){const sn=Zt<ot?Tt:Tt+1;de[Zt].codewords[sn]=w[zt++]}return de}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var xn;(function(St){St[St.TERMINATOR=0]="TERMINATOR",St[St.NUMERIC=1]="NUMERIC",St[St.ALPHANUMERIC=2]="ALPHANUMERIC",St[St.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",St[St.BYTE=4]="BYTE",St[St.ECI=5]="ECI",St[St.KANJI=6]="KANJI",St[St.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",St[St.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",St[St.HANZI=9]="HANZI"})(xn||(xn={}));class pn{constructor(w,E,M,z){this.value=w,this.stringValue=E,this.characterCountBitsForVersions=M,this.bits=z,pn.FOR_BITS.set(z,this),pn.FOR_VALUE.set(w,this)}static forBits(w){const E=pn.FOR_BITS.get(w);if(E===void 0)throw new f;return E}getCharacterCountBits(w){const E=w.getVersionNumber();let M;return E<=9?M=0:E<=26?M=1:M=2,this.characterCountBitsForVersions[M]}getValue(){return this.value}getBits(){return this.bits}equals(w){if(!(w instanceof pn))return!1;const E=w;return this.value===E.value}toString(){return this.stringValue}}pn.FOR_BITS=new Map,pn.FOR_VALUE=new Map,pn.TERMINATOR=new pn(xn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),pn.NUMERIC=new pn(xn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),pn.ALPHANUMERIC=new pn(xn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),pn.STRUCTURED_APPEND=new pn(xn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),pn.BYTE=new pn(xn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),pn.ECI=new pn(xn.ECI,"ECI",Int32Array.from([0,0,0]),7),pn.KANJI=new pn(xn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),pn.FNC1_FIRST_POSITION=new pn(xn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),pn.FNC1_SECOND_POSITION=new pn(xn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),pn.HANZI=new pn(xn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class An{static decode(w,E,M,z){const W=new me(w);let J=new te;const de=new Array;let Ee=-1,De=-1;try{let ot=null,_t=!1,zt;do{if(W.available()<4)zt=pn.TERMINATOR;else{const gn=W.readBits(4);zt=pn.forBits(gn)}switch(zt){case pn.TERMINATOR:break;case pn.FNC1_FIRST_POSITION:case pn.FNC1_SECOND_POSITION:_t=!0;break;case pn.STRUCTURED_APPEND:if(W.available()<16)throw new O;Ee=W.readBits(8),De=W.readBits(8);break;case pn.ECI:const gn=An.parseECIValue(W);if(ot=Y.getCharacterSetECIByValue(gn),ot===null)throw new O;break;case pn.HANZI:const Tt=W.readBits(4),Zt=W.readBits(zt.getCharacterCountBits(E));Tt===An.GB2312_SUBSET&&An.decodeHanziSegment(W,J,Zt);break;default:const sn=W.readBits(zt.getCharacterCountBits(E));switch(zt){case pn.NUMERIC:An.decodeNumericSegment(W,J,sn);break;case pn.ALPHANUMERIC:An.decodeAlphanumericSegment(W,J,sn,_t);break;case pn.BYTE:An.decodeByteSegment(W,J,sn,ot,de,z);break;case pn.KANJI:An.decodeKanjiSegment(W,J,sn);break;default:throw new O}break}}while(zt!==pn.TERMINATOR)}catch{throw new O}return new Fe(w,J.toString(),de.length===0?null:de,M===null?null:M.toString(),Ee,De)}static decodeHanziSegment(w,E,M){if(M*13>w.available())throw new O;const z=new Uint8Array(2*M);let W=0;for(;M>0;){const J=w.readBits(13);let de=J/96<<8&4294967295|J%96;de<959?de+=41377:de+=42657,z[W]=de>>8&255,z[W+1]=de&255,W+=2,M--}try{E.append(Q.decode(z,q.GB2312))}catch(J){throw new O(J)}}static decodeKanjiSegment(w,E,M){if(M*13>w.available())throw new O;const z=new Uint8Array(2*M);let W=0;for(;M>0;){const J=w.readBits(13);let de=J/192<<8&4294967295|J%192;de<7936?de+=33088:de+=49472,z[W]=de>>8,z[W+1]=de,W+=2,M--}try{E.append(Q.decode(z,q.SHIFT_JIS))}catch(J){throw new O(J)}}static decodeByteSegment(w,E,M,z,W,J){if(8*M>w.available())throw new O;const de=new Uint8Array(M);for(let De=0;De<M;De++)de[De]=w.readBits(8);let Ee;z===null?Ee=q.guessEncoding(de,J):Ee=z.getName();try{E.append(Q.decode(de,Ee))}catch(De){throw new O(De)}W.push(de)}static toAlphaNumericChar(w){if(w>=An.ALPHANUMERIC_CHARS.length)throw new O;return An.ALPHANUMERIC_CHARS[w]}static decodeAlphanumericSegment(w,E,M,z){const W=E.length();for(;M>1;){if(w.available()<11)throw new O;const J=w.readBits(11);E.append(An.toAlphaNumericChar(Math.floor(J/45))),E.append(An.toAlphaNumericChar(J%45)),M-=2}if(M===1){if(w.available()<6)throw new O;E.append(An.toAlphaNumericChar(w.readBits(6)))}if(z)for(let J=W;J<E.length();J++)E.charAt(J)==="%"&&(J<E.length()-1&&E.charAt(J+1)==="%"?E.deleteCharAt(J+1):E.setCharAt(J,""))}static decodeNumericSegment(w,E,M){for(;M>=3;){if(w.available()<10)throw new O;const z=w.readBits(10);if(z>=1e3)throw new O;E.append(An.toAlphaNumericChar(Math.floor(z/100))),E.append(An.toAlphaNumericChar(Math.floor(z/10)%10)),E.append(An.toAlphaNumericChar(z%10)),M-=3}if(M===2){if(w.available()<7)throw new O;const z=w.readBits(7);if(z>=100)throw new O;E.append(An.toAlphaNumericChar(Math.floor(z/10))),E.append(An.toAlphaNumericChar(z%10))}else if(M===1){if(w.available()<4)throw new O;const z=w.readBits(4);if(z>=10)throw new O;E.append(An.toAlphaNumericChar(z))}}static parseECIValue(w){const E=w.readBits(8);if(!(E&128))return E&127;if((E&192)===128){const M=w.readBits(8);return(E&63)<<8&4294967295|M}if((E&224)===192){const M=w.readBits(16);return(E&31)<<16&4294967295|M}throw new O}}An.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",An.GB2312_SUBSET=1;class or{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 $t{constructor(){this.rsDecoder=new He(dt.QR_CODE_FIELD_256)}decodeBooleanArray(w,E){return this.decodeBitMatrix(fe.parseFromBooleanArray(w),E)}decodeBitMatrix(w,E){const M=new Dt(w);let z=null;try{return this.decodeBitMatrixParser(M,E)}catch(W){z=W}try{M.remask(),M.setMirror(!0),M.readVersion(),M.readFormatInformation(),M.mirror();const W=this.decodeBitMatrixParser(M,E);return W.setOther(new or(!0)),W}catch(W){throw z!==null?z:W}}decodeBitMatrixParser(w,E){const M=w.readVersion(),z=w.readFormatInformation().getErrorCorrectionLevel(),W=w.readCodewords(),J=Qt.getDataBlocks(W,M,z);let de=0;for(const ot of J)de+=ot.getNumDataCodewords();const Ee=new Uint8Array(de);let De=0;for(const ot of J){const _t=ot.getCodewords(),zt=ot.getNumDataCodewords();this.correctErrors(_t,zt);for(let gn=0;gn<zt;gn++)Ee[De++]=_t[gn]}return An.decode(Ee,M,z,E)}correctErrors(w,E){const M=new Int32Array(w);try{this.rsDecoder.decode(M,w.length-E)}catch{throw new g}for(let z=0;z<E;z++)w[z]=M[z]}}class bt extends jt{constructor(w,E,M){super(w,E),this.estimatedModuleSize=M}aboutEquals(w,E,M){if(Math.abs(E-this.getY())<=w&&Math.abs(M-this.getX())<=w){const z=Math.abs(w-this.estimatedModuleSize);return z<=1||z<=this.estimatedModuleSize}return!1}combineEstimate(w,E,M){const z=(this.getX()+E)/2,W=(this.getY()+w)/2,J=(this.estimatedModuleSize+M)/2;return new bt(z,W,J)}}class rn{constructor(w,E,M,z,W,J,de){this.image=w,this.startX=E,this.startY=M,this.width=z,this.height=W,this.moduleSize=J,this.resultPointCallback=de,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const w=this.startX,E=this.height,M=this.width,z=w+M,W=this.startY+E/2,J=new Int32Array(3),de=this.image;for(let Ee=0;Ee<E;Ee++){const De=W+(Ee&1?-Math.floor((Ee+1)/2):Math.floor((Ee+1)/2));J[0]=0,J[1]=0,J[2]=0;let ot=w;for(;ot<z&&!de.get(ot,De);)ot++;let _t=0;for(;ot<z;){if(de.get(ot,De))if(_t===1)J[1]++;else if(_t===2){if(this.foundPatternCross(J)){const zt=this.handlePossibleCenter(J,De,ot);if(zt!==null)return zt}J[0]=J[2],J[1]=1,J[2]=0,_t=1}else J[++_t]++;else _t===1&&_t++,J[_t]++;ot++}if(this.foundPatternCross(J)){const zt=this.handlePossibleCenter(J,De,z);if(zt!==null)return zt}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new G}static centerFromEnd(w,E){return E-w[2]-w[1]/2}foundPatternCross(w){const E=this.moduleSize,M=E/2;for(let z=0;z<3;z++)if(Math.abs(E-w[z])>=M)return!1;return!0}crossCheckVertical(w,E,M,z){const W=this.image,J=W.getHeight(),de=this.crossCheckStateCount;de[0]=0,de[1]=0,de[2]=0;let Ee=w;for(;Ee>=0&&W.get(E,Ee)&&de[1]<=M;)de[1]++,Ee--;if(Ee<0||de[1]>M)return NaN;for(;Ee>=0&&!W.get(E,Ee)&&de[0]<=M;)de[0]++,Ee--;if(de[0]>M)return NaN;for(Ee=w+1;Ee<J&&W.get(E,Ee)&&de[1]<=M;)de[1]++,Ee++;if(Ee===J||de[1]>M)return NaN;for(;Ee<J&&!W.get(E,Ee)&&de[2]<=M;)de[2]++,Ee++;if(de[2]>M)return NaN;const De=de[0]+de[1]+de[2];return 5*Math.abs(De-z)>=2*z?NaN:this.foundPatternCross(de)?rn.centerFromEnd(de,Ee):NaN}handlePossibleCenter(w,E,M){const z=w[0]+w[1]+w[2],W=rn.centerFromEnd(w,M),J=this.crossCheckVertical(E,W,2*w[1],z);if(!isNaN(J)){const de=(w[0]+w[1]+w[2])/3;for(const De of this.possibleCenters)if(De.aboutEquals(de,J,W))return De.combineEstimate(J,W,de);const Ee=new bt(W,J,de);this.possibleCenters.push(Ee),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(Ee)}return null}}class ur extends jt{constructor(w,E,M,z){super(w,E),this.estimatedModuleSize=M,this.count=z,z===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(w,E,M){if(Math.abs(E-this.getY())<=w&&Math.abs(M-this.getX())<=w){const z=Math.abs(w-this.estimatedModuleSize);return z<=1||z<=this.estimatedModuleSize}return!1}combineEstimate(w,E,M){const z=this.count+1,W=(this.count*this.getX()+E)/z,J=(this.count*this.getY()+w)/z,de=(this.count*this.estimatedModuleSize+M)/z;return new ur(W,J,de,z)}}class gr{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 br{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,M=w!=null&&w.get($.PURE_BARCODE)!==void 0,z=this.image,W=z.getHeight(),J=z.getWidth();let de=Math.floor(3*W/(4*br.MAX_MODULES));(de<br.MIN_SKIP||E)&&(de=br.MIN_SKIP);let Ee=!1;const De=new Int32Array(5);for(let _t=de-1;_t<W&&!Ee;_t+=de){De[0]=0,De[1]=0,De[2]=0,De[3]=0,De[4]=0;let zt=0;for(let gn=0;gn<J;gn++)if(z.get(gn,_t))(zt&1)===1&&zt++,De[zt]++;else if(zt&1)De[zt]++;else if(zt===4)if(br.foundPatternCross(De)){if(this.handlePossibleCenter(De,_t,gn,M)===!0)if(de=2,this.hasSkipped===!0)Ee=this.haveMultiplyConfirmedCenters();else{const Zt=this.findRowSkip();Zt>De[2]&&(_t+=Zt-De[2]-de,gn=J-1)}else{De[0]=De[2],De[1]=De[3],De[2]=De[4],De[3]=1,De[4]=0,zt=3;continue}zt=0,De[0]=0,De[1]=0,De[2]=0,De[3]=0,De[4]=0}else De[0]=De[2],De[1]=De[3],De[2]=De[4],De[3]=1,De[4]=0,zt=3;else De[++zt]++;br.foundPatternCross(De)&&this.handlePossibleCenter(De,_t,J,M)===!0&&(de=De[0],this.hasSkipped&&(Ee=this.haveMultiplyConfirmedCenters()))}const ot=this.selectBestPatterns();return jt.orderBestPatterns(ot),new gr(ot)}static centerFromEnd(w,E){return E-w[4]-w[3]-w[2]/2}static foundPatternCross(w){let E=0;for(let W=0;W<5;W++){const J=w[W];if(J===0)return!1;E+=J}if(E<7)return!1;const M=E/7,z=M/2;return Math.abs(M-w[0])<z&&Math.abs(M-w[1])<z&&Math.abs(3*M-w[2])<3*z&&Math.abs(M-w[3])<z&&Math.abs(M-w[4])<z}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,M,z){const W=this.getCrossCheckStateCount();let J=0;const de=this.image;for(;w>=J&&E>=J&&de.get(E-J,w-J);)W[2]++,J++;if(w<J||E<J)return!1;for(;w>=J&&E>=J&&!de.get(E-J,w-J)&&W[1]<=M;)W[1]++,J++;if(w<J||E<J||W[1]>M)return!1;for(;w>=J&&E>=J&&de.get(E-J,w-J)&&W[0]<=M;)W[0]++,J++;if(W[0]>M)return!1;const Ee=de.getHeight(),De=de.getWidth();for(J=1;w+J<Ee&&E+J<De&&de.get(E+J,w+J);)W[2]++,J++;if(w+J>=Ee||E+J>=De)return!1;for(;w+J<Ee&&E+J<De&&!de.get(E+J,w+J)&&W[3]<M;)W[3]++,J++;if(w+J>=Ee||E+J>=De||W[3]>=M)return!1;for(;w+J<Ee&&E+J<De&&de.get(E+J,w+J)&&W[4]<M;)W[4]++,J++;if(W[4]>=M)return!1;const ot=W[0]+W[1]+W[2]+W[3]+W[4];return Math.abs(ot-z)<2*z&&br.foundPatternCross(W)}crossCheckVertical(w,E,M,z){const W=this.image,J=W.getHeight(),de=this.getCrossCheckStateCount();let Ee=w;for(;Ee>=0&&W.get(E,Ee);)de[2]++,Ee--;if(Ee<0)return NaN;for(;Ee>=0&&!W.get(E,Ee)&&de[1]<=M;)de[1]++,Ee--;if(Ee<0||de[1]>M)return NaN;for(;Ee>=0&&W.get(E,Ee)&&de[0]<=M;)de[0]++,Ee--;if(de[0]>M)return NaN;for(Ee=w+1;Ee<J&&W.get(E,Ee);)de[2]++,Ee++;if(Ee===J)return NaN;for(;Ee<J&&!W.get(E,Ee)&&de[3]<M;)de[3]++,Ee++;if(Ee===J||de[3]>=M)return NaN;for(;Ee<J&&W.get(E,Ee)&&de[4]<M;)de[4]++,Ee++;if(de[4]>=M)return NaN;const De=de[0]+de[1]+de[2]+de[3]+de[4];return 5*Math.abs(De-z)>=2*z?NaN:br.foundPatternCross(de)?br.centerFromEnd(de,Ee):NaN}crossCheckHorizontal(w,E,M,z){const W=this.image,J=W.getWidth(),de=this.getCrossCheckStateCount();let Ee=w;for(;Ee>=0&&W.get(Ee,E);)de[2]++,Ee--;if(Ee<0)return NaN;for(;Ee>=0&&!W.get(Ee,E)&&de[1]<=M;)de[1]++,Ee--;if(Ee<0||de[1]>M)return NaN;for(;Ee>=0&&W.get(Ee,E)&&de[0]<=M;)de[0]++,Ee--;if(de[0]>M)return NaN;for(Ee=w+1;Ee<J&&W.get(Ee,E);)de[2]++,Ee++;if(Ee===J)return NaN;for(;Ee<J&&!W.get(Ee,E)&&de[3]<M;)de[3]++,Ee++;if(Ee===J||de[3]>=M)return NaN;for(;Ee<J&&W.get(Ee,E)&&de[4]<M;)de[4]++,Ee++;if(de[4]>=M)return NaN;const De=de[0]+de[1]+de[2]+de[3]+de[4];return 5*Math.abs(De-z)>=z?NaN:br.foundPatternCross(de)?br.centerFromEnd(de,Ee):NaN}handlePossibleCenter(w,E,M,z){const W=w[0]+w[1]+w[2]+w[3]+w[4];let J=br.centerFromEnd(w,M),de=this.crossCheckVertical(E,Math.floor(J),w[2],W);if(!isNaN(de)&&(J=this.crossCheckHorizontal(Math.floor(J),Math.floor(de),w[2],W),!isNaN(J)&&(!z||this.crossCheckDiagonal(Math.floor(de),Math.floor(J),w[2],W)))){const Ee=W/7;let De=!1;const ot=this.possibleCenters;for(let _t=0,zt=ot.length;_t<zt;_t++){const gn=ot[_t];if(gn.aboutEquals(Ee,de,J)){ot[_t]=gn.combineEstimate(de,J,Ee),De=!0;break}}if(!De){const _t=new ur(J,de,Ee);ot.push(_t),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(_t)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let E=null;for(const M of this.possibleCenters)if(M.getCount()>=br.CENTER_QUORUM)if(E==null)E=M;else return this.hasSkipped=!0,Math.floor((Math.abs(E.getX()-M.getX())-Math.abs(E.getY()-M.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let w=0,E=0;const M=this.possibleCenters.length;for(const J of this.possibleCenters)J.getCount()>=br.CENTER_QUORUM&&(w++,E+=J.getEstimatedModuleSize());if(w<3)return!1;const z=E/M;let W=0;for(const J of this.possibleCenters)W+=Math.abs(J.getEstimatedModuleSize()-z);return W<=.05*E}selectBestPatterns(){const w=this.possibleCenters.length;if(w<3)throw new G;const E=this.possibleCenters;let M;if(w>3){let z=0,W=0;for(const Ee of this.possibleCenters){const De=Ee.getEstimatedModuleSize();z+=De,W+=De*De}M=z/w;let J=Math.sqrt(W/w-M*M);E.sort((Ee,De)=>{const ot=Math.abs(De.getEstimatedModuleSize()-M),_t=Math.abs(Ee.getEstimatedModuleSize()-M);return ot<_t?-1:ot>_t?1:0});const de=Math.max(.2*M,J);for(let Ee=0;Ee<E.length&&E.length>3;Ee++){const De=E[Ee];Math.abs(De.getEstimatedModuleSize()-M)>de&&(E.splice(Ee,1),Ee--)}}if(E.length>3){let z=0;for(const W of E)z+=W.getEstimatedModuleSize();M=z/E.length,E.sort((W,J)=>{if(J.getCount()===W.getCount()){const de=Math.abs(J.getEstimatedModuleSize()-M),Ee=Math.abs(W.getEstimatedModuleSize()-M);return de<Ee?1:de>Ee?-1:0}else return J.getCount()-W.getCount()}),E.splice(3)}return[E[0],E[1],E[2]]}}br.CENTER_QUORUM=2,br.MIN_SKIP=3,br.MAX_MODULES=57;class Br{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 M=new br(this.image,this.resultPointCallback).find(w);return this.processFinderPatternInfo(M)}processFinderPatternInfo(w){const E=w.getTopLeft(),M=w.getTopRight(),z=w.getBottomLeft(),W=this.calculateModuleSize(E,M,z);if(W<1)throw new G("No pattern found in proccess finder.");const J=Br.computeDimension(E,M,z,W),de=Ze.getProvisionalVersionForDimension(J),Ee=de.getDimensionForVersion()-7;let De=null;if(de.getAlignmentPatternCenters().length>0){const gn=M.getX()-E.getX()+z.getX(),Tt=M.getY()-E.getY()+z.getY(),Zt=1-3/Ee,sn=Math.floor(E.getX()+Zt*(gn-E.getX())),$n=Math.floor(E.getY()+Zt*(Tt-E.getY()));for(let Cr=4;Cr<=16;Cr<<=1)try{De=this.findAlignmentInRegion(W,sn,$n,Cr);break}catch(kr){if(!(kr instanceof G))throw kr}}const ot=Br.createTransform(E,M,z,De,J),_t=Br.sampleGrid(this.image,ot,J);let zt;return De===null?zt=[z,E,M]:zt=[z,E,M,De],new un(_t,zt)}static createTransform(w,E,M,z,W){const J=W-3.5;let de,Ee,De,ot;return z!==null?(de=z.getX(),Ee=z.getY(),De=J-3,ot=De):(de=E.getX()-w.getX()+M.getX(),Ee=E.getY()-w.getY()+M.getY(),De=J,ot=J),Nn.quadrilateralToQuadrilateral(3.5,3.5,J,3.5,De,ot,3.5,J,w.getX(),w.getY(),E.getX(),E.getY(),de,Ee,M.getX(),M.getY())}static sampleGrid(w,E,M){return rt.getInstance().sampleGridWithTransform(w,M,M,E)}static computeDimension(w,E,M,z){const W=yt.round(jt.distance(w,E)/z),J=yt.round(jt.distance(w,M)/z);let de=Math.floor((W+J)/2)+7;switch(de&3){case 0:de++;break;case 2:de--;break;case 3:throw new G("Dimensions could be not found.")}return de}calculateModuleSize(w,E,M){return(this.calculateModuleSizeOneWay(w,E)+this.calculateModuleSizeOneWay(w,M))/2}calculateModuleSizeOneWay(w,E){const M=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(w.getX()),Math.floor(w.getY()),Math.floor(E.getX()),Math.floor(E.getY())),z=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(E.getX()),Math.floor(E.getY()),Math.floor(w.getX()),Math.floor(w.getY()));return isNaN(M)?z/7:isNaN(z)?M/7:(M+z)/14}sizeOfBlackWhiteBlackRunBothWays(w,E,M,z){let W=this.sizeOfBlackWhiteBlackRun(w,E,M,z),J=1,de=w-(M-w);de<0?(J=w/(w-de),de=0):de>=this.image.getWidth()&&(J=(this.image.getWidth()-1-w)/(de-w),de=this.image.getWidth()-1);let Ee=Math.floor(E-(z-E)*J);return J=1,Ee<0?(J=E/(E-Ee),Ee=0):Ee>=this.image.getHeight()&&(J=(this.image.getHeight()-1-E)/(Ee-E),Ee=this.image.getHeight()-1),de=Math.floor(w+(de-w)*J),W+=this.sizeOfBlackWhiteBlackRun(w,E,de,Ee),W-1}sizeOfBlackWhiteBlackRun(w,E,M,z){const W=Math.abs(z-E)>Math.abs(M-w);if(W){let gn=w;w=E,E=gn,gn=M,M=z,z=gn}const J=Math.abs(M-w),de=Math.abs(z-E);let Ee=-J/2;const De=w<M?1:-1,ot=E<z?1:-1;let _t=0;const zt=M+De;for(let gn=w,Tt=E;gn!==zt;gn+=De){const Zt=W?Tt:gn,sn=W?gn:Tt;if(_t===1===this.image.get(Zt,sn)){if(_t===2)return yt.distance(gn,Tt,w,E);_t++}if(Ee+=de,Ee>0){if(Tt===z)break;Tt+=ot,Ee-=J}}return _t===2?yt.distance(M+De,z,w,E):NaN}findAlignmentInRegion(w,E,M,z){const W=Math.floor(z*w),J=Math.max(0,E-W),de=Math.min(this.image.getWidth()-1,E+W);if(de-J<w*3)throw new G("Alignment top exceeds estimated module size.");const Ee=Math.max(0,M-W),De=Math.min(this.image.getHeight()-1,M+W);if(De-Ee<w*3)throw new G("Alignment bottom exceeds estimated module size.");return new rn(this.image,J,Ee,de-J,De-Ee,w,this.resultPointCallback).find()}}class Gr{constructor(){this.decoder=new $t}getDecoder(){return this.decoder}decode(w,E){let M,z;if(E!=null&&E.get($.PURE_BARCODE)!==void 0){const Ee=Gr.extractPureBits(w.getBlackMatrix());M=this.decoder.decodeBitMatrix(Ee,E),z=Gr.NO_POINTS}else{const Ee=new Br(w.getBlackMatrix()).detect(E);M=this.decoder.decodeBitMatrix(Ee.getBits(),E),z=Ee.getPoints()}M.getOther()instanceof or&&M.getOther().applyMirroredCorrection(z);const W=new ge(M.getText(),M.getRawBytes(),void 0,z,be.QR_CODE,void 0),J=M.getByteSegments();J!==null&&W.putMetadata(je.BYTE_SEGMENTS,J);const de=M.getECLevel();return de!==null&&W.putMetadata(je.ERROR_CORRECTION_LEVEL,de),M.hasStructuredAppend()&&(W.putMetadata(je.STRUCTURED_APPEND_SEQUENCE,M.getStructuredAppendSequenceNumber()),W.putMetadata(je.STRUCTURED_APPEND_PARITY,M.getStructuredAppendParity())),W}reset(){}static extractPureBits(w){const E=w.getTopLeftOnBit(),M=w.getBottomRightOnBit();if(E===null||M===null)throw new G;const z=this.moduleSize(E,w);let W=E[1],J=M[1],de=E[0],Ee=M[0];if(de>=Ee||W>=J)throw new G;if(J-W!==Ee-de&&(Ee=de+(J-W),Ee>=w.getWidth()))throw new G;const De=Math.round((Ee-de+1)/z),ot=Math.round((J-W+1)/z);if(De<=0||ot<=0)throw new G;if(ot!==De)throw new G;const _t=Math.floor(z/2);W+=_t,de+=_t;const zt=de+Math.floor((De-1)*z)-Ee;if(zt>0){if(zt>_t)throw new G;de-=zt}const gn=W+Math.floor((ot-1)*z)-J;if(gn>0){if(gn>_t)throw new G;W-=gn}const Tt=new fe(De,ot);for(let Zt=0;Zt<ot;Zt++){const sn=W+Math.floor(Zt*z);for(let $n=0;$n<De;$n++)w.get(de+Math.floor($n*z),sn)&&Tt.set($n,Zt)}return Tt}static moduleSize(w,E){const M=E.getHeight(),z=E.getWidth();let W=w[0],J=w[1],de=!0,Ee=0;for(;W<z&&J<M;){if(de!==E.get(W,J)){if(++Ee===5)break;de=!de}W++,J++}if(W===z||J===M)throw new G;return(W-w[0])/7}}Gr.NO_POINTS=new Array;class Or{PDF417Common(){}static getBitCountSum(w){return yt.sum(w)}static toIntArray(w){if(w==null||!w.length)return Or.EMPTY_INT_ARRAY;const E=new Int32Array(w.length);let M=0;for(const z of w)E[M++]=z;return E}static getCodeword(w){const E=T.binarySearch(Or.SYMBOL_TABLE,w&262143);return E<0?-1:(Or.CODEWORD_TABLE[E]-1)%Or.NUMBER_OF_CODEWORDS}}Or.NUMBER_OF_CODEWORDS=929,Or.MAX_CODEWORDS_IN_BARCODE=Or.NUMBER_OF_CODEWORDS-1,Or.MIN_ROWS_IN_BARCODE=3,Or.MAX_ROWS_IN_BARCODE=90,Or.MODULES_IN_CODEWORD=17,Or.MODULES_IN_STOP_PATTERN=18,Or.BARS_IN_MODULE=8,Or.EMPTY_INT_ARRAY=new Int32Array([]),Or.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]),Or.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 Lt{constructor(w,E){this.bits=w,this.points=E}getBits(){return this.bits}getPoints(){return this.points}}class nn{static detectMultiple(w,E,M){let z=w.getBlackMatrix(),W=nn.detect(M,z);return W.length||(z=z.clone(),z.rotate180(),W=nn.detect(M,z)),new Lt(z,W)}static detect(w,E){const M=new Array;let z=0,W=0,J=!1;for(;z<E.getHeight();){const de=nn.findVertices(E,z,W);if(de[0]==null&&de[3]==null){if(!J)break;J=!1,W=0;for(const Ee of M)Ee[1]!=null&&(z=Math.trunc(Math.max(z,Ee[1].getY()))),Ee[3]!=null&&(z=Math.max(z,Math.trunc(Ee[3].getY())));z+=nn.ROW_STEP;continue}if(J=!0,M.push(de),!w)break;de[2]!=null?(W=Math.trunc(de[2].getX()),z=Math.trunc(de[2].getY())):(W=Math.trunc(de[4].getX()),z=Math.trunc(de[4].getY()))}return M}static findVertices(w,E,M){const z=w.getHeight(),W=w.getWidth(),J=new Array(8);return nn.copyToResult(J,nn.findRowsWithPattern(w,z,W,E,M,nn.START_PATTERN),nn.INDEXES_START_PATTERN),J[4]!=null&&(M=Math.trunc(J[4].getX()),E=Math.trunc(J[4].getY())),nn.copyToResult(J,nn.findRowsWithPattern(w,z,W,E,M,nn.STOP_PATTERN),nn.INDEXES_STOP_PATTERN),J}static copyToResult(w,E,M){for(let z=0;z<M.length;z++)w[M[z]]=E[z]}static findRowsWithPattern(w,E,M,z,W,J){const de=new Array(4);let Ee=!1;const De=new Int32Array(J.length);for(;z<E;z+=nn.ROW_STEP){let _t=nn.findGuardPattern(w,W,z,M,!1,J,De);if(_t!=null){for(;z>0;){const zt=nn.findGuardPattern(w,W,--z,M,!1,J,De);if(zt!=null)_t=zt;else{z++;break}}de[0]=new jt(_t[0],z),de[1]=new jt(_t[1],z),Ee=!0;break}}let ot=z+1;if(Ee){let _t=0,zt=Int32Array.from([Math.trunc(de[0].getX()),Math.trunc(de[1].getX())]);for(;ot<E;ot++){const gn=nn.findGuardPattern(w,zt[0],ot,M,!1,J,De);if(gn!=null&&Math.abs(zt[0]-gn[0])<nn.MAX_PATTERN_DRIFT&&Math.abs(zt[1]-gn[1])<nn.MAX_PATTERN_DRIFT)zt=gn,_t=0;else{if(_t>nn.SKIPPED_ROW_COUNT_MAX)break;_t++}}ot-=_t+1,de[2]=new jt(zt[0],ot),de[3]=new jt(zt[1],ot)}return ot-z<nn.BARCODE_MIN_HEIGHT&&T.fill(de,null),de}static findGuardPattern(w,E,M,z,W,J,de){T.fillWithin(de,0,de.length,0);let Ee=E,De=0;for(;w.get(Ee,M)&&Ee>0&&De++<nn.MAX_PIXEL_DRIFT;)Ee--;let ot=Ee,_t=0,zt=J.length;for(let gn=W;ot<z;ot++)if(w.get(ot,M)!==gn)de[_t]++;else{if(_t===zt-1){if(nn.patternMatchVariance(de,J,nn.MAX_INDIVIDUAL_VARIANCE)<nn.MAX_AVG_VARIANCE)return new Int32Array([Ee,ot]);Ee+=de[0]+de[1],v.arraycopy(de,2,de,0,_t-1),de[_t-1]=0,de[_t]=0,_t--}else _t++;de[_t]=1,gn=!gn}return _t===zt-1&&nn.patternMatchVariance(de,J,nn.MAX_INDIVIDUAL_VARIANCE)<nn.MAX_AVG_VARIANCE?new Int32Array([Ee,ot-1]):null}static patternMatchVariance(w,E,M){let z=w.length,W=0,J=0;for(let De=0;De<z;De++)W+=w[De],J+=E[De];if(W<J)return 1/0;let de=W/J;M*=de;let Ee=0;for(let De=0;De<z;De++){let ot=w[De],_t=E[De]*de,zt=ot>_t?ot-_t:_t-ot;if(zt>M)return 1/0;Ee+=zt}return Ee/W}}nn.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),nn.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),nn.MAX_AVG_VARIANCE=.42,nn.MAX_INDIVIDUAL_VARIANCE=.8,nn.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),nn.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),nn.MAX_PIXEL_DRIFT=3,nn.MAX_PATTERN_DRIFT=5,nn.SKIPPED_ROW_COUNT_MAX=25,nn.ROW_STEP=5,nn.BARCODE_MIN_HEIGHT=10;class Ot{constructor(w,E){if(E.length===0)throw new f;this.field=w;let M=E.length;if(M>1&&E[0]===0){let z=1;for(;z<M&&E[z]===0;)z++;z===M?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(M-z),v.arraycopy(E,z,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 z=0;for(let W of this.coefficients)z=this.field.add(z,W);return z}let E=this.coefficients[0],M=this.coefficients.length;for(let z=1;z<M;z++)E=this.field.add(this.field.multiply(w,E),this.coefficients[z]);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,M=w.coefficients;if(E.length>M.length){let J=E;E=M,M=J}let z=new Int32Array(M.length),W=M.length-E.length;v.arraycopy(M,0,z,0,W);for(let J=W;J<M.length;J++)z[J]=this.field.add(E[J-W],M[J]);return new Ot(this.field,z)}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 Ot?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 Ot(this.field,new Int32Array([0]));let E=this.coefficients,M=E.length,z=w.coefficients,W=z.length,J=new Int32Array(M+W-1);for(let de=0;de<M;de++){let Ee=E[de];for(let De=0;De<W;De++)J[de+De]=this.field.add(J[de+De],this.field.multiply(Ee,z[De]))}return new Ot(this.field,J)}negative(){let w=this.coefficients.length,E=new Int32Array(w);for(let M=0;M<w;M++)E[M]=this.field.subtract(0,this.coefficients[M]);return new Ot(this.field,E)}multiplyScalar(w){if(w===0)return new Ot(this.field,new Int32Array([0]));if(w===1)return this;let E=this.coefficients.length,M=new Int32Array(E);for(let z=0;z<E;z++)M[z]=this.field.multiply(this.coefficients[z],w);return new Ot(this.field,M)}multiplyByMonomial(w,E){if(w<0)throw new f;if(E===0)return new Ot(this.field,new Int32Array([0]));let M=this.coefficients.length,z=new Int32Array(M+w);for(let W=0;W<M;W++)z[W]=this.field.multiply(this.coefficients[W],E);return new Ot(this.field,z)}toString(){let w=new te;for(let E=this.getDegree();E>=0;E--){let M=this.getCoefficient(E);M!==0&&(M<0?(w.append(" - "),M=-M):w.length()>0&&w.append(" + "),(E===0||M!==1)&&w.append(M),E!==0&&(E===1?w.append("x"):(w.append("x^"),w.append(E))))}return w.toString()}}class en{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 Ye;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 Fn extends en{constructor(w,E){super(),this.modulus=w,this.expTable=new Int32Array(w),this.logTable=new Int32Array(w);let M=1;for(let z=0;z<w;z++)this.expTable[z]=M,M=M*E%w;for(let z=0;z<w-1;z++)this.logTable[this.expTable[z]]=z;this.zero=new Ot(this,new Int32Array([0])),this.one=new Ot(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 M=new Int32Array(w+1);return M[0]=E,new Ot(this,M)}}Fn.PDF417_GF=new Fn(Or.NUMBER_OF_CODEWORDS,3);class yr{constructor(){this.field=Fn.PDF417_GF}decode(w,E,M){let z=new Ot(this.field,w),W=new Int32Array(E),J=!1;for(let Tt=E;Tt>0;Tt--){let Zt=z.evaluateAt(this.field.exp(Tt));W[E-Tt]=Zt,Zt!==0&&(J=!0)}if(!J)return 0;let de=this.field.getOne();if(M!=null)for(const Tt of M){let Zt=this.field.exp(w.length-1-Tt),sn=new Ot(this.field,new Int32Array([this.field.subtract(0,Zt),1]));de=de.multiply(sn)}let Ee=new Ot(this.field,W),De=this.runEuclideanAlgorithm(this.field.buildMonomial(E,1),Ee,E),ot=De[0],_t=De[1],zt=this.findErrorLocations(ot),gn=this.findErrorMagnitudes(_t,ot,zt);for(let Tt=0;Tt<zt.length;Tt++){let Zt=w.length-1-this.field.log(zt[Tt]);if(Zt<0)throw g.getChecksumInstance();w[Zt]=this.field.subtract(w[Zt],gn[Tt])}return zt.length}runEuclideanAlgorithm(w,E,M){if(w.getDegree()<E.getDegree()){let zt=w;w=E,E=zt}let z=w,W=E,J=this.field.getZero(),de=this.field.getOne();for(;W.getDegree()>=Math.round(M/2);){let zt=z,gn=J;if(z=W,J=de,z.isZero())throw g.getChecksumInstance();W=zt;let Tt=this.field.getZero(),Zt=z.getCoefficient(z.getDegree()),sn=this.field.inverse(Zt);for(;W.getDegree()>=z.getDegree()&&!W.isZero();){let $n=W.getDegree()-z.getDegree(),Cr=this.field.multiply(W.getCoefficient(W.getDegree()),sn);Tt=Tt.add(this.field.buildMonomial($n,Cr)),W=W.subtract(z.multiplyByMonomial($n,Cr))}de=Tt.multiply(J).subtract(gn).negative()}let Ee=de.getCoefficient(0);if(Ee===0)throw g.getChecksumInstance();let De=this.field.inverse(Ee),ot=de.multiply(De),_t=W.multiply(De);return[ot,_t]}findErrorLocations(w){let E=w.getDegree(),M=new Int32Array(E),z=0;for(let W=1;W<this.field.getSize()&&z<E;W++)w.evaluateAt(W)===0&&(M[z]=this.field.inverse(W),z++);if(z!==E)throw g.getChecksumInstance();return M}findErrorMagnitudes(w,E,M){let z=E.getDegree(),W=new Int32Array(z);for(let De=1;De<=z;De++)W[z-De]=this.field.multiply(De,E.getCoefficient(De));let J=new Ot(this.field,W),de=M.length,Ee=new Int32Array(de);for(let De=0;De<de;De++){let ot=this.field.inverse(M[De]),_t=this.field.subtract(0,w.evaluateAt(ot)),zt=this.field.inverse(J.evaluateAt(ot));Ee[De]=this.field.multiply(_t,zt)}return Ee}}class hr{constructor(w,E,M,z,W){w instanceof hr?this.constructor_2(w):this.constructor_1(w,E,M,z,W)}constructor_1(w,E,M,z,W){const J=E==null||M==null,de=z==null||W==null;if(J&&de)throw new G;J?(E=new jt(0,z.getY()),M=new jt(0,W.getY())):de&&(z=new jt(w.getWidth()-1,E.getY()),W=new jt(w.getWidth()-1,M.getY())),this.image=w,this.topLeft=E,this.bottomLeft=M,this.topRight=z,this.bottomRight=W,this.minX=Math.trunc(Math.min(E.getX(),M.getX())),this.maxX=Math.trunc(Math.max(z.getX(),W.getX())),this.minY=Math.trunc(Math.min(E.getY(),z.getY())),this.maxY=Math.trunc(Math.max(M.getY(),W.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 hr(w.image,w.topLeft,w.bottomLeft,E.topRight,E.bottomRight)}addMissingRows(w,E,M){let z=this.topLeft,W=this.bottomLeft,J=this.topRight,de=this.bottomRight;if(w>0){let Ee=M?this.topLeft:this.topRight,De=Math.trunc(Ee.getY()-w);De<0&&(De=0);let ot=new jt(Ee.getX(),De);M?z=ot:J=ot}if(E>0){let Ee=M?this.bottomLeft:this.bottomRight,De=Math.trunc(Ee.getY()+E);De>=this.image.getHeight()&&(De=this.image.getHeight()-1);let ot=new jt(Ee.getX(),De);M?W=ot:de=ot}return new hr(this.image,z,W,J,de)}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 lt{constructor(w,E,M,z){this.columnCount=w,this.errorCorrectionLevel=z,this.rowCountUpperPart=E,this.rowCountLowerPart=M,this.rowCount=E+M}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class Ct{constructor(){this.buffer=""}static form(w,E){let M=-1;function z(J,de,Ee,De,ot,_t){if(J==="%%")return"%";if(E[++M]===void 0)return;J=De?parseInt(De.substr(1)):void 0;let zt=ot?parseInt(ot.substr(1)):void 0,gn;switch(_t){case"s":gn=E[M];break;case"c":gn=E[M][0];break;case"f":gn=parseFloat(E[M]).toFixed(J);break;case"p":gn=parseFloat(E[M]).toPrecision(J);break;case"e":gn=parseFloat(E[M]).toExponential(J);break;case"x":gn=parseInt(E[M]).toString(zt||16);break;case"d":gn=parseFloat(parseInt(E[M],zt||10).toPrecision(J)).toFixed(0);break}gn=typeof gn=="object"?JSON.stringify(gn):(+gn).toString(zt);let Tt=parseInt(Ee),Zt=Ee&&Ee[0]+""=="0"?"0":" ";for(;gn.length<Tt;)gn=de!==void 0?gn+Zt:Zt+gn;return gn}let W=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return w.replace(W,z)}format(w,...E){this.buffer+=Ct.form(w,E)}toString(){return this.buffer}}class On{constructor(w){this.boundingBox=new hr(w),this.codewords=new Array(w.getMaxY()-w.getMinY()+1)}getCodewordNearby(w){let E=this.getCodeword(w);if(E!=null)return E;for(let M=1;M<On.MAX_NEARBY_DISTANCE;M++){let z=this.imageRowToCodewordIndex(w)-M;if(z>=0&&(E=this.codewords[z],E!=null)||(z=this.imageRowToCodewordIndex(w)+M,z<this.codewords.length&&(E=this.codewords[z],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 Ct;let E=0;for(const M of this.codewords){if(M==null){w.format("%3d: | %n",E++);continue}w.format("%3d: %3d|%3d%n",E++,M.getRowNumber(),M.getValue())}return w.toString()}}On.MAX_NEARBY_DISTANCE=5;class qn{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[M,z]of this.values.entries()){const W={getKey:()=>M,getValue:()=>z};W.getValue()>w?(w=W.getValue(),E=[],E.push(W.getKey())):W.getValue()===w&&E.push(W.getKey())}return Or.toIntArray(E)}getConfidence(w){return this.values.get(w)}}class _r extends On{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 M=this.getBoundingBox(),z=this._isLeft?M.getTopLeft():M.getTopRight(),W=this._isLeft?M.getBottomLeft():M.getBottomRight(),J=this.imageRowToCodewordIndex(Math.trunc(z.getY())),de=this.imageRowToCodewordIndex(Math.trunc(W.getY())),Ee=-1,De=1,ot=0;for(let _t=J;_t<de;_t++){if(E[_t]==null)continue;let zt=E[_t],gn=zt.getRowNumber()-Ee;if(gn===0)ot++;else if(gn===1)De=Math.max(De,ot),ot=1,Ee=zt.getRowNumber();else if(gn<0||zt.getRowNumber()>=w.getRowCount()||gn>_t)E[_t]=null;else{let Tt;De>2?Tt=(De-2)*gn:Tt=gn;let Zt=Tt>=_t;for(let sn=1;sn<=Tt&&!Zt;sn++)Zt=E[_t-sn]!=null;Zt?E[_t]=null:(Ee=zt.getRowNumber(),ot=1)}}}getRowHeights(){let w=this.getBarcodeMetadata();if(w==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(w);let E=new Int32Array(w.getRowCount());for(let M of this.getCodewords())if(M!=null){let z=M.getRowNumber();if(z>=E.length)continue;E[z]++}return E}adjustIncompleteIndicatorColumnRowNumbers(w){let E=this.getBoundingBox(),M=this._isLeft?E.getTopLeft():E.getTopRight(),z=this._isLeft?E.getBottomLeft():E.getBottomRight(),W=this.imageRowToCodewordIndex(Math.trunc(M.getY())),J=this.imageRowToCodewordIndex(Math.trunc(z.getY())),de=this.getCodewords(),Ee=-1;for(let De=W;De<J;De++){if(de[De]==null)continue;let ot=de[De];ot.setRowNumberAsRowIndicatorColumn();let _t=ot.getRowNumber()-Ee;_t===0||(_t===1?Ee=ot.getRowNumber():ot.getRowNumber()>=w.getRowCount()?de[De]=null:Ee=ot.getRowNumber())}}getBarcodeMetadata(){let w=this.getCodewords(),E=new qn,M=new qn,z=new qn,W=new qn;for(let de of w){if(de==null)continue;de.setRowNumberAsRowIndicatorColumn();let Ee=de.getValue()%30,De=de.getRowNumber();switch(this._isLeft||(De+=2),De%3){case 0:M.setValue(Ee*3+1);break;case 1:W.setValue(Ee/3),z.setValue(Ee%3);break;case 2:E.setValue(Ee+1);break}}if(E.getValue().length===0||M.getValue().length===0||z.getValue().length===0||W.getValue().length===0||E.getValue()[0]<1||M.getValue()[0]+z.getValue()[0]<Or.MIN_ROWS_IN_BARCODE||M.getValue()[0]+z.getValue()[0]>Or.MAX_ROWS_IN_BARCODE)return null;let J=new lt(E.getValue()[0],M.getValue()[0],z.getValue()[0],W.getValue()[0]);return this.removeIncorrectCodewords(w,J),J}removeIncorrectCodewords(w,E){for(let M=0;M<w.length;M++){let z=w[M];if(w[M]==null)continue;let W=z.getValue()%30,J=z.getRowNumber();if(J>E.getRowCount()){w[M]=null;continue}switch(this._isLeft||(J+=2),J%3){case 0:W*3+1!==E.getRowCountUpperPart()&&(w[M]=null);break;case 1:(Math.trunc(W/3)!==E.getErrorCorrectionLevel()||W%3!==E.getRowCountLowerPart())&&(w[M]=null);break;case 2:W+1!==E.getColumnCount()&&(w[M]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
`+super.toString()}}class jr{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=Or.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 M=this.detectionResultColumns[E].getCodewords();for(let z=0;z<M.length;z++)M[z]!=null&&(M[z].hasValidRowNumber()||this.adjustRowNumbers(E,z,M))}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 M=0;M<w.length;M++)if(w[M]!=null&&E[M]!=null&&w[M].getRowNumber()===E[M].getRowNumber())for(let z=1;z<=this.barcodeColumnCount;z++){let W=this.detectionResultColumns[z].getCodewords()[M];W!=null&&(W.setRowNumber(w[M].getRowNumber()),W.hasValidRowNumber()||(this.detectionResultColumns[z].getCodewords()[M]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let w=0,E=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let M=0;M<E.length;M++){if(E[M]==null)continue;let z=E[M].getRowNumber(),W=0;for(let J=this.barcodeColumnCount+1;J>0&&W<this.ADJUST_ROW_NUMBER_SKIP;J--){let de=this.detectionResultColumns[J].getCodewords()[M];de!=null&&(W=jr.adjustRowNumberIfValid(z,W,de),de.hasValidRowNumber()||w++)}}return w}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let w=0,E=this.detectionResultColumns[0].getCodewords();for(let M=0;M<E.length;M++){if(E[M]==null)continue;let z=E[M].getRowNumber(),W=0;for(let J=1;J<this.barcodeColumnCount+1&&W<this.ADJUST_ROW_NUMBER_SKIP;J++){let de=this.detectionResultColumns[J].getCodewords()[M];de!=null&&(W=jr.adjustRowNumberIfValid(z,W,de),de.hasValidRowNumber()||w++)}}return w}static adjustRowNumberIfValid(w,E,M){return M==null||M.hasValidRowNumber()||(M.isValidRowNumber(w)?(M.setRowNumber(w),E=0):++E),E}adjustRowNumbers(w,E,M){if(!this.detectionResultColumns[w-1])return;let z=M[E],W=this.detectionResultColumns[w-1].getCodewords(),J=W;this.detectionResultColumns[w+1]!=null&&(J=this.detectionResultColumns[w+1].getCodewords());let de=new Array(14);de[2]=W[E],de[3]=J[E],E>0&&(de[0]=M[E-1],de[4]=W[E-1],de[5]=J[E-1]),E>1&&(de[8]=M[E-2],de[10]=W[E-2],de[11]=J[E-2]),E<M.length-1&&(de[1]=M[E+1],de[6]=W[E+1],de[7]=J[E+1]),E<M.length-2&&(de[9]=M[E+2],de[12]=W[E+2],de[13]=J[E+2]);for(let Ee of de)if(jr.adjustRowNumber(z,Ee))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 Ct;for(let M=0;M<w.getCodewords().length;M++){E.format("CW %3d:",M);for(let z=0;z<this.barcodeColumnCount+2;z++){if(this.detectionResultColumns[z]==null){E.format(" | ");continue}let W=this.detectionResultColumns[z].getCodewords()[M];if(W==null){E.format(" | ");continue}E.format(" %3d|%3d",W.getRowNumber(),W.getValue())}E.format("%n")}return E.toString()}}class Fr{constructor(w,E,M,z){this.rowNumber=Fr.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(w),this.endX=Math.trunc(E),this.bucket=Math.trunc(M),this.value=Math.trunc(z)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(w){return w!==Fr.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}}Fr.BARCODE_ROW_UNKNOWN=-1;class nr{static initialize(){for(let w=0;w<Or.SYMBOL_TABLE.length;w++){let E=Or.SYMBOL_TABLE[w],M=E&1;for(let z=0;z<Or.BARS_IN_MODULE;z++){let W=0;for(;(E&1)===M;)W+=1,E>>=1;M=E&1,nr.RATIOS_TABLE[w]||(nr.RATIOS_TABLE[w]=new Array(Or.BARS_IN_MODULE)),nr.RATIOS_TABLE[w][Or.BARS_IN_MODULE-z-1]=Math.fround(W/Or.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(w){let E=nr.getDecodedCodewordValue(nr.sampleBitCounts(w));return E!==-1?E:nr.getClosestDecodedValue(w)}static sampleBitCounts(w){let E=yt.sum(w),M=new Int32Array(Or.BARS_IN_MODULE),z=0,W=0;for(let J=0;J<Or.MODULES_IN_CODEWORD;J++){let de=E/(2*Or.MODULES_IN_CODEWORD)+J*E/Or.MODULES_IN_CODEWORD;W+w[z]<=de&&(W+=w[z],z++),M[z]++}return M}static getDecodedCodewordValue(w){let E=nr.getBitValue(w);return Or.getCodeword(E)===-1?-1:E}static getBitValue(w){let E=0;for(let M=0;M<w.length;M++)for(let z=0;z<w[M];z++)E=E<<1|(M%2===0?1:0);return Math.trunc(E)}static getClosestDecodedValue(w){let E=yt.sum(w),M=new Array(Or.BARS_IN_MODULE);if(E>1)for(let J=0;J<M.length;J++)M[J]=Math.fround(w[J]/E);let z=Kt.MAX_VALUE,W=-1;this.bSymbolTableReady||nr.initialize();for(let J=0;J<nr.RATIOS_TABLE.length;J++){let de=0,Ee=nr.RATIOS_TABLE[J];for(let De=0;De<Or.BARS_IN_MODULE;De++){let ot=Math.fround(Ee[De]-M[De]);if(de+=Math.fround(ot*ot),de>=z)break}de<z&&(z=de,W=Or.SYMBOL_TABLE[J])}return W}}nr.bSymbolTableReady=!1,nr.RATIOS_TABLE=new Array(Or.SYMBOL_TABLE.length).map(St=>new Array(Or.BARS_IN_MODULE));class vr{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 Yr{static parseLong(w,E=void 0){return parseInt(w,E)}}class dr extends u{}dr.kind="NullPointerException";class rs{writeBytes(w){this.writeBytesOffset(w,0,w.length)}writeBytesOffset(w,E,M){if(w==null)throw new dr;if(E<0||E>w.length||M<0||E+M>w.length||E+M<0)throw new C;if(M===0)return;for(let z=0;z<M;z++)this.write(w[E+z])}flush(){}close(){}}class gs extends u{}class ms extends rs{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 M=this.buf.length<<1;if(M-w<0&&(M=w),M<0){if(w<0)throw new gs;M=I.MAX_VALUE}this.buf=T.copyOfUint8Array(this.buf,M)}write(w){this.ensureCapacity(this.count+1),this.buf[this.count]=w,this.count+=1}writeBytesOffset(w,E,M){if(E<0||E>w.length||M<0||E+M-w.length>0)throw new C;this.ensureCapacity(this.count+M),v.arraycopy(w,E,this.buf,this.count,M),this.count+=M}writeTo(w){w.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return T.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 At;(function(St){St[St.ALPHA=0]="ALPHA",St[St.LOWER=1]="LOWER",St[St.MIXED=2]="MIXED",St[St.PUNCT=3]="PUNCT",St[St.ALPHA_SHIFT=4]="ALPHA_SHIFT",St[St.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(At||(At={}));function pt(){if(typeof window<"u")return window.BigInt||null;if(typeof Lu<"u")return Lu.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let le;function Me(St){if(typeof le>"u"&&(le=pt()),le===null)throw new Error("BigInt is not supported!");return le(St)}function ft(){let St=[];St[0]=Me(1);let w=Me(900);St[1]=w;for(let E=2;E<16;E++)St[E]=St[E-1]*w;return St}class ut{static decode(w,E){let M=new te(""),z=Y.ISO8859_1;M.enableDecoding(z);let W=1,J=w[W++],de=new vr;for(;W<w[0];){switch(J){case ut.TEXT_COMPACTION_MODE_LATCH:W=ut.textCompaction(w,W,M);break;case ut.BYTE_COMPACTION_MODE_LATCH:case ut.BYTE_COMPACTION_MODE_LATCH_6:W=ut.byteCompaction(J,w,z,W,M);break;case ut.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:M.append(w[W++]);break;case ut.NUMERIC_COMPACTION_MODE_LATCH:W=ut.numericCompaction(w,W,M);break;case ut.ECI_CHARSET:Y.getCharacterSetECIByValue(w[W++]);break;case ut.ECI_GENERAL_PURPOSE:W+=2;break;case ut.ECI_USER_DEFINED:W++;break;case ut.BEGIN_MACRO_PDF417_CONTROL_BLOCK:W=ut.decodeMacroBlock(w,W,de);break;case ut.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ut.MACRO_PDF417_TERMINATOR:throw new O;default:W--,W=ut.textCompaction(w,W,M);break}if(W<w.length)J=w[W++];else throw O.getFormatInstance()}if(M.length()===0)throw O.getFormatInstance();let Ee=new Fe(null,M.toString(),null,E);return Ee.setOther(de),Ee}static decodeMacroBlock(w,E,M){if(E+ut.NUMBER_OF_SEQUENCE_CODEWORDS>w[0])throw O.getFormatInstance();let z=new Int32Array(ut.NUMBER_OF_SEQUENCE_CODEWORDS);for(let de=0;de<ut.NUMBER_OF_SEQUENCE_CODEWORDS;de++,E++)z[de]=w[E];M.setSegmentIndex(I.parseInt(ut.decodeBase900toBase10(z,ut.NUMBER_OF_SEQUENCE_CODEWORDS)));let W=new te;E=ut.textCompaction(w,E,W),M.setFileId(W.toString());let J=-1;for(w[E]===ut.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(J=E+1);E<w[0];)switch(w[E]){case ut.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(E++,w[E]){case ut.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let de=new te;E=ut.textCompaction(w,E+1,de),M.setFileName(de.toString());break;case ut.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let Ee=new te;E=ut.textCompaction(w,E+1,Ee),M.setSender(Ee.toString());break;case ut.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let De=new te;E=ut.textCompaction(w,E+1,De),M.setAddressee(De.toString());break;case ut.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let ot=new te;E=ut.numericCompaction(w,E+1,ot),M.setSegmentCount(I.parseInt(ot.toString()));break;case ut.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let _t=new te;E=ut.numericCompaction(w,E+1,_t),M.setTimestamp(Yr.parseLong(_t.toString()));break;case ut.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let zt=new te;E=ut.numericCompaction(w,E+1,zt),M.setChecksum(I.parseInt(zt.toString()));break;case ut.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let gn=new te;E=ut.numericCompaction(w,E+1,gn),M.setFileSize(Yr.parseLong(gn.toString()));break;default:throw O.getFormatInstance()}break;case ut.MACRO_PDF417_TERMINATOR:E++,M.setLastSegment(!0);break;default:throw O.getFormatInstance()}if(J!==-1){let de=E-J;M.isLastSegment()&&de--,M.setOptionalData(T.copyOfRange(w,J,J+de))}return E}static textCompaction(w,E,M){let z=new Int32Array((w[0]-E)*2),W=new Int32Array((w[0]-E)*2),J=0,de=!1;for(;E<w[0]&&!de;){let Ee=w[E++];if(Ee<ut.TEXT_COMPACTION_MODE_LATCH)z[J]=Ee/30,z[J+1]=Ee%30,J+=2;else switch(Ee){case ut.TEXT_COMPACTION_MODE_LATCH:z[J++]=ut.TEXT_COMPACTION_MODE_LATCH;break;case ut.BYTE_COMPACTION_MODE_LATCH:case ut.BYTE_COMPACTION_MODE_LATCH_6:case ut.NUMERIC_COMPACTION_MODE_LATCH:case ut.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ut.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ut.MACRO_PDF417_TERMINATOR:E--,de=!0;break;case ut.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:z[J]=ut.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,Ee=w[E++],W[J]=Ee,J++;break}}return ut.decodeTextCompaction(z,W,J,M),E}static decodeTextCompaction(w,E,M,z){let W=At.ALPHA,J=At.ALPHA,de=0;for(;de<M;){let Ee=w[de],De="";switch(W){case At.ALPHA:if(Ee<26)De=String.fromCharCode(65+Ee);else switch(Ee){case 26:De=" ";break;case ut.LL:W=At.LOWER;break;case ut.ML:W=At.MIXED;break;case ut.PS:J=W,W=At.PUNCT_SHIFT;break;case ut.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:z.append(E[de]);break;case ut.TEXT_COMPACTION_MODE_LATCH:W=At.ALPHA;break}break;case At.LOWER:if(Ee<26)De=String.fromCharCode(97+Ee);else switch(Ee){case 26:De=" ";break;case ut.AS:J=W,W=At.ALPHA_SHIFT;break;case ut.ML:W=At.MIXED;break;case ut.PS:J=W,W=At.PUNCT_SHIFT;break;case ut.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:z.append(E[de]);break;case ut.TEXT_COMPACTION_MODE_LATCH:W=At.ALPHA;break}break;case At.MIXED:if(Ee<ut.PL)De=ut.MIXED_CHARS[Ee];else switch(Ee){case ut.PL:W=At.PUNCT;break;case 26:De=" ";break;case ut.LL:W=At.LOWER;break;case ut.AL:W=At.ALPHA;break;case ut.PS:J=W,W=At.PUNCT_SHIFT;break;case ut.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:z.append(E[de]);break;case ut.TEXT_COMPACTION_MODE_LATCH:W=At.ALPHA;break}break;case At.PUNCT:if(Ee<ut.PAL)De=ut.PUNCT_CHARS[Ee];else switch(Ee){case ut.PAL:W=At.ALPHA;break;case ut.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:z.append(E[de]);break;case ut.TEXT_COMPACTION_MODE_LATCH:W=At.ALPHA;break}break;case At.ALPHA_SHIFT:if(W=J,Ee<26)De=String.fromCharCode(65+Ee);else switch(Ee){case 26:De=" ";break;case ut.TEXT_COMPACTION_MODE_LATCH:W=At.ALPHA;break}break;case At.PUNCT_SHIFT:if(W=J,Ee<ut.PAL)De=ut.PUNCT_CHARS[Ee];else switch(Ee){case ut.PAL:W=At.ALPHA;break;case ut.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:z.append(E[de]);break;case ut.TEXT_COMPACTION_MODE_LATCH:W=At.ALPHA;break}break}De!==""&&z.append(De),de++}}static byteCompaction(w,E,M,z,W){let J=new ms,de=0,Ee=0,De=!1;switch(w){case ut.BYTE_COMPACTION_MODE_LATCH:let ot=new Int32Array(6),_t=E[z++];for(;z<E[0]&&!De;)switch(ot[de++]=_t,Ee=900*Ee+_t,_t=E[z++],_t){case ut.TEXT_COMPACTION_MODE_LATCH:case ut.BYTE_COMPACTION_MODE_LATCH:case ut.NUMERIC_COMPACTION_MODE_LATCH:case ut.BYTE_COMPACTION_MODE_LATCH_6:case ut.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ut.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ut.MACRO_PDF417_TERMINATOR:z--,De=!0;break;default:if(de%5===0&&de>0){for(let zt=0;zt<6;++zt)J.write(Number(Me(Ee)>>Me(8*(5-zt))));Ee=0,de=0}break}z===E[0]&&_t<ut.TEXT_COMPACTION_MODE_LATCH&&(ot[de++]=_t);for(let zt=0;zt<de;zt++)J.write(ot[zt]);break;case ut.BYTE_COMPACTION_MODE_LATCH_6:for(;z<E[0]&&!De;){let zt=E[z++];if(zt<ut.TEXT_COMPACTION_MODE_LATCH)de++,Ee=900*Ee+zt;else switch(zt){case ut.TEXT_COMPACTION_MODE_LATCH:case ut.BYTE_COMPACTION_MODE_LATCH:case ut.NUMERIC_COMPACTION_MODE_LATCH:case ut.BYTE_COMPACTION_MODE_LATCH_6:case ut.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ut.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ut.MACRO_PDF417_TERMINATOR:z--,De=!0;break}if(de%5===0&&de>0){for(let gn=0;gn<6;++gn)J.write(Number(Me(Ee)>>Me(8*(5-gn))));Ee=0,de=0}}break}return W.append(Q.decode(J.toByteArray(),M)),z}static numericCompaction(w,E,M){let z=0,W=!1,J=new Int32Array(ut.MAX_NUMERIC_CODEWORDS);for(;E<w[0]&&!W;){let de=w[E++];if(E===w[0]&&(W=!0),de<ut.TEXT_COMPACTION_MODE_LATCH)J[z]=de,z++;else switch(de){case ut.TEXT_COMPACTION_MODE_LATCH:case ut.BYTE_COMPACTION_MODE_LATCH:case ut.BYTE_COMPACTION_MODE_LATCH_6:case ut.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ut.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ut.MACRO_PDF417_TERMINATOR:E--,W=!0;break}(z%ut.MAX_NUMERIC_CODEWORDS===0||de===ut.NUMERIC_COMPACTION_MODE_LATCH||W)&&z>0&&(M.append(ut.decodeBase900toBase10(J,z)),z=0)}return E}static decodeBase900toBase10(w,E){let M=Me(0);for(let W=0;W<E;W++)M+=ut.EXP900[E-W-1]*Me(w[W]);let z=M.toString();if(z.charAt(0)!=="1")throw new O;return z.substring(1)}}ut.TEXT_COMPACTION_MODE_LATCH=900,ut.BYTE_COMPACTION_MODE_LATCH=901,ut.NUMERIC_COMPACTION_MODE_LATCH=902,ut.BYTE_COMPACTION_MODE_LATCH_6=924,ut.ECI_USER_DEFINED=925,ut.ECI_GENERAL_PURPOSE=926,ut.ECI_CHARSET=927,ut.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,ut.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,ut.MACRO_PDF417_TERMINATOR=922,ut.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,ut.MAX_NUMERIC_CODEWORDS=15,ut.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,ut.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,ut.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,ut.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,ut.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,ut.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,ut.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,ut.PL=25,ut.LL=27,ut.AS=27,ut.ML=28,ut.AL=28,ut.PS=29,ut.PAL=29,ut.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
-.$/"|*()?{}'`,ut.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",ut.EXP900=pt()?ft():[],ut.NUMBER_OF_SEQUENCE_CODEWORDS=2;class on{constructor(){}static decode(w,E,M,z,W,J,de){let Ee=new hr(w,E,M,z,W),De=null,ot=null,_t;for(let Tt=!0;;Tt=!1){if(E!=null&&(De=on.getRowIndicatorColumn(w,Ee,E,!0,J,de)),z!=null&&(ot=on.getRowIndicatorColumn(w,Ee,z,!1,J,de)),_t=on.merge(De,ot),_t==null)throw G.getNotFoundInstance();let Zt=_t.getBoundingBox();if(Tt&&Zt!=null&&(Zt.getMinY()<Ee.getMinY()||Zt.getMaxY()>Ee.getMaxY()))Ee=Zt;else break}_t.setBoundingBox(Ee);let zt=_t.getBarcodeColumnCount()+1;_t.setDetectionResultColumn(0,De),_t.setDetectionResultColumn(zt,ot);let gn=De!=null;for(let Tt=1;Tt<=zt;Tt++){let Zt=gn?Tt:zt-Tt;if(_t.getDetectionResultColumn(Zt)!==void 0)continue;let sn;Zt===0||Zt===zt?sn=new _r(Ee,Zt===0):sn=new On(Ee),_t.setDetectionResultColumn(Zt,sn);let $n=-1,Cr=$n;for(let kr=Ee.getMinY();kr<=Ee.getMaxY();kr++){if($n=on.getStartColumn(_t,Zt,kr,gn),$n<0||$n>Ee.getMaxX()){if(Cr===-1)continue;$n=Cr}let Pr=on.detectCodeword(w,Ee.getMinX(),Ee.getMaxX(),gn,$n,kr,J,de);Pr!=null&&(sn.setCodeword(kr,Pr),Cr=$n,J=Math.min(J,Pr.getWidth()),de=Math.max(de,Pr.getWidth()))}}return on.createDecoderResult(_t)}static merge(w,E){if(w==null&&E==null)return null;let M=on.getBarcodeMetadata(w,E);if(M==null)return null;let z=hr.merge(on.adjustBoundingBox(w),on.adjustBoundingBox(E));return new jr(M,z)}static adjustBoundingBox(w){if(w==null)return null;let E=w.getRowHeights();if(E==null)return null;let M=on.getMax(E),z=0;for(let de of E)if(z+=M-de,de>0)break;let W=w.getCodewords();for(let de=0;z>0&&W[de]==null;de++)z--;let J=0;for(let de=E.length-1;de>=0&&(J+=M-E[de],!(E[de]>0));de--);for(let de=W.length-1;J>0&&W[de]==null;de--)J--;return w.getBoundingBox().addMissingRows(z,J,w.isLeft())}static getMax(w){let E=-1;for(let M of w)E=Math.max(E,M);return E}static getBarcodeMetadata(w,E){let M;if(w==null||(M=w.getBarcodeMetadata())==null)return E==null?null:E.getBarcodeMetadata();let z;return E==null||(z=E.getBarcodeMetadata())==null?M:M.getColumnCount()!==z.getColumnCount()&&M.getErrorCorrectionLevel()!==z.getErrorCorrectionLevel()&&M.getRowCount()!==z.getRowCount()?null:M}static getRowIndicatorColumn(w,E,M,z,W,J){let de=new _r(E,z);for(let Ee=0;Ee<2;Ee++){let De=Ee===0?1:-1,ot=Math.trunc(Math.trunc(M.getX()));for(let _t=Math.trunc(Math.trunc(M.getY()));_t<=E.getMaxY()&&_t>=E.getMinY();_t+=De){let zt=on.detectCodeword(w,0,w.getWidth(),z,ot,_t,W,J);zt!=null&&(de.setCodeword(_t,zt),z?ot=zt.getStartX():ot=zt.getEndX())}}return de}static adjustCodewordCount(w,E){let M=E[0][1],z=M.getValue(),W=w.getBarcodeColumnCount()*w.getBarcodeRowCount()-on.getNumberOfECCodeWords(w.getBarcodeECLevel());if(z.length===0){if(W<1||W>Or.MAX_CODEWORDS_IN_BARCODE)throw G.getNotFoundInstance();M.setValue(W)}else z[0]!==W&&M.setValue(W)}static createDecoderResult(w){let E=on.createBarcodeMatrix(w);on.adjustCodewordCount(w,E);let M=new Array,z=new Int32Array(w.getBarcodeRowCount()*w.getBarcodeColumnCount()),W=[],J=new Array;for(let Ee=0;Ee<w.getBarcodeRowCount();Ee++)for(let De=0;De<w.getBarcodeColumnCount();De++){let ot=E[Ee][De+1].getValue(),_t=Ee*w.getBarcodeColumnCount()+De;ot.length===0?M.push(_t):ot.length===1?z[_t]=ot[0]:(J.push(_t),W.push(ot))}let de=new Array(W.length);for(let Ee=0;Ee<de.length;Ee++)de[Ee]=W[Ee];return on.createDecoderResultFromAmbiguousValues(w.getBarcodeECLevel(),z,Or.toIntArray(M),Or.toIntArray(J),de)}static createDecoderResultFromAmbiguousValues(w,E,M,z,W){let J=new Int32Array(z.length),de=100;for(;de-- >0;){for(let Ee=0;Ee<J.length;Ee++)E[z[Ee]]=W[Ee][J[Ee]];try{return on.decodeCodewords(E,w,M)}catch(Ee){if(!(Ee instanceof g))throw Ee}if(J.length===0)throw g.getChecksumInstance();for(let Ee=0;Ee<J.length;Ee++)if(J[Ee]<W[Ee].length-1){J[Ee]++;break}else if(J[Ee]=0,Ee===J.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 z=0;z<E.length;z++)for(let W=0;W<E[z].length;W++)E[z][W]=new qn;let M=0;for(let z of w.getDetectionResultColumns()){if(z!=null){for(let W of z.getCodewords())if(W!=null){let J=W.getRowNumber();if(J>=0){if(J>=E.length)continue;E[J][M].setValue(W.getValue())}}}M++}return E}static isValidBarcodeColumn(w,E){return E>=0&&E<=w.getBarcodeColumnCount()+1}static getStartColumn(w,E,M,z){let W=z?1:-1,J=null;if(on.isValidBarcodeColumn(w,E-W)&&(J=w.getDetectionResultColumn(E-W).getCodeword(M)),J!=null)return z?J.getEndX():J.getStartX();if(J=w.getDetectionResultColumn(E).getCodewordNearby(M),J!=null)return z?J.getStartX():J.getEndX();if(on.isValidBarcodeColumn(w,E-W)&&(J=w.getDetectionResultColumn(E-W).getCodewordNearby(M)),J!=null)return z?J.getEndX():J.getStartX();let de=0;for(;on.isValidBarcodeColumn(w,E-W);){E-=W;for(let Ee of w.getDetectionResultColumn(E).getCodewords())if(Ee!=null)return(z?Ee.getEndX():Ee.getStartX())+W*de*(Ee.getEndX()-Ee.getStartX());de++}return z?w.getBoundingBox().getMinX():w.getBoundingBox().getMaxX()}static detectCodeword(w,E,M,z,W,J,de,Ee){W=on.adjustCodewordStartColumn(w,E,M,z,W,J);let De=on.getModuleBitCount(w,E,M,z,W,J);if(De==null)return null;let ot,_t=yt.sum(De);if(z)ot=W+_t;else{for(let Tt=0;Tt<De.length/2;Tt++){let Zt=De[Tt];De[Tt]=De[De.length-1-Tt],De[De.length-1-Tt]=Zt}ot=W,W=ot-_t}if(!on.checkCodewordSkew(_t,de,Ee))return null;let zt=nr.getDecodedValue(De),gn=Or.getCodeword(zt);return gn===-1?null:new Fr(W,ot,on.getCodewordBucketNumber(zt),gn)}static getModuleBitCount(w,E,M,z,W,J){let de=W,Ee=new Int32Array(8),De=0,ot=z?1:-1,_t=z;for(;(z?de<M:de>=E)&&De<Ee.length;)w.get(de,J)===_t?(Ee[De]++,de+=ot):(De++,_t=!_t);return De===Ee.length||de===(z?M:E)&&De===Ee.length-1?Ee:null}static getNumberOfECCodeWords(w){return 2<<w}static adjustCodewordStartColumn(w,E,M,z,W,J){let de=W,Ee=z?-1:1;for(let De=0;De<2;De++){for(;(z?de>=E:de<M)&&z===w.get(de,J);){if(Math.abs(W-de)>on.CODEWORD_SKEW_SIZE)return W;de+=Ee}Ee=-Ee,z=!z}return de}static checkCodewordSkew(w,E,M){return E-on.CODEWORD_SKEW_SIZE<=w&&w<=M+on.CODEWORD_SKEW_SIZE}static decodeCodewords(w,E,M){if(w.length===0)throw O.getFormatInstance();let z=1<<E+1,W=on.correctErrors(w,M,z);on.verifyCodewordCount(w,z);let J=ut.decode(w,""+E);return J.setErrorsCorrected(W),J.setErasures(M.length),J}static correctErrors(w,E,M){if(E!=null&&E.length>M/2+on.MAX_ERRORS||M<0||M>on.MAX_EC_CODEWORDS)throw g.getChecksumInstance();return on.errorCorrection.decode(w,M,E)}static verifyCodewordCount(w,E){if(w.length<4)throw O.getFormatInstance();let M=w[0];if(M>w.length)throw O.getFormatInstance();if(M===0)if(E<w.length)w[0]=w.length-E;else throw O.getFormatInstance()}static getBitCountForCodeword(w){let E=new Int32Array(8),M=0,z=E.length-1;for(;!((w&1)!==M&&(M=w&1,z--,z<0));)E[z]++,w>>=1;return E}static getCodewordBucketNumber(w){return w instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(w):this.getCodewordBucketNumber_number(w)}static getCodewordBucketNumber_number(w){return on.getCodewordBucketNumber(on.getBitCountForCodeword(w))}static getCodewordBucketNumber_Int32Array(w){return(w[0]-w[2]+w[4]-w[6]+9)%9}static toString(w){let E=new Ct;for(let M=0;M<w.length;M++){E.format("Row %2d: ",M);for(let z=0;z<w[M].length;z++){let W=w[M][z];W.getValue().length===0?E.format(" ",null):E.format("%4d(%2d)",W.getValue()[0],W.getConfidence(W.getValue()[0]))}E.format("%n")}return E.toString()}}on.CODEWORD_SKEW_SIZE=2,on.MAX_ERRORS=3,on.MAX_EC_CODEWORDS=512,on.errorCorrection=new yr;class bn{decode(w,E=null){let M=bn.decode(w,E,!1);if(M==null||M.length===0||M[0]==null)throw G.getNotFoundInstance();return M[0]}decodeMultiple(w,E=null){try{return bn.decode(w,E,!0)}catch(M){throw M instanceof O||M instanceof g?G.getNotFoundInstance():M}}static decode(w,E,M){const z=new Array,W=nn.detectMultiple(w,E,M);for(const J of W.getPoints()){const de=on.decode(W.getBits(),J[4],J[5],J[6],J[7],bn.getMinCodewordWidth(J),bn.getMaxCodewordWidth(J)),Ee=new ge(de.getText(),de.getRawBytes(),void 0,J,be.PDF_417);Ee.putMetadata(je.ERROR_CORRECTION_LEVEL,de.getECLevel());const De=de.getOther();De!=null&&Ee.putMetadata(je.PDF417_EXTRA_METADATA,De),z.push(Ee)}return z.map(J=>J)}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?I.MAX_VALUE:Math.trunc(Math.abs(w.getX()-E.getX()))}static getMaxCodewordWidth(w){return Math.floor(Math.max(Math.max(bn.getMaxWidth(w[0],w[4]),bn.getMaxWidth(w[6],w[2])*Or.MODULES_IN_CODEWORD/Or.MODULES_IN_STOP_PATTERN),Math.max(bn.getMaxWidth(w[1],w[5]),bn.getMaxWidth(w[7],w[3])*Or.MODULES_IN_CODEWORD/Or.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(w){return Math.floor(Math.min(Math.min(bn.getMinWidth(w[0],w[4]),bn.getMinWidth(w[6],w[2])*Or.MODULES_IN_CODEWORD/Or.MODULES_IN_STOP_PATTERN),Math.min(bn.getMinWidth(w[1],w[5]),bn.getMinWidth(w[7],w[3])*Or.MODULES_IN_CODEWORD/Or.MODULES_IN_STOP_PATTERN)))}reset(){}}class Gn extends u{}Gn.kind="ReaderException";class rr{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,M=r(w)?null:w.get($.POSSIBLE_FORMATS),z=new Array;if(!r(M)){const W=M.some(J=>J===be.UPC_A||J===be.UPC_E||J===be.EAN_13||J===be.EAN_8||J===be.CODABAR||J===be.CODE_39||J===be.CODE_93||J===be.CODE_128||J===be.ITF||J===be.RSS_14||J===be.RSS_EXPANDED);W&&!E&&z.push(new k(w,this.verbose)),M.includes(be.QR_CODE)&&z.push(new Gr),M.includes(be.DATA_MATRIX)&&z.push(new Oe),M.includes(be.AZTEC)&&z.push(new wn),M.includes(be.PDF_417)&&z.push(new bn),W&&E&&z.push(new k(w,this.verbose))}z.length===0&&(E||z.push(new k(w,this.verbose)),z.push(new Gr),z.push(new Oe),z.push(new wn),z.push(new bn),E&&z.push(new k(w,this.verbose))),this.readers=z}reset(){if(this.readers!==null)for(const w of this.readers)w.reset()}decodeInternal(w){if(this.readers===null)throw new Gn("No readers where selected, nothing can be read.");for(const E of this.readers)try{return E.decode(w,this.hints)}catch(M){if(M instanceof Gn)continue}throw new G("No MultiFormat Readers were able to detect the code.")}}class Jn extends Se{constructor(w=null,E=500){const M=new rr;M.setHints(w),super(M,E)}decodeBitmap(w){return this.reader.decodeWithState(w)}}class Xn extends Se{constructor(w=500){super(new bn,w)}}class Zr extends Se{constructor(w=500){super(new Gr,w)}}var $r;(function(St){St[St.ERROR_CORRECTION=0]="ERROR_CORRECTION",St[St.CHARACTER_SET=1]="CHARACTER_SET",St[St.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",St[St.MIN_SIZE=3]="MIN_SIZE",St[St.MAX_SIZE=4]="MAX_SIZE",St[St.MARGIN=5]="MARGIN",St[St.PDF417_COMPACT=6]="PDF417_COMPACT",St[St.PDF417_COMPACTION=7]="PDF417_COMPACTION",St[St.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",St[St.AZTEC_LAYERS=9]="AZTEC_LAYERS",St[St.QR_VERSION=10]="QR_VERSION"})($r||($r={}));var wr=$r;class pr{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 M=E[E.length-1];const z=this.field;for(let W=E.length;W<=w;W++){const J=M.multiply(new Qe(z,Int32Array.from([1,z.exp(W-1+z.getGeneratorBase())])));E.push(J),M=J}}return E[w]}encode(w,E){if(E===0)throw new f("No error correction bytes");const M=w.length-E;if(M<=0)throw new f("No data bytes provided");const z=this.buildGenerator(E),W=new Int32Array(M);v.arraycopy(w,0,W,0,M);let J=new Qe(this.field,W);J=J.multiplyByMonomial(E,1);const Ee=J.divide(z)[1].getCoefficients(),De=E-Ee.length;for(let ot=0;ot<De;ot++)w[M+ot]=0;v.arraycopy(Ee,0,w,M+De,Ee.length)}}class ar{constructor(){}static applyMaskPenaltyRule1(w){return ar.applyMaskPenaltyRule1Internal(w,!0)+ar.applyMaskPenaltyRule1Internal(w,!1)}static applyMaskPenaltyRule2(w){let E=0;const M=w.getArray(),z=w.getWidth(),W=w.getHeight();for(let J=0;J<W-1;J++){const de=M[J];for(let Ee=0;Ee<z-1;Ee++){const De=de[Ee];De===de[Ee+1]&&De===M[J+1][Ee]&&De===M[J+1][Ee+1]&&E++}}return ar.N2*E}static applyMaskPenaltyRule3(w){let E=0;const M=w.getArray(),z=w.getWidth(),W=w.getHeight();for(let J=0;J<W;J++)for(let de=0;de<z;de++){const Ee=M[J];de+6<z&&Ee[de]===1&&Ee[de+1]===0&&Ee[de+2]===1&&Ee[de+3]===1&&Ee[de+4]===1&&Ee[de+5]===0&&Ee[de+6]===1&&(ar.isWhiteHorizontal(Ee,de-4,de)||ar.isWhiteHorizontal(Ee,de+7,de+11))&&E++,J+6<W&&M[J][de]===1&&M[J+1][de]===0&&M[J+2][de]===1&&M[J+3][de]===1&&M[J+4][de]===1&&M[J+5][de]===0&&M[J+6][de]===1&&(ar.isWhiteVertical(M,de,J-4,J)||ar.isWhiteVertical(M,de,J+7,J+11))&&E++}return E*ar.N3}static isWhiteHorizontal(w,E,M){E=Math.max(E,0),M=Math.min(M,w.length);for(let z=E;z<M;z++)if(w[z]===1)return!1;return!0}static isWhiteVertical(w,E,M,z){M=Math.max(M,0),z=Math.min(z,w.length);for(let W=M;W<z;W++)if(w[W][E]===1)return!1;return!0}static applyMaskPenaltyRule4(w){let E=0;const M=w.getArray(),z=w.getWidth(),W=w.getHeight();for(let Ee=0;Ee<W;Ee++){const De=M[Ee];for(let ot=0;ot<z;ot++)De[ot]===1&&E++}const J=w.getHeight()*w.getWidth();return Math.floor(Math.abs(E*2-J)*10/J)*ar.N4}static getDataMaskBit(w,E,M){let z,W;switch(w){case 0:z=M+E&1;break;case 1:z=M&1;break;case 2:z=E%3;break;case 3:z=(M+E)%3;break;case 4:z=Math.floor(M/2)+Math.floor(E/3)&1;break;case 5:W=M*E,z=(W&1)+W%3;break;case 6:W=M*E,z=(W&1)+W%3&1;break;case 7:W=M*E,z=W%3+(M+E&1)&1;break;default:throw new f("Invalid mask pattern: "+w)}return z===0}static applyMaskPenaltyRule1Internal(w,E){let M=0;const z=E?w.getHeight():w.getWidth(),W=E?w.getWidth():w.getHeight(),J=w.getArray();for(let de=0;de<z;de++){let Ee=0,De=-1;for(let ot=0;ot<W;ot++){const _t=E?J[de][ot]:J[ot][de];_t===De?Ee++:(Ee>=5&&(M+=ar.N1+(Ee-5)),Ee=1,De=_t)}Ee>=5&&(M+=ar.N1+(Ee-5))}return M}}ar.N1=3,ar.N2=3,ar.N3=40,ar.N4=10;class Vr{constructor(w,E){this.width=w,this.height=E;const M=new Array(E);for(let z=0;z!==E;z++)M[z]=new Uint8Array(w);this.bytes=M}getHeight(){return this.height}getWidth(){return this.width}get(w,E){return this.bytes[E][w]}getArray(){return this.bytes}setNumber(w,E,M){this.bytes[E][w]=M}setBoolean(w,E,M){this.bytes[E][w]=M?1:0}clear(w){for(const E of this.bytes)T.fill(E,w)}equals(w){if(!(w instanceof Vr))return!1;const E=w;if(this.width!==E.width||this.height!==E.height)return!1;for(let M=0,z=this.height;M<z;++M){const W=this.bytes[M],J=E.bytes[M];for(let de=0,Ee=this.width;de<Ee;++de)if(W[de]!==J[de])return!1}return!0}toString(){const w=new te;for(let E=0,M=this.height;E<M;++E){const z=this.bytes[E];for(let W=0,J=this.width;W<J;++W)switch(z[W]){case 0:w.append(" 0");break;case 1:w.append(" 1");break;default:w.append(" ");break}w.append(`
`)}return w.toString()}}class Ur{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<Ur.NUM_MASK_PATTERNS}}Ur.NUM_MASK_PATTERNS=8;class bs extends u{}bs.kind="WriterException";class Sr{constructor(){}static clearMatrix(w){w.clear(255)}static buildMatrix(w,E,M,z,W){Sr.clearMatrix(W),Sr.embedBasicPatterns(M,W),Sr.embedTypeInfo(E,z,W),Sr.maybeEmbedVersionInfo(M,W),Sr.embedDataBits(w,z,W)}static embedBasicPatterns(w,E){Sr.embedPositionDetectionPatternsAndSeparators(E),Sr.embedDarkDotAtLeftBottomCorner(E),Sr.maybeEmbedPositionAdjustmentPatterns(w,E),Sr.embedTimingPatterns(E)}static embedTypeInfo(w,E,M){const z=new L;Sr.makeTypeInfoBits(w,E,z);for(let W=0,J=z.getSize();W<J;++W){const de=z.get(z.getSize()-1-W),Ee=Sr.TYPE_INFO_COORDINATES[W],De=Ee[0],ot=Ee[1];if(M.setBoolean(De,ot,de),W<8){const _t=M.getWidth()-W-1;M.setBoolean(_t,8,de)}else{const zt=M.getHeight()-7+(W-8);M.setBoolean(8,zt,de)}}}static maybeEmbedVersionInfo(w,E){if(w.getVersionNumber()<7)return;const M=new L;Sr.makeVersionInfoBits(w,M);let z=6*3-1;for(let W=0;W<6;++W)for(let J=0;J<3;++J){const de=M.get(z);z--,E.setBoolean(W,E.getHeight()-11+J,de),E.setBoolean(E.getHeight()-11+J,W,de)}}static embedDataBits(w,E,M){let z=0,W=-1,J=M.getWidth()-1,de=M.getHeight()-1;for(;J>0;){for(J===6&&(J-=1);de>=0&&de<M.getHeight();){for(let Ee=0;Ee<2;++Ee){const De=J-Ee;if(!Sr.isEmpty(M.get(De,de)))continue;let ot;z<w.getSize()?(ot=w.get(z),++z):ot=!1,E!==255&&ar.getDataMaskBit(E,De,de)&&(ot=!ot),M.setBoolean(De,de,ot)}de+=W}W=-W,de+=W,J-=2}if(z!==w.getSize())throw new bs("Not all bits consumed: "+z+"/"+w.getSize())}static findMSBSet(w){return 32-I.numberOfLeadingZeros(w)}static calculateBCHCode(w,E){if(E===0)throw new f("0 polynomial");const M=Sr.findMSBSet(E);for(w<<=M-1;Sr.findMSBSet(w)>=M;)w^=E<<Sr.findMSBSet(w)-M;return w}static makeTypeInfoBits(w,E,M){if(!Ur.isValidMaskPattern(E))throw new bs("Invalid mask pattern");const z=w.getBits()<<3|E;M.appendBits(z,5);const W=Sr.calculateBCHCode(z,Sr.TYPE_INFO_POLY);M.appendBits(W,10);const J=new L;if(J.appendBits(Sr.TYPE_INFO_MASK_PATTERN,15),M.xor(J),M.getSize()!==15)throw new bs("should not happen but we got: "+M.getSize())}static makeVersionInfoBits(w,E){E.appendBits(w.getVersionNumber(),6);const M=Sr.calculateBCHCode(w.getVersionNumber(),Sr.VERSION_INFO_POLY);if(E.appendBits(M,12),E.getSize()!==18)throw new bs("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 M=(E+1)%2;Sr.isEmpty(w.get(E,6))&&w.setNumber(E,6,M),Sr.isEmpty(w.get(6,E))&&w.setNumber(6,E,M)}}static embedDarkDotAtLeftBottomCorner(w){if(w.get(8,w.getHeight()-8)===0)throw new bs;w.setNumber(8,w.getHeight()-8,1)}static embedHorizontalSeparationPattern(w,E,M){for(let z=0;z<8;++z){if(!Sr.isEmpty(M.get(w+z,E)))throw new bs;M.setNumber(w+z,E,0)}}static embedVerticalSeparationPattern(w,E,M){for(let z=0;z<7;++z){if(!Sr.isEmpty(M.get(w,E+z)))throw new bs;M.setNumber(w,E+z,0)}}static embedPositionAdjustmentPattern(w,E,M){for(let z=0;z<5;++z){const W=Sr.POSITION_ADJUSTMENT_PATTERN[z];for(let J=0;J<5;++J)M.setNumber(w+J,E+z,W[J])}}static embedPositionDetectionPattern(w,E,M){for(let z=0;z<7;++z){const W=Sr.POSITION_DETECTION_PATTERN[z];for(let J=0;J<7;++J)M.setNumber(w+J,E+z,W[J])}}static embedPositionDetectionPatternsAndSeparators(w){const E=Sr.POSITION_DETECTION_PATTERN[0].length;Sr.embedPositionDetectionPattern(0,0,w),Sr.embedPositionDetectionPattern(w.getWidth()-E,0,w),Sr.embedPositionDetectionPattern(0,w.getWidth()-E,w);const M=8;Sr.embedHorizontalSeparationPattern(0,M-1,w),Sr.embedHorizontalSeparationPattern(w.getWidth()-M,M-1,w),Sr.embedHorizontalSeparationPattern(0,w.getWidth()-M,w);const z=7;Sr.embedVerticalSeparationPattern(z,0,w),Sr.embedVerticalSeparationPattern(w.getHeight()-z-1,0,w),Sr.embedVerticalSeparationPattern(z,w.getHeight()-z,w)}static maybeEmbedPositionAdjustmentPatterns(w,E){if(w.getVersionNumber()<2)return;const M=w.getVersionNumber()-1,z=Sr.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[M];for(let W=0,J=z.length;W!==J;W++){const de=z[W];if(de>=0)for(let Ee=0;Ee!==J;Ee++){const De=z[Ee];De>=0&&Sr.isEmpty(E.get(De,de))&&Sr.embedPositionAdjustmentPattern(De-2,de-2,E)}}}}Sr.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])]),Sr.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])]),Sr.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])]),Sr.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])]),Sr.VERSION_INFO_POLY=7973,Sr.TYPE_INFO_POLY=1335,Sr.TYPE_INFO_MASK_PATTERN=21522;class Pn{constructor(w,E){this.dataBytes=w,this.errorCorrectionBytes=E}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Ln{constructor(){}static calculateMaskPenalty(w){return ar.applyMaskPenaltyRule1(w)+ar.applyMaskPenaltyRule2(w)+ar.applyMaskPenaltyRule3(w)+ar.applyMaskPenaltyRule4(w)}static encode(w,E,M=null){let z=Ln.DEFAULT_BYTE_MODE_ENCODING;const W=M!==null&&M.get(wr.CHARACTER_SET)!==void 0;W&&(z=M.get(wr.CHARACTER_SET).toString());const J=this.chooseMode(w,z),de=new L;if(J===pn.BYTE&&(W||Ln.DEFAULT_BYTE_MODE_ENCODING!==z)){const kr=Y.getCharacterSetECIByName(z);kr!==void 0&&this.appendECI(kr,de)}this.appendModeInfo(J,de);const Ee=new L;this.appendBytes(w,J,Ee,z);let De;if(M!==null&&M.get(wr.QR_VERSION)!==void 0){const kr=Number.parseInt(M.get(wr.QR_VERSION).toString(),10);De=Ze.getVersionForNumber(kr);const Pr=this.calculateBitsNeeded(J,de,Ee,De);if(!this.willFit(Pr,De,E))throw new bs("Data too big for requested version")}else De=this.recommendVersion(E,J,de,Ee);const ot=new L;ot.appendBitArray(de);const _t=J===pn.BYTE?Ee.getSizeInBytes():w.length;this.appendLengthInfo(_t,De,J,ot),ot.appendBitArray(Ee);const zt=De.getECBlocksForLevel(E),gn=De.getTotalCodewords()-zt.getTotalECCodewords();this.terminateBits(gn,ot);const Tt=this.interleaveWithECBytes(ot,De.getTotalCodewords(),gn,zt.getNumBlocks()),Zt=new Ur;Zt.setECLevel(E),Zt.setMode(J),Zt.setVersion(De);const sn=De.getDimensionForVersion(),$n=new Vr(sn,sn),Cr=this.chooseMaskPattern(Tt,E,De,$n);return Zt.setMaskPattern(Cr),Sr.buildMatrix(Tt,E,De,Cr,$n),Zt.setMatrix($n),Zt}static recommendVersion(w,E,M,z){const W=this.calculateBitsNeeded(E,M,z,Ze.getVersionForNumber(1)),J=this.chooseVersion(W,w),de=this.calculateBitsNeeded(E,M,z,J);return this.chooseVersion(de,w)}static calculateBitsNeeded(w,E,M,z){return E.getSize()+w.getCharacterCountBits(z)+M.getSize()}static getAlphanumericCode(w){return w<Ln.ALPHANUMERIC_TABLE.length?Ln.ALPHANUMERIC_TABLE[w]:-1}static chooseMode(w,E=null){if(Y.SJIS.getName()===E&&this.isOnlyDoubleByteKanji(w))return pn.KANJI;let M=!1,z=!1;for(let W=0,J=w.length;W<J;++W){const de=w.charAt(W);if(Ln.isDigit(de))M=!0;else if(this.getAlphanumericCode(de.charCodeAt(0))!==-1)z=!0;else return pn.BYTE}return z?pn.ALPHANUMERIC:M?pn.NUMERIC:pn.BYTE}static isOnlyDoubleByteKanji(w){let E;try{E=Q.encode(w,Y.SJIS)}catch{return!1}const M=E.length;if(M%2!==0)return!1;for(let z=0;z<M;z+=2){const W=E[z]&255;if((W<129||W>159)&&(W<224||W>235))return!1}return!0}static chooseMaskPattern(w,E,M,z){let W=Number.MAX_SAFE_INTEGER,J=-1;for(let de=0;de<Ur.NUM_MASK_PATTERNS;de++){Sr.buildMatrix(w,E,M,de,z);let Ee=this.calculateMaskPenalty(z);Ee<W&&(W=Ee,J=de)}return J}static chooseVersion(w,E){for(let M=1;M<=40;M++){const z=Ze.getVersionForNumber(M);if(Ln.willFit(w,z,E))return z}throw new bs("Data too big")}static willFit(w,E,M){const z=E.getTotalCodewords(),J=E.getECBlocksForLevel(M).getTotalECCodewords(),de=z-J,Ee=(w+7)/8;return de>=Ee}static terminateBits(w,E){const M=w*8;if(E.getSize()>M)throw new bs("data bits cannot fit in the QR Code"+E.getSize()+" > "+M);for(let J=0;J<4&&E.getSize()<M;++J)E.appendBit(!1);const z=E.getSize()&7;if(z>0)for(let J=z;J<8;J++)E.appendBit(!1);const W=w-E.getSizeInBytes();for(let J=0;J<W;++J)E.appendBits(J&1?17:236,8);if(E.getSize()!==M)throw new bs("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(w,E,M,z,W,J){if(z>=M)throw new bs("Block ID too large");const de=w%M,Ee=M-de,De=Math.floor(w/M),ot=De+1,_t=Math.floor(E/M),zt=_t+1,gn=De-_t,Tt=ot-zt;if(gn!==Tt)throw new bs("EC bytes mismatch");if(M!==Ee+de)throw new bs("RS blocks mismatch");if(w!==(_t+gn)*Ee+(zt+Tt)*de)throw new bs("Total bytes mismatch");z<Ee?(W[0]=_t,J[0]=gn):(W[0]=zt,J[0]=Tt)}static interleaveWithECBytes(w,E,M,z){if(w.getSizeInBytes()!==M)throw new bs("Number of bits and data bytes does not match");let W=0,J=0,de=0;const Ee=new Array;for(let ot=0;ot<z;++ot){const _t=new Int32Array(1),zt=new Int32Array(1);Ln.getNumDataBytesAndNumECBytesForBlockID(E,M,z,ot,_t,zt);const gn=_t[0],Tt=new Uint8Array(gn);w.toBytes(8*W,Tt,0,gn);const Zt=Ln.generateECBytes(Tt,zt[0]);Ee.push(new Pn(Tt,Zt)),J=Math.max(J,gn),de=Math.max(de,Zt.length),W+=_t[0]}if(M!==W)throw new bs("Data bytes does not match offset");const De=new L;for(let ot=0;ot<J;++ot)for(const _t of Ee){const zt=_t.getDataBytes();ot<zt.length&&De.appendBits(zt[ot],8)}for(let ot=0;ot<de;++ot)for(const _t of Ee){const zt=_t.getErrorCorrectionBytes();ot<zt.length&&De.appendBits(zt[ot],8)}if(E!==De.getSizeInBytes())throw new bs("Interleaving error: "+E+" and "+De.getSizeInBytes()+" differ.");return De}static generateECBytes(w,E){const M=w.length,z=new Int32Array(M+E);for(let J=0;J<M;J++)z[J]=w[J]&255;new pr(dt.QR_CODE_FIELD_256).encode(z,E);const W=new Uint8Array(E);for(let J=0;J<E;J++)W[J]=z[M+J];return W}static appendModeInfo(w,E){E.appendBits(w.getBits(),4)}static appendLengthInfo(w,E,M,z){const W=M.getCharacterCountBits(E);if(w>=1<<W)throw new bs(w+" is bigger than "+((1<<W)-1));z.appendBits(w,W)}static appendBytes(w,E,M,z){switch(E){case pn.NUMERIC:Ln.appendNumericBytes(w,M);break;case pn.ALPHANUMERIC:Ln.appendAlphanumericBytes(w,M);break;case pn.BYTE:Ln.append8BitBytes(w,M,z);break;case pn.KANJI:Ln.appendKanjiBytes(w,M);break;default:throw new bs("Invalid mode: "+E)}}static getDigit(w){return w.charCodeAt(0)-48}static isDigit(w){const E=Ln.getDigit(w);return E>=0&&E<=9}static appendNumericBytes(w,E){const M=w.length;let z=0;for(;z<M;){const W=Ln.getDigit(w.charAt(z));if(z+2<M){const J=Ln.getDigit(w.charAt(z+1)),de=Ln.getDigit(w.charAt(z+2));E.appendBits(W*100+J*10+de,10),z+=3}else if(z+1<M){const J=Ln.getDigit(w.charAt(z+1));E.appendBits(W*10+J,7),z+=2}else E.appendBits(W,4),z++}}static appendAlphanumericBytes(w,E){const M=w.length;let z=0;for(;z<M;){const W=Ln.getAlphanumericCode(w.charCodeAt(z));if(W===-1)throw new bs;if(z+1<M){const J=Ln.getAlphanumericCode(w.charCodeAt(z+1));if(J===-1)throw new bs;E.appendBits(W*45+J,11),z+=2}else E.appendBits(W,6),z++}}static append8BitBytes(w,E,M){let z;try{z=Q.encode(w,M)}catch(W){throw new bs(W)}for(let W=0,J=z.length;W!==J;W++){const de=z[W];E.appendBits(de,8)}}static appendKanjiBytes(w,E){let M;try{M=Q.encode(w,Y.SJIS)}catch(W){throw new bs(W)}const z=M.length;for(let W=0;W<z;W+=2){const J=M[W]&255,de=M[W+1]&255,Ee=J<<8&4294967295|de;let De=-1;if(Ee>=33088&&Ee<=40956?De=Ee-33088:Ee>=57408&&Ee<=60351&&(De=Ee-49472),De===-1)throw new bs("Invalid byte sequence");const ot=(De>>8)*192+(De&255);E.appendBits(ot,13)}}static appendECI(w,E){E.appendBits(pn.ECI.getBits(),4),E.appendBits(w.getValue(),8)}}Ln.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]),Ln.DEFAULT_BYTE_MODE_ENCODING=Y.UTF8.getName();class ht{write(w,E,M,z=null){if(w.length===0)throw new f("Found empty contents");if(E<0||M<0)throw new f("Requested dimensions are too small: "+E+"x"+M);let W=he.L,J=ht.QUIET_ZONE_SIZE;z!==null&&(z.get(wr.ERROR_CORRECTION)!==void 0&&(W=he.fromString(z.get(wr.ERROR_CORRECTION).toString())),z.get(wr.MARGIN)!==void 0&&(J=Number.parseInt(z.get(wr.MARGIN).toString(),10)));const de=Ln.encode(w,W,z);return this.renderResult(de,E,M,J)}writeToDom(w,E,M,z,W=null){typeof w=="string"&&(w=document.querySelector(w));const J=this.write(E,M,z,W);w&&w.appendChild(J)}renderResult(w,E,M,z){const W=w.getMatrix();if(W===null)throw new at;const J=W.getWidth(),de=W.getHeight(),Ee=J+z*2,De=de+z*2,ot=Math.max(E,Ee),_t=Math.max(M,De),zt=Math.min(Math.floor(ot/Ee),Math.floor(_t/De)),gn=Math.floor((ot-J*zt)/2),Tt=Math.floor((_t-de*zt)/2),Zt=this.createSVGElement(ot,_t);for(let sn=0,$n=Tt;sn<de;sn++,$n+=zt)for(let Cr=0,kr=gn;Cr<J;Cr++,kr+=zt)if(W.get(Cr,sn)===1){const Pr=this.createSvgRectElement(kr,$n,zt,zt);Zt.appendChild(Pr)}return Zt}createSVGElement(w,E){const M=document.createElementNS(ht.SVG_NS,"svg");return M.setAttributeNS(null,"height",w.toString()),M.setAttributeNS(null,"width",E.toString()),M}createSvgRectElement(w,E,M,z){const W=document.createElementNS(ht.SVG_NS,"rect");return W.setAttributeNS(null,"x",w.toString()),W.setAttributeNS(null,"y",E.toString()),W.setAttributeNS(null,"height",M.toString()),W.setAttributeNS(null,"width",z.toString()),W.setAttributeNS(null,"fill","#000000"),W}}ht.QUIET_ZONE_SIZE=4,ht.SVG_NS="http://www.w3.org/2000/svg";class Yt{encode(w,E,M,z,W){if(w.length===0)throw new f("Found empty contents");if(E!==be.QR_CODE)throw new f("Can only encode QR_CODE, but got "+E);if(M<0||z<0)throw new f(`Requested dimensions are too small: ${M}x${z}`);let J=he.L,de=Yt.QUIET_ZONE_SIZE;W!==null&&(W.get(wr.ERROR_CORRECTION)!==void 0&&(J=he.fromString(W.get(wr.ERROR_CORRECTION).toString())),W.get(wr.MARGIN)!==void 0&&(de=Number.parseInt(W.get(wr.MARGIN).toString(),10)));const Ee=Ln.encode(w,J,W);return Yt.renderResult(Ee,M,z,de)}static renderResult(w,E,M,z){const W=w.getMatrix();if(W===null)throw new at;const J=W.getWidth(),de=W.getHeight(),Ee=J+z*2,De=de+z*2,ot=Math.max(E,Ee),_t=Math.max(M,De),zt=Math.min(Math.floor(ot/Ee),Math.floor(_t/De)),gn=Math.floor((ot-J*zt)/2),Tt=Math.floor((_t-de*zt)/2),Zt=new fe(ot,_t);for(let sn=0,$n=Tt;sn<de;sn++,$n+=zt)for(let Cr=0,kr=gn;Cr<J;Cr++,kr+=zt)W.get(Cr,sn)===1&&Zt.setRegion(kr,$n,zt,zt);return Zt}}Yt.QUIET_ZONE_SIZE=4;class lr{encode(w,E,M,z,W){let J;switch(E){case be.QR_CODE:J=new Yt;break;default:throw new f("No encoder available for format "+E)}return J.encode(w,E,M,z,W)}}class sr extends K{constructor(w,E,M,z,W,J,de,Ee){if(super(J,de),this.yuvData=w,this.dataWidth=E,this.dataHeight=M,this.left=z,this.top=W,z+J>E||W+de>M)throw new f("Crop rectangle does not fit within image data.");Ee&&this.reverseHorizontal(J,de)}getRow(w,E){if(w<0||w>=this.getHeight())throw new f("Requested row is outside the image: "+w);const M=this.getWidth();(E==null||E.length<M)&&(E=new Uint8ClampedArray(M));const z=(w+this.top)*this.dataWidth+this.left;return v.arraycopy(this.yuvData,z,E,0,M),E}getMatrix(){const w=this.getWidth(),E=this.getHeight();if(w===this.dataWidth&&E===this.dataHeight)return this.yuvData;const M=w*E,z=new Uint8ClampedArray(M);let W=this.top*this.dataWidth+this.left;if(w===this.dataWidth)return v.arraycopy(this.yuvData,W,z,0,M),z;for(let J=0;J<E;J++){const de=J*w;v.arraycopy(this.yuvData,W,z,de,w),W+=this.dataWidth}return z}isCropSupported(){return!0}crop(w,E,M,z){return new sr(this.yuvData,this.dataWidth,this.dataHeight,this.left+w,this.top+E,M,z,!1)}renderThumbnail(){const w=this.getWidth()/sr.THUMBNAIL_SCALE_FACTOR,E=this.getHeight()/sr.THUMBNAIL_SCALE_FACTOR,M=new Int32Array(w*E),z=this.yuvData;let W=this.top*this.dataWidth+this.left;for(let J=0;J<E;J++){const de=J*w;for(let Ee=0;Ee<w;Ee++){const De=z[W+Ee*sr.THUMBNAIL_SCALE_FACTOR]&255;M[de+Ee]=4278190080|De*65793}W+=this.dataWidth*sr.THUMBNAIL_SCALE_FACTOR}return M}getThumbnailWidth(){return this.getWidth()/sr.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/sr.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(w,E){const M=this.yuvData;for(let z=0,W=this.top*this.dataWidth+this.left;z<E;z++,W+=this.dataWidth){const J=W+w/2;for(let de=W,Ee=W+w-1;de<J;de++,Ee--){const De=M[de];M[de]=M[Ee],M[Ee]=De}}}invert(){return new H(this)}}sr.THUMBNAIL_SCALE_FACTOR=2;class Mr extends K{constructor(w,E,M,z,W,J,de){if(super(E,M),this.dataWidth=z,this.dataHeight=W,this.left=J,this.top=de,w.BYTES_PER_ELEMENT===4){const Ee=E*M,De=new Uint8ClampedArray(Ee);for(let ot=0;ot<Ee;ot++){const _t=w[ot],zt=_t>>16&255,gn=_t>>7&510,Tt=_t&255;De[ot]=(zt+gn+Tt)/4&255}this.luminances=De}else this.luminances=w;if(z===void 0&&(this.dataWidth=E),W===void 0&&(this.dataHeight=M),J===void 0&&(this.left=0),de===void 0&&(this.top=0),this.left+E>this.dataWidth||this.top+M>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 M=this.getWidth();(E==null||E.length<M)&&(E=new Uint8ClampedArray(M));const z=(w+this.top)*this.dataWidth+this.left;return v.arraycopy(this.luminances,z,E,0,M),E}getMatrix(){const w=this.getWidth(),E=this.getHeight();if(w===this.dataWidth&&E===this.dataHeight)return this.luminances;const M=w*E,z=new Uint8ClampedArray(M);let W=this.top*this.dataWidth+this.left;if(w===this.dataWidth)return v.arraycopy(this.luminances,W,z,0,M),z;for(let J=0;J<E;J++){const de=J*w;v.arraycopy(this.luminances,W,z,de,w),W+=this.dataWidth}return z}isCropSupported(){return!0}crop(w,E,M,z){return new Mr(this.luminances,M,z,this.dataWidth,this.dataHeight,this.left+w,this.top+E)}invert(){return new H(this)}}class Lr extends Y{static forName(w){return this.getCharacterSetECIByName(w)}}class ss{}ss.ISO_8859_1=Y.ISO8859_1;class ys{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 Bt{static singletonList(w){return[w]}static min(w,E){return w.sort(E)[0]}}class mr{constructor(w){this.previous=w}getPrevious(){return this.previous}}class er extends mr{constructor(w,E,M){super(w),this.value=E,this.bitCount=M}appendTo(w,E){w.appendBits(this.value,this.bitCount)}add(w,E){return new er(this,w,E)}addBinaryShift(w,E){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new er(this,w,E)}toString(){let w=this.value&(1<<this.bitCount)-1;return w|=1<<this.bitCount,"<"+I.toBinaryString(w|1<<this.bitCount).substring(1)+">"}}class qr extends er{constructor(w,E,M){super(w,0,0),this.binaryShiftStart=E,this.binaryShiftByteCount=M}appendTo(w,E){for(let M=0;M<this.binaryShiftByteCount;M++)(M===0||M===31&&this.binaryShiftByteCount<=62)&&(w.appendBits(31,5),this.binaryShiftByteCount>62?w.appendBits(this.binaryShiftByteCount-31,16):M===0?w.appendBits(Math.min(this.binaryShiftByteCount,31),5):w.appendBits(this.binaryShiftByteCount-31,5)),w.appendBits(E[this.binaryShiftStart+M],8)}addBinaryShift(w,E){return new qr(this,w,E)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function xs(St,w,E){return new qr(St,w,E)}function ls(St,w,E){return new er(St,w,E)}const hs=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],vs=0,vi=1,Ps=2,As=3,Ts=4,mc=new er(null,0,0),Ls=[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 Pa(St){for(let w of St)T.fill(w,-1);return St[vs][Ts]=0,St[vi][Ts]=0,St[vi][vs]=28,St[As][Ts]=0,St[Ps][Ts]=0,St[Ps][vs]=15,St}const Wu=Pa(T.createInt32Array(6,6));class Sa{constructor(w,E,M,z){this.token=w,this.mode=E,this.binaryShiftByteCount=M,this.bitCount=z}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(w,E){let M=this.bitCount,z=this.token;if(w!==this.mode){let J=Ls[this.mode][w];z=ls(z,J&65535,J>>16),M+=J>>16}let W=w===Ps?4:5;return z=ls(z,E,W),new Sa(z,w,0,M+W)}shiftAndAppend(w,E){let M=this.token,z=this.mode===Ps?4:5;return M=ls(M,Wu[this.mode][w],z),M=ls(M,E,5),new Sa(M,this.mode,0,this.bitCount+z+5)}addBinaryShiftChar(w){let E=this.token,M=this.mode,z=this.bitCount;if(this.mode===Ts||this.mode===Ps){let de=Ls[M][vs];E=ls(E,de&65535,de>>16),z+=de>>16,M=vs}let W=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,J=new Sa(E,M,this.binaryShiftByteCount+1,z+W);return J.binaryShiftByteCount===2078&&(J=J.endBinaryShift(w+1)),J}endBinaryShift(w){if(this.binaryShiftByteCount===0)return this;let E=this.token;return E=xs(E,w-this.binaryShiftByteCount,this.binaryShiftByteCount),new Sa(E,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(w){let E=this.bitCount+(Ls[this.mode][w.mode]>>16);return this.binaryShiftByteCount<w.binaryShiftByteCount?E+=Sa.calculateBinaryShiftCost(w)-Sa.calculateBinaryShiftCost(this):this.binaryShiftByteCount>w.binaryShiftByteCount&&w.binaryShiftByteCount>0&&(E+=10),E<=w.bitCount}toBitArray(w){let E=[];for(let z=this.endBinaryShift(w.length).token;z!==null;z=z.getPrevious())E.unshift(z);let M=new L;for(const z of E)z.appendTo(M,w);return M}toString(){return q.format("%s bits=%d bytes=%d",hs[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(w){return w.binaryShiftByteCount>62?21:w.binaryShiftByteCount>31?20:w.binaryShiftByteCount>0?10:0}}Sa.INITIAL_STATE=new Sa(mc,vs,0,0);function Xo(St){const w=q.getCharCode(" "),E=q.getCharCode("."),M=q.getCharCode(",");St[vs][w]=1;const z=q.getCharCode("Z"),W=q.getCharCode("A");for(let zt=W;zt<=z;zt++)St[vs][zt]=zt-W+2;St[vi][w]=1;const J=q.getCharCode("z"),de=q.getCharCode("a");for(let zt=de;zt<=J;zt++)St[vi][zt]=zt-de+2;St[Ps][w]=1;const Ee=q.getCharCode("9"),De=q.getCharCode("0");for(let zt=De;zt<=Ee;zt++)St[Ps][zt]=zt-De+2;St[Ps][M]=12,St[Ps][E]=13;const ot=["\0"," ","","","","","","","\x07","\b"," ",`
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let zt=0;zt<ot.length;zt++)St[As][q.getCharCode(ot[zt])]=zt;const _t=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let zt=0;zt<_t.length;zt++)q.getCharCode(_t[zt])>0&&(St[Ts][q.getCharCode(_t[zt])]=zt);return St}const qu=Xo(T.createInt32Array(5,256));class Ql{constructor(w){this.text=w}encode(){const w=q.getCharCode(" "),E=q.getCharCode(`
`);let M=Bt.singletonList(Sa.INITIAL_STATE);for(let W=0;W<this.text.length;W++){let J,de=W+1<this.text.length?this.text[W+1]:0;switch(this.text[W]){case q.getCharCode("\r"):J=de===E?2:0;break;case q.getCharCode("."):J=de===w?3:0;break;case q.getCharCode(","):J=de===w?4:0;break;case q.getCharCode(":"):J=de===w?5:0;break;default:J=0}J>0?(M=Ql.updateStateListForPair(M,W,J),W++):M=this.updateStateListForChar(M,W)}return Bt.min(M,(W,J)=>W.getBitCount()-J.getBitCount()).toBitArray(this.text)}updateStateListForChar(w,E){const M=[];for(let z of w)this.updateStateForChar(z,E,M);return Ql.simplifyStates(M)}updateStateForChar(w,E,M){let z=this.text[E]&255,W=qu[w.getMode()][z]>0,J=null;for(let de=0;de<=Ts;de++){let Ee=qu[de][z];if(Ee>0){if(J==null&&(J=w.endBinaryShift(E)),!W||de===w.getMode()||de===Ps){const De=J.latchAndAppend(de,Ee);M.push(De)}if(!W&&Wu[w.getMode()][de]>=0){const De=J.shiftAndAppend(de,Ee);M.push(De)}}}if(w.getBinaryShiftByteCount()>0||qu[w.getMode()][z]===0){let de=w.addBinaryShiftChar(E);M.push(de)}}static updateStateListForPair(w,E,M){const z=[];for(let W of w)this.updateStateForPair(W,E,M,z);return this.simplifyStates(z)}static updateStateForPair(w,E,M,z){let W=w.endBinaryShift(E);if(z.push(W.latchAndAppend(Ts,M)),w.getMode()!==Ts&&z.push(W.shiftAndAppend(Ts,M)),M===3||M===4){let J=W.latchAndAppend(Ps,16-M).latchAndAppend(Ps,1);z.push(J)}if(w.getBinaryShiftByteCount()>0){let J=w.addBinaryShiftChar(E).addBinaryShiftChar(E+1);z.push(J)}}static simplifyStates(w){let E=[];for(const M of w){let z=!0;for(const W of E){if(W.isBetterThanOrEqualTo(M)){z=!1;break}M.isBetterThanOrEqualTo(W)&&(E=E.filter(J=>J!==W))}z&&E.push(M)}return E}}class Ci{constructor(){}static encodeBytes(w){return Ci.encode(w,Ci.DEFAULT_EC_PERCENT,Ci.DEFAULT_AZTEC_LAYERS)}static encode(w,E,M){let z=new Ql(w).encode(),W=I.truncDivision(z.getSize()*E,100)+11,J=z.getSize()+W,de,Ee,De,ot,_t;if(M!==Ci.DEFAULT_AZTEC_LAYERS){if(de=M<0,Ee=Math.abs(M),Ee>(de?Ci.MAX_NB_BITS_COMPACT:Ci.MAX_NB_BITS))throw new f(q.format("Illegal value %s for layers",M));De=Ci.totalBitsInLayer(Ee,de),ot=Ci.WORD_SIZE[Ee];let Pr=De-De%ot;if(_t=Ci.stuffBits(z,ot),_t.getSize()+W>Pr)throw new f("Data to large for user specified layer");if(de&&_t.getSize()>ot*64)throw new f("Data to large for user specified layer")}else{ot=0,_t=null;for(let Pr=0;;Pr++){if(Pr>Ci.MAX_NB_BITS)throw new f("Data too large for an Aztec code");if(de=Pr<=3,Ee=de?Pr+1:Pr,De=Ci.totalBitsInLayer(Ee,de),J>De)continue;(_t==null||ot!==Ci.WORD_SIZE[Ee])&&(ot=Ci.WORD_SIZE[Ee],_t=Ci.stuffBits(z,ot));let Is=De-De%ot;if(!(de&&_t.getSize()>ot*64)&&_t.getSize()+W<=Is)break}}let zt=Ci.generateCheckWords(_t,De,ot),gn=_t.getSize()/ot,Tt=Ci.generateModeMessage(de,Ee,gn),Zt=(de?11:14)+Ee*4,sn=new Int32Array(Zt),$n;if(de){$n=Zt;for(let Pr=0;Pr<sn.length;Pr++)sn[Pr]=Pr}else{$n=Zt+1+2*I.truncDivision(I.truncDivision(Zt,2)-1,15);let Pr=I.truncDivision(Zt,2),Is=I.truncDivision($n,2);for(let ni=0;ni<Pr;ni++){let xc=ni+I.truncDivision(ni,15);sn[Pr-ni-1]=Is-xc-1,sn[Pr+ni]=Is+xc+1}}let Cr=new fe($n);for(let Pr=0,Is=0;Pr<Ee;Pr++){let ni=(Ee-Pr)*4+(de?9:12);for(let xc=0;xc<ni;xc++){let ao=xc*2;for(let oo=0;oo<2;oo++)zt.get(Is+ao+oo)&&Cr.set(sn[Pr*2+oo],sn[Pr*2+xc]),zt.get(Is+ni*2+ao+oo)&&Cr.set(sn[Pr*2+xc],sn[Zt-1-Pr*2-oo]),zt.get(Is+ni*4+ao+oo)&&Cr.set(sn[Zt-1-Pr*2-oo],sn[Zt-1-Pr*2-xc]),zt.get(Is+ni*6+ao+oo)&&Cr.set(sn[Zt-1-Pr*2-xc],sn[Pr*2+oo])}Is+=ni*8}if(Ci.drawModeMessage(Cr,de,$n,Tt),de)Ci.drawBullsEye(Cr,I.truncDivision($n,2),5);else{Ci.drawBullsEye(Cr,I.truncDivision($n,2),7);for(let Pr=0,Is=0;Pr<I.truncDivision(Zt,2)-1;Pr+=15,Is+=16)for(let ni=I.truncDivision($n,2)&1;ni<$n;ni+=2)Cr.set(I.truncDivision($n,2)-Is,ni),Cr.set(I.truncDivision($n,2)+Is,ni),Cr.set(ni,I.truncDivision($n,2)-Is),Cr.set(ni,I.truncDivision($n,2)+Is)}let kr=new ys;return kr.setCompact(de),kr.setSize($n),kr.setLayers(Ee),kr.setCodeWords(gn),kr.setMatrix(Cr),kr}static drawBullsEye(w,E,M){for(let z=0;z<M;z+=2)for(let W=E-z;W<=E+z;W++)w.set(W,E-z),w.set(W,E+z),w.set(E-z,W),w.set(E+z,W);w.set(E-M,E-M),w.set(E-M+1,E-M),w.set(E-M,E-M+1),w.set(E+M,E-M),w.set(E+M,E-M+1),w.set(E+M,E+M-1)}static generateModeMessage(w,E,M){let z=new L;return w?(z.appendBits(E-1,2),z.appendBits(M-1,6),z=Ci.generateCheckWords(z,28,4)):(z.appendBits(E-1,5),z.appendBits(M-1,11),z=Ci.generateCheckWords(z,40,4)),z}static drawModeMessage(w,E,M,z){let W=I.truncDivision(M,2);if(E)for(let J=0;J<7;J++){let de=W-3+J;z.get(J)&&w.set(de,W-5),z.get(J+7)&&w.set(W+5,de),z.get(20-J)&&w.set(de,W+5),z.get(27-J)&&w.set(W-5,de)}else for(let J=0;J<10;J++){let de=W-5+J+I.truncDivision(J,5);z.get(J)&&w.set(de,W-7),z.get(J+10)&&w.set(W+7,de),z.get(29-J)&&w.set(de,W+7),z.get(39-J)&&w.set(W-7,de)}}static generateCheckWords(w,E,M){let z=w.getSize()/M,W=new pr(Ci.getGF(M)),J=I.truncDivision(E,M),de=Ci.bitsToWords(w,M,J);W.encode(de,J-z);let Ee=E%M,De=new L;De.appendBits(0,Ee);for(const ot of Array.from(de))De.appendBits(ot,M);return De}static bitsToWords(w,E,M){let z=new Int32Array(M),W,J;for(W=0,J=w.getSize()/E;W<J;W++){let de=0;for(let Ee=0;Ee<E;Ee++)de|=w.get(W*E+Ee)?1<<E-Ee-1:0;z[W]=de}return z}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 M=new L,z=w.getSize(),W=(1<<E)-2;for(let J=0;J<z;J+=E){let de=0;for(let Ee=0;Ee<E;Ee++)(J+Ee>=z||w.get(J+Ee))&&(de|=1<<E-1-Ee);(de&W)===W?(M.appendBits(de&W,E),J--):de&W?M.appendBits(de,E):(M.appendBits(de|1,E),J--)}return M}static totalBitsInLayer(w,E){return((E?88:112)+16*w)*w}}Ci.DEFAULT_EC_PERCENT=33,Ci.DEFAULT_AZTEC_LAYERS=0,Ci.MAX_NB_BITS=32,Ci.MAX_NB_BITS_COMPACT=4,Ci.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,M,z){return this.encodeWithHints(w,E,M,z,null)}encodeWithHints(w,E,M,z,W){let J=ss.ISO_8859_1,de=Ci.DEFAULT_EC_PERCENT,Ee=Ci.DEFAULT_AZTEC_LAYERS;return W!=null&&(W.has(wr.CHARACTER_SET)&&(J=Lr.forName(W.get(wr.CHARACTER_SET).toString())),W.has(wr.ERROR_CORRECTION)&&(de=I.parseInt(W.get(wr.ERROR_CORRECTION).toString())),W.has(wr.AZTEC_LAYERS)&&(Ee=I.parseInt(W.get(wr.AZTEC_LAYERS).toString()))),Ed.encodeLayers(w,E,M,z,J,de,Ee)}static encodeLayers(w,E,M,z,W,J,de){if(E!==be.AZTEC)throw new f("Can only encode AZTEC, but got "+E);let Ee=Ci.encode(q.getBytes(w,W),J,de);return Ed.renderResult(Ee,M,z)}static renderResult(w,E,M){let z=w.getMatrix();if(z==null)throw new at;let W=z.getWidth(),J=z.getHeight(),de=Math.max(E,W),Ee=Math.max(M,J),De=Math.min(de/W,Ee/J),ot=(de-W*De)/2,_t=(Ee-J*De)/2,zt=new fe(de,Ee);for(let gn=0,Tt=_t;gn<J;gn++,Tt+=De)for(let Zt=0,sn=ot;Zt<W;Zt++,sn+=De)z.get(Zt,gn)&&zt.setRegion(sn,Tt,De,De);return zt}}n.AbstractExpandedDecoder=It,n.ArgumentException=d,n.ArithmeticException=Ye,n.AztecCode=ys,n.AztecCodeReader=wn,n.AztecCodeWriter=Ed,n.AztecDecoder=vt,n.AztecDetector=Ut,n.AztecDetectorResult=vn,n.AztecEncoder=Ci,n.AztecHighLevelEncoder=Ql,n.AztecPoint=nt,n.BarcodeFormat=be,n.Binarizer=y,n.BinaryBitmap=x,n.BitArray=L,n.BitMatrix=fe,n.BitSource=me,n.BrowserAztecCodeReader=Jt,n.BrowserBarcodeReader=P,n.BrowserCodeReader=Se,n.BrowserDatamatrixCodeReader=$e,n.BrowserMultiFormatReader=Jn,n.BrowserPDF417Reader=Xn,n.BrowserQRCodeReader=Zr,n.BrowserQRCodeSvgWriter=ht,n.CharacterSetECI=Y,n.ChecksumException=g,n.Code128Reader=xt,n.Code39Reader=We,n.DataMatrixDecodedBitStreamParser=Ie,n.DataMatrixReader=Oe,n.DecodeHintType=$,n.DecoderResult=Fe,n.DefaultGridSampler=dn,n.DetectorResult=un,n.EAN13Reader=hn,n.EncodeHintType=wr,n.Exception=u,n.FormatException=O,n.GenericGF=dt,n.GenericGFPoly=Qe,n.GlobalHistogramBinarizer=ie,n.GridSampler=ln,n.GridSamplerInstance=rt,n.HTMLCanvasElementLuminanceSource=ee,n.HybridBinarizer=oe,n.ITFReader=Pt,n.IllegalArgumentException=f,n.IllegalStateException=at,n.InvertedLuminanceSource=H,n.LuminanceSource=K,n.MathUtils=yt,n.MultiFormatOneDReader=k,n.MultiFormatReader=rr,n.MultiFormatWriter=lr,n.NotFoundException=G,n.OneDReader=Vt,n.PDF417DecodedBitStreamParser=ut,n.PDF417DecoderErrorCorrection=yr,n.PDF417Reader=bn,n.PDF417ResultMetadata=vr,n.PerspectiveTransform=Nn,n.PlanarYUVLuminanceSource=sr,n.QRCodeByteMatrix=Vr,n.QRCodeDataMask=wt,n.QRCodeDecodedBitStreamParser=An,n.QRCodeDecoderErrorCorrectionLevel=he,n.QRCodeDecoderFormatInformation=Pe,n.QRCodeEncoder=Ln,n.QRCodeEncoderQRCode=Ur,n.QRCodeMaskUtil=ar,n.QRCodeMatrixUtil=Sr,n.QRCodeMode=pn,n.QRCodeReader=Gr,n.QRCodeVersion=Ze,n.QRCodeWriter=Yt,n.RGBLuminanceSource=Mr,n.RSS14Reader=A,n.RSSExpandedReader=p,n.ReaderException=Gn,n.ReedSolomonDecoder=He,n.ReedSolomonEncoder=pr,n.ReedSolomonException=st,n.Result=ge,n.ResultMetadataType=je,n.ResultPoint=jt,n.StringUtils=q,n.UnsupportedOperationException=re,n.VideoInputDevice=se,n.WhiteRectangleDetector=Hn,n.WriterException=bs,n.ZXingArrays=T,n.ZXingCharset=Lr,n.ZXingInteger=I,n.ZXingStandardCharsets=ss,n.ZXingStringBuilder=te,n.ZXingStringEncoding=Q,n.ZXingSystem=v,n.createAbstractExpandedDecoder=cn,Object.defineProperty(n,"__esModule",{value:!0})})}(f_,f_.exports)),f_.exports}var So=M$t();const L$t=Pi(So),R$t=RAe({__proto__:null,default:L$t},[So]);var B2e=function(){function t(e,n,r){if(this.formatMap=new Map([[Os.QR_CODE,So.BarcodeFormat.QR_CODE],[Os.AZTEC,So.BarcodeFormat.AZTEC],[Os.CODABAR,So.BarcodeFormat.CODABAR],[Os.CODE_39,So.BarcodeFormat.CODE_39],[Os.CODE_93,So.BarcodeFormat.CODE_93],[Os.CODE_128,So.BarcodeFormat.CODE_128],[Os.DATA_MATRIX,So.BarcodeFormat.DATA_MATRIX],[Os.MAXICODE,So.BarcodeFormat.MAXICODE],[Os.ITF,So.BarcodeFormat.ITF],[Os.EAN_13,So.BarcodeFormat.EAN_13],[Os.EAN_8,So.BarcodeFormat.EAN_8],[Os.PDF_417,So.BarcodeFormat.PDF_417],[Os.RSS_14,So.BarcodeFormat.RSS_14],[Os.RSS_EXPANDED,So.BarcodeFormat.RSS_EXPANDED],[Os.UPC_A,So.BarcodeFormat.UPC_A],[Os.UPC_E,So.BarcodeFormat.UPC_E],[Os.UPC_EAN_EXTENSION,So.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!R$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(So.DecodeHintType.POSSIBLE_FORMATS,s),a.set(So.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 So.MultiFormatReader(this.verbose,this.hints),r=new So.HTMLCanvasElementLuminanceSource(e),s=new So.BinaryBitmap(new So.HybridBinarizer(r)),a=n.decode(s);return{text:a.text,format:A$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}(),D$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())})},B$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}}},$2e=function(){function t(e,n,r){if(this.formatMap=new Map([[Os.QR_CODE,"qr_code"],[Os.AZTEC,"aztec"],[Os.CODABAR,"codabar"],[Os.CODE_39,"code_39"],[Os.CODE_93,"code_93"],[Os.CODE_128,"code_128"],[Os.DATA_MATRIX,"data_matrix"],[Os.ITF,"itf"],[Os.EAN_13,"ean_13"],[Os.EAN_8,"ean_8"],[Os.PDF_417,"pdf417"],[Os.UPC_A,"upc_a"],[Os.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 D$t(this,void 0,void 0,function(){var n,r;return B$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:A$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}(),U2e=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())})},z2e=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}}},$$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&&$2e.isSupported()?(this.primaryDecoder=new $2e(e,r,s),this.secondaryDecoder=new B2e(e,r,s)):this.primaryDecoder=new B2e(e,r,s)}return t.prototype.decodeAsync=function(e){return U2e(this,void 0,void 0,function(){var n;return z2e(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 U2e(this,void 0,void 0,function(){var n,r;return z2e(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}(),uue=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)}}(),YR=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())})},XR=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}}},E$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}(),U$t=function(t){uue(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}(E$e),z$t=function(t){uue(e,t);function e(n){return t.call(this,"zoom",n)||this}return e}(U$t),H$t=function(t){uue(e,t);function e(n){return t.call(this,"torch",n)||this}return e}(E$e),V$t=function(){function t(e){this.track=e}return t.prototype.zoomFeature=function(){return new z$t(this.track)},t.prototype.torchFeature=function(){return new H$t(this.track)},t}(),W$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 YR(this,void 0,void 0,function(){var a,o;return XR(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 YR(this,void 0,void 0,function(){return XR(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 V$t(this.getFirstTrackOrFail())},t}(),q$t=function(){function t(e){this.mediaStream=e}return t.prototype.render=function(e,n,r){return YR(this,void 0,void 0,function(){return XR(this,function(s){return[2,W$t.create(e,this.mediaStream,n,r)]})})},t.create=function(e){return YR(this,void 0,void 0,function(){var n,r;return XR(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}(),H2e=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())})},V2e=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}}},G$t=function(){function t(){}return t.failIfNotSupported=function(){return H2e(this,void 0,void 0,function(){return V2e(this,function(e){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new t]})})},t.prototype.create=function(e){return H2e(this,void 0,void 0,function(){return V2e(this,function(n){return[2,q$t.create(e)]})})},t}(),K$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())})},Y$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}}},X$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=f4.unableToQuerySupportedDevices();return t.isHttpsOrLocalhost()||(e=f4.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 K$t(this,void 0,void 0,function(){var e,n,r,s,a,o,l;return Y$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}(),sl;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.NOT_STARTED=1]="NOT_STARTED",t[t.SCANNING=2]="SCANNING",t[t.PAUSED=3]="PAUSED"})(sl||(sl={}));var Q$t=function(){function t(){this.state=sl.NOT_STARTED,this.onGoingTransactionNewState=sl.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===sl.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=sl.UNKNOWN,this.directTransition(e)},t.prototype.cancel=function(){if(this.onGoingTransactionNewState===sl.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=sl.UNKNOWN},t.prototype.getState=function(){return this.state},t.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==sl.UNKNOWN)throw"Cannot transition to a new state, already under transition"},t.prototype.validateTransition=function(e){switch(this.state){case sl.UNKNOWN:throw"Transition from unknown is not allowed";case sl.NOT_STARTED:this.failIfNewStateIs(e,[sl.PAUSED]);break;case sl.SCANNING:break;case sl.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}(),Z$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()===sl.NOT_STARTED},t.prototype.isScanning=function(){return this.stateManager.getState()!==sl.NOT_STARTED},t.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===sl.SCANNING},t.prototype.isPaused=function(){return this.stateManager.getState()===sl.PAUSED},t}(),J$t=function(){function t(){}return t.create=function(){return new Z$t(new Q$t)},t}(),eUt=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)}}(),Bf=function(t){eUt(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}(P$t),tUt=function(){function t(e,n){this.logger=n,this.fps=Bf.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=Bf.DEFAULT_DISABLE_FLIP}return t.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?_$e.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},t.prototype.isShadedBoxEnabled=function(){return!gg(this.qrbox)},t.create=function(e,n){return new t(e,n)},t}(),W2e=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 F$t(this.verbose),this.qrcode=new $$t(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(r),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=J$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=tUt.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:Bf.DEFAULT_WIDTH,d.style.position="relative",this.shouldScan=!0,this.element=d;var f=this,x=this.stateManagerProxy.startTransition(sl.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 S={onRenderSurfaceReady:function(T,I){f.setupUi(T,I,l),f.isScanning=!0,f.foreverScan(l,r,o)}};G$t.failIfNotSupported().then(function(T){T.create(v).then(function(I){return I.render(a.element,C,S).then(function(L){f.renderedCamera=L,x.execute(),g(null)}).catch(function(L){x.cancel(),y(L)})}).catch(function(I){x.cancel(),y(f4.errorGettingUserMedia(I))})}).catch(function(T){x.cancel(),y(f4.cameraStreamingNotSupported())})})},t.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(sl.PAUSED),this.showPausedState(),(gg(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(sl.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(sl.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var r=function(){if(e.element){var a=document.getElementById(Bf.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(gg(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:Bf.DEFAULT_WIDTH,f=Math.max(u.clientHeight?u.clientHeight:c,Bf.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=Bf.FILE_SCAN_HIDDEN_CANVAS_PADDING,C=Math.max(o.width,x.width),S=Math.max(o.height,x.height),T=C+2*v,I=S+2*v,L=r.createCanvasElement(T,I);u.appendChild(L);var F=L.getContext("2d");if(!F)throw"Unable to get 2d context from canvas";F.canvas.width=T,F.canvas.height=I,F.drawImage(o,0,0,l,c,v,v,C,S);try{r.qrcode.decodeRobustlyAsync(L).then(function($){s(R2e.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 X$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(!_$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=[Os.QR_CODE,Os.AZTEC,Os.CODABAR,Os.CODE_39,Os.CODE_93,Os.CODE_128,Os.DATA_MATRIX,Os.MAXICODE,Os.ITF,Os.EAN_13,Os.EAN_8,Os.PDF_417,Os.RSS_14,Os.RSS_EXPANDED,Os.UPC_A,Os.UPC_E,Os.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];T$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(gg(e))return!0;if(!gg(e.useBarCodeDetectorIfSupported))return e.useBarCodeDetectorIfSupported!==!1;if(gg(e.experimentalFeatures))return!0;var n=e.experimentalFeatures;return gg(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<Bf.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(Bf.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=gg(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=f4.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,R2e.createFromQrcodeResult(s)),r.possiblyUpdateShaders(!0),!0}).catch(function(s){r.possiblyUpdateShaders(!1);var a=f4.codeParseError(s);return n(a,I$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?Bf.BORDER_SHADER_MATCH_COLOR:Bf.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=gg(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(Bf.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=Bf.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}(),q2e;(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"})(q2e||(q2e={}));function KE(){const[t,e]=h.useState(!1),[n,r]=h.useState([]),[s,a]=h.useState(null),[o,l]=h.useState(null),c=h.useRef(null);h.useEffect(()=>{l(localStorage.getItem("hyperAddress"))},[]),h.useEffect(()=>{t&&W2e.getCameras().then(d=>{r(d||[]);const x=d.find(g=>/back|environment/i.test(g.label))||d[0];x&&a(x.id)})},[t]),h.useEffect(()=>{if(!t||!s)return;const d=new W2e("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 nUt=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState(!1),[s,a]=h.useState(!1),[o,l]=h.useState(!1),[c,u]=h.useState(!1),[d,f]=h.useState(!1),[x,g]=h.useState(!1),[y,v]=h.useState(!1),[C,S]=h.useState(!1),T=()=>{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(Ga,{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:Hi,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:O1,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:T,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:T,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(KE,{}),i.jsx(Ga,{to:"/terminal/BTC",onClick:()=>e(!1),children:"Terminal"}),i.jsx(Ga,{to:"/discover-wallets",onClick:()=>e(!1),children:"Discover Wallets"}),i.jsx(Ga,{to:"/hyperliquid-vaults",onClick:()=>e(!1),children:"Discover Vaults"}),i.jsx(Ga,{to:"/copy-trade",onClick:()=>e(!1),children:"My Copy Trading"}),i.jsx(Ga,{to:"/wallet-management",onClick:()=>e(!1),children:"Wallet Management"}),i.jsx(Ga,{to:"/ticker",onClick:()=>e(!1),children:"Ticker"}),i.jsx(Ga,{to:"/leaderboard",onClick:()=>e(!1),children:"Leaderboard"}),i.jsx(Ga,{to:"/referral",onClick:()=>e(!1),children:"Referral"}),i.jsx(Ga,{to:"/tracked-wallets",onClick:()=>e(!1),children:"Tracked Wallets"}),i.jsx(Ga,{to:"/tracker",onClick:()=>e(!1),children:"My Activities"}),i.jsx(Ga,{to:"/hyperliquid-whale-trades",onClick:()=>e(!1),children:"Whale trades"}),i.jsx(Ga,{to:"/back-testing",onClick:()=>e(!1),children:"Backtest"}),i.jsx(Ga,{to:"/hyperliquid-fee-calculator ",onClick:()=>e(!1),children:"HL Fee Calculator"}),i.jsx(Ga,{to:"/terminal/extended/BTC#gridbot",onClick:()=>e(!1),children:"Extended Grid Bot"}),i.jsx(Ga,{to:"/dca-bot?market=extended",onClick:()=>e(!1),children:"Extended DCA Bot"}),i.jsxs(Ga,{to:"/dca-bot?market=hyperliquid",onClick:()=>e(!1),children:["Hyperliquid DCA Bot",i.jsx(T0,{label:"NEW",tone:"emerald"})]}),i.jsxs("div",{onClick:()=>g(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:["Extended Farming ",i.jsx(T0,{tone:"emerald",label:"SMART"})]}),i.jsx(Ga,{to:"/terminal/lighter/BTC#gridbot",onClick:()=>e(!1),children:"Lighter Grid Bot"}),i.jsx(Ga,{to:"/terminal/hyperliquid/BTC#gridbot",onClick:()=>e(!1),children:"HL Grid Bot"}),i.jsx(Ga,{to:"/market-maker",onClick:()=>e(!1),children:"HL Market Maker"}),i.jsxs(Ga,{to:"/polymarket",onClick:()=>e(!1),children:["Polymarket Bot",i.jsx(T0,{})]}),i.jsxs(Ga,{to:"/polymarket-dca",onClick:()=>e(!1),children:["Polymarket DCA Bot",i.jsx(T0,{})]}),i.jsx(Ga,{to:"/market-maker",onClick:()=>e(!1),children:"HL Market Maker"}),i.jsxs(Ga,{to:"/standx-mm",onClick:()=>e(!1),children:["StandX Market Maker",i.jsx(T0,{label:"BETA",tone:"emerald"})]}),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:()=>S(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:"Pacifica Farming"})]})})]}),i.jsx(Mce,{open:n,setOpen:r}),i.jsx(Lce,{open:s,setOpen:a}),i.jsx(Rce,{open:o,setOpen:l}),i.jsx(Dce,{open:c,setOpen:u}),i.jsx(Bce,{open:d,setOpen:f}),i.jsx(MU,{open:x,setOpen:g}),i.jsx($ce,{open:y,setOpen:v}),i.jsx(Uce,{open:C,setOpen:S})]})},k$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"})]}),rUt=()=>{var fe,G,ie,oe,K,H;const t=h.useRef(null),[e,n]=h.useState(!1),[r,s]=h.useState([]),[a,o]=h.useState([]),[l,c]=h.useState(!1),[u,d]=h.useState(!1),[f,x]=h.useState(()=>{const ee=localStorage.getItem("isToasterMinimized");return ee===null?!1:ee==="true"});h.useEffect(()=>{localStorage.setItem("isToasterMinimized",f)},[f]);const[g,y]=h.useState([]),C=localStorage.getItem("isDateToasterFormat")||"date",[S,T]=h.useState(C);h.useEffect(()=>{localStorage.setItem("isDateToasterFormat",S)},[S]);const[I,L]=h.useState(0),F=h.useRef(null),[$,O]=h.useState(null),[U,Y]=h.useState(0),re=1e4;h.useEffect(()=>{if(l||r.length===0||e){clearInterval(F.current);return}const ee=Date.now();return O(ee),F.current=setTimeout(()=>{L(se=>(se+1)%r.length),Y(0)},re-U),()=>clearTimeout(F.current)},[l,r.length,e,I,U]),h.useEffect(()=>{I>=(r==null?void 0:r.length)&&L(0)},[r]);async function Q(){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 se=await ee.json();se&&s(se.refcodes)}catch(ee){return console.error("Error fetching metrics:",ee.message),null}finally{d(!1)}}h.useEffect(()=>{let ee;return f||(Q(),ee=setInterval(()=>{Q()},6e4)),()=>{ee&&clearInterval(ee)}},[f]),h.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 se=[...a??[]],pe=Array.from({length:(r==null?void 0:r.length)-((a==null?void 0:a.length)??0)},(be,we)=>we+((a==null?void 0:a.length)??0)),Se=pe==null?void 0:pe.sort(()=>Math.random()-.5),ge=[...se,...Se??[]];o(ge);const ve=ge==null?void 0:ge.map(be=>r==null?void 0:r[be]);y(ve)}else{const se=(ee=a==null?void 0:a.map(pe=>r==null?void 0:r[pe]))==null?void 0:ee.filter(Boolean);y(se)}},[r]);const[q,te]=h.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 se=!ee;return localStorage.setItem("isToasterMinimized",se?"true":"false"),se})},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:z9e,alt:"Toggle",className:"w-8 h-8 opacity-90 group-hover:opacity-100"})}),(!f||q)&&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:`${q?"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(se=>{const pe=!se;return localStorage.setItem("isToasterMinimized",pe?"true":"false"),pe}),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(k$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),$&&Y(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(G2e,{content:(fe=g[I])==null?void 0:fe.result,createdAt:(G=g[I])==null?void 0:G.created_at,category:(ie=g[I])==null?void 0:ie.category,metric:(oe=g[I])==null?void 0:oe.metric,metricId:(K=g[I])==null?void 0:K.metric_definition_id,isDeleted:(H=g[I])==null?void 0:H.is_deleted,isDateToasterFormat:S,setIsDateToasterFormat:T,isDropdownOpen:l,activeIndex:I,progressRef:t})},`toast-${I}`)}):g==null?void 0:g.map((ee,se)=>i.jsx(G2e,{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:S,setIsDateToasterFormat:T,isDropdownOpen:l,progressRef:t},se))})]})]})},G2e=({content:t,createdAt:e,category:n,metric:r,metricId:s,isDeleted:a,isDateToasterFormat:o,setIsDateToasterFormat:l,isDropdownOpen:c,activeIndex:u,progressRef:d})=>{var T,I;function f({date:L}){const[F,$]=h.useState(vo(L));return h.useEffect(()=>{const O=setInterval(()=>{$(vo(L))},1e3);return()=>clearInterval(O)},[L]),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,S=s===3||s===6||s===9;return i.jsxs("div",{onClick:L=>{L.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?z9e:g?$9e:y?yct:""}`,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:L=>wm(L)})}),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?((T=(t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress))==null?void 0:T.slice(0,5))+".."+((I=(t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress))==null?void 0:I.slice(-4)):"--"}),i.jsx("img",{onClick:L=>{L.stopPropagation(),navigator.clipboard.writeText((t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress)),fn.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:io,alt:"",className:"cursor-pointer"})]}),x?`is one of ${v?"today's":C?"week's":S?"month's":""} most profitable Top Follower Wallets!`:g?`has generated $${t!=null&&t.earned_rpnl?Ir(t==null?void 0:t.earned_rpnl):"-"} in profits for its followers ${v?"today":C?"this week":S?"this month":""} - a wallet you’ll want to watch!`:y?`is one of ${v?"today's":C?"this week's":S?"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:Iae,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:vct,alt:"",className:"w-[14px] h-[14px]"}),g&&i.jsx("img",{src:wct,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?Ir(t==null?void 0:t.rpnl):"-"}`:g?`+$${t!=null&&t.earned_rpnl?Ir(t==null?void 0:t.earned_rpnl):"-"}`:y?Ir(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":S?"30D":""})})]}),i.jsxs("div",{className:`${c?"justify-start":"justify-between"} flex items-center w-full mt-1.5`,children:[i.jsx("div",{onClick:L=>{L.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}):$c(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}`)})]})]})]})},sUt=()=>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:gct,alt:"",className:"w-[14px] h-[14px]"})}),iUt=()=>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:U9e,alt:"",className:"w-[14px] h-[14px]"})}),aUt=()=>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:bct,alt:"",className:"w-[14px] h-[14px]"})}),oUt=()=>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:j2,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"})]}),lUt=({open:t,setOpen:e,favoriteName:n,setFavoriteName:r,likeError:s,like:a,setLikeError:o})=>i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),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 H5({walletAddress:t,children:e}){const{isConnected:n,address:r}=ds(),{trackedWatchList:s,getTrackedWatchList:a,setSignModalOpen:o}=h.useContext(Qr),[l,c]=h.useState(""),[u,d]=h.useState(!1),[f,x]=h.useState(""),g=async C=>{try{const S=window.localStorage.getItem("hyperToken"),T="https://dextrabothypev2.nftinit.io/api/hyper/tracker/save/",I=window.localStorage.getItem("hyperAddress");if(S||o(!0),!C){x("Please enter a wallet label.");return}const L=await fetch(T,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:r?r.toLowerCase():I,token:S,track_address:t,tag:C})});L.ok;const F=await L.json();F.success?(a(),c(""),d(!1),x(""),fn.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),fn.error(F.error_message),x(F.error_message))}catch(S){console.error("Error in like function:",S),fn.error(S.message||"Something went wrong!"),x(S.message)}},y=async()=>{try{const C=window.localStorage.getItem("hyperToken"),S=window.localStorage.getItem("hyperAddress"),T="https://dextrabothypev2.nftinit.io/api/hyper/tracker/unfollow/";C||o(!0);const I=await fetch(T,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:r?r.toLowerCase():S,token:C,track_address:t})});if(!I.ok)throw new Error(`Failed to unlike: ${I.status} ${I.statusText}`);const L=await I.json();L.success?(a(),fn.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(L.error_message),fn.error(L.error_message))}catch(C){console.error("Error in unlike function:",C),fn.error(C.message||"Something went wrong!")}},v=()=>{window.localStorage.getItem("hyperToken")?d(!0):o(!0)};return i.jsxs(i.Fragment,{children:[i.jsx(lUt,{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 cUt({open:t,setOpen:e,copyTradeSave:n}){return i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Hi,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 Zi=(t,e=null)=>{e&&t.target.src===e?t.target.src=Ha:e&&t.target.src!==e?t.target.src=e:t.target.src!==Ha&&(t.target.src=Ha)};function uUt({positions:t,loading:e}){const[n,r]=h.useState(!1),[s,a]=h.useState("upnl"),[o,l]=h.useState("desc"),c=d=>{s===d?l(o==="asc"?"desc":"asc"):(a(d),l("asc"))},u=h.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 h.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(ka,{})}):!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:Yl,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(o2,{}):i.jsx(a2,{}):i.jsx(l2,{})]})}),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(o2,{}):i.jsx(a2,{}):i.jsx(l2,{})]})})]})}),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=>Zi(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(Us,{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:`$${Ir(d.unrealizedPnl||0)}`})})]},f)})})]})})})}const{min:dUt,max:fUt}=Math,E3=(t,e=0,n=1)=>dUt(fUt(e,t),n),due=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]=E3(t[e],0,255)):e===3&&(t[e]=E3(t[e],0,1));return t},T$e={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])T$e[`[object ${t}]`]=t.toLowerCase();function Gi(t){return T$e[Object.prototype.toString.call(t)]||"object"}const Oi=(t,e=null)=>t.length>=3?Array.prototype.slice.call(t):Gi(t[0])=="object"&&e?e.split("").filter(n=>t[0][n]!==void 0).map(n=>t[0][n]):t[0].slice(0),S8=t=>{if(t.length<2)return null;const e=t.length-1;return Gi(t[e])=="string"?t[e].toLowerCase():null},{PI:HU,min:P$e,max:I$e}=Math,up=t=>Math.round(t*100)/100,Bne=t=>Math.round(t*100)/100,jg=HU*2,Wq=HU/3,hUt=HU/180,pUt=180/HU;function F$e(t){return[...t.slice(0,3).reverse(),...t.slice(3)]}const Ti={format:{},autodetect:[]};let os=class{constructor(...e){const n=this;if(Gi(e[0])==="object"&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let r=S8(e),s=!1;if(!r){s=!0,Ti.sorted||(Ti.autodetect=Ti.autodetect.sort((a,o)=>o.p-a.p),Ti.sorted=!0);for(let a of Ti.autodetect)if(r=a.test(...e),r)break}if(Ti.format[r]){const a=Ti.format[r].apply(null,s?e:e.slice(0,-1));n._rgb=due(a)}else throw new Error("unknown format: "+e);n._rgb.length===3&&n._rgb.push(1)}toString(){return Gi(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}};const mUt="3.1.2",wi=(...t)=>new os(...t);wi.version=mUt;const YS={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"},xUt=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,gUt=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,O$e=t=>{if(t.match(xUt)){(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(gUt)){(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:xF}=Math,M$e=(...t)=>{let[e,n,r,s]=Oi(t,"rgba"),a=S8(t)||"auto";s===void 0&&(s=1),a==="auto"&&(a=s<1?"rgba":"rgb"),e=xF(e),n=xF(n),r=xF(r);let l="000000"+(e<<16|n<<8|r).toString(16);l=l.substr(l.length-6);let c="0"+xF(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}`}};os.prototype.name=function(){const t=M$e(this._rgb,"rgb");for(let e of Object.keys(YS))if(YS[e]===t)return e.toLowerCase();return t};Ti.format.named=t=>{if(t=t.toLowerCase(),YS[t])return O$e(YS[t]);throw new Error("unknown color name: "+t)};Ti.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&Gi(t)==="string"&&YS[t.toLowerCase()])return"named"}});os.prototype.alpha=function(t,e=!1){return t!==void 0&&Gi(t)==="number"?e?(this._rgb[3]=t,this):new os([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]};os.prototype.clipped=function(){return this._rgb._clipped||!1};const Z0={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}},bUt=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 Gg(t){const e=bUt.get(String(t).toLowerCase());if(!e)throw new Error("unknown Lab illuminant "+t);Z0.labWhitePoint=t,Z0.Xn=e[0],Z0.Zn=e[1]}function YE(){return Z0.labWhitePoint}const fue=(...t)=>{t=Oi(t,"lab");const[e,n,r]=t,[s,a,o]=yUt(e,n,r),[l,c,u]=L$e(s,a,o);return[l,c,u,t.length>3?t[3]:1]},yUt=(t,e,n)=>{const{kE:r,kK:s,kKE:a,Xn:o,Yn:l,Zn:c}=Z0,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,S=y*o,T=v*l,I=C*c;return[S,T,I]},qq=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},L$e=(t,e,n)=>{const{MtxAdaptMa:r,MtxAdaptMaI:s,MtxXYZ2RGB:a,RefWhiteRGB:o,Xn:l,Yn:c,Zn:u}=Z0,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),S=(t*r.m01+e*r.m11+n*r.m21)*(y/f),T=(t*r.m02+e*r.m12+n*r.m22)*(v/x),I=C*s.m00+S*s.m10+T*s.m20,L=C*s.m01+S*s.m11+T*s.m21,F=C*s.m02+S*s.m12+T*s.m22,$=qq(I*a.m00+L*a.m10+F*a.m20),O=qq(I*a.m01+L*a.m11+F*a.m21),U=qq(I*a.m02+L*a.m12+F*a.m22);return[$*255,O*255,U*255]},hue=(...t)=>{const[e,n,r,...s]=Oi(t,"rgb"),[a,o,l]=R$e(e,n,r),[c,u,d]=vUt(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]};function vUt(t,e,n){const{Xn:r,Yn:s,Zn:a,kE:o,kK:l}=Z0,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 Gq(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 R$e=(t,e,n)=>{t=Gq(t/255),e=Gq(e/255),n=Gq(n/255);const{MtxRGB2XYZ:r,MtxAdaptMa:s,MtxAdaptMaI:a,Xn:o,Yn:l,Zn:c,As:u,Bs:d,Cs:f}=Z0;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,S=o*s.m02+l*s.m12+c*s.m22;let T=x*s.m00+g*s.m10+y*s.m20,I=x*s.m01+g*s.m11+y*s.m21,L=x*s.m02+g*s.m12+y*s.m22;return T*=v/u,I*=C/d,L*=S/f,x=T*a.m00+I*a.m10+L*a.m20,g=T*a.m01+I*a.m11+L*a.m21,y=T*a.m02+I*a.m12+L*a.m22,[x,g,y]};os.prototype.lab=function(){return hue(this._rgb)};const wUt=(...t)=>new os(...t,"lab");Object.assign(wi,{lab:wUt,getLabWhitePoint:YE,setLabWhitePoint:Gg});Ti.format.lab=fue;Ti.autodetect.push({p:2,test:(...t)=>{if(t=Oi(t,"lab"),Gi(t)==="array"&&t.length===3)return"lab"}});os.prototype.darken=function(t=1){const e=this,n=e.lab();return n[0]-=Z0.Kn*t,new os(n,"lab").alpha(e.alpha(),!0)};os.prototype.brighten=function(t=1){return this.darken(-t)};os.prototype.darker=os.prototype.darken;os.prototype.brighter=os.prototype.brighten;os.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:CUt}=Math,NUt=1e-7,SUt=20;os.prototype.luminance=function(t,e="rgb"){if(t!==void 0&&Gi(t)==="number"){if(t===0)return new os([0,0,0,this._rgb[3]],"rgb");if(t===1)return new os([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),r=SUt;const s=(o,l)=>{const c=o.interpolate(l,.5,e),u=c.luminance();return Math.abs(t-u)<NUt||!r--?c:u>t?s(o,c):s(c,l)},a=(n>t?s(new os([0,0,0]),this):s(this,new os([255,255,255]))).rgb();return new os([...a,this._rgb[3]])}return jUt(...this._rgb.slice(0,3))};const jUt=(t,e,n)=>(t=Kq(t),e=Kq(e),n=Kq(n),.2126*t+.7152*e+.0722*n),Kq=t=>(t/=255,t<=.03928?t/12.92:CUt((t+.055)/1.055,2.4)),Bu={},XS=(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 Gi(t)!=="object"&&(t=new os(t)),Gi(e)!=="object"&&(e=new os(e)),Bu[s](t,e,n).alpha(t.alpha()+n*(e.alpha()-t.alpha()))};os.prototype.mix=os.prototype.interpolate=function(t,e=.5,...n){return XS(this,t,e,...n)};os.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 os([e[0]*n,e[1]*n,e[2]*n,n],"rgb")};const{sin:AUt,cos:_Ut}=Math,D$e=(...t)=>{let[e,n,r]=Oi(t,"lch");return isNaN(r)&&(r=0),r=r*hUt,[e,_Ut(r)*n,AUt(r)*n]},pue=(...t)=>{t=Oi(t,"lch");const[e,n,r]=t,[s,a,o]=D$e(e,n,r),[l,c,u]=fue(s,a,o);return[l,c,u,t.length>3?t[3]:1]},EUt=(...t)=>{const e=F$e(Oi(t,"hcl"));return pue(...e)},{sqrt:kUt,atan2:TUt,round:PUt}=Math,B$e=(...t)=>{const[e,n,r]=Oi(t,"lab"),s=kUt(n*n+r*r);let a=(TUt(r,n)*pUt+360)%360;return PUt(s*1e4)===0&&(a=Number.NaN),[e,s,a]},mue=(...t)=>{const[e,n,r,...s]=Oi(t,"rgb"),[a,o,l]=hue(e,n,r),[c,u,d]=B$e(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]};os.prototype.lch=function(){return mue(this._rgb)};os.prototype.hcl=function(){return F$e(mue(this._rgb))};const IUt=(...t)=>new os(...t,"lch"),FUt=(...t)=>new os(...t,"hcl");Object.assign(wi,{lch:IUt,hcl:FUt});Ti.format.lch=pue;Ti.format.hcl=EUt;["lch","hcl"].forEach(t=>Ti.autodetect.push({p:2,test:(...e)=>{if(e=Oi(e,t),Gi(e)==="array"&&e.length===3)return t}}));os.prototype.saturate=function(t=1){const e=this,n=e.lch();return n[1]+=Z0.Kn*t,n[1]<0&&(n[1]=0),new os(n,"lch").alpha(e.alpha(),!0)};os.prototype.desaturate=function(t=1){return this.saturate(-t)};os.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(Gi(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(Gi(e)==="number")a[o]=e;else throw new Error("unsupported value for Color.set");const l=new os(a,r);return n?(this._rgb=l._rgb,this):l}throw new Error(`unknown channel ${s} in mode ${r}`)}else return a};os.prototype.tint=function(t=.5,...e){return XS(this,"white",t,...e)};os.prototype.shade=function(t=.5,...e){return XS(this,"black",t,...e)};const OUt=(t,e,n)=>{const r=t._rgb,s=e._rgb;return new os(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"rgb")};Bu.rgb=OUt;const{sqrt:Yq,pow:wC}=Math,MUt=(t,e,n)=>{const[r,s,a]=t._rgb,[o,l,c]=e._rgb;return new os(Yq(wC(r,2)*(1-n)+wC(o,2)*n),Yq(wC(s,2)*(1-n)+wC(l,2)*n),Yq(wC(a,2)*(1-n)+wC(c,2)*n),"rgb")};Bu.lrgb=MUt;const LUt=(t,e,n)=>{const r=t.lab(),s=e.lab();return new os(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"lab")};Bu.lab=LUt;const j8=(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 os([y,x,g],r):new os([g,x,y],r)},$$e=(t,e,n)=>j8(t,e,n,"lch");Bu.lch=$$e;Bu.hcl=$$e;const RUt=t=>{if(Gi(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)},DUt=(...t)=>{const[e,n,r]=Oi(t,"rgb");return(e<<16)+(n<<8)+r};os.prototype.num=function(){return DUt(this._rgb)};const BUt=(...t)=>new os(...t,"num");Object.assign(wi,{num:BUt});Ti.format.num=RUt;Ti.autodetect.push({p:5,test:(...t)=>{if(t.length===1&&Gi(t[0])==="number"&&t[0]>=0&&t[0]<=16777215)return"num"}});const $Ut=(t,e,n)=>{const r=t.num(),s=e.num();return new os(r+n*(s-r),"num")};Bu.num=$Ut;const{floor:UUt}=Math,zUt=(...t)=>{t=Oi(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=UUt(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]},HUt=(...t)=>{const[e,n,r]=Oi(t,"rgb"),s=P$e(e,n,r),a=I$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]};os.prototype.hcg=function(){return HUt(this._rgb)};const VUt=(...t)=>new os(...t,"hcg");wi.hcg=VUt;Ti.format.hcg=zUt;Ti.autodetect.push({p:1,test:(...t)=>{if(t=Oi(t,"hcg"),Gi(t)==="array"&&t.length===3)return"hcg"}});const WUt=(t,e,n)=>j8(t,e,n,"hcg");Bu.hcg=WUt;const{cos:CC}=Math,qUt=(...t)=>{t=Oi(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*CC(jg*e)/CC(Wq-jg*e))/3,a=1-(o+s)):e<2/3?(e-=1/3,s=(1-n)/3,a=(1+n*CC(jg*e)/CC(Wq-jg*e))/3,o=1-(s+a)):(e-=2/3,a=(1-n)/3,o=(1+n*CC(jg*e)/CC(Wq-jg*e))/3,s=1-(a+o)),s=E3(r*s*3),a=E3(r*a*3),o=E3(r*o*3),[s*255,a*255,o*255,t.length>3?t[3]:1]},{min:GUt,sqrt:KUt,acos:YUt}=Math,XUt=(...t)=>{let[e,n,r]=Oi(t,"rgb");e/=255,n/=255,r/=255;let s;const a=GUt(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/=KUt((e-n)*(e-n)+(e-r)*(n-r)),s=YUt(s),r>n&&(s=jg-s),s/=jg),[s*360,l,o]};os.prototype.hsi=function(){return XUt(this._rgb)};const QUt=(...t)=>new os(...t,"hsi");wi.hsi=QUt;Ti.format.hsi=qUt;Ti.autodetect.push({p:2,test:(...t)=>{if(t=Oi(t,"hsi"),Gi(t)==="array"&&t.length===3)return"hsi"}});const ZUt=(t,e,n)=>j8(t,e,n,"hsi");Bu.hsi=ZUt;const $ne=(...t)=>{t=Oi(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]},U$e=(...t)=>{t=Oi(t,"rgba");let[e,n,r]=t;e/=255,n/=255,r/=255;const s=P$e(e,n,r),a=I$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]};os.prototype.hsl=function(){return U$e(this._rgb)};const JUt=(...t)=>new os(...t,"hsl");wi.hsl=JUt;Ti.format.hsl=$ne;Ti.autodetect.push({p:2,test:(...t)=>{if(t=Oi(t,"hsl"),Gi(t)==="array"&&t.length===3)return"hsl"}});const ezt=(t,e,n)=>j8(t,e,n,"hsl");Bu.hsl=ezt;const{floor:tzt}=Math,nzt=(...t)=>{t=Oi(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=tzt(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:rzt,max:szt}=Math,izt=(...t)=>{t=Oi(t,"rgb");let[e,n,r]=t;const s=rzt(e,n,r),a=szt(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]};os.prototype.hsv=function(){return izt(this._rgb)};const azt=(...t)=>new os(...t,"hsv");wi.hsv=azt;Ti.format.hsv=nzt;Ti.autodetect.push({p:2,test:(...t)=>{if(t=Oi(t,"hsv"),Gi(t)==="array"&&t.length===3)return"hsv"}});const ozt=(t,e,n)=>j8(t,e,n,"hsv");Bu.hsv=ozt;function QR(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 xue=(...t)=>{t=Oi(t,"lab");const[e,n,r,...s]=t,[a,o,l]=lzt([e,n,r]),[c,u,d]=L$e(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]};function lzt(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=QR(n,t);return QR(e,r.map(s=>s**3))}const gue=(...t)=>{const[e,n,r,...s]=Oi(t,"rgb"),a=R$e(e,n,r);return[...czt(a),...s.length>0&&s[0]<1?[s[0]]:[]]};function czt(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=QR(e,t);return QR(n,r.map(s=>Math.cbrt(s)))}os.prototype.oklab=function(){return gue(this._rgb)};const uzt=(...t)=>new os(...t,"oklab");Object.assign(wi,{oklab:uzt});Ti.format.oklab=xue;Ti.autodetect.push({p:2,test:(...t)=>{if(t=Oi(t,"oklab"),Gi(t)==="array"&&t.length===3)return"oklab"}});const dzt=(t,e,n)=>{const r=t.oklab(),s=e.oklab();return new os(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"oklab")};Bu.oklab=dzt;const fzt=(t,e,n)=>j8(t,e,n,"oklch");Bu.oklch=fzt;const{pow:Xq,sqrt:Qq,PI:Zq,cos:K2e,sin:Y2e,atan2:hzt}=Math,pzt=(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 os(f)),e==="lrgb")return mzt(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*Zq;c+=K2e(x)*n[0],u+=Y2e(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*Zq;c+=K2e(v)*n[x+1],u+=Y2e(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=hzt(u/l[f],c/l[f])/Zq*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 os(o,e).alpha(d>.99999?1:d,!0)},mzt=(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]+=Xq(l[0],2)*o,r[1]+=Xq(l[1],2)*o,r[2]+=Xq(l[2],2)*o,r[3]+=l[3]*o}return r[0]=Qq(r[0]),r[1]=Qq(r[1]),r[2]=Qq(r[2]),r[3]>.9999999&&(r[3]=1),new os(due(r))},{pow:xzt}=Math;function ZR(t){let e="rgb",n=wi("#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(O){if(O=O||["#fff","#000"],O&&Gi(O)==="string"&&wi.brewer&&wi.brewer[O.toLowerCase()]&&(O=wi.brewer[O.toLowerCase()]),Gi(O)==="array"){O.length===1&&(O=[O[0],O[0]]),O=O.slice(0);for(let U=0;U<O.length;U++)O[U]=wi(O[U]);a.length=0;for(let U=0;U<O.length;U++)a.push(U/(O.length-1))}return F(),c=O},S=function(O){if(l!=null){const U=l.length-1;let Y=0;for(;Y<U&&O>=l[Y];)Y++;return Y-1}return 0};let T=O=>O,I=O=>O;const L=function(O,U){let Y,re;if(U==null&&(U=!1),isNaN(O)||O===null)return n;U?re=O:l&&l.length>2?re=S(O)/(l.length-2):f!==d?re=(O-d)/(f-d):re=1,re=I(re),U||(re=T(re)),v!==1&&(re=xzt(re,v)),re=o[0]+re*(1-o[0]-o[1]),re=E3(re,0,1);const Q=Math.floor(re*1e4);if(y&&g[Q])Y=g[Q];else{if(Gi(c)==="array")for(let q=0;q<a.length;q++){const te=a[q];if(re<=te){Y=c[q];break}if(re>=te&&q===a.length-1){Y=c[q];break}if(re>te&&re<a[q+1]){re=(re-te)/(a[q+1]-te),Y=wi.interpolate(c[q],c[q+1],re,e);break}}else Gi(c)==="function"&&(Y=c(re));y&&(g[Q]=Y)}return Y};var F=()=>g={};C(t);const $=function(O){const U=wi(L(O));return u&&U[u]?U[u]():U};return $.classes=function(O){if(O!=null){if(Gi(O)==="array")l=O,s=[O[0],O[O.length-1]];else{const U=wi.analyze(s);O===0?l=[U.min,U.max]:l=wi.limits(U,"e",O)}return $}return l},$.domain=function(O){if(!arguments.length)return s;d=O[0],f=O[O.length-1],a=[];const U=c.length;if(O.length===U&&d!==f)for(let Y of Array.from(O))a.push((Y-d)/(f-d));else{for(let Y=0;Y<U;Y++)a.push(Y/(U-1));if(O.length>2){const Y=O.map((Q,q)=>q/(O.length-1)),re=O.map(Q=>(Q-d)/(f-d));re.every((Q,q)=>Y[q]===Q)||(I=Q=>{if(Q<=0||Q>=1)return Q;let q=0;for(;Q>=re[q+1];)q++;const te=(Q-re[q])/(re[q+1]-re[q]);return Y[q]+te*(Y[q+1]-Y[q])})}}return s=[d,f],$},$.mode=function(O){return arguments.length?(e=O,F(),$):e},$.range=function(O,U){return C(O),$},$.out=function(O){return u=O,$},$.spread=function(O){return arguments.length?(r=O,$):r},$.correctLightness=function(O){return O==null&&(O=!0),x=O,F(),x?T=function(U){const Y=L(0,!0).lab()[0],re=L(1,!0).lab()[0],Q=Y>re;let q=L(U,!0).lab()[0];const te=Y+(re-Y)*U;let fe=q-te,G=0,ie=1,oe=20;for(;Math.abs(fe)>.01&&oe-- >0;)(function(){return Q&&(fe*=-1),fe<0?(G=U,U+=(ie-U)*.5):(ie=U,U+=(G-U)*.5),q=L(U,!0).lab()[0],fe=q-te})();return U}:T=U=>U,$},$.padding=function(O){return O!=null?(Gi(O)==="number"&&(O=[O,O]),o=O,$):o},$.colors=function(O,U){arguments.length<2&&(U="hex");let Y=[];if(arguments.length===0)Y=c.slice(0);else if(O===1)Y=[$(.5)];else if(O>1){const re=s[0],Q=s[1]-re;Y=gzt(0,O).map(q=>$(re+q/(O-1)*Q))}else{t=[];let re=[];if(l&&l.length>2)for(let Q=1,q=l.length,te=1<=q;te?Q<q:Q>q;te?Q++:Q--)re.push((l[Q-1]+l[Q])*.5);else re=s;Y=re.map(Q=>$(Q))}return wi[U]&&(Y=Y.map(re=>re[U]())),Y},$.cache=function(O){return O!=null?(y=O,$):y},$.gamma=function(O){return O!=null?(v=O,$):v},$.nodata=function(O){return O!=null?(n=wi(O),$):n},$}function gzt(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 bzt=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},yzt=function(t){let e,n,r,s;if(t=t.map(a=>new os(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 os(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 os(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 os(l,"lab")}}else if(t.length>=5){let a,o,l;a=t.map(c=>c.lab()),l=t.length-1,o=bzt(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 os(d,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return e},vzt=t=>{const e=yzt(t);return e.scale=()=>ZR(e),e},{round:z$e}=Math;os.prototype.rgb=function(t=!0){return t===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(z$e)};os.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map((e,n)=>n<3?t===!1?e:z$e(e):e)};const wzt=(...t)=>new os(...t,"rgb");Object.assign(wi,{rgb:wzt});Ti.format.rgb=(...t)=>{const e=Oi(t,"rgba");return e[3]===void 0&&(e[3]=1),e};Ti.autodetect.push({p:3,test:(...t)=>{if(t=Oi(t,"rgba"),Gi(t)==="array"&&(t.length===3||t.length===4&&Gi(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)},M2=t=>(e,n)=>{const r=wi(n).rgb(),s=wi(e).rgb();return wi.rgb(t(r,s))},L2=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},Czt=t=>t,Nzt=(t,e)=>t*e/255,Szt=(t,e)=>t>e?e:t,jzt=(t,e)=>t>e?t:e,Azt=(t,e)=>255*(1-(1-t/255)*(1-e/255)),_zt=(t,e)=>e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255)),Ezt=(t,e)=>255*(1-(1-e/255)/(t/255)),kzt=(t,e)=>t===255?255:(t=255*(e/255)/(1-t/255),t>255?255:t);Tm.normal=M2(L2(Czt));Tm.multiply=M2(L2(Nzt));Tm.screen=M2(L2(Azt));Tm.overlay=M2(L2(_zt));Tm.darken=M2(L2(Szt));Tm.lighten=M2(L2(jzt));Tm.dodge=M2(L2(kzt));Tm.burn=M2(L2(Ezt));const{pow:Tzt,sin:Pzt,cos:Izt}=Math;function Fzt(t=300,e=-1.5,n=1,r=1,s=[0,1]){let a=0,o;Gi(s)==="array"?o=s[1]-s[0]:(o=0,s=[s,s]);const l=function(c){const u=jg*((t+120)/360+e*c),d=Tzt(s[0]+o*c,r),x=(a!==0?n[0]+c*a:n)*d*(1-d)/2,g=Izt(u),y=Pzt(u),v=d+x*(-.14861*g+1.78277*y),C=d+x*(-.29227*g-.90649*y),S=d+x*(1.97294*g);return wi(due([v*255,C*255,S*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,Gi(n)==="array"?(a=n[1]-n[0],a===0&&(n=n[1])):a=0,l)},l.lightness=function(c){return c==null?s:(Gi(c)==="array"?(s=c,o=c[1]-c[0]):(s=[c,c],o=0),l)},l.scale=()=>wi.scale(l),l.hue(n),l}const Ozt="0123456789abcdef",{floor:Mzt,random:Lzt}=Math,Rzt=()=>{let t="#";for(let e=0;e<6;e++)t+=Ozt.charAt(Mzt(Lzt()*16));return new os(t,"hex")},{log:X2e,pow:Dzt,floor:Bzt,abs:$zt}=Math;function H$e(t,e=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return Gi(t)==="object"&&(t=Object.values(t)),t.forEach(r=>{e&&Gi(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)=>V$e(n,r,s),n}function V$e(t,e="equal",n=7){Gi(t)=="array"&&(t=H$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*X2e(r),c=Math.LOG10E*X2e(s);o.push(r);for(let u=1;u<n;u++)o.push(Dzt(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=Bzt(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 S=0;S<n;S++)d[S]=0;for(let S=0;S<c;S++){const T=a[S];let I=Number.MAX_VALUE,L;for(let F=0;F<n;F++){const $=$zt(g[F]-T);$<I&&(I=$,L=F),d[L]++,u[S]=L}}const C=new Array(n);for(let S=0;S<n;S++)C[S]=null;for(let S=0;S<c;S++)l=u[S],C[l]===null?C[l]=a[S]:C[l]+=a[S];for(let S=0;S<n;S++)C[S]*=1/d[S];f=!1;for(let S=0;S<n;S++)if(C[S]!==g[S]){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,S)=>C-S),o.push(v[0]);for(let C=1;C<v.length;C+=2){const S=v[C];!isNaN(S)&&o.indexOf(S)===-1&&o.push(S)}}return o}const Uzt=(t,e)=>{t=new os(t),e=new os(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 Q2e=.027,zzt=5e-4,Hzt=.1,Z2e=1.14,gF=.022,J2e=1.414,Vzt=(t,e)=>{t=new os(t),e=new os(e),t.alpha()<1&&(t=XS(e,t,t.alpha(),"rgb"));const n=eve(...t.rgb()),r=eve(...e.rgb()),s=n>=gF?n:n+Math.pow(gF-n,J2e),a=r>=gF?r:r+Math.pow(gF-r,J2e),o=Math.pow(a,.56)-Math.pow(s,.57),l=Math.pow(a,.65)-Math.pow(s,.62),c=Math.abs(a-s)<zzt?0:s<a?o*Z2e:l*Z2e;return(Math.abs(c)<Hzt?0:c>0?c-Q2e:c+Q2e)*100};function eve(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:ng,pow:Rl,min:Wzt,max:qzt,atan2:tve,abs:nve,cos:bF,sin:rve,exp:Gzt,PI:sve}=Math;function Kzt(t,e,n=1,r=1,s=1){var a=function(Se){return 360*Se/(2*sve)},o=function(Se){return 2*sve*Se/360};t=new os(t),e=new os(e);const[l,c,u]=Array.from(t.lab()),[d,f,x]=Array.from(e.lab()),g=(l+d)/2,y=ng(Rl(c,2)+Rl(u,2)),v=ng(Rl(f,2)+Rl(x,2)),C=(y+v)/2,S=.5*(1-ng(Rl(C,7)/(Rl(C,7)+Rl(25,7)))),T=c*(1+S),I=f*(1+S),L=ng(Rl(T,2)+Rl(u,2)),F=ng(Rl(I,2)+Rl(x,2)),$=(L+F)/2,O=a(tve(u,T)),U=a(tve(x,I)),Y=O>=0?O:O+360,re=U>=0?U:U+360,Q=nve(Y-re)>180?(Y+re+360)/2:(Y+re)/2,q=1-.17*bF(o(Q-30))+.24*bF(o(2*Q))+.32*bF(o(3*Q+6))-.2*bF(o(4*Q-63));let te=re-Y;te=nve(te)<=180?te:re<=Y?te+360:te-360,te=2*ng(L*F)*rve(o(te)/2);const fe=d-l,G=F-L,ie=1+.015*Rl(g-50,2)/ng(20+Rl(g-50,2)),oe=1+.045*$,K=1+.015*$*q,H=30*Gzt(-Rl((Q-275)/25,2)),se=-(2*ng(Rl($,7)/(Rl($,7)+Rl(25,7))))*rve(2*o(H)),pe=ng(Rl(fe/(n*ie),2)+Rl(G/(r*oe),2)+Rl(te/(s*K),2)+se*(G/(r*oe))*(te/(s*K)));return qzt(0,Wzt(100,pe))}function Yzt(t,e,n="lab"){t=new os(t),e=new os(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 Xzt=(...t)=>{try{return new os(...t),!0}catch{return!1}},Qzt={cool(){return ZR([wi.hsl(180,1,.9),wi.hsl(250,.7,.4)])},hot(){return ZR(["#000","#f00","#ff0","#fff"]).mode("rgb")}},Une={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"]},W$e=Object.keys(Une),ive=new Map(W$e.map(t=>[t.toLowerCase(),t])),Zzt=typeof Proxy=="function"?new Proxy(Une,{get(t,e){const n=e.toLowerCase();if(ive.has(n))return t[ive.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(W$e)}}):Une,Jzt=(...t)=>{t=Oi(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:ave}=Math,eHt=(...t)=>{let[e,n,r]=Oi(t,"rgb");e=e/255,n=n/255,r=r/255;const s=1-ave(e,ave(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]};os.prototype.cmyk=function(){return eHt(this._rgb)};const tHt=(...t)=>new os(...t,"cmyk");Object.assign(wi,{cmyk:tHt});Ti.format.cmyk=Jzt;Ti.autodetect.push({p:2,test:(...t)=>{if(t=Oi(t,"cmyk"),Gi(t)==="array"&&t.length===4)return"cmyk"}});const nHt=(...t)=>{const e=Oi(t,"hsla");let n=S8(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(" ")})`},rHt=(...t)=>{const e=Oi(t,"lab");let n=S8(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(" ")})`},sHt=(...t)=>{const e=Oi(t,"lch");let n=S8(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(" ")})`},iHt=(...t)=>{const e=Oi(t,"lab");return e[0]=up(e[0]*100)+"%",e[1]=Bne(e[1]),e[2]=Bne(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklab(${e.join(" ")})`},q$e=(...t)=>{const[e,n,r,...s]=Oi(t,"rgb"),[a,o,l]=gue(e,n,r),[c,u,d]=B$e(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]},aHt=(...t)=>{const e=Oi(t,"lch");return e[0]=up(e[0]*100)+"%",e[1]=Bne(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:Jq}=Math,oHt=(...t)=>{const e=Oi(t,"rgba");let n=S8(t)||"rgb";if(n.substr(0,3)==="hsl")return nHt(U$e(e),n);if(n.substr(0,3)==="lab"){const r=YE();Gg("d50");const s=rHt(hue(e),n);return Gg(r),s}if(n.substr(0,3)==="lch"){const r=YE();Gg("d50");const s=sHt(mue(e),n);return Gg(r),s}return n.substr(0,5)==="oklab"?iHt(gue(e)):n.substr(0,5)==="oklch"?aHt(q$e(e)):(e[0]=Jq(e[0]),e[1]=Jq(e[1]),e[2]=Jq(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(" ")})`)},G$e=(...t)=>{t=Oi(t,"lch");const[e,n,r,...s]=t,[a,o,l]=D$e(e,n,r),[c,u,d]=xue(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]},l1=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,Cm=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,JR=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,vp=/\s*/.source,A8=/\s+/.source,bue=/\s*,\s*/.source,VU=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,_8=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,K$e=new RegExp("^rgba?\\("+vp+[l1,l1,l1].join(A8)+_8+"\\)$"),Y$e=new RegExp("^rgb\\("+vp+[l1,l1,l1].join(bue)+vp+"\\)$"),X$e=new RegExp("^rgba\\("+vp+[l1,l1,l1,Cm].join(bue)+vp+"\\)$"),Q$e=new RegExp("^hsla?\\("+vp+[VU,JR,JR].join(A8)+_8+"\\)$"),Z$e=new RegExp("^hsl?\\("+vp+[VU,JR,JR].join(bue)+vp+"\\)$"),J$e=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,eUe=new RegExp("^lab\\("+vp+[Cm,Cm,Cm].join(A8)+_8+"\\)$"),tUe=new RegExp("^lch\\("+vp+[Cm,Cm,VU].join(A8)+_8+"\\)$"),nUe=new RegExp("^oklab\\("+vp+[Cm,Cm,Cm].join(A8)+_8+"\\)$"),rUe=new RegExp("^oklch\\("+vp+[Cm,Cm,VU].join(A8)+_8+"\\)$"),{round:sUe}=Math,NC=t=>t.map((e,n)=>n<=2?E3(sUe(e),0,255):e),Dl=(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,yue=t=>{if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e;if(Ti.format.named)try{return Ti.format.named(t)}catch{}if((e=t.match(K$e))||(e=t.match(Y$e))){let n=e.slice(1,4);for(let s=0;s<3;s++)n[s]=+Dl(Ju(n[s],0),0,255);n=NC(n);const r=e[4]!==void 0?+Dl(e[4],0,1):1;return n[3]=r,n}if(e=t.match(X$e)){const n=e.slice(1,5);for(let r=0;r<4;r++)n[r]=+Dl(n[r],0,255);return n}if((e=t.match(Q$e))||(e=t.match(Z$e))){const n=e.slice(1,4);n[0]=+Ju(n[0].replace("deg",""),0),n[1]=+Dl(Ju(n[1],0),0,100)*.01,n[2]=+Dl(Ju(n[2],0),0,100)*.01;const r=NC($ne(n)),s=e[4]!==void 0?+Dl(e[4],0,1):1;return r[3]=s,r}if(e=t.match(J$e)){const n=e.slice(1,4);n[1]*=.01,n[2]*=.01;const r=$ne(n);for(let s=0;s<3;s++)r[s]=sUe(r[s]);return r[3]=+e[4],r}if(e=t.match(eUe)){const n=e.slice(1,4);n[0]=Dl(Ju(n[0],0),0,100),n[1]=Dl(Ju(n[1],0),-125,125,!0),n[2]=Dl(Ju(n[2],0),-125,125,!0);const r=YE();Gg("d50");const s=NC(fue(n));Gg(r);const a=e[4]!==void 0?+Dl(e[4],0,1):1;return s[3]=a,s}if(e=t.match(tUe)){const n=e.slice(1,4);n[0]=Dl(n[0],0,100),n[1]=Dl(Ju(n[1],0),0,150,!1),n[2]=+Ju(n[2].replace("deg",""),0);const r=YE();Gg("d50");const s=NC(pue(n));Gg(r);const a=e[4]!==void 0?+Dl(e[4],0,1):1;return s[3]=a,s}if(e=t.match(nUe)){const n=e.slice(1,4);n[0]=Dl(Ju(n[0],0),0,1),n[1]=Dl(Ju(n[1],0),-.4,.4,!0),n[2]=Dl(Ju(n[2],0),-.4,.4,!0);const r=NC(xue(n)),s=e[4]!==void 0?+Dl(e[4],0,1):1;return r[3]=s,r}if(e=t.match(rUe)){const n=e.slice(1,4);n[0]=Dl(Ju(n[0],0),0,1),n[1]=Dl(Ju(n[1],0),0,.4,!1),n[2]=+Ju(n[2].replace("deg",""),0);const r=NC(G$e(n)),s=e[4]!==void 0?+Dl(e[4],0,1):1;return r[3]=s,r}};yue.test=t=>K$e.test(t)||Q$e.test(t)||eUe.test(t)||tUe.test(t)||nUe.test(t)||rUe.test(t)||Y$e.test(t)||X$e.test(t)||Z$e.test(t)||J$e.test(t)||t==="transparent";os.prototype.css=function(t){return oHt(this._rgb,t)};const lHt=(...t)=>new os(...t,"css");wi.css=lHt;Ti.format.css=yue;Ti.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&Gi(t)==="string"&&yue.test(t))return"css"}});Ti.format.gl=(...t)=>{const e=Oi(t,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};const cHt=(...t)=>new os(...t,"gl");wi.gl=cHt;os.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]};os.prototype.hex=function(t){return M$e(this._rgb,t)};const uHt=(...t)=>new os(...t,"hex");wi.hex=uHt;Ti.format.hex=O$e;Ti.autodetect.push({p:4,test:(t,...e)=>{if(!e.length&&Gi(t)==="string"&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{log:yF}=Math,iUe=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*yF(r),s=e<20?0:-254.76935184120902+.8274096064007395*(s=e-10)+115.67994401066147*yF(s)):(n=351.97690566805693+.114206453784165*(n=e-55)-40.25366309332127*yF(n),r=325.4494125711974+.07943456536662342*(r=e-50)-28.0852963507957*yF(r),s=255),[n,r,s,1]},{round:dHt}=Math,fHt=(...t)=>{const e=Oi(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=iUe(l);c[2]/c[0]>=r/n?a=l:s=l}return dHt(l)};os.prototype.temp=os.prototype.kelvin=os.prototype.temperature=function(){return fHt(this._rgb)};const eG=(...t)=>new os(...t,"temp");Object.assign(wi,{temp:eG,kelvin:eG,temperature:eG});Ti.format.temp=Ti.format.kelvin=Ti.format.temperature=iUe;os.prototype.oklch=function(){return q$e(this._rgb)};const hHt=(...t)=>new os(...t,"oklch");Object.assign(wi,{oklch:hHt});Ti.format.oklch=G$e;Ti.autodetect.push({p:2,test:(...t)=>{if(t=Oi(t,"oklch"),Gi(t)==="array"&&t.length===3)return"oklch"}});Object.assign(wi,{analyze:H$e,average:pzt,bezier:vzt,blend:Tm,brewer:Zzt,Color:os,colors:YS,contrast:Uzt,contrastAPCA:Vzt,cubehelix:Fzt,deltaE:Kzt,distance:Yzt,input:Ti,interpolate:XS,limits:V$e,mix:XS,random:Rzt,scale:ZR,scales:Qzt,valid:Xzt});const pHt=({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"})}),Aw=({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"})]}),tG=({dataCoin:t,coinInclude:e,coinExclude:n,setCoinInclude:r,setCoinExclude:s,isLoadingCoin:a})=>{const[o,l]=h.useState(!1),[c,u]=h.useState(""),d=()=>{l(C=>!C)};h.useEffect(()=>{const C=t.filter(S=>!(n!=null&&n.includes(S.value))).map(S=>S.value);r(C)},[t,n]);const f=C=>{e!=null&&e.includes(C)?(r(e.filter(S=>S!==C)),s([...n,C])):(s(n.filter(S=>S!==C)),r([...e,C]))},x=()=>{const C=t.map(S=>S.value);r(C),s([])},g=()=>{const C=t.map(S=>S.value);s(C),r([])},y=t==null?void 0:t.filter(C=>{var S;return(S=C.label.toLowerCase())==null?void 0:S.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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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(Vy,{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(Aw,{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,S)=>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(pHt,{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:T=>wm(T)}),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"})})]})]},S))})]})]})]})},nG=new Map,mHt=t=>{if(!t)return Math.floor(Math.random()*1240);const e=t.toLowerCase().replace(/^0x/,"");return parseInt(e.slice(0,8),16)%1240};function aUe({wallet:t,className:e=""}){const[n,r]=h.useState(()=>nG.get(t)||null),[s,a]=h.useState(!1);return h.useEffect(()=>{if(nG.has(t))return;const o=mHt(t);Ns.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)}`),nG.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 xHt=({open:t,setOpen:e,setCopyTradeModal:n,onClose:r,setIsUnderstand:s})=>i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Hi,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"})})]})]})})})})})]}),gHt=({open:t,setOpen:e,setCopyTradeModal:n,onClose:r,setIsLighterUnderstand:s})=>i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Hi,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:jm,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"})})]})]})})})})})]}),bHt=({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:S,setHyperAddress:T}=h.useContext(Qr),{address:I}=ds(),[L,F]=h.useState(!1),[$,O]=h.useState(!1),[U,Y]=h.useState(""),[re,Q]=h.useState(""),[q,te]=h.useState(""),[fe,G]=h.useState(!1),ie=async()=>{var pe,Se,ge,ve,be,we;const ee=window.localStorage.getItem("hyperToken"),se=window.localStorage.getItem("hyperAddress");if(!(!ee||!se))try{G(!0);const je=await bi(se.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((pe=je==null?void 0:je.mushboomer_counts)==null?void 0:pe.eth),g((Se=je==null?void 0:je.mushboomer_counts)==null?void 0:Se.sol),y(je==null?void 0:je.referral_code),v(je==null?void 0:je.refcode),C(je==null?void 0:je.whitelist),S(ee),T(se),te(je==null?void 0:je.farming_tools),e(je==null?void 0:je.farming_tools),G(!1),je!=null&&je.farming_tools&&n(!1),r((ge=je==null?void 0:je.copy_trade_slots_info)==null?void 0:ge.extra_slot_count),s((ve=je==null?void 0:je.copy_trade_slots_info)==null?void 0:ve.subs_slot_count),a((be=je==null?void 0:je.copy_trade_slots_info)==null?void 0:be.using_slot_count),o((we=je==null?void 0:je.copy_trade_slots_info)==null?void 0:we.total_slot_count),l(je==null?void 0:je.copy_trade_slots_wallets)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),S(""),T(""),G(!1))}catch(je){console.error("Token verification error:",je),console.error(je.message||"An unknown error occurred."),G(!1)}},oe=async()=>new Tl(window.ethereum).eth.getAccounts(se=>se),K=async(ee="farming",se=24,pe=5e3)=>{se<=0||(await new Promise(Se=>setTimeout(Se,pe)),await ie(),ee==="farming"&&!q?K(ee,se-1,pe):t())},H=async()=>{Q("");const ee=window.localStorage.getItem("hyperToken"),se=window.localStorage.getItem("hyperAddress");if(!ee||!I){c(!0);return}O(!0),F(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(ge){console.error("Failed to switch network",ge),F(!1);return}const pe=new Tl(window.ethereum);var Se=await oe();if(Se.length>0?Se=Se[0]:Se=void 0,Se){const ve={from:Se,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:"120000000000000000"};await pe.eth.sendTransaction(ve).then(be=>{console.log("txHash :>> ",be),F(!1),Y(be.transactionHash),fetch("https://dextrabothypev2.nftinit.io/api/hyper/payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:I?I.toLowerCase():se,token:ee,payment_tx:be.transactionHash,payment_role:"farming_tools"})}),ie(),K("farming")}).catch(be=>{console.log(be),be.code===-32003||be.message.includes("insufficient funds")?Q("Insufficient funds."):be.message==="MetaMask Tx Signature: User denied transaction signature."&&O(!1)})}else await pe.eth.requestAccounts()};return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:$,setOpen:O,transactionHash:U,transactionLoading:L,paymentPresaleRole:q,errorFunds:re,activeMethod:2}),i.jsx("div",{children:i.jsx("div",{onClick:()=>{H()},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"})})]})},vue=({open:t=!1,setOpen:e=()=>{},oldSlotCount:n,checkAccountTrade:r,tradeMarket:s})=>{const{address:a}=ds(),{setSignModalOpen:o,setTelegramChatId:l,setSubscriberRole:c,setSubsExpireDay:u,setMushboomerETH:d,setMushboomerSOL:f,setIsReferralCode:x,setIsReferralCodeName:g,setIsWhitelist:y,setHyperToken:v,setHyperAddress:C}=h.useContext(Qr),[S,T]=h.useState(1),[I,L]=h.useState(!1),[F,$]=h.useState(!1),[O,U]=h.useState(""),[Y,re]=h.useState(""),[Q,q]=h.useState(""),te=se=>/^\d*$/.test(se),fe=se=>{["e","E","+","-"].includes(se.key)&&se.preventDefault()};h.useEffect(()=>{t||T(1)},[t]);const G=h.useRef(Q);h.useEffect(()=>{G.current=Q},[Q]);const ie=h.useMemo(()=>{if(S==="")return!1;const se=Number(S);return Number.isInteger(se)&&se>=1},[S]),oe=async()=>{var Se,ge,ve;const se=window.localStorage.getItem("hyperToken"),pe=window.localStorage.getItem("hyperAddress");if(!(!se||!pe))try{const be=await bi(pe.toLowerCase(),se);be!=null&&be.success?(l(be==null?void 0:be.telegram_chat_id),c(be==null?void 0:be.subscriber_role),u(be==null?void 0:be.subs_expire_day),d((Se=be==null?void 0:be.mushboomer_counts)==null?void 0:Se.eth),f((ge=be==null?void 0:be.mushboomer_counts)==null?void 0:ge.sol),x(be==null?void 0:be.referral_code),g(be==null?void 0:be.refcode),y(be==null?void 0:be.whitelist),v(se),C(pe),q((ve=be==null?void 0:be.copy_trade_slots_info)==null?void 0:ve.extra_slot_count)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),v(""),C(""))}catch(be){console.error("Token verification error:",be),console.error(be.message||"An unknown error occurred.")}},K=async()=>new Tl(window.ethereum).eth.getAccounts(pe=>pe),H=async(se="slot",pe=24,Se=5e3)=>{pe<=0||(await new Promise(ge=>setTimeout(ge,Se)),await oe(),se==="slot"&&G.current<=n?H(se,pe-1,Se):r())},ee=async se=>{re("");const pe=window.localStorage.getItem("hyperToken"),Se=window.localStorage.getItem("hyperAddress");if(!pe||!a){o(!0);return}$(!0),L(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(be){console.error("Failed to switch network",be),L(!1);return}const ge=new Tl(window.ethereum);var ve=await K();if(ve.length>0?ve=ve[0]:ve=void 0,ve){const we=se*.012,je=ge.utils.toWei(we.toString(),"ether"),Fe={from:ve,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:je};await ge.eth.sendTransaction(Fe).then(Re=>{console.log("txHash :>> ",Re),L(!1),U(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():Se,token:pe,payment_tx:Re.transactionHash,slot_role:"lighter_copy_trade",slot_qty:Number(S)})}),oe(),H("slot")}).catch(Re=>{console.log(Re),Re.code===-32003||Re.message.includes("insufficient funds")?re("Insufficient funds."):Re.message==="MetaMask Tx Signature: User denied transaction signature."&&$(!1)})}else await ge.eth.requestAccounts()};return t?i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:F,setOpen:$,transactionHash:O,transactionLoading:I,paymentPresaleRole:!(Q<=n),errorFunds:Y,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:()=>T(se=>{const pe=Number(se||0);return pe>1?String(pe-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:S,onChange:se=>{const pe=se.target.value.trim();if(pe==="")return T("");te(pe)&&T(pe)},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:()=>T(se=>{const pe=Number(se||0);return String(pe+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:"+"})]}),S!==""&&!ie&&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:[(S*.012).toFixed(3)," ETH"]})]}),i.jsx("div",{onClick:se=>{se.preventDefault(),ie&&ee(S)},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 ${ie?"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy"})]})})]})]}):null},yHt=({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(L0,{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(as,{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:Yl,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 V5({open:t,setOpen:e,copyTradeData:n,copyTradeWallet:r,setCopyTradeWallet:s,isScalper:a,setCopyTradeData:o,sourcePage:l="default"}){var sr,Mr,Lr,ss,ys;const{getCopyTradeWatchList:c,copyTradeWatchList:u,mushboomerETH:d,mushboomerSOL:f,trackedWatchList:x,isWhitelist:g,setTelegramChatId:y,setSubscriberRole:v,setSubsExpireDay:C,setMushboomerETH:S,setMushboomerSOL:T,setIsReferralCode:I,setIsReferralCodeName:L,setIsWhitelist:F,setHyperToken:$,setHyperAddress:O}=h.useContext(Qr),{address:U}=ds(),[Y,re]=h.useState(!1),[Q,q]=h.useState(!1),[te,fe]=h.useState("method_two"),[G,ie]=h.useState("All"),[oe,K]=h.useState([]),[H,ee]=h.useState(!1),[se,pe]=h.useState(null),[Se,ge]=h.useState(!1),[ve,be]=h.useState(!1),[we,je]=h.useState(!1),[Fe,Re]=h.useState(!1),[Qe,Ye]=h.useState(!1),[dt,st]=h.useState(!1),[at,He]=h.useState(!1),[qe,vt]=h.useState(!1),[yt,Kt]=h.useState(""),[jt,un]=h.useState(""),[vn,Hn]=h.useState(""),[ln,Nn]=h.useState(""),[dn,rt]=h.useState(""),[nt,Ut]=h.useState(""),[wn,Jt]=h.useState(""),[Vt,xt]=h.useState(""),[We,Pt]=h.useState(100),[Ke,ct]=h.useState(!0),[Nt,Ht]=h.useState(!0),[Rt,hn]=h.useState(!1),[yn,Cn]=h.useState(!0),[En,Rn]=h.useState(!0),[Mn,Yn]=h.useState(null),[Zn,Vn]=h.useState(null),[tr,Sn]=h.useState(""),[ze,xe]=h.useState(""),[Ge,_e]=h.useState({inputValue:"",selectValue:"%"}),[Be,qt]=h.useState({inputValue:"",selectValue:"%"}),[It,mt]=h.useState([]),[Ft,Tn]=h.useState(!0),[kn,Gt]=h.useState([]),[mn,gt]=h.useState([]);h.useState(!1),h.useState(!1);const[Wt,jn]=h.useState(!1),[kt,cn]=h.useState(null),[Ce,m]=h.useState(null),[p,N]=h.useState(null),[A,k]=h.useState(null),[P,D]=h.useState(!1),[V,Z]=h.useState(!1),[ce,ue]=h.useState(!1),[me,Ne]=h.useState(!1),[Ie,Le]=h.useState(!1),Xe=h.useRef(null),[Oe,$e]=h.useState(null),[ae,he]=h.useState(!1),Pe=h.useRef(null),[Ve,Te]=h.useState(!1),[Ze,it]=h.useState(!1),[wt,Dt]=h.useState(!1),[Qt,xn]=h.useState([]),[pn,An]=h.useState([]),[or,$t]=h.useState(!1),[bt,rn]=h.useState(!1),[ur,gr]=h.useState(!1),[br,Br]=h.useState(0),[Gr,Or]=h.useState(0),[Lt,nn]=h.useState(0),[Ot,en]=h.useState(0),[Fn,yr]=h.useState(null),[hr,lt]=h.useState(!1),[Ct,On]=h.useState(!1),[qn,_r]=h.useState([]),[jr,Fr]=h.useState(null),[nr,vr]=h.useState(!1),Yr=async Bt=>{var xs,ls,hs,vs,vi,Ps;if(!t)return;const mr=Bt||Oe,er=window.localStorage.getItem("hyperToken"),qr=window.localStorage.getItem("hyperAddress");if(!(!er||!qr))try{gr(!0);const As=await bi(qr.toLowerCase(),er);As!=null&&As.success?(y(As==null?void 0:As.telegram_chat_id),v(As==null?void 0:As.subscriber_role),C(As==null?void 0:As.subs_expire_day),S((xs=As==null?void 0:As.mushboomer_counts)==null?void 0:xs.eth),T((ls=As==null?void 0:As.mushboomer_counts)==null?void 0:ls.sol),I(As==null?void 0:As.referral_code),L(As==null?void 0:As.refcode),F(As==null?void 0:As.whitelist),$(er),O(qr),Br((hs=As==null?void 0:As.copy_trade_slots_info)==null?void 0:hs.extra_slot_count),Or((vs=As==null?void 0:As.copy_trade_slots_info)==null?void 0:vs.subs_slot_count),nn((vi=As==null?void 0:As.copy_trade_slots_info)==null?void 0:vi.using_slot_count),en((Ps=As==null?void 0:As.copy_trade_slots_info)==null?void 0:Ps.total_slot_count),_r(As==null?void 0:As.copy_trade_slots_wallets),$t(As==null?void 0:As.farming_tools),mr==="lighter"?As!=null&&As.farming_tools?rn(!1):rn(!0):rn(!1),gr(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),$(""),O(""),gr(!1))}catch(As){console.error("Token verification error:",As),console.error(As.message||"An unknown error occurred."),gr(!1)}};h.useEffect(()=>{if(t)if(or&&Ot==0&&Oe==="lighter"&&Mn){const Bt=qn==null?void 0:qn.includes(Mn);On(!Bt)}else On(!1)},[Mn,Oe,Ot,or,t]);const dr=h.useMemo(()=>n?Array.isArray(n)?n:[]:[],[n]);h.useEffect(()=>{if(l==="default"||!l||!dr.length)return;const Bt=dr.findIndex(mr=>(mr==null?void 0:mr.wallet_id)===l);Bt!==-1&&Fr(Bt)},[l,dr]),h.useEffect(()=>{l!=="default"||!dr.length||jr===null&&Fr(0)},[dr,l]);const rs=dr[jr]||null,gs=h.useMemo(()=>!nr||!Mn?!1:dr.some(Bt=>(Bt==null?void 0:Bt.wallet_id)===Mn),[nr,Mn,dr,Oe]);function ms(Bt){return String(Bt).trim().toUpperCase()}const At=Bt=>{Bt&&(Kt(Bt==null?void 0:Bt.margin_used_rate),un(Bt==null?void 0:Bt.min_usd_per_order),Hn(Bt==null?void 0:Bt.max_usd_per_order),Nn(Bt==null?void 0:Bt.max_usd_per_positions),rt(Bt==null?void 0:Bt.initial_order_max_usd),Ut(Bt==null?void 0:Bt.margin_used_amount),Jt(Bt==null?void 0:Bt.increase_limit),xt(Bt==null?void 0:Bt.copy_current_percentage),Pt((Bt==null?void 0:Bt.scaling)==null?100:Bt==null?void 0:Bt.scaling),ie((Bt==null?void 0:Bt.position_type)===0?"All":(Bt==null?void 0:Bt.position_type)===1?"LONG":(Bt==null?void 0:Bt.position_type)===2?"SHORT":"All"),$e(Bt!=null&&Bt.target_platform?(Bt==null?void 0:Bt.target_platform)==="hyper"?"hyper":Bt==null?void 0:Bt.target_platform:"hyper"),fe((Bt==null?void 0:Bt.method_type)===1?"method_one":(Bt==null?void 0:Bt.method_type)===2?"method_two":(Bt==null?void 0:Bt.method_type)===2e3?"method_twothousand":"method_two"),ct((Bt==null?void 0:Bt.copy_trait_mode)==null?!0:Bt==null?void 0:Bt.copy_trait_mode),Ht((Bt==null?void 0:Bt.open_with_increase)!==null?Bt==null?void 0:Bt.open_with_increase:!0),hn((Bt==null?void 0:Bt.included_twaps)!==null?Bt==null?void 0:Bt.included_twaps:!1),Cn((Bt==null?void 0:Bt.future_listed_tokens)!==null?Bt==null?void 0:Bt.future_listed_tokens:!0),Rn((Bt==null?void 0:Bt.copy_current)!==null?Bt==null?void 0:Bt.copy_current:!0),Yn(Bt==null?void 0:Bt.wallet_id),Vn(Bt==null?void 0:Bt.wallet_id),Sn(Bt==null?void 0:Bt.tag),xe(Bt==null?void 0:Bt.comments),_e({inputValue:Bt==null?void 0:Bt.stop_loss_amount,selectValue:(Bt==null?void 0:Bt.stop_loss_type)??"%"}),qt({inputValue:Bt==null?void 0:Bt.target_price_amount,selectValue:Bt==null?void 0:Bt.target_price_type}),Gt((Bt==null?void 0:Bt.include_coins)||[]),gt((Bt==null?void 0:Bt.exclude_coins)||[]),Vr(Bt!=null&&Bt.target_platform?(Bt==null?void 0:Bt.target_platform)==="hyper"?"hyper":Bt==null?void 0:Bt.target_platform:"hyper"))};h.useEffect(()=>{rs===null&&n!==null?nr||At(Array.isArray(n)?n[0]:n):At(rs)},[rs,n]),h.useEffect(()=>{t&&n===null&&(async()=>{try{const Bt=window.localStorage.getItem("hyperToken"),mr=window.localStorage.getItem("hyperAddress");if(!Bt)return;const[er,qr]=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:U?U.toLowerCase():mr,token:Bt})}),fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:U?U.toLowerCase():mr,token:Bt})})]),[xs,ls]=await Promise.all([er.json(),qr.json()]),hs=xs!=null&&xs.success?xs.data:[],vs=ls!=null&&ls.success?ls.data:[];hs.length>0?$e("hyper"):vs.length>0?$e("lighter"):$e("hyper")}catch(Bt){console.error("Wallet auto-select error:",Bt)}})()},[t,n]);const pt=u==null?void 0:u.some(Bt=>(Bt==null?void 0:Bt.wallet_address)===r),le=async()=>{try{const Bt=window.localStorage.getItem("hyperToken"),mr=window.localStorage.getItem("hyperAddress");if(!Bt){setSignModalOpen(!0);return}const er="https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",qr={address:U?U.toLowerCase():mr,token:Bt},xs=await fetch(er,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(qr)});if(!xs.ok)throw new Error(`Server responded with status ${xs.status}`);const ls=await xs.json();if(ls.success){vr(!0);const hs=ls==null?void 0:ls.data;At(hs),Fr(null)}else console.log(ls.error_message),fn.error(ls.error_message)}catch(Bt){console.error("Error in like function:",Bt),fn.error(Bt.message||"Something went wrong!")}},Me=Bt=>{let mr=Bt.target.value;if(mr===""){_e(er=>({...er,inputValue:""}));return}/^\d*\.?\d{0,2}$/.test(mr)&&_e(er=>({...er,inputValue:mr}))},ft=Bt=>{let mr=Bt.target.value;if(mr===""){qt(er=>({...er,inputValue:""}));return}/^\d*\.?\d{0,2}$/.test(mr)&&qt(er=>({...er,inputValue:mr}))},ut=Bt=>{let mr=Bt.target.value.trim();if(mr===""){Kt(null);return}/^\d*\.?\d{0,2}$/.test(mr)&&Kt(mr)},on=Bt=>{let mr=Bt.target.value.trim();if(mr===""){un(null);return}if(/^\d*\.?\d{0,2}$/.test(mr)){un(mr);const er=parseFloat(mr),qr=te==="method_twothousand"&&(vn!=null&&!isNaN(vn)&&vn&&er>Number(vn)||ln!=null&&!isNaN(ln)&&ln&&er>Number(ln));st(qr);const xs=te==="method_twothousand"&&vn!=null&&!isNaN(vn)&&vn&&er!=null&&!isNaN(er)&&er&&er>Number(vn);Ye(xs);const ls=te==="method_twothousand"&&ln!=null&&!isNaN(ln)&&ln&&er>Number(ln);vt(ls)}},bn=Bt=>{let mr=Bt.target.value.trim();if(mr===""){Hn(null);return}if(/^\d*\.?\d{0,2}$/.test(mr)){Hn(mr);const er=parseFloat(mr),qr=te==="method_twothousand"&&(er==null||isNaN(er)||!er||jt!=null&&!isNaN(jt)&&jt&&er<Number(jt)||er!=null&&!isNaN(er)&&er&&ln!=null&&!isNaN(ln)&&ln&&er>Number(ln));Ye(qr);const xs=te==="method_twothousand"&&jt!=null&&!isNaN(jt)&&jt&&er<Number(jt);st(xs);const ls=te==="method_twothousand"&&er!=null&&!isNaN(er)&&er&&ln!=null&&!isNaN(ln)&&ln&&er>Number(ln);vt(ls)}},Gn=Bt=>{let mr=Bt.target.value.trim();if(mr===""){rt(null);return}if(/^\d*\.?\d{0,2}$/.test(mr)){rt(mr);const er=parseFloat(mr),qr=te==="method_twothousand"&&ln!=null&&!isNaN(ln)&&ln&&er&&er>Number(ln);He(qr),vt(qr)}},rr=Bt=>{let mr=Bt.target.value.trim();if(mr===""){Nn(null);return}if(/^\d*\.?\d{0,2}$/.test(mr)){Nn(mr);const er=parseFloat(mr),qr=te==="method_twothousand"&&(vn!=null&&!isNaN(vn)&&vn&&er<Number(vn)||jt!=null&&!isNaN(jt)&&jt&&er<Number(jt)||dn!=null&&!isNaN(dn)&&dn&&er<Number(dn));vt(qr);const xs=te==="method_twothousand"&&vn!=null&&!isNaN(vn)&&vn&&er!=null&&!isNaN(er)&&er&&er<Number(vn);Ye(xs);const ls=te==="method_twothousand"&&jt!=null&&!isNaN(jt)&&jt&&er<Number(jt);st(ls);const hs=te==="method_twothousand"&&dn!=null&&!isNaN(dn)&&dn&&er<Number(dn);He(hs)}},Jn=Bt=>{Sn(Bt.target.value),je(!1)},Xn=Bt=>{let mr=Bt.target.value;if(mr===""){Ut("");return}/^\d*\.?\d{0,2}$/.test(mr)&&Ut(mr),be(!1)},Zr=Bt=>{let mr=Bt.target.value;if(mr===""){Jt("");return}/^\d*\.?\d{0,2}$/.test(mr)&&Jt(mr)},$r=Bt=>{let mr=Bt.target.value;if(mr===""){Pt("");return}/^\d*\.?\d{0,2}$/.test(mr)&&Pt(mr)},wr=Bt=>{["-","+","e"].includes(Bt.key)&&Bt.preventDefault()};async function pr(){try{q(!0);const Bt=Mn,mr=window.localStorage.getItem("hyperToken"),er="https://dextrabothypev2.nftinit.io/",qr=window.localStorage.getItem("hyperAddress");if(!mr||!r)throw new Error("Authentication token is missing. Please log in again.");const ls=await(await fetch(er+"api/test_app/following/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:U?U.toLowerCase():qr,token:mr,follow_address:r.toLowerCase(),copy_trait_mode:Ke??!1,open_with_increase:Nt??!1,included_twaps:Rt??!1,future_listed_tokens:yn??!1,copy_current:En??!1,margin_used_rate:yt??null,min_usd_per_order:jt??null,max_usd_per_order:vn??null,max_usd_per_positions:ln??null,initial_order_max_usd:dn||null,margin_used_amount:nt||null,increase_limit:wn||null,copy_current_percentage:Vt||null,scaling:We||null,method_type:te=="method_two"?2:te=="method_twothousand"?2e3:te=="method_one"?1:null,position_type:G=="All"?0:G=="LONG"?1:G=="SHORT"?2:null,tag:tr??null,comments:ze??null,stop_loss_amount:Ge.inputValue?Ge.inputValue:null,stop_loss_type:Ge.selectValue??"%",target_price_amount:Be.inputValue?Be.inputValue:null,target_price_type:Be.selectValue??"%",wallet_id:Mn??null,include_coins:Array.isArray(kn)&&(kn==null?void 0:kn.length)>0?kn:null,exclude_coins:Array.isArray(mn)&&(mn==null?void 0:mn.length)>0?mn:null,target_platform:Oe??"hyper"})})).json();if(ls.success){q(!1),c();const hs=Array.isArray(ls.data)?ls.data.filter(Ps=>{var As;return((As=Ps==null?void 0:Ps.wallet_address)==null?void 0:As.toLowerCase())===(r==null?void 0:r.toLowerCase())}):[],vs=hs==null?void 0:hs.sort((Ps,As)=>new Date(As.created_at)-new Date(Ps.created_at));o(vs);const vi=vs==null?void 0:vs.findIndex(Ps=>(Ps==null?void 0:Ps.wallet_id)===Bt);Fr(vi!==-1?vi:0),Yr(Oe),jn(!1),fn.success(`${(r==null?void 0:r.slice(0,5))+"..."+(r==null?void 0:r.slice(-3))} ${pt?"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"}}),vr(!1)}else q(!1),fn.error(ls.error_message||"Registration failed.")}catch(Bt){console.error("Error in copyTradeSave:",Bt),fn.error(Bt.message||"An unexpected error occurred."),q(!1)}}const ar=async()=>{try{re(!0);const Bt=window.localStorage.getItem("hyperToken"),mr="https://dextrabothypev2.nftinit.io/api/test_app/following/unfollow/",er=window.localStorage.getItem("hyperAddress");if(!Bt||!r)throw new Error("Required information is missing. Please log in or connect your wallet.");const qr=await fetch(mr,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:U?U.toLowerCase():er,token:Bt,follow_address:r,target_platform:Oe??"hyper",wallet_id:Mn??null})});if(!qr.ok)throw new Error(`Failed to unlike: ${qr.status} ${qr.statusText}`);const xs=await qr.json();if(xs.success){re(!1),c();const ls=Array.isArray(xs.data)?xs.data.filter(vs=>{var vi;return((vi=vs==null?void 0:vs.wallet_address)==null?void 0:vi.toLowerCase())===(r==null?void 0:r.toLowerCase())}):[],hs=Array.isArray(ls)?[...ls].sort((vs,vi)=>new Date(vi.created_at)-new Date(vs.created_at)):[];o(hs),hs.length>0?Fr(0):Fr(null),Yr(Oe),ls&&ls.length===0&&le(),fn.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(xs.error_message),fn.error(xs.error_message),re(!1)}catch(Bt){console.error("Error in unlike function:",Bt),fn.error(Bt.message||"Something went wrong!"),re(!1)}},Vr=async Bt=>{if(!t)return;const mr=Bt||Oe;try{ee(!0);const er=window.localStorage.getItem("hyperToken"),qr=window.localStorage.getItem("hyperAddress"),xs=mr==="hyper"?"https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list":"https://dextrabothypev2.nftinit.io/api/wallet/list-lighter";if(!er)return;const hs=await(await fetch(xs,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:U?U.toLowerCase():qr,token:er})})).json();hs.success?(K(hs==null?void 0:hs.data),ee(!1)):(console.log(hs.error_message),ee(!1),pe(hs.error_message))}catch(er){console.error("Error generate wallet list:",er),ee(!1),pe(er.message)}},Ur=async()=>{try{const Bt=window.localStorage.getItem("hyperToken"),mr=window.localStorage.getItem("hyperAddress");if(!Bt)return;const[er,qr]=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:U?U.toLowerCase():mr,token:Bt})}),fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:U?U.toLowerCase():mr,token:Bt})})]),[xs,ls]=await Promise.all([er.json(),qr.json()]);xs.success&&xn(xs.data),ls!=null&&ls.success&&An(ls.data)}catch(Bt){console.error("Error fetching wallet lists:",Bt)}},bs=Bt=>Bt!=null&&Bt.assetPositions?Bt.assetPositions.filter(mr=>{if(!mr.position||!mr.position.szi)return!1;const er=parseFloat(mr.position.szi);return!isNaN(er)&&er!==0}).map(mr=>{const er=mr.position,qr=parseFloat(er.szi),xs=parseFloat(er.entryPx),ls=parseFloat(er.positionValue),hs=parseFloat(er.unrealizedPnl),vs=parseFloat(er.returnOnEquity)*100,vi=parseFloat(er.marginUsed),Ps=er.leverage.value,As=parseFloat(er.cumFunding.sinceOpen),Ts=qr>0?"Long":"Short";return{asset:er.coin,type:Ts,size:Math.abs(qr),entryPrice:xs.toFixed(2),currentPrice:(ls/Math.abs(qr)).toFixed(2),leverage:Ps,positionValue:ls.toFixed(2),marginUsed:vi.toFixed(2),unrealizedPnl:hs.toFixed(2),roe:vs.toFixed(2),funding:As.toFixed(4),liquidationPrice:er.liquidationPx?parseFloat(er.liquidationPx).toFixed(2):"N/A"}}):[];h.useEffect(()=>{const Bt=async()=>{const qr=await Ns.post("https://api-ui.hyperliquid.xyz/info",{type:"clearinghouseState",user:r});if(qr.data){cn(qr.data);const xs=bs(qr.data);m(xs)}},mr=async()=>{var xs,ls,hs;const qr=await Ns.post("https://api-ui.hyperliquid.xyz/info",{type:"portfolio",user:r});if(qr.data){const vs=((ls=(xs=qr.data.find(Ps=>Ps[0]==="perpMonth"))==null?void 0:xs[1])==null?void 0:ls.pnlHistory)||[],vi=((hs=vs[vs.length-1])==null?void 0:hs[1])??0;N(vi)}},er=async()=>{var ls;const xs=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(((ls=xs==null?void 0:xs.results[0])==null?void 0:ls.win_complated_rate)||"-")};r&&(Bt(),mr(),er())},[r]),h.useEffect(()=>{if(!t)return;let Bt=!1;async function mr(){var er,qr;try{Tn(!0);const ls=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/")).json(),hs=()=>wi.random().hex(),vs={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},vi=(qr=(er=ls.coins)==null?void 0:er.filter(Ps=>!Ps.startsWith("@")&&!Ps.endsWith("/USDC")))==null?void 0:qr.map(Ps=>({value:Ps,label:Ps.endsWith("/USDC")?Ps+" (Spot)":Ps,color:hs(),icon:`https://app.hyperliquid.xyz/coins/${vs[Ps]||Ps.split("/")[0]}.svg`}));Bt||(mt(vi),Tn(!1))}catch(xs){Bt||(console.error("Data retrieval error:",xs),Tn(!1))}}return mr(),()=>{Bt=!0}},[t]),h.useEffect(()=>{t&&(Vr(Oe),Yr(Oe))},[Oe,t]),h.useEffect(()=>{t&&Ur()},[t]),h.useEffect(()=>{if(!t||!pt||!rs||!Array.isArray(It)||It.length===0)return;const Bt=It.map(hs=>typeof hs=="string"?hs:hs.value).filter(Boolean),mr=new Map(Bt.map(hs=>[ms(hs),hs])),er=Bt.map(ms),qr=new Set([...(rs.include_coins||[]).map(ms),...(rs.exclude_coins||[]).map(ms)]),xs=er.filter(hs=>!qr.has(hs));if(xs.length===0)return;const ls=xs.map(hs=>mr.get(hs)||hs);rs.future_listed_tokens?Gt(hs=>Array.from(new Set([...hs||[],...ls]))):gt(hs=>Array.from(new Set([...hs||[],...ls])))},[t,pt,It,rs]),h.useEffect(()=>{t||(e(!1),Kt(null),un(null),Hn(null),Nn(null),rt(null),Ut(null),Jt(null),xt(null),Pt(100),fe("method_two"),$e(null),ie("All"),ct(!0),Ht(!0),hn(!1),Cn(!0),Rn(!0),Yn(null),Vn(null),Sn(null),xe(null),_e({inputValue:null,selectValue:"%"}),qt({inputValue:null,selectValue:"%"}),Gt(null),gt(null),ge(!1),be(!1),Ye(!1),st(!1),He(!1),vt(!1),je(!1),Re(!1),ue(!1),Dt(!1),Le(!1),he(!1),$t(!1),rn(!1),On(!1),vr(!1),K([]),o(null),Fr(null))},[t]),h.useEffect(()=>{const Bt=oe.find(mr=>(mr==null?void 0:mr.wallet_id)===(n==null?void 0:n.wallet_id));Bt&&Yn(Bt==null?void 0:Bt.wallet_id)},[oe,n]),h.useEffect(()=>{Oe==="lighter"?(We!==""&&Number(We)>100?Re(!0):Re(!1),rn(!or)):(Re(!1),rn(!1))},[We,Oe]);const Sr=Bt=>{Yn(Bt??null),ge(!1),Le(!1)},Pn=Bt=>{$e(Bt),he(!1),Rn(!1),Bt==="lighter"&&(te=="method_twothousand"||te=="method_one")&&fe("method_two"),Yn(null)},Ln=()=>{Vr(Oe)};h.useEffect(()=>{const Bt=mr=>{Xe.current&&!Xe.current.contains(mr.target)&&Le(!1),Pe.current&&!Pe.current.contains(mr.target)&&he(!1)};return document.addEventListener("mousedown",Bt),()=>{document.removeEventListener("mousedown",Bt)}},[]);const ht=[Se,ve,Qe,dt,at,qe,we,bt,Ct].filter(Boolean).length;h.useEffect(()=>{t&&a&&!V&&(u!=null&&u.some(Bt=>(Bt==null?void 0:Bt.wallet_address)===r)||D(!0),Z(!0)),t||Z(!1)},[t,a]),h.useEffect(()=>{t&&a&&!Ze&&Oe!==null&&!P&&(u!=null&&u.some(Bt=>(Bt==null?void 0:Bt.wallet_address)===r)||Oe==="lighter"&&Te(!0),it(!0)),t||it(!1)},[t,a,Oe,P]);const Yt=()=>{Te(!1),D(!1),e(!1)},lr=[{id:1,label:"Hyperliquid",value:"hyper"},{id:2,label:"Lighter",value:"lighter"}];return i.jsxs(i.Fragment,{children:[i.jsx(cUt,{open:Wt,setOpen:jn,copyTradeSave:pr}),i.jsx(xHt,{open:P,setOpen:D,setCopyTradeModal:e,onClose:Yt,setIsUnderstand:ue}),i.jsx(M5,{open:me,setOpen:Ne,handleListRequest:Vr,handlePageChange:()=>{}}),i.jsx(gHt,{open:Ve,setOpen:Te,setCopyTradeModal:e,onClose:Yt,setIsLighterUnderstand:Dt}),hr&&Ea.createPortal(i.jsx(vue,{open:hr,setOpen:lt,oldSlotCount:Fn,checkAccountTrade:Yr,tradeMarket:"copyTrade"}),document.body),i.jsxs(ha,{open:t,onClose:Yt,className:"relative z-50",children:[i.jsx(fa,{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(Ji,{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&&P&&!(u!=null&&u.some(Bt=>(Bt==null?void 0:Bt.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:H?i.jsx("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:i.jsx(ka,{})}):g||d>0||f>0?(oe==null?void 0:oe.length)>0||(Qt==null?void 0:Qt.length)>0||(pn==null?void 0:pn.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(zOe,{})}),i.jsx("div",{style:{backgroundImage:`url(${Xlt})`,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(aUe,{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:Bt=>{Bt.stopPropagation(),navigator.clipboard.writeText(r),fn.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:io,alt:"",className:"cursor-pointer"})}),i.jsx("span",{className:"ml-auto cursor-pointer",children:i.jsx(H5,{walletAddress:r,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:x.some(Bt=>Bt.wallet_address===r)?i.jsx("img",{src:k5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:qj,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:["$",kt?Ir(kt==null?void 0:kt.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:`${kt&&Ce&&Ce.reduce((Bt,mr)=>Bt+parseFloat(mr.unrealizedPnl),0)>=0?"text-[#67FFBD]":"text-[#FF7173]"} font-manrope text-[16px] font-semibold leading-[13px] tracking-[0.32px]`,children:["$",kt&&Ce?Ir(Math.abs(Ce.reduce((Bt,mr)=>Bt+parseFloat(mr.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:[A,"%"]})]}),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?Ir(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(uUt,{positions:Ce})]}),i.jsx("div",{className:"w-full h-px bg-[#353535] mb-1"}),i.jsx("div",{className:"mt-2",children:i.jsx(yHt,{normalizedCopyTradeList:dr,selectedWmIndex:jr,setSelectedWmIndex:Fr,getSettingList:le,setIsNewSetting:vr})})]})]})]}),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:`${Q||Y?"block":"hidden"} flex justify-center items-center w-full h-full absolute bg-[#101010]/80 z-50 -mt-[64px] rounded-3xl`,children:i.jsx(ka,{})}),i.jsxs("div",{className:"flex-col justify-between items-center gap-4 w-full border-b border-[#353535] pb-3",children:[ht>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:Wo,alt:"Dextrabot"}),ht]}),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(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5"}),i.jsx("span",{children:i.jsx(fo,{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(T0,{})]}),i.jsxs("div",{ref:Pe,className:"relative w-full max-w-[250px]",children:[i.jsxs("div",{className:`${pt&&!nr?"cursor-not-allowed":"cursor-pointer"} rounded-md bg-[#353535] text-white px-2 h-8 flex items-center justify-between`,onClick:Bt=>{Bt.preventDefault(),(!pt&&nr||pt&&nr||!pt&&!nr)&&he(!ae)},children:[i.jsxs("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] flex items-center gap-2",children:[Oe==="hyper"?i.jsx("img",{src:"https://app.hyperliquid.xyz/coins/HYPE.svg",className:"w-4 h-4"}):i.jsx(L0,{className:"w-4 h-4 text-white"}),Oe==="hyper"?"Hyperliquid":"Lighter"]}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${ae?"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"})})]}),ae&&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:lr==null?void 0:lr.map(Bt=>i.jsxs("div",{onClick:mr=>{mr.preventDefault(),(!pt&&nr||pt&&nr||!pt&&!nr)&&(Pn(Bt.value),Bt.value==="lighter"&&!wt&&a&&Te(!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] ${Bt.value===Oe?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white ${pt&&!nr?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsxs("span",{className:"text-white flex items-center gap-2",children:[Bt.label==="Hyperliquid"?i.jsx("img",{src:"https://app.hyperliquid.xyz/coins/HYPE.svg",className:"w-4 h-4"}):i.jsx(L0,{className:"w-4 h-4 text-white"}),Bt.label]}),Bt.value===Oe&&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.id))})})]})]}),i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{onClick:()=>{Ln()},className:"hidden sm:flex lg:hidden xl:flex justify-center items-center cursor-pointer",children:i.jsx(v2e,{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:Xe,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:()=>Le(!Ie),children:[i.jsx("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px]",children:Mn?((sr=oe==null?void 0:oe.find(Bt=>(Bt==null?void 0:Bt.wallet_id)===Mn))==null?void 0:sr.wallet_name)==="Dextrabot"&&((Mr=oe==null?void 0:oe.find(Bt=>(Bt==null?void 0:Bt.wallet_id)===Mn))==null?void 0:Mr.version)===3?((Lr=oe==null?void 0:oe.find(Bt=>(Bt==null?void 0:Bt.wallet_id)===Mn))==null?void 0:Lr.wallet_name)+" (API-AGENT) Wallet":(ss=oe==null?void 0:oe.find(Bt=>(Bt==null?void 0:Bt.wallet_id)===Mn))==null?void 0:ss.wallet_name:"Select"}),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.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 Bt=Oe==="hyper"?"hyperliquid":"lighter";window.open(`/wallet-management#${Bt}#add-account#${Bt}`,"_blank"),Le(!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:oe&&((ys=[...oe].sort((Bt,mr)=>{var xs,ls;const er=(xs=Bt==null?void 0:Bt.wallet_name)==null?void 0:xs.includes("Dextrabot"),qr=(ls=mr==null?void 0:mr.wallet_name)==null?void 0:ls.includes("Dextrabot");return er&&!qr?-1:!er&&qr?1:0}))==null?void 0:ys.map((Bt,mr)=>i.jsxs("div",{onClick:er=>{er.preventDefault(),(!pt&&nr||pt&&nr||!pt&&!nr)&&Sr(Bt==null?void 0:Bt.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] ${pt&&!nr?"cursor-not-allowed":"cursor-pointer"} ${(Bt==null?void 0:Bt.wallet_id)===Mn?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white`,children:[i.jsx("span",{className:"text-white",children:(Bt==null?void 0:Bt.wallet_name)==="Dextrabot"&&(Bt==null?void 0:Bt.version)===3?(Bt==null?void 0:Bt.wallet_name)+" (API-AGENT) Wallet":Bt==null?void 0:Bt.wallet_name}),(Bt==null?void 0:Bt.wallet_id)===Mn&&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==null?void 0:Bt.wallet_id)??mr)))})]}),Se&&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:()=>{Ln()},className:"flex sm:hidden lg:flex xl:hidden justify-center items-center cursor-pointer",children:i.jsx(v2e,{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:Qlt,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:`${bt||Oe==="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:Cme,alt:"Dextrabot",className:"w-4 h-4 mr-2"}),"Methodology"]})})]}),bt||Oe==="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:Cme,alt:"Dextrabot",className:"w-4 h-4 mr-2"}),"Methodology"]})}):Oe==="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(E5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[Lt||0,"/",Ot+Lt||0]})]})]}),i.jsx("div",{onClick:()=>{yr(br),lt(!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:`${bt?"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"&&Oe==="hyper"||(te=="method_two"||te=="method_twothousand")&&(!pt||pt&&nr)&&Oe==="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")&&pt&&!nr||Oe!=="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"&&Oe==="hyper"||(te=="method_one"||te=="method_two")&&(!pt||pt&&nr)&&Oe==="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")&&pt&&!nr||Oe!=="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")&&(!pt||pt&&nr))&&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")&&pt&&!nr?"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:yt||"",onChange:ut,type:"text",name:"marginUsedRate",onKeyDown:wr,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
${yt?"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:nt||"",onChange:Xn,type:"text",name:"marginUsedAmount",onKeyDown:wr,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
${ve?"border border-[#FF797C]":nt?"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:wn||"",onChange:Zr,type:"text",name:"marginIncreaseLimit",onKeyDown:wr,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
${wn?"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:Nt?"On":"Off"}),i.jsx(Oo,{checked:Nt,onChange:Ht,className:`${Nt?"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:Ge.inputValue||"",onChange:Me,onKeyDown:wr,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
${Ge.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:Be.inputValue||"",onChange:ft,onKeyDown:wr,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
${Be.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:Rt?"On":"Off"}),i.jsx(Oo,{checked:Rt,onChange:hn,className:`${Rt?"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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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(rg,{title:"All",set_click:()=>ie("All"),isPositionType:G}),i.jsx(rg,{title:"LONG",set_click:()=>ie("LONG"),isPositionType:G}),i.jsx(rg,{title:"SHORT",set_click:()=>ie("SHORT"),isPositionType:G})]})]})]}),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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(fo,{content:pt?"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:En?"On":"Off"}),i.jsx(Oo,{checked:En,onChange:Bt=>{(!pt||pt&&nr)&&Ke&&Rn(Bt)},className:`${En?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9
${pt&&!nr||!Ke?"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
${En?"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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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:yn?"On":"Off"}),i.jsx(Oo,{checked:yn,onChange:Cn,className:`${yn?"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(tG,{dataCoin:It,coinInclude:kn,coinExclude:mn,setCoinInclude:Gt,setCoinExclude:gt,isLoadingCoin:Ft})})})}),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:tr||"",onChange:Jn,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
${we?"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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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:Ke?"On":"Off"}),i.jsx(Oo,{checked:Ke,onChange:Bt=>{ct(Bt),Bt||Rn(!1)},className:`${Ke?"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:`${qe?"-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:`${qe?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:Wo,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(fo,{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:`${qe?"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:ln||"",onChange:rr,type:"text",name:"maxUsdPerpPositions",onKeyDown:wr,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":ln?"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:`${at?"-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:`${at?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:Wo,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(fo,{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:`${at?"":"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:dn||"",onChange:Gn,type:"text",name:"initialOrderMaxUsd",onKeyDown:wr,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
${at?"border border-[#FF797C] focus:outline-none focus:ring-0":dn?"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:Wo,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(fo,{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:jt||"",onChange:on,type:"text",name:"minUsdPerOrder",onKeyDown:wr,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":jt?"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&&(ln||jt)?"-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&&(ln||jt)?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:Wo,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(fo,{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&&(ln||jt)?"":"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:vn||"",onChange:bn,type:"text",name:"maxUsdPerOrder",onKeyDown:wr,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":vn?"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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(fo,{content:pt?"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:En?"On":"Off"}),i.jsx(Oo,{checked:En,onChange:Bt=>{(!pt||pt&&nr)&&Ke&&Rn(Bt)},className:`${En?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9
${pt&&!nr||!Ke?"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
${En?"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:Nt?"On":"Off"}),i.jsx(Oo,{checked:Nt,onChange:Ht,className:`${Nt?"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:Ge.inputValue||"",onChange:Me,onKeyDown:wr,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
${Ge.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:Be.inputValue||"",onChange:ft,onKeyDown:wr,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
${Be.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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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(rg,{title:"All",set_click:()=>ie("All"),isPositionType:G}),i.jsx(rg,{title:"LONG",set_click:()=>ie("LONG"),isPositionType:G}),i.jsx(rg,{title:"SHORT",set_click:()=>ie("SHORT"),isPositionType:G})]})]})]}),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:Rt?"On":"Off"}),i.jsx(Oo,{checked:Rt,onChange:hn,className:`${Rt?"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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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:yn?"On":"Off"}),i.jsx(Oo,{checked:yn,onChange:Cn,className:`${yn?"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(tG,{dataCoin:It,coinInclude:kn,coinExclude:mn,setCoinInclude:Gt,setCoinExclude:gt,isLoadingCoin:Ft})})})}),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:tr||"",onChange:Jn,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
${we?"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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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:Ke?"On":"Off"}),i.jsx(Oo,{checked:Ke,onChange:Bt=>{ct(Bt),Bt||Rn(!1)},className:`${Ke?"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:We||"",onChange:$r,type:"text",name:"scalingPercentage",onKeyDown:wr,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 ${We?Fe?"border border-[#D97706]":"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`}),Fe&&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(CS,{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:Nt?"On":"Off"}),i.jsx(Oo,{checked:Nt,onChange:Ht,className:`${Nt?"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:Ge.inputValue||"",onChange:Me,onKeyDown:wr,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
${Ge.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:Be.inputValue||"",onChange:ft,onKeyDown:wr,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
${Be.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:Rt?"On":"Off"}),i.jsx(Oo,{checked:Rt,onChange:hn,className:`${Rt?"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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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(rg,{title:"All",set_click:()=>ie("All"),isPositionType:G}),i.jsx(rg,{title:"LONG",set_click:()=>ie("LONG"),isPositionType:G}),i.jsx(rg,{title:"SHORT",set_click:()=>ie("SHORT"),isPositionType:G})]})]})]}),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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(fo,{content:Oe==="lighter"?"Coming Soon":pt?"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:`${Oe==="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:En?"On":"Off"}),i.jsx(Oo,{checked:En,onChange:Bt=>{(!pt||pt&&nr)&&Ke&&Oe==="hyper"&&Rn(Bt)},className:`${En?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9
${pt&&!nr||!Ke||Oe==="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
${En?"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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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:yn?"On":"Off"}),i.jsx(Oo,{checked:yn,onChange:Cn,className:`${yn?"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(tG,{dataCoin:It,coinInclude:kn,coinExclude:mn,setCoinInclude:Gt,setCoinExclude:gt,isLoadingCoin:Ft})})})}),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:tr||"",onChange:Jn,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
${we?"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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(fo,{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:Ke?"On":"Off"}),i.jsx(Oo,{checked:Ke,onChange:Bt=>{ct(Bt),Bt||Rn(!1)},className:`${Ke?"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`})})]})]})]}),Oe==="lighter"?bt?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."}):Ct?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."}):gs?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."}):gs&&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:[ht>0&&!bt&&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:Wo,alt:"Dextrabot"}),ht]}),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:Bt=>{Mn!=null&&!isNaN(Mn)&&(te!=="method_one"||nt!=null&&!isNaN(nt)&&nt)&&(te!=="method_twothousand"||vn!=null&&!isNaN(vn)&&vn&&(!(ln!=null&&!isNaN(ln)&&ln)||Number(ln)>=Number(vn)&&(!(jt!=null&&!isNaN(jt)&&jt)||Number(ln)>=Number(jt))&&(!(dn!=null&&!isNaN(dn)&&dn)||Number(ln)>=Number(dn)))&&(!(jt!=null&&!isNaN(jt)&&jt)||Number(vn)>=Number(jt)))&&tr&&(Oe!=="lighter"||or)&&(Oe!=="lighter"||!Ct)?!Ge.inputValue||!Be.inputValue?jn(!0):pr():(ge(Mn==null||isNaN(Mn)),be(te==="method_one"&&(nt==null||isNaN(nt)||!nt)),Ye(te==="method_twothousand"&&(vn==null||isNaN(vn)||!vn||vn!=null&&!isNaN(vn)&&vn&&jt!=null&&!isNaN(jt)&&jt&&Number(jt)>Number(vn)||vn!=null&&!isNaN(vn)&&vn&&ln!=null&&!isNaN(ln)&&ln&&Number(vn)>Number(ln))),st(te==="method_twothousand"&&(vn!=null&&!isNaN(vn)&&vn&&jt!=null&&!isNaN(jt)&&jt&&Number(jt)>Number(vn)||ln!=null&&!isNaN(ln)&&ln&&jt!=null&&!isNaN(jt)&&jt&&Number(jt)>Number(ln))),He(te==="method_twothousand"&&ln!=null&&!isNaN(ln)&&ln&&dn!=null&&!isNaN(dn)&&dn&&Number(dn)>Number(ln)),vt(te==="method_twothousand"&&ln!=null&&!isNaN(ln)&&ln&&(vn!=null&&!isNaN(vn)&&vn&&Number(vn)>Number(ln)||jt!=null&&!isNaN(jt)&&jt&&Number(jt)>Number(ln)||dn!=null&&!isNaN(dn)&&dn&&Number(dn)>Number(ln))),je(!tr||tr===""),Re(Oe==="lighter"&&We&&We>100),rn(Oe==="lighter"&&!or))},type:"button",className:`${te==="method_one"||Oe==="lighter"&&bt||Oe==="lighter"&&Ct||gs?"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"}),ht>0&&Oe==="lighter"&&bt&&i.jsx(bHt,{checkAccountCopy:Yr,setIsLighterSub:$t,setLighterSubError:rn,setSlotCount:Br,setSlotSubsCount:Or,setSlotUsingCount:nn,setSlotTotalCount:en,setSlotCountWallets:_r}),ht>0&&!bt&&Ct&&Oe==="lighter"&&i.jsx("div",{onClick:()=>{yr(br),lt(!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:Bt=>{Bt.preventDefault(),u!=null&&u.some(mr=>mr.wallet_address===r)&&ar()},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(Bt=>Bt.wallet_address===r)&&!nr?"":"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:Hi,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:Hi,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 rg=({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 oUe(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=oUe(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function da(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=oUe(t))&&(r&&(r+=" "),r+=e);return r}var rG,ove;function Cf(){if(ove)return rG;ove=1;var t=Array.isArray;return rG=t,rG}var sG,lve;function lUe(){if(lve)return sG;lve=1;var t=typeof Lu=="object"&&Lu&&Lu.Object===Object&&Lu;return sG=t,sG}var iG,cve;function Sx(){if(cve)return iG;cve=1;var t=lUe(),e=typeof self=="object"&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return iG=n,iG}var aG,uve;function rP(){if(uve)return aG;uve=1;var t=Sx(),e=t.Symbol;return aG=e,aG}var oG,dve;function vHt(){if(dve)return oG;dve=1;var t=rP(),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 oG=a,oG}var lG,fve;function wHt(){if(fve)return lG;fve=1;var t=Object.prototype,e=t.toString;function n(r){return e.call(r)}return lG=n,lG}var cG,hve;function H1(){if(hve)return cG;hve=1;var t=rP(),e=vHt(),n=wHt(),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 cG=o,cG}var uG,pve;function V1(){if(pve)return uG;pve=1;function t(e){return e!=null&&typeof e=="object"}return uG=t,uG}var dG,mve;function E8(){if(mve)return dG;mve=1;var t=H1(),e=V1(),n="[object Symbol]";function r(s){return typeof s=="symbol"||e(s)&&t(s)==n}return dG=r,dG}var fG,xve;function wue(){if(xve)return fG;xve=1;var t=Cf(),e=E8(),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 fG=s,fG}var hG,gve;function R2(){if(gve)return hG;gve=1;function t(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}return hG=t,hG}var pG,bve;function Cue(){if(bve)return pG;bve=1;var t=H1(),e=R2(),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 pG=o,pG}var mG,yve;function CHt(){if(yve)return mG;yve=1;var t=Sx(),e=t["__core-js_shared__"];return mG=e,mG}var xG,vve;function NHt(){if(vve)return xG;vve=1;var t=CHt(),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 xG=n,xG}var gG,wve;function cUe(){if(wve)return gG;wve=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 gG=n,gG}var bG,Cve;function SHt(){if(Cve)return bG;Cve=1;var t=Cue(),e=NHt(),n=R2(),r=cUe(),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 bG=f,bG}var yG,Nve;function jHt(){if(Nve)return yG;Nve=1;function t(e,n){return e==null?void 0:e[n]}return yG=t,yG}var vG,Sve;function W5(){if(Sve)return vG;Sve=1;var t=SHt(),e=jHt();function n(r,s){var a=e(r,s);return t(a)?a:void 0}return vG=n,vG}var wG,jve;function WU(){if(jve)return wG;jve=1;var t=W5(),e=t(Object,"create");return wG=e,wG}var CG,Ave;function AHt(){if(Ave)return CG;Ave=1;var t=WU();function e(){this.__data__=t?t(null):{},this.size=0}return CG=e,CG}var NG,_ve;function _Ht(){if(_ve)return NG;_ve=1;function t(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}return NG=t,NG}var SG,Eve;function EHt(){if(Eve)return SG;Eve=1;var t=WU(),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 SG=s,SG}var jG,kve;function kHt(){if(kve)return jG;kve=1;var t=WU(),e=Object.prototype,n=e.hasOwnProperty;function r(s){var a=this.__data__;return t?a[s]!==void 0:n.call(a,s)}return jG=r,jG}var AG,Tve;function THt(){if(Tve)return AG;Tve=1;var t=WU(),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 AG=n,AG}var _G,Pve;function PHt(){if(Pve)return _G;Pve=1;var t=AHt(),e=_Ht(),n=EHt(),r=kHt(),s=THt();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,_G=a,_G}var EG,Ive;function IHt(){if(Ive)return EG;Ive=1;function t(){this.__data__=[],this.size=0}return EG=t,EG}var kG,Fve;function Nue(){if(Fve)return kG;Fve=1;function t(e,n){return e===n||e!==e&&n!==n}return kG=t,kG}var TG,Ove;function qU(){if(Ove)return TG;Ove=1;var t=Nue();function e(n,r){for(var s=n.length;s--;)if(t(n[s][0],r))return s;return-1}return TG=e,TG}var PG,Mve;function FHt(){if(Mve)return PG;Mve=1;var t=qU(),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 PG=r,PG}var IG,Lve;function OHt(){if(Lve)return IG;Lve=1;var t=qU();function e(n){var r=this.__data__,s=t(r,n);return s<0?void 0:r[s][1]}return IG=e,IG}var FG,Rve;function MHt(){if(Rve)return FG;Rve=1;var t=qU();function e(n){return t(this.__data__,n)>-1}return FG=e,FG}var OG,Dve;function LHt(){if(Dve)return OG;Dve=1;var t=qU();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 OG=e,OG}var MG,Bve;function GU(){if(Bve)return MG;Bve=1;var t=IHt(),e=FHt(),n=OHt(),r=MHt(),s=LHt();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,MG=a,MG}var LG,$ve;function Sue(){if($ve)return LG;$ve=1;var t=W5(),e=Sx(),n=t(e,"Map");return LG=n,LG}var RG,Uve;function RHt(){if(Uve)return RG;Uve=1;var t=PHt(),e=GU(),n=Sue();function r(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}return RG=r,RG}var DG,zve;function DHt(){if(zve)return DG;zve=1;function t(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}return DG=t,DG}var BG,Hve;function KU(){if(Hve)return BG;Hve=1;var t=DHt();function e(n,r){var s=n.__data__;return t(r)?s[typeof r=="string"?"string":"hash"]:s.map}return BG=e,BG}var $G,Vve;function BHt(){if(Vve)return $G;Vve=1;var t=KU();function e(n){var r=t(this,n).delete(n);return this.size-=r?1:0,r}return $G=e,$G}var UG,Wve;function $Ht(){if(Wve)return UG;Wve=1;var t=KU();function e(n){return t(this,n).get(n)}return UG=e,UG}var zG,qve;function UHt(){if(qve)return zG;qve=1;var t=KU();function e(n){return t(this,n).has(n)}return zG=e,zG}var HG,Gve;function zHt(){if(Gve)return HG;Gve=1;var t=KU();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 HG=e,HG}var VG,Kve;function jue(){if(Kve)return VG;Kve=1;var t=RHt(),e=BHt(),n=$Ht(),r=UHt(),s=zHt();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,VG=a,VG}var WG,Yve;function uUe(){if(Yve)return WG;Yve=1;var t=jue(),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,WG=n,WG}var qG,Xve;function HHt(){if(Xve)return qG;Xve=1;var t=uUe(),e=500;function n(r){var s=t(r,function(o){return a.size===e&&a.clear(),o}),a=s.cache;return s}return qG=n,qG}var GG,Qve;function VHt(){if(Qve)return GG;Qve=1;var t=HHt(),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 GG=r,GG}var KG,Zve;function Aue(){if(Zve)return KG;Zve=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 KG=t,KG}var YG,Jve;function WHt(){if(Jve)return YG;Jve=1;var t=rP(),e=Aue(),n=Cf(),r=E8(),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 YG=o,YG}var XG,ewe;function dUe(){if(ewe)return XG;ewe=1;var t=WHt();function e(n){return n==null?"":t(n)}return XG=e,XG}var QG,twe;function fUe(){if(twe)return QG;twe=1;var t=Cf(),e=wue(),n=VHt(),r=dUe();function s(a,o){return t(a)?a:e(a,o)?[a]:n(r(a))}return QG=s,QG}var ZG,nwe;function YU(){if(nwe)return ZG;nwe=1;var t=E8();function e(n){if(typeof n=="string"||t(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return ZG=e,ZG}var JG,rwe;function _ue(){if(rwe)return JG;rwe=1;var t=fUe(),e=YU();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 JG=n,JG}var eK,swe;function hUe(){if(swe)return eK;swe=1;var t=_ue();function e(n,r,s){var a=n==null?void 0:t(n,r);return a===void 0?s:a}return eK=e,eK}var qHt=hUe();const dp=Pi(qHt);var tK,iwe;function GHt(){if(iwe)return tK;iwe=1;function t(e){return e==null}return tK=t,tK}var KHt=GHt();const Ai=Pi(KHt);var nK,awe;function YHt(){if(awe)return nK;awe=1;var t=H1(),e=Cf(),n=V1(),r="[object String]";function s(a){return typeof a=="string"||!e(a)&&n(a)&&t(a)==r}return nK=s,nK}var XHt=YHt();const p5=Pi(XHt);var QHt=Cue();const ki=Pi(QHt);var ZHt=R2();const k8=Pi(ZHt);var rK={exports:{}},Ma={};/**
* @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 owe;function JHt(){if(owe)return Ma;owe=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 S=C.$$typeof;switch(S){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 S}}case e:return S}}}return Ma.ContextConsumer=o,Ma.ContextProvider=a,Ma.Element=t,Ma.ForwardRef=c,Ma.Fragment=n,Ma.Lazy=x,Ma.Memo=f,Ma.Portal=e,Ma.Profiler=s,Ma.StrictMode=r,Ma.Suspense=u,Ma.SuspenseList=d,Ma.isAsyncMode=function(){return!1},Ma.isConcurrentMode=function(){return!1},Ma.isContextConsumer=function(C){return v(C)===o},Ma.isContextProvider=function(C){return v(C)===a},Ma.isElement=function(C){return typeof C=="object"&&C!==null&&C.$$typeof===t},Ma.isForwardRef=function(C){return v(C)===c},Ma.isFragment=function(C){return v(C)===n},Ma.isLazy=function(C){return v(C)===x},Ma.isMemo=function(C){return v(C)===f},Ma.isPortal=function(C){return v(C)===e},Ma.isProfiler=function(C){return v(C)===s},Ma.isStrictMode=function(C){return v(C)===r},Ma.isSuspense=function(C){return v(C)===u},Ma.isSuspenseList=function(C){return v(C)===d},Ma.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)},Ma.typeOf=v,Ma}var lwe;function eVt(){return lwe||(lwe=1,rK.exports=JHt()),rK.exports}var tVt=eVt(),sK,cwe;function pUe(){if(cwe)return sK;cwe=1;var t=H1(),e=V1(),n="[object Number]";function r(s){return typeof s=="number"||e(s)&&t(s)==n}return sK=r,sK}var iK,uwe;function nVt(){if(uwe)return iK;uwe=1;var t=pUe();function e(n){return t(n)&&n!=+n}return iK=e,iK}var rVt=nVt();const T8=Pi(rVt);var sVt=pUe();const iVt=Pi(sVt);var gm=function(e){return e===0?0:e>0?1:-1},_w=function(e){return p5(e)&&e.indexOf("%")===e.length-1},fs=function(e){return iVt(e)&&!T8(e)},cc=function(e){return fs(e)||p5(e)},aVt=0,q5=function(e){var n=++aVt;return"".concat(e||"").concat(n)},m5=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(!fs(e)&&!p5(e))return r;var a;if(_w(e)){var o=e.indexOf("%");a=n*parseFloat(e.slice(0,o))/100}else a=+e;return T8(a)&&(a=r),s&&a>n&&(a=n),a},Qb=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},oVt=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},_l=function(e,n){return fs(e)&&fs(n)?function(r){return e+r*(n-e)}:function(){return n}};function eD(t,e,n){return!t||!t.length?null:t.find(function(r){return r&&(typeof e=="function"?e(r):dp(r,e))===n})}var lVt=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}},cVt=function(e,n){return fs(e)&&fs(n)?e-n:p5(e)&&p5(n)?e.localeCompare(n):e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():String(e).localeCompare(String(n))};function z4(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 zne(t){"@babel/helpers - typeof";return zne=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},zne(t)}var uVt=["viewBox","children"],dVt=["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"],dwe=["points","pathLength"],aK={svg:uVt,polygon:dwe,polyline:dwe},Eue=["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"],tD=function(e,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),!k8(r))return null;var s={};return Object.keys(r).forEach(function(a){Eue.includes(a)&&(s[a]=n||function(o){return r[a](r,o)})}),s},fVt=function(e,n,r){return function(s){return e(n,r,s),null}},XE=function(e,n,r){if(!k8(e)||zne(e)!=="object")return null;var s=null;return Object.keys(e).forEach(function(a){var o=e[a];Eue.includes(a)&&typeof o=="function"&&(s||(s={}),s[a]=fVt(o,n,r))}),s},hVt=["children"],pVt=["children"];function fwe(t,e){if(t==null)return{};var n=mVt(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 mVt(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 Hne(t){"@babel/helpers - typeof";return Hne=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},Hne(t)}var hwe={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"},c1=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},pwe=null,oK=null,kue=function t(e){if(e===pwe&&Array.isArray(oK))return oK;var n=[];return h.Children.forEach(e,function(r){Ai(r)||(tVt.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),oK=n,pwe=e,n};function pf(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(s){return c1(s)}):r=[c1(e)],kue(t).forEach(function(s){var a=dp(s,"type.displayName")||dp(s,"type.name");r.indexOf(a)!==-1&&n.push(s)}),n}function qf(t,e){var n=pf(t,e);return n[0]}var mwe=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,s=n.height;return!(!fs(r)||r<=0||!fs(s)||s<=0)},xVt=["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"],gVt=function(e){return e&&e.type&&p5(e.type)&&xVt.indexOf(e.type)>=0},mUe=function(e){return e&&Hne(e)==="object"&&"clipDot"in e},bVt=function(e,n,r,s){var a,o=(a=aK==null?void 0:aK[s])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!ki(e)&&(s&&o.includes(n)||dVt.includes(n))||r&&Eue.includes(n)},ji=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var s=e;if(h.isValidElement(e)&&(s=e.props),!k8(s))return null;var a={};return Object.keys(s).forEach(function(o){var l;bVt((l=s)===null||l===void 0?void 0:l[o],o,n,r)&&(a[o]=s[o])}),a},Vne=function t(e,n){if(e===n)return!0;var r=h.Children.count(e);if(r!==h.Children.count(n))return!1;if(r===0)return!0;if(r===1)return xwe(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(!xwe(a,o))return!1}return!0},xwe=function(e,n){if(Ai(e)&&Ai(n))return!0;if(!Ai(e)&&!Ai(n)){var r=e.props||{},s=r.children,a=fwe(r,hVt),o=n.props||{},l=o.children,c=fwe(o,pVt);return s&&l?z4(a,c)&&Vne(s,l):!s&&!l?z4(a,c):!1}return!1},gwe=function(e,n){var r=[],s={};return kue(e).forEach(function(a,o){if(gVt(a))r.push(a);else if(a){var l=c1(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},yVt=function(e){var n=e&&e.type;return n&&hwe[n]?hwe[n]:null},vVt=function(e,n){return kue(n).indexOf(e)},wVt=["children","width","height","viewBox","className","style","title","desc"];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 CVt(t,e){if(t==null)return{};var n=NVt(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 NVt(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 qne(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=CVt(t,wVt),d=s||{width:n,height:r,x:0,y:0},f=da("recharts-surface",a);return ke.createElement("svg",Wne({},ji(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),ke.createElement("title",null,l),ke.createElement("desc",null,c),e)}var SVt=["children","className"];function Gne(){return Gne=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},Gne.apply(this,arguments)}function jVt(t,e){if(t==null)return{};var n=AVt(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 AVt(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 _a=ke.forwardRef(function(t,e){var n=t.children,r=t.className,s=jVt(t,SVt),a=da("recharts-layer",r);return ke.createElement("g",Gne({className:a},ji(s,!0),{ref:e}),n)}),u1=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]},lK,bwe;function _Vt(){if(bwe)return lK;bwe=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 lK=t,lK}var cK,ywe;function EVt(){if(ywe)return cK;ywe=1;var t=_Vt();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 cK=e,cK}var uK,vwe;function xUe(){if(vwe)return uK;vwe=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 uK=c,uK}var dK,wwe;function kVt(){if(wwe)return dK;wwe=1;function t(e){return e.split("")}return dK=t,dK}var fK,Cwe;function TVt(){if(Cwe)return fK;Cwe=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+")*",S=v+y+C,T="(?:"+[d+l+"?",l,f,x,o].join("|")+")",I=RegExp(c+"(?="+c+")|"+T+S,"g");function L(F){return F.match(I)||[]}return fK=L,fK}var hK,Nwe;function PVt(){if(Nwe)return hK;Nwe=1;var t=kVt(),e=xUe(),n=TVt();function r(s){return e(s)?n(s):t(s)}return hK=r,hK}var pK,Swe;function IVt(){if(Swe)return pK;Swe=1;var t=EVt(),e=xUe(),n=PVt(),r=dUe();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 pK=s,pK}var mK,jwe;function FVt(){if(jwe)return mK;jwe=1;var t=IVt(),e=t("toUpperCase");return mK=e,mK}var OVt=FVt();const XU=Pi(OVt);function po(t){return function(){return t}}const gUe=Math.cos,nD=Math.sin,Lm=Math.sqrt,rD=Math.PI,QU=2*rD,Kne=Math.PI,Yne=2*Kne,Jv=1e-6,MVt=Yne-Jv;function bUe(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function LVt(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return bUe;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 RVt{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?bUe:LVt(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>Jv)if(!(Math.abs(f*c-u*d)>Jv)||!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,S=Math.sqrt(v),T=Math.sqrt(x),I=a*Math.tan((Kne-Math.acos((v+x-C)/(2*S*T)))/2),L=I/T,F=I/S;Math.abs(L-1)>Jv&&this._append`L${e+L*d},${n+L*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)>Jv||Math.abs(this._y1-d)>Jv)&&this._append`L${u},${d}`,r&&(x<0&&(x=x%Yne+Yne),x>MVt?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>Jv&&this._append`A${r},${r},0,${+(x>=Kne)},${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 Tue(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 RVt(e)}function Pue(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function yUe(t){this._context=t}yUe.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 ZU(t){return new yUe(t)}function vUe(t){return t[0]}function wUe(t){return t[1]}function CUe(t,e){var n=po(!0),r=null,s=ZU,a=null,o=Tue(l);t=typeof t=="function"?t:t===void 0?vUe:po(t),e=typeof e=="function"?e:e===void 0?wUe:po(e);function l(c){var u,d=(c=Pue(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:po(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:po(+c),l):e},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:po(!!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 vF(t,e,n){var r=null,s=po(!0),a=null,o=ZU,l=null,c=Tue(u);t=typeof t=="function"?t:t===void 0?vUe:po(+t),e=typeof e=="function"?e:po(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?wUe:po(+n);function u(f){var x,g,y,v=(f=Pue(f)).length,C,S=!1,T,I=new Array(v),L=new Array(v);for(a==null&&(l=o(T=c())),x=0;x<=v;++x){if(!(x<v&&s(C=f[x],x,f))===S)if(S=!S)g=x,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),y=x-1;y>=g;--y)l.point(I[y],L[y]);l.lineEnd(),l.areaEnd()}S&&(I[x]=+t(C,x,f),L[x]=+e(C,x,f),l.point(r?+r(C,x,f):I[x],n?+n(C,x,f):L[x]))}if(T)return l=null,T+""||null}function d(){return CUe().defined(s).curve(o).context(a)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:po(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:po(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:po(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:po(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:po(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:po(+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:po(!!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 NUe{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 DVt(t){return new NUe(t,!0)}function BVt(t){return new NUe(t,!1)}const Iue={draw(t,e){const n=Lm(e/rD);t.moveTo(n,0),t.arc(0,0,n,0,QU)}},$Vt={draw(t,e){const n=Lm(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()}},SUe=Lm(1/3),UVt=SUe*2,zVt={draw(t,e){const n=Lm(e/UVt),r=n*SUe;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},HVt={draw(t,e){const n=Lm(e),r=-n/2;t.rect(r,r,n,n)}},VVt=.8908130915292852,jUe=nD(rD/10)/nD(7*rD/10),WVt=nD(QU/10)*jUe,qVt=-gUe(QU/10)*jUe,GVt={draw(t,e){const n=Lm(e*VVt),r=WVt*n,s=qVt*n;t.moveTo(0,-n),t.lineTo(r,s);for(let a=1;a<5;++a){const o=QU*a/5,l=gUe(o),c=nD(o);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*s,c*r+l*s)}t.closePath()}},xK=Lm(3),KVt={draw(t,e){const n=-Lm(e/(xK*3));t.moveTo(0,n*2),t.lineTo(-xK*n,-n),t.lineTo(xK*n,-n),t.closePath()}},Ph=-.5,Ih=Lm(3)/2,Xne=1/Lm(12),YVt=(Xne/2+1)*3,XVt={draw(t,e){const n=Lm(e/YVt),r=n/2,s=n*Xne,a=r,o=n*Xne+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 QVt(t,e){let n=null,r=Tue(s);t=typeof t=="function"?t:po(t||Iue),e=typeof e=="function"?e:po(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:po(a),s):t},s.size=function(a){return arguments.length?(e=typeof a=="function"?a:po(+a),s):e},s.context=function(a){return arguments.length?(n=a??null,s):n},s}function sD(){}function iD(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 AUe(t){this._context=t}AUe.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:iD(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:iD(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function ZVt(t){return new AUe(t)}function _Ue(t){this._context=t}_Ue.prototype={areaStart:sD,areaEnd:sD,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:iD(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function JVt(t){return new _Ue(t)}function EUe(t){this._context=t}EUe.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:iD(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function eWt(t){return new EUe(t)}function kUe(t){this._context=t}kUe.prototype={areaStart:sD,areaEnd:sD,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 tWt(t){return new kUe(t)}function Awe(t){return t<0?-1:1}function _we(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(Awe(a)+Awe(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function Ewe(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function gK(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 aD(t){this._context=t}aD.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:gK(this,this._t0,Ewe(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,gK(this,Ewe(this,n=_we(this,t,e)),n);break;default:gK(this,this._t0,n=_we(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function TUe(t){this._context=new PUe(t)}(TUe.prototype=Object.create(aD.prototype)).point=function(t,e){aD.prototype.point.call(this,e,t)};function PUe(t){this._context=t}PUe.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 nWt(t){return new aD(t)}function rWt(t){return new TUe(t)}function IUe(t){this._context=t}IUe.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=kwe(t),s=kwe(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 kwe(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 sWt(t){return new IUe(t)}function JU(t,e){this._context=t,this._t=e}JU.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 iWt(t){return new JU(t,.5)}function aWt(t){return new JU(t,0)}function oWt(t){return new JU(t,1)}function QS(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 Qne(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function lWt(t,e){return t[e]}function cWt(t){const e=[];return e.key=t,e}function uWt(){var t=po([]),e=Qne,n=QS,r=lWt;function s(a){var o=Array.from(t.apply(this,arguments),cWt),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=Pue(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:po(Array.from(a)),s):t},s.value=function(a){return arguments.length?(r=typeof a=="function"?a:po(+a),s):r},s.order=function(a){return arguments.length?(e=a==null?Qne:typeof a=="function"?a:po(Array.from(a)),s):e},s.offset=function(a){return arguments.length?(n=a??QS,s):n},s}function dWt(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}QS(t,e)}}function fWt(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}QS(t,e)}}function hWt(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,S=v[r-1][1]||0;g+=C-S}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,QS(t,e)}}function QE(t){"@babel/helpers - typeof";return QE=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},QE(t)}var pWt=["type","size","sizeType"];function Zne(){return Zne=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},Zne.apply(this,arguments)}function Twe(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 Pwe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Twe(Object(n),!0).forEach(function(r){mWt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Twe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mWt(t,e,n){return e=xWt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xWt(t){var e=gWt(t,"string");return QE(e)=="symbol"?e:e+""}function gWt(t,e){if(QE(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(QE(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bWt(t,e){if(t==null)return{};var n=yWt(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 yWt(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 FUe={symbolCircle:Iue,symbolCross:$Vt,symbolDiamond:zVt,symbolSquare:HVt,symbolStar:GVt,symbolTriangle:KVt,symbolWye:XVt},vWt=Math.PI/180,wWt=function(e){var n="symbol".concat(XU(e));return FUe[n]||Iue},CWt=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*vWt;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}},NWt=function(e,n){FUe["symbol".concat(XU(e))]=n},ez=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=bWt(e,pWt),u=Pwe(Pwe({},c),{},{type:r,size:a,sizeType:l}),d=function(){var C=wWt(r),S=QVt().type(C).size(CWt(a,l,r));return S()},f=u.className,x=u.cx,g=u.cy,y=ji(u,!0);return x===+x&&g===+g&&a===+a?ke.createElement("path",Zne({},y,{className:da("recharts-symbols",f),transform:"translate(".concat(x,", ").concat(g,")"),d:d()})):null};ez.registerSymbol=NWt;function ZS(t){"@babel/helpers - typeof";return ZS=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},ZS(t)}function Jne(){return Jne=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},Jne.apply(this,arguments)}function Iwe(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 SWt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Iwe(Object(n),!0).forEach(function(r){ZE(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Iwe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function jWt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AWt(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,MUe(r.key),r)}}function _Wt(t,e,n){return AWt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function EWt(t,e,n){return e=oD(e),kWt(t,OUe()?Reflect.construct(e,n||[],oD(t).constructor):e.apply(t,n))}function kWt(t,e){if(e&&(ZS(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return TWt(t)}function TWt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OUe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OUe=function(){return!!t})()}function oD(t){return oD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},oD(t)}function PWt(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&&ere(t,e)}function ere(t,e){return ere=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},ere(t,e)}function ZE(t,e,n){return e=MUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MUe(t){var e=IWt(t,"string");return ZS(e)=="symbol"?e:e+""}function IWt(t,e){if(ZS(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ZS(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $p=32,Fue=function(t){function e(){return jWt(this,e),EWt(this,e,arguments)}return PWt(e,t),_Wt(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 ke.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 ke.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 ke.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(ke.isValidElement(r.legendIcon)){var u=SWt({},r);return delete u.legendIcon,ke.cloneElement(r.legendIcon,u)}return ke.createElement(ez,{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=da(ZE(ZE({"recharts-legend-item":!0},"legend-item-".concat(y),!0),"inactive",g.inactive));if(g.type==="none")return null;var S=ki(g.value)?null:g.value;u1(!ki(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 T=g.inactive?u:g.color;return ke.createElement("li",Jne({className:C,style:f,key:"legend-item-".concat(y)},XE(r.props,g,y)),ke.createElement(qne,{width:o,height:o,viewBox:d,style:x},r.renderIcon(g)),ke.createElement("span",{className:"recharts-legend-item-text",style:{color:T}},v?v(S,g,y):S))})}},{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 ke.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(h.PureComponent);ZE(Fue,"displayName","Legend");ZE(Fue,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var bK,Fwe;function FWt(){if(Fwe)return bK;Fwe=1;var t=GU();function e(){this.__data__=new t,this.size=0}return bK=e,bK}var yK,Owe;function OWt(){if(Owe)return yK;Owe=1;function t(e){var n=this.__data__,r=n.delete(e);return this.size=n.size,r}return yK=t,yK}var vK,Mwe;function MWt(){if(Mwe)return vK;Mwe=1;function t(e){return this.__data__.get(e)}return vK=t,vK}var wK,Lwe;function LWt(){if(Lwe)return wK;Lwe=1;function t(e){return this.__data__.has(e)}return wK=t,wK}var CK,Rwe;function RWt(){if(Rwe)return CK;Rwe=1;var t=GU(),e=Sue(),n=jue(),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 NK,Dwe;function LUe(){if(Dwe)return NK;Dwe=1;var t=GU(),e=FWt(),n=OWt(),r=MWt(),s=LWt(),a=RWt();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,NK=o,NK}var SK,Bwe;function DWt(){if(Bwe)return SK;Bwe=1;var t="__lodash_hash_undefined__";function e(n){return this.__data__.set(n,t),this}return SK=e,SK}var jK,$we;function BWt(){if($we)return jK;$we=1;function t(e){return this.__data__.has(e)}return jK=t,jK}var AK,Uwe;function RUe(){if(Uwe)return AK;Uwe=1;var t=jue(),e=DWt(),n=BWt();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,AK=r,AK}var _K,zwe;function DUe(){if(zwe)return _K;zwe=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 _K=t,_K}var EK,Hwe;function BUe(){if(Hwe)return EK;Hwe=1;function t(e,n){return e.has(n)}return EK=t,EK}var kK,Vwe;function $Ue(){if(Vwe)return kK;Vwe=1;var t=RUe(),e=DUe(),n=BUe(),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 S=-1,T=!0,I=c&s?new t:void 0;for(f.set(o,l),f.set(l,o);++S<g;){var L=o[S],F=l[S];if(u)var $=x?u(F,L,S,l,o,f):u(L,F,S,o,l,f);if($!==void 0){if($)continue;T=!1;break}if(I){if(!e(l,function(O,U){if(!n(I,U)&&(L===O||d(L,O,c,u,f)))return I.push(U)})){T=!1;break}}else if(!(L===F||d(L,F,c,u,f))){T=!1;break}}return f.delete(o),f.delete(l),T}return kK=a,kK}var TK,Wwe;function $Wt(){if(Wwe)return TK;Wwe=1;var t=Sx(),e=t.Uint8Array;return TK=e,TK}var PK,qwe;function UWt(){if(qwe)return PK;qwe=1;function t(e){var n=-1,r=Array(e.size);return e.forEach(function(s,a){r[++n]=[a,s]}),r}return PK=t,PK}var IK,Gwe;function Oue(){if(Gwe)return IK;Gwe=1;function t(e){var n=-1,r=Array(e.size);return e.forEach(function(s){r[++n]=s}),r}return IK=t,IK}var FK,Kwe;function zWt(){if(Kwe)return FK;Kwe=1;var t=rP(),e=$Wt(),n=Nue(),r=$Ue(),s=UWt(),a=Oue(),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]",S="[object ArrayBuffer]",T="[object DataView]",I=t?t.prototype:void 0,L=I?I.valueOf:void 0;function F($,O,U,Y,re,Q,q){switch(U){case T:if($.byteLength!=O.byteLength||$.byteOffset!=O.byteOffset)return!1;$=$.buffer,O=O.buffer;case S:return!($.byteLength!=O.byteLength||!Q(new e($),new e(O)));case c:case u:case x:return n(+$,+O);case d:return $.name==O.name&&$.message==O.message;case g:case v:return $==O+"";case f:var te=s;case y:var fe=Y&o;if(te||(te=a),$.size!=O.size&&!fe)return!1;var G=q.get($);if(G)return G==O;Y|=l,q.set($,O);var ie=r(te($),te(O),Y,re,Q,q);return q.delete($),ie;case C:if(L)return L.call($)==L.call(O)}return!1}return FK=F,FK}var OK,Ywe;function UUe(){if(Ywe)return OK;Ywe=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 OK=t,OK}var MK,Xwe;function HWt(){if(Xwe)return MK;Xwe=1;var t=UUe(),e=Cf();function n(r,s,a){var o=s(r);return e(r)?o:t(o,a(r))}return MK=n,MK}var LK,Qwe;function VWt(){if(Qwe)return LK;Qwe=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 LK=t,LK}var RK,Zwe;function WWt(){if(Zwe)return RK;Zwe=1;function t(){return[]}return RK=t,RK}var DK,Jwe;function qWt(){if(Jwe)return DK;Jwe=1;var t=VWt(),e=WWt(),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 DK=a,DK}var BK,e3e;function GWt(){if(e3e)return BK;e3e=1;function t(e,n){for(var r=-1,s=Array(e);++r<e;)s[r]=n(r);return s}return BK=t,BK}var $K,t3e;function KWt(){if(t3e)return $K;t3e=1;var t=H1(),e=V1(),n="[object Arguments]";function r(s){return e(s)&&t(s)==n}return $K=r,$K}var UK,n3e;function Mue(){if(n3e)return UK;n3e=1;var t=KWt(),e=V1(),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 UK=a,UK}var h_={exports:{}},zK,r3e;function YWt(){if(r3e)return zK;r3e=1;function t(){return!1}return zK=t,zK}h_.exports;var s3e;function zUe(){return s3e||(s3e=1,function(t,e){var n=Sx(),r=YWt(),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}(h_,h_.exports)),h_.exports}var HK,i3e;function Lue(){if(i3e)return HK;i3e=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 HK=n,HK}var VK,a3e;function Rue(){if(a3e)return VK;a3e=1;var t=9007199254740991;function e(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=t}return VK=e,VK}var WK,o3e;function XWt(){if(o3e)return WK;o3e=1;var t=H1(),e=Rue(),n=V1(),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]",S="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",L="[object Int8Array]",F="[object Int16Array]",$="[object Int32Array]",O="[object Uint8Array]",U="[object Uint8ClampedArray]",Y="[object Uint16Array]",re="[object Uint32Array]",Q={};Q[T]=Q[I]=Q[L]=Q[F]=Q[$]=Q[O]=Q[U]=Q[Y]=Q[re]=!0,Q[r]=Q[s]=Q[C]=Q[a]=Q[S]=Q[o]=Q[l]=Q[c]=Q[u]=Q[d]=Q[f]=Q[x]=Q[g]=Q[y]=Q[v]=!1;function q(te){return n(te)&&e(te.length)&&!!Q[t(te)]}return WK=q,WK}var qK,l3e;function HUe(){if(l3e)return qK;l3e=1;function t(e){return function(n){return e(n)}}return qK=t,qK}var p_={exports:{}};p_.exports;var c3e;function QWt(){return c3e||(c3e=1,function(t,e){var n=lUe(),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}(p_,p_.exports)),p_.exports}var GK,u3e;function VUe(){if(u3e)return GK;u3e=1;var t=XWt(),e=HUe(),n=QWt(),r=n&&n.isTypedArray,s=r?e(r):t;return GK=s,GK}var KK,d3e;function ZWt(){if(d3e)return KK;d3e=1;var t=GWt(),e=Mue(),n=Cf(),r=zUe(),s=Lue(),a=VUe(),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):[],S=C.length;for(var T in u)(d||l.call(u,T))&&!(v&&(T=="length"||g&&(T=="offset"||T=="parent")||y&&(T=="buffer"||T=="byteLength"||T=="byteOffset")||s(T,S)))&&C.push(T);return C}return KK=c,KK}var YK,f3e;function JWt(){if(f3e)return YK;f3e=1;var t=Object.prototype;function e(n){var r=n&&n.constructor,s=typeof r=="function"&&r.prototype||t;return n===s}return YK=e,YK}var XK,h3e;function WUe(){if(h3e)return XK;h3e=1;function t(e,n){return function(r){return e(n(r))}}return XK=t,XK}var QK,p3e;function eqt(){if(p3e)return QK;p3e=1;var t=WUe(),e=t(Object.keys,Object);return QK=e,QK}var ZK,m3e;function tqt(){if(m3e)return ZK;m3e=1;var t=JWt(),e=eqt(),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 ZK=s,ZK}var JK,x3e;function sP(){if(x3e)return JK;x3e=1;var t=Cue(),e=Rue();function n(r){return r!=null&&e(r.length)&&!t(r)}return JK=n,JK}var eY,g3e;function tz(){if(g3e)return eY;g3e=1;var t=ZWt(),e=tqt(),n=sP();function r(s){return n(s)?t(s):e(s)}return eY=r,eY}var tY,b3e;function nqt(){if(b3e)return tY;b3e=1;var t=HWt(),e=qWt(),n=tz();function r(s){return t(s,n,e)}return tY=r,tY}var nY,y3e;function rqt(){if(y3e)return nY;y3e=1;var t=nqt(),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 S=x[C];if(!(f?S in o:r.call(o,S)))return!1}var T=d.get(a),I=d.get(o);if(T&&I)return T==o&&I==a;var L=!0;d.set(a,o),d.set(o,a);for(var F=f;++C<g;){S=x[C];var $=a[S],O=o[S];if(c)var U=f?c(O,$,S,o,a,d):c($,O,S,a,o,d);if(!(U===void 0?$===O||u($,O,l,c,d):U)){L=!1;break}F||(F=S=="constructor")}if(L&&!F){var Y=a.constructor,re=o.constructor;Y!=re&&"constructor"in a&&"constructor"in o&&!(typeof Y=="function"&&Y instanceof Y&&typeof re=="function"&&re instanceof re)&&(L=!1)}return d.delete(a),d.delete(o),L}return nY=s,nY}var rY,v3e;function sqt(){if(v3e)return rY;v3e=1;var t=W5(),e=Sx(),n=t(e,"DataView");return rY=n,rY}var sY,w3e;function iqt(){if(w3e)return sY;w3e=1;var t=W5(),e=Sx(),n=t(e,"Promise");return sY=n,sY}var iY,C3e;function qUe(){if(C3e)return iY;C3e=1;var t=W5(),e=Sx(),n=t(e,"Set");return iY=n,iY}var aY,N3e;function aqt(){if(N3e)return aY;N3e=1;var t=W5(),e=Sx(),n=t(e,"WeakMap");return aY=n,aY}var oY,S3e;function oqt(){if(S3e)return oY;S3e=1;var t=sqt(),e=Sue(),n=iqt(),r=qUe(),s=aqt(),a=H1(),o=cUe(),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),S=o(s),T=a;return(t&&T(new t(new ArrayBuffer(1)))!=x||e&&T(new e)!=l||n&&T(n.resolve())!=u||r&&T(new r)!=d||s&&T(new s)!=f)&&(T=function(I){var L=a(I),F=L==c?I.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 S:return f}return L}),oY=T,oY}var lY,j3e;function lqt(){if(j3e)return lY;j3e=1;var t=LUe(),e=$Ue(),n=zWt(),r=rqt(),s=oqt(),a=Cf(),o=zUe(),l=VUe(),c=1,u="[object Arguments]",d="[object Array]",f="[object Object]",x=Object.prototype,g=x.hasOwnProperty;function y(v,C,S,T,I,L){var F=a(v),$=a(C),O=F?d:s(v),U=$?d:s(C);O=O==u?f:O,U=U==u?f:U;var Y=O==f,re=U==f,Q=O==U;if(Q&&o(v)){if(!o(C))return!1;F=!0,Y=!1}if(Q&&!Y)return L||(L=new t),F||l(v)?e(v,C,S,T,I,L):n(v,C,O,S,T,I,L);if(!(S&c)){var q=Y&&g.call(v,"__wrapped__"),te=re&&g.call(C,"__wrapped__");if(q||te){var fe=q?v.value():v,G=te?C.value():C;return L||(L=new t),I(fe,G,S,T,L)}}return Q?(L||(L=new t),r(v,C,S,T,I,L)):!1}return lY=y,lY}var cY,A3e;function Due(){if(A3e)return cY;A3e=1;var t=lqt(),e=V1();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 cY=n,cY}var uY,_3e;function cqt(){if(_3e)return uY;_3e=1;var t=LUe(),e=Due(),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 S=c(y,v,g,a,o,C);if(!(S===void 0?e(v,y,n|r,c,C):S))return!1}}return!0}return uY=s,uY}var dY,E3e;function GUe(){if(E3e)return dY;E3e=1;var t=R2();function e(n){return n===n&&!t(n)}return dY=e,dY}var fY,k3e;function uqt(){if(k3e)return fY;k3e=1;var t=GUe(),e=tz();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 fY=n,fY}var hY,T3e;function KUe(){if(T3e)return hY;T3e=1;function t(e,n){return function(r){return r==null?!1:r[e]===n&&(n!==void 0||e in Object(r))}}return hY=t,hY}var pY,P3e;function dqt(){if(P3e)return pY;P3e=1;var t=cqt(),e=uqt(),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 pY=r,pY}var mY,I3e;function fqt(){if(I3e)return mY;I3e=1;function t(e,n){return e!=null&&n in Object(e)}return mY=t,mY}var xY,F3e;function hqt(){if(F3e)return xY;F3e=1;var t=fUe(),e=Mue(),n=Cf(),r=Lue(),s=Rue(),a=YU();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 xY=o,xY}var gY,O3e;function pqt(){if(O3e)return gY;O3e=1;var t=fqt(),e=hqt();function n(r,s){return r!=null&&e(r,s,t)}return gY=n,gY}var bY,M3e;function mqt(){if(M3e)return bY;M3e=1;var t=Due(),e=hUe(),n=pqt(),r=wue(),s=GUe(),a=KUe(),o=YU(),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 bY=u,bY}var yY,L3e;function P8(){if(L3e)return yY;L3e=1;function t(e){return e}return yY=t,yY}var vY,R3e;function xqt(){if(R3e)return vY;R3e=1;function t(e){return function(n){return n==null?void 0:n[e]}}return vY=t,vY}var wY,D3e;function gqt(){if(D3e)return wY;D3e=1;var t=_ue();function e(n){return function(r){return t(r,n)}}return wY=e,wY}var CY,B3e;function bqt(){if(B3e)return CY;B3e=1;var t=xqt(),e=gqt(),n=wue(),r=YU();function s(a){return n(a)?t(r(a)):e(a)}return CY=s,CY}var NY,$3e;function D2(){if($3e)return NY;$3e=1;var t=dqt(),e=mqt(),n=P8(),r=Cf(),s=bqt();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 NY=a,NY}var SY,U3e;function YUe(){if(U3e)return SY;U3e=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 SY=t,SY}var jY,z3e;function yqt(){if(z3e)return jY;z3e=1;function t(e){return e!==e}return jY=t,jY}var AY,H3e;function vqt(){if(H3e)return AY;H3e=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 AY=t,AY}var _Y,V3e;function wqt(){if(V3e)return _Y;V3e=1;var t=YUe(),e=yqt(),n=vqt();function r(s,a,o){return a===a?n(s,a,o):t(s,e,o)}return _Y=r,_Y}var EY,W3e;function Cqt(){if(W3e)return EY;W3e=1;var t=wqt();function e(n,r){var s=n==null?0:n.length;return!!s&&t(n,r,0)>-1}return EY=e,EY}var kY,q3e;function Nqt(){if(q3e)return kY;q3e=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 kY=t,kY}var TY,G3e;function Sqt(){if(G3e)return TY;G3e=1;function t(){}return TY=t,TY}var PY,K3e;function jqt(){if(K3e)return PY;K3e=1;var t=qUe(),e=Sqt(),n=Oue(),r=1/0,s=t&&1/n(new t([,-0]))[1]==r?function(a){return new t(a)}:e;return PY=s,PY}var IY,Y3e;function Aqt(){if(Y3e)return IY;Y3e=1;var t=RUe(),e=Cqt(),n=Nqt(),r=BUe(),s=jqt(),a=Oue(),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 S=u?null:s(c);if(S)return a(S);y=!1,x=r,C=new t}else C=u?[]:v;e:for(;++f<g;){var T=c[f],I=u?u(T):T;if(T=d||T!==0?T:0,y&&I===I){for(var L=C.length;L--;)if(C[L]===I)continue e;u&&C.push(I),v.push(T)}else x(C,I,d)||(C!==v&&C.push(I),v.push(T))}return v}return IY=l,IY}var FY,X3e;function _qt(){if(X3e)return FY;X3e=1;var t=D2(),e=Aqt();function n(r,s){return r&&r.length?e(r,t(s,2)):[]}return FY=n,FY}var Eqt=_qt();const Q3e=Pi(Eqt);function XUe(t,e,n){return e===!0?Q3e(t,n):ki(e)?Q3e(t,e):t}function JS(t){"@babel/helpers - typeof";return JS=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},JS(t)}var kqt=["ref"];function Z3e(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 sg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Z3e(Object(n),!0).forEach(function(r){nz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Z3e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Tqt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function J3e(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,ZUe(r.key),r)}}function Pqt(t,e,n){return J3e(t.prototype,e),J3e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Iqt(t,e,n){return e=lD(e),Fqt(t,QUe()?Reflect.construct(e,n,lD(t).constructor):e.apply(t,n))}function Fqt(t,e){if(e&&(JS(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Oqt(t)}function Oqt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function QUe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(QUe=function(){return!!t})()}function lD(t){return lD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},lD(t)}function Mqt(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&&tre(t,e)}function tre(t,e){return tre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},tre(t,e)}function nz(t,e,n){return e=ZUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZUe(t){var e=Lqt(t,"string");return JS(e)=="symbol"?e:e+""}function Lqt(t,e){if(JS(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(JS(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Rqt(t,e){if(t==null)return{};var n=Dqt(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 Dqt(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 Bqt(t){return t.value}function $qt(t,e){if(ke.isValidElement(t))return ke.cloneElement(t,e);if(typeof t=="function")return ke.createElement(t,e);e.ref;var n=Rqt(e,kqt);return ke.createElement(Fue,n)}var e5e=1,k3=function(t){function e(){var n;Tqt(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Iqt(this,e,[].concat(s)),nz(n,"lastBoundingBox",{width:-1,height:-1}),n}return Mqt(e,t),Pqt(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)>e5e||Math.abs(s.height-this.lastBoundingBox.height)>e5e)&&(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?sg({},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 sg(sg({},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=sg(sg({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return ke.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(g){r.wrapperNode=g}},$qt(a,sg(sg({},this.props),{},{payload:XUe(d,u,Bqt)})))}}],[{key:"getWithHeight",value:function(r,s){var a=sg(sg({},this.defaultProps),r.props),o=a.layout;return o==="vertical"&&fs(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||s}:null}}])}(h.PureComponent);nz(k3,"displayName","Legend");nz(k3,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var OY,t5e;function Uqt(){if(t5e)return OY;t5e=1;var t=rP(),e=Mue(),n=Cf(),r=t?t.isConcatSpreadable:void 0;function s(a){return n(a)||e(a)||!!(r&&a&&a[r])}return OY=s,OY}var MY,n5e;function JUe(){if(n5e)return MY;n5e=1;var t=UUe(),e=Uqt();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 MY=n,MY}var LY,r5e;function zqt(){if(r5e)return LY;r5e=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 LY=t,LY}var RY,s5e;function Hqt(){if(s5e)return RY;s5e=1;var t=zqt(),e=t();return RY=e,RY}var DY,i5e;function eze(){if(i5e)return DY;i5e=1;var t=Hqt(),e=tz();function n(r,s){return r&&t(r,s,e)}return DY=n,DY}var BY,a5e;function Vqt(){if(a5e)return BY;a5e=1;var t=sP();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 BY=e,BY}var $Y,o5e;function Bue(){if(o5e)return $Y;o5e=1;var t=eze(),e=Vqt(),n=e(t);return $Y=n,$Y}var UY,l5e;function tze(){if(l5e)return UY;l5e=1;var t=Bue(),e=sP();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 UY=n,UY}var zY,c5e;function Wqt(){if(c5e)return zY;c5e=1;function t(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}return zY=t,zY}var HY,u5e;function qqt(){if(u5e)return HY;u5e=1;var t=E8();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 HY=e,HY}var VY,d5e;function Gqt(){if(d5e)return VY;d5e=1;var t=qqt();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 VY=e,VY}var WY,f5e;function Kqt(){if(f5e)return WY;f5e=1;var t=Aue(),e=_ue(),n=D2(),r=tze(),s=Wqt(),a=HUe(),o=Gqt(),l=P8(),c=Cf();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,S){var T=t(f,function(I){return I(v)});return{criteria:T,index:++g,value:v}});return s(y,function(v,C){return o(v,C,x)})}return WY=u,WY}var qY,h5e;function Yqt(){if(h5e)return qY;h5e=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 qY=t,qY}var GY,p5e;function Xqt(){if(p5e)return GY;p5e=1;var t=Yqt(),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 GY=n,GY}var KY,m5e;function Qqt(){if(m5e)return KY;m5e=1;function t(e){return function(){return e}}return KY=t,KY}var YY,x5e;function nze(){if(x5e)return YY;x5e=1;var t=W5(),e=function(){try{var n=t(Object,"defineProperty");return n({},"",{}),n}catch{}}();return YY=e,YY}var XY,g5e;function Zqt(){if(g5e)return XY;g5e=1;var t=Qqt(),e=nze(),n=P8(),r=e?function(s,a){return e(s,"toString",{configurable:!0,enumerable:!1,value:t(a),writable:!0})}:n;return XY=r,XY}var QY,b5e;function Jqt(){if(b5e)return QY;b5e=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 QY=r,QY}var ZY,y5e;function eGt(){if(y5e)return ZY;y5e=1;var t=Zqt(),e=Jqt(),n=e(t);return ZY=n,ZY}var JY,v5e;function tGt(){if(v5e)return JY;v5e=1;var t=P8(),e=Xqt(),n=eGt();function r(s,a){return n(e(s,a,t),s+"")}return JY=r,JY}var eX,w5e;function rz(){if(w5e)return eX;w5e=1;var t=Nue(),e=sP(),n=Lue(),r=R2();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 eX=s,eX}var tX,C5e;function nGt(){if(C5e)return tX;C5e=1;var t=JUe(),e=Kqt(),n=tGt(),r=rz(),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 tX=s,tX}var rGt=nGt();const $ue=Pi(rGt);function JE(t){"@babel/helpers - typeof";return JE=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},JE(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 sGt(t,e){return lGt(t)||oGt(t,e)||aGt(t,e)||iGt()}function iGt(){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 N5e(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 N5e(t,e)}}function N5e(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 oGt(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 lGt(t){if(Array.isArray(t))return t}function S5e(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 nX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?S5e(Object(n),!0).forEach(function(r){cGt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):S5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function cGt(t,e,n){return e=uGt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uGt(t){var e=dGt(t,"string");return JE(e)=="symbol"?e:e+""}function dGt(t,e){if(JE(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(JE(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fGt(t){return Array.isArray(t)&&cc(t[0])&&cc(t[1])?t.join(" ~ "):t}var hGt=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,S=e.accessibilityLayer,T=S===void 0?!1:S,I=function(){if(d&&d.length){var q={padding:0,margin:0},te=(x?$ue(d,x):d).map(function(fe,G){if(fe.type==="none")return null;var ie=nX({display:"block",paddingTop:4,paddingBottom:4,color:fe.color||"#000"},l),oe=fe.formatter||f||fGt,K=fe.value,H=fe.name,ee=K,se=H;if(ee!=null&&se!=null){var pe=oe(K,H,fe,G,d);if(Array.isArray(pe)){var Se=sGt(pe,2);ee=Se[0],se=Se[1]}else ee=pe}return ke.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(G),style:ie},cc(se)?ke.createElement("span",{className:"recharts-tooltip-item-name"},se):null,cc(se)?ke.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,ke.createElement("span",{className:"recharts-tooltip-item-value"},ee),ke.createElement("span",{className:"recharts-tooltip-item-unit"},fe.unit||""))});return ke.createElement("ul",{className:"recharts-tooltip-item-list",style:q},te)}return null},L=nX({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),F=nX({margin:0},u),$=!Ai(v),O=$?v:"",U=da("recharts-default-tooltip",g),Y=da("recharts-tooltip-label",y);$&&C&&d!==void 0&&d!==null&&(O=C(v,d));var re=T?{role:"status","aria-live":"assertive"}:{};return ke.createElement("div",nre({className:U,style:L},re),ke.createElement("p",{className:Y,style:F},ke.isValidElement(O)?O:"".concat(O)),I())};function ek(t){"@babel/helpers - typeof";return ek=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},ek(t)}function wF(t,e,n){return e=pGt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pGt(t){var e=mGt(t,"string");return ek(e)=="symbol"?e:e+""}function mGt(t,e){if(ek(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ek(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var x7="recharts-tooltip-wrapper",xGt={visibility:"hidden"};function gGt(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return da(x7,wF(wF(wF(wF({},"".concat(x7,"-right"),fs(n)&&e&&fs(e.x)&&n>=e.x),"".concat(x7,"-left"),fs(n)&&e&&fs(e.x)&&n<e.x),"".concat(x7,"-bottom"),fs(r)&&e&&fs(e.y)&&r>=e.y),"".concat(x7,"-top"),fs(r)&&e&&fs(e.y)&&r<e.y))}function j5e(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&&fs(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 bGt(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 yGt(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=j5e({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=j5e({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=bGt({translateX:d,translateY:f,useTranslate3d:l})):u=xGt,{cssProperties:u,cssClasses:gGt({translateX:d,translateY:f,coordinate:n})}}function ej(t){"@babel/helpers - typeof";return ej=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},ej(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 _5e(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){sre(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 vGt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wGt(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,sze(r.key),r)}}function CGt(t,e,n){return wGt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function NGt(t,e,n){return e=cD(e),SGt(t,rze()?Reflect.construct(e,n,cD(t).constructor):e.apply(t,n))}function SGt(t,e){if(e&&(ej(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jGt(t)}function jGt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rze(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rze=function(){return!!t})()}function cD(t){return cD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},cD(t)}function AGt(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 sre(t,e,n){return e=sze(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sze(t){var e=_Gt(t,"string");return ej(e)=="symbol"?e:e+""}function _Gt(t,e){if(ej(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ej(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var E5e=1,EGt=function(t){function e(){var n;vGt(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=NGt(this,e,[].concat(s)),sre(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),sre(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 AGt(e,t),CGt(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>E5e||Math.abs(r.height-this.state.lastBoundingBox.height)>E5e)&&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,S=s.viewBox,T=s.wrapperStyle,I=yGt({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:g,position:y,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:C,viewBox:S}),L=I.cssClasses,F=I.cssProperties,$=_5e(_5e({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},T);return ke.createElement("div",{tabIndex:-1,className:L,style:$,ref:function(U){r.wrapperNode=U}},u)}}])}(h.PureComponent),kGt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Nm={isSsr:kGt(),get:function(e){return Nm[e]},set:function(e,n){if(typeof e=="string")Nm[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(s){Nm[s]=e[s]})}}};function tj(t){"@babel/helpers - typeof";return tj=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},tj(t)}function k5e(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 T5e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?k5e(Object(n),!0).forEach(function(r){Uue(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):k5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function TGt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function PGt(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,aze(r.key),r)}}function IGt(t,e,n){return PGt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function FGt(t,e,n){return e=uD(e),OGt(t,ize()?Reflect.construct(e,n||[],uD(t).constructor):e.apply(t,n))}function OGt(t,e){if(e&&(tj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return MGt(t)}function MGt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ize(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ize=function(){return!!t})()}function uD(t){return uD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},uD(t)}function LGt(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 Uue(t,e,n){return e=aze(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aze(t){var e=RGt(t,"string");return tj(e)=="symbol"?e:e+""}function RGt(t,e){if(tj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(tj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function DGt(t){return t.dataKey}function BGt(t,e){return ke.isValidElement(t)?ke.cloneElement(t,e):typeof t=="function"?ke.createElement(t,e):ke.createElement(hGt,e)}var sm=function(t){function e(){return TGt(this,e),FGt(this,e,arguments)}return LGt(e,t),IGt(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,S=s.reverseDirection,T=s.useTranslate3d,I=s.viewBox,L=s.wrapperStyle,F=y??[];f&&F.length&&(F=XUe(y.filter(function(O){return O.value!=null&&(O.hide!==!0||r.props.includeHidden)}),v,DGt));var $=F.length>0;return ke.createElement(EGt,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:x,active:a,coordinate:d,hasPayload:$,offset:g,position:C,reverseDirection:S,useTranslate3d:T,viewBox:I,wrapperStyle:L},BGt(u,T5e(T5e({},this.props),{},{payload:F})))}}])}(h.PureComponent);Uue(sm,"displayName","Tooltip");Uue(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:!Nm.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 rX,P5e;function $Gt(){if(P5e)return rX;P5e=1;var t=Sx(),e=function(){return t.Date.now()};return rX=e,rX}var sX,I5e;function UGt(){if(I5e)return sX;I5e=1;var t=/\s/;function e(n){for(var r=n.length;r--&&t.test(n.charAt(r)););return r}return sX=e,sX}var iX,F5e;function zGt(){if(F5e)return iX;F5e=1;var t=UGt(),e=/^\s+/;function n(r){return r&&r.slice(0,t(r)+1).replace(e,"")}return iX=n,iX}var aX,O5e;function oze(){if(O5e)return aX;O5e=1;var t=zGt(),e=R2(),n=E8(),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 aX=c,aX}var oX,M5e;function lze(){if(M5e)return oX;M5e=1;var t=R2(),e=$Gt(),n=oze(),r="Expected a function",s=Math.max,a=Math.min;function o(l,c,u){var d,f,x,g,y,v,C=0,S=!1,T=!1,I=!0;if(typeof l!="function")throw new TypeError(r);c=n(c)||0,t(u)&&(S=!!u.leading,T="maxWait"in u,x=T?s(n(u.maxWait)||0,c):x,I="trailing"in u?!!u.trailing:I);function L(te){var fe=d,G=f;return d=f=void 0,C=te,g=l.apply(G,fe),g}function F(te){return C=te,y=setTimeout(U,c),S?L(te):g}function $(te){var fe=te-v,G=te-C,ie=c-fe;return T?a(ie,x-G):ie}function O(te){var fe=te-v,G=te-C;return v===void 0||fe>=c||fe<0||T&&G>=x}function U(){var te=e();if(O(te))return Y(te);y=setTimeout(U,$(te))}function Y(te){return y=void 0,I&&d?L(te):(d=f=void 0,g)}function re(){y!==void 0&&clearTimeout(y),C=0,d=v=f=y=void 0}function Q(){return y===void 0?g:Y(e())}function q(){var te=e(),fe=O(te);if(d=arguments,f=this,v=te,fe){if(y===void 0)return F(v);if(T)return clearTimeout(y),y=setTimeout(U,c),L(v)}return y===void 0&&(y=setTimeout(U,c)),g}return q.cancel=re,q.flush=Q,q}return oX=o,oX}var lX,L5e;function HGt(){if(L5e)return lX;L5e=1;var t=lze(),e=R2(),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 lX=r,lX}var VGt=HGt();const cze=Pi(VGt);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 R5e(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?R5e(Object(n),!0).forEach(function(r){WGt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):R5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function WGt(t,e,n){return e=qGt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qGt(t){var e=GGt(t,"string");return tk(e)=="symbol"?e:e+""}function GGt(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)}function KGt(t,e){return ZGt(t)||QGt(t,e)||XGt(t,e)||YGt()}function YGt(){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 XGt(t,e){if(t){if(typeof t=="string")return D5e(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 D5e(t,e)}}function D5e(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 QGt(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 ZGt(t){if(Array.isArray(t))return t}var uze=h.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,S=t.className,T=t.onResize,I=t.style,L=I===void 0?{}:I,F=h.useRef(null),$=h.useRef();$.current=T,h.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 O=h.useState({containerWidth:s.width,containerHeight:s.height}),U=KGt(O,2),Y=U[0],re=U[1],Q=h.useCallback(function(te,fe){re(function(G){var ie=Math.round(te),oe=Math.round(fe);return G.containerWidth===ie&&G.containerHeight===oe?G:{containerWidth:ie,containerHeight:oe}})},[]);h.useEffect(function(){var te=function(H){var ee,se=H[0].contentRect,pe=se.width,Se=se.height;Q(pe,Se),(ee=$.current)===null||ee===void 0||ee.call($,pe,Se)};v>0&&(te=cze(te,v,{trailing:!0,leading:!1}));var fe=new ResizeObserver(te),G=F.current.getBoundingClientRect(),ie=G.width,oe=G.height;return Q(ie,oe),fe.observe(F.current),function(){fe.disconnect()}},[Q,v]);var q=h.useMemo(function(){var te=Y.containerWidth,fe=Y.containerHeight;if(te<0||fe<0)return null;u1(_w(o)||_w(c),`The width(%s) and height(%s) are both fixed numbers,
maybe you don't need to use a ResponsiveContainer.`,o,c),u1(!n||n>0,"The aspect(%s) must be greater than zero.",n);var G=_w(o)?te:o,ie=_w(c)?fe:c;n&&n>0&&(G?ie=G/n:ie&&(G=ie*n),x&&ie>x&&(ie=x)),u1(G>0||ie>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.`,G,ie,o,c,d,f,n);var oe=!Array.isArray(g)&&c1(g.type).endsWith("Chart");return ke.Children.map(g,function(K){return ke.isValidElement(K)?h.cloneElement(K,CF({width:G,height:ie},oe?{style:CF({height:"100%",width:"100%",maxHeight:ie,maxWidth:G},K.props.style)}:{})):K})},[n,g,c,x,f,d,Y,o]);return ke.createElement("div",{id:C?"".concat(C):void 0,className:da("recharts-responsive-container",S),style:CF(CF({},L),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:x}),ref:F},q)}),zue=function(e){return null};zue.displayName="Cell";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 B5e(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 are(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?B5e(Object(n),!0).forEach(function(r){JGt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):B5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function JGt(t,e,n){return e=eKt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eKt(t){var e=tKt(t,"string");return nk(e)=="symbol"?e:e+""}function tKt(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)}var SC={widthCache:{},cacheCount:0},nKt=2e3,rKt={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},$5e="recharts_measurement_span";function sKt(t){var e=are({},t);return Object.keys(e).forEach(function(n){e[n]||delete e[n]}),e}var W_=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Nm.isSsr)return{width:0,height:0};var r=sKt(n),s=JSON.stringify({text:e,copyStyle:r});if(SC.widthCache[s])return SC.widthCache[s];try{var a=document.getElementById($5e);a||(a=document.createElement("span"),a.setAttribute("id",$5e),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=are(are({},rKt),r);Object.assign(a.style,o),a.textContent="".concat(e);var l=a.getBoundingClientRect(),c={width:l.width,height:l.height};return SC.widthCache[s]=c,++SC.cacheCount>nKt&&(SC.cacheCount=0,SC.widthCache={}),c}catch{return{width:0,height:0}}},iKt=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};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 dD(t,e){return cKt(t)||lKt(t,e)||oKt(t,e)||aKt()}function aKt(){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 oKt(t,e){if(t){if(typeof t=="string")return U5e(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 U5e(t,e)}}function U5e(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 lKt(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 cKt(t){if(Array.isArray(t))return t}function uKt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function z5e(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,fKt(r.key),r)}}function dKt(t,e,n){return z5e(t.prototype,e),z5e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function fKt(t){var e=hKt(t,"string");return rk(e)=="symbol"?e:e+""}function hKt(t,e){if(rk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(rk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var H5e=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,V5e=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,pKt=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,mKt=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,dze={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},xKt=Object.keys(dze),h4="NaN";function gKt(t,e){return t*dze[e]}var NF=function(){function t(e,n){uKt(this,t),this.num=e,this.unit=n,this.num=e,this.unit=n,Number.isNaN(e)&&(this.unit=""),n!==""&&!pKt.test(n)&&(this.num=NaN,this.unit=""),xKt.includes(n)&&(this.num=gKt(e,n),this.unit="px")}return dKt(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=mKt.exec(n))!==null&&r!==void 0?r:[],a=dD(s,3),o=a[1],l=a[2];return new t(parseFloat(o),l??"")}}])}();function fze(t){if(t.includes(h4))return h4;for(var e=t;e.includes("*")||e.includes("/");){var n,r=(n=H5e.exec(e))!==null&&n!==void 0?n:[],s=dD(r,4),a=s[1],o=s[2],l=s[3],c=NF.parse(a??""),u=NF.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return h4;e=e.replace(H5e,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var f,x=(f=V5e.exec(e))!==null&&f!==void 0?f:[],g=dD(x,4),y=g[1],v=g[2],C=g[3],S=NF.parse(y??""),T=NF.parse(C??""),I=v==="+"?S.add(T):S.subtract(T);if(I.isNaN())return h4;e=e.replace(V5e,I.toString())}return e}var W5e=/\(([^()]*)\)/;function bKt(t){for(var e=t;e.includes("(");){var n=W5e.exec(e),r=dD(n,2),s=r[1];e=e.replace(W5e,fze(s))}return e}function yKt(t){var e=t.replace(/\s+/g,"");return e=bKt(e),e=fze(e),e}function vKt(t){try{return yKt(t)}catch{return h4}}function cX(t){var e=vKt(t.slice(5,-1));return e===h4?"":e}var wKt=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],CKt=["dx","dy","angle","className","breakAll"];function ore(){return ore=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},ore.apply(this,arguments)}function q5e(t,e){if(t==null)return{};var n=NKt(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 NKt(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 G5e(t,e){return _Kt(t)||AKt(t,e)||jKt(t,e)||SKt()}function SKt(){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 jKt(t,e){if(t){if(typeof t=="string")return K5e(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 K5e(t,e)}}function K5e(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 AKt(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 _Kt(t){if(Array.isArray(t))return t}var hze=/[ \f\n\r\t\v\u2028\u2029]+/,pze=function(e){var n=e.children,r=e.breakAll,s=e.style;try{var a=[];Ai(n)||(r?a=n.toString().split(""):a=n.toString().split(hze));var o=a.map(function(c){return{word:c,width:W_(c,s).width}}),l=r?0:W_(" ",s).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},EKt=function(e,n,r,s,a){var o=e.maxLines,l=e.children,c=e.style,u=e.breakAll,d=fs(o),f=l,x=function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return G.reduce(function(ie,oe){var K=oe.word,H=oe.width,ee=ie[ie.length-1];if(ee&&(s==null||a||ee.width+H+r<Number(s)))ee.words.push(K),ee.width+=H+r;else{var se={words:[K],width:H};ie.push(se)}return ie},[])},g=x(n),y=function(G){return G.reduce(function(ie,oe){return ie.width>oe.width?ie:oe})};if(!d)return g;for(var v="…",C=function(G){var ie=f.slice(0,G),oe=pze({breakAll:u,style:c,children:ie+v}).wordsWithComputedWidth,K=x(oe),H=K.length>o||y(K).width>Number(s);return[H,K]},S=0,T=f.length-1,I=0,L;S<=T&&I<=f.length-1;){var F=Math.floor((S+T)/2),$=F-1,O=C($),U=G5e(O,2),Y=U[0],re=U[1],Q=C(F),q=G5e(Q,1),te=q[0];if(!Y&&!te&&(S=F+1),Y&&te&&(T=F-1),!Y&&te){L=re;break}I++}return L||g},Y5e=function(e){var n=Ai(e)?[]:e.toString().split(hze);return[{words:n}]},kKt=function(e){var n=e.width,r=e.scaleToFit,s=e.children,a=e.style,o=e.breakAll,l=e.maxLines;if((n||r)&&!Nm.isSsr){var c,u,d=pze({breakAll:o,children:s,style:a});if(d){var f=d.wordsWithComputedWidth,x=d.spaceWidth;c=f,u=x}else return Y5e(s);return EKt({breakAll:o,children:s,maxLines:l,style:a},c,u,n,r)}return Y5e(s)},X5e="#808080",fD=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,S=C===void 0?X5e:C,T=q5e(e,wKt),I=h.useMemo(function(){return kKt({breakAll:T.breakAll,children:T.children,maxLines:T.maxLines,scaleToFit:f,style:T.style,width:T.width})},[T.breakAll,T.children,T.maxLines,f,T.style,T.width]),L=T.dx,F=T.dy,$=T.angle,O=T.className,U=T.breakAll,Y=q5e(T,CKt);if(!cc(r)||!cc(a))return null;var re=r+(fs(L)?L:0),Q=a+(fs(F)?F:0),q;switch(v){case"start":q=cX("calc(".concat(u,")"));break;case"middle":q=cX("calc(".concat((I.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:q=cX("calc(".concat(I.length-1," * -").concat(l,")"));break}var te=[];if(f){var fe=I[0].width,G=T.width;te.push("scale(".concat((fs(G)?G/fe:1)/fe,")"))}return $&&te.push("rotate(".concat($,", ").concat(re,", ").concat(Q,")")),te.length&&(Y.transform=te.join(" ")),ke.createElement("text",ore({},ji(Y,!0),{x:re,y:Q,className:da("recharts-text",O),textAnchor:g,fill:S.includes("url")?X5e:S}),I.map(function(ie,oe){var K=ie.words.join(U?"":" ");return ke.createElement("tspan",{x:re,dy:oe===0?q:l,key:"".concat(K,"-").concat(oe)},K)}))};function Wy(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function TKt(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hue(t){let e,n,r;t.length!==2?(e=Wy,n=(l,c)=>Wy(t(l),c),r=(l,c)=>t(l)-c):(e=t===Wy||t===TKt?t:PKt,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 PKt(){return 0}function mze(t){return t===null?NaN:+t}function*IKt(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const FKt=Hue(Wy),iP=FKt.right;Hue(mze).center;class Q5e extends Map{constructor(e,n=LKt){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(Z5e(this,e))}has(e){return super.has(Z5e(this,e))}set(e,n){return super.set(OKt(this,e),n)}delete(e){return super.delete(MKt(this,e))}}function Z5e({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function OKt({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function MKt({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function LKt(t){return t!==null&&typeof t=="object"?t.valueOf():t}function RKt(t=Wy){if(t===Wy)return xze;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 xze(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const DKt=Math.sqrt(50),BKt=Math.sqrt(10),$Kt=Math.sqrt(2);function hD(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>=DKt?10:a>=BKt?5:a>=$Kt?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?hD(t,e,n*2):[l,c,u]}function lre(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?hD(e,t,n):hD(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 cre(t,e,n){return e=+e,t=+t,n=+n,hD(t,e,n)[2]}function ure(t,e,n){e=+e,t=+t,n=+n;const r=e<t,s=r?cre(e,t,n):cre(t,e,n);return(r?-1:1)*(s<0?1/-s:s)}function J5e(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function e6e(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function gze(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?xze:RKt(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));gze(t,e,g,y,s)}const a=t[e];let o=n,l=r;for(g7(t,n,e),s(t[r],a)>0&&g7(t,n,r);o<l;){for(g7(t,o,l),++o,--l;s(t[o],a)<0;)++o;for(;s(t[l],a)>0;)--l}s(t[n],a)===0?g7(t,n,l):(++l,g7(t,l,r)),l<=e&&(n=l+1),e<=l&&(r=l-1)}return t}function g7(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function UKt(t,e,n){if(t=Float64Array.from(IKt(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return e6e(t);if(e>=1)return J5e(t);var r,s=(r-1)*e,a=Math.floor(s),o=J5e(gze(t,a).subarray(0,a+1)),l=e6e(t.subarray(a+1));return o+(l-o)*(s-a)}}function zKt(t,e,n=mze){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 HKt(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 Np(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function W1(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 dre=Symbol("implicit");function Vue(){var t=new Q5e,e=[],n=[],r=dre;function s(a){let o=t.get(a);if(o===void 0){if(r!==dre)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 Q5e;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 Vue(e,n).unknown(r)},Np.apply(s,arguments),s}function sk(){var t=Vue().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=HKt(x).map(function(S){return y+a*S});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 sk(e(),[r,s]).round(l).paddingInner(c).paddingOuter(u).align(d)},Np.apply(f(),arguments)}function bze(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return bze(e())},t}function q_(){return bze(sk.apply(null,arguments).paddingInner(1))}function Wue(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function yze(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function aP(){}var ik=.7,pD=1/ik,H4="\\s*([+-]?\\d+)\\s*",ak="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",J0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",VKt=/^#([0-9a-f]{3,8})$/,WKt=new RegExp(`^rgb\\(${H4},${H4},${H4}\\)$`),qKt=new RegExp(`^rgb\\(${J0},${J0},${J0}\\)$`),GKt=new RegExp(`^rgba\\(${H4},${H4},${H4},${ak}\\)$`),KKt=new RegExp(`^rgba\\(${J0},${J0},${J0},${ak}\\)$`),YKt=new RegExp(`^hsl\\(${ak},${J0},${J0}\\)$`),XKt=new RegExp(`^hsla\\(${ak},${J0},${J0},${ak}\\)$`),t6e={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};Wue(aP,ok,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:n6e,formatHex:n6e,formatHex8:QKt,formatHsl:ZKt,formatRgb:r6e,toString:r6e});function n6e(){return this.rgb().formatHex()}function QKt(){return this.rgb().formatHex8()}function ZKt(){return vze(this).formatHsl()}function r6e(){return this.rgb().formatRgb()}function ok(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=VKt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?s6e(e):n===3?new lf(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?SF(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?SF(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=WKt.exec(t))?new lf(e[1],e[2],e[3],1):(e=qKt.exec(t))?new lf(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=GKt.exec(t))?SF(e[1],e[2],e[3],e[4]):(e=KKt.exec(t))?SF(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=YKt.exec(t))?o6e(e[1],e[2]/100,e[3]/100,1):(e=XKt.exec(t))?o6e(e[1],e[2]/100,e[3]/100,e[4]):t6e.hasOwnProperty(t)?s6e(t6e[t]):t==="transparent"?new lf(NaN,NaN,NaN,0):null}function s6e(t){return new lf(t>>16&255,t>>8&255,t&255,1)}function SF(t,e,n,r){return r<=0&&(t=e=n=NaN),new lf(t,e,n,r)}function JKt(t){return t instanceof aP||(t=ok(t)),t?(t=t.rgb(),new lf(t.r,t.g,t.b,t.opacity)):new lf}function fre(t,e,n,r){return arguments.length===1?JKt(t):new lf(t,e,n,r??1)}function lf(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Wue(lf,fre,yze(aP,{brighter(t){return t=t==null?pD:Math.pow(pD,t),new lf(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ik:Math.pow(ik,t),new lf(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new lf(T3(this.r),T3(this.g),T3(this.b),mD(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:i6e,formatHex:i6e,formatHex8:eYt,formatRgb:a6e,toString:a6e}));function i6e(){return`#${Ew(this.r)}${Ew(this.g)}${Ew(this.b)}`}function eYt(){return`#${Ew(this.r)}${Ew(this.g)}${Ew(this.b)}${Ew((isNaN(this.opacity)?1:this.opacity)*255)}`}function a6e(){const t=mD(this.opacity);return`${t===1?"rgb(":"rgba("}${T3(this.r)}, ${T3(this.g)}, ${T3(this.b)}${t===1?")":`, ${t})`}`}function mD(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function T3(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ew(t){return t=T3(t),(t<16?"0":"")+t.toString(16)}function o6e(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 vze(t){if(t instanceof hm)return new hm(t.h,t.s,t.l,t.opacity);if(t instanceof aP||(t=ok(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 tYt(t,e,n,r){return arguments.length===1?vze(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}Wue(hm,tYt,yze(aP,{brighter(t){return t=t==null?pD:Math.pow(pD,t),new hm(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ik:Math.pow(ik,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 lf(uX(t>=240?t-240:t+120,s,r),uX(t,s,r),uX(t<120?t+240:t-120,s,r),this.opacity)},clamp(){return new hm(l6e(this.h),jF(this.s),jF(this.l),mD(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=mD(this.opacity);return`${t===1?"hsl(":"hsla("}${l6e(this.h)}, ${jF(this.s)*100}%, ${jF(this.l)*100}%${t===1?")":`, ${t})`}`}}));function l6e(t){return t=(t||0)%360,t<0?t+360:t}function jF(t){return Math.max(0,Math.min(1,t||0))}function uX(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 que=t=>()=>t;function nYt(t,e){return function(n){return t+n*e}}function rYt(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 sYt(t){return(t=+t)==1?wze:function(e,n){return n-e?rYt(e,n,t):que(isNaN(e)?n:e)}}function wze(t,e){var n=e-t;return n?nYt(t,n):que(isNaN(t)?e:t)}const c6e=function t(e){var n=sYt(e);function r(s,a){var o=n((s=fre(s)).r,(a=fre(a)).r),l=n(s.g,a.g),c=n(s.b,a.b),u=wze(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 iYt(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 aYt(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function oYt(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]=I8(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 lYt(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function xD(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function cYt(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]=I8(t[s],e[s]):r[s]=e[s];return function(a){for(s in n)r[s]=n[s](a);return r}}var hre=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,dX=new RegExp(hre.source,"g");function uYt(t){return function(){return t}}function dYt(t){return function(e){return t(e)+""}}function fYt(t,e){var n=hre.lastIndex=dX.lastIndex=0,r,s,a,o=-1,l=[],c=[];for(t=t+"",e=e+"";(r=hre.exec(t))&&(s=dX.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:xD(r,s)})),n=dX.lastIndex;return n<e.length&&(a=e.slice(n),l[o]?l[o]+=a:l[++o]=a),l.length<2?c[0]?dYt(c[0].x):uYt(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 I8(t,e){var n=typeof e,r;return e==null||n==="boolean"?que(e):(n==="number"?xD:n==="string"?(r=ok(e))?(e=r,c6e):fYt:e instanceof ok?c6e:e instanceof Date?lYt:aYt(e)?iYt:Array.isArray(e)?oYt:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?cYt:xD)(t,e)}function Gue(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function hYt(t,e){e===void 0&&(e=t,t=I8);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 pYt(t){return function(){return t}}function gD(t){return+t}var u6e=[0,1];function md(t){return t}function pre(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:pYt(isNaN(e)?NaN:.5)}function mYt(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function xYt(t,e,n){var r=t[0],s=t[1],a=e[0],o=e[1];return s<r?(r=pre(s,r),a=n(o,a)):(r=pre(r,s),a=n(a,o)),function(l){return a(r(l))}}function gYt(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]=pre(t[o],t[o+1]),a[o]=n(e[o],e[o+1]);return function(l){var c=iP(t,l,1,r)-1;return a[c](s[c](l))}}function oP(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function sz(){var t=u6e,e=u6e,n=I8,r,s,a,o=md,l,c,u;function d(){var x=Math.min(t.length,e.length);return o!==md&&(o=mYt(t[0],t[x-1])),l=x>2?gYt:xYt,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),xD)))(x)))},f.domain=function(x){return arguments.length?(t=Array.from(x,gD),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=Gue,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 Kue(){return sz()(md,md)}function bYt(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function bD(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 nj(t){return t=bD(Math.abs(t)),t?t[1]:NaN}function yYt(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 vYt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var wYt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function lk(t){if(!(e=wYt.exec(t)))throw new Error("invalid format: "+t);var e;return new Yue({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]})}lk.prototype=Yue.prototype;function Yue(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+""}Yue.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 CYt(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 Cze;function NYt(t,e){var n=bD(t,e);if(!n)return t+"";var r=n[0],s=n[1],a=s-(Cze=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")+bD(t,Math.max(0,e+a-1))[0]}function d6e(t,e){var n=bD(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 f6e={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:bYt,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)=>d6e(t*100,e),r:d6e,s:NYt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function h6e(t){return t}var p6e=Array.prototype.map,m6e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function SYt(t){var e=t.grouping===void 0||t.thousands===void 0?h6e:yYt(p6e.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?h6e:vYt(p6e.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=lk(f);var x=f.fill,g=f.align,y=f.sign,v=f.symbol,C=f.zero,S=f.width,T=f.comma,I=f.precision,L=f.trim,F=f.type;F==="n"?(T=!0,F="g"):f6e[F]||(I===void 0&&(I=12),L=!0,F="g"),(C||x==="0"&&g==="=")&&(C=!0,x="0",g="=");var $=v==="$"?n:v==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",O=v==="$"?r:/[%p]/.test(F)?o:"",U=f6e[F],Y=/[defgprs%]/.test(F);I=I===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,I)):Math.max(0,Math.min(20,I));function re(Q){var q=$,te=O,fe,G,ie;if(F==="c")te=U(Q)+te,Q="";else{Q=+Q;var oe=Q<0||1/Q<0;if(Q=isNaN(Q)?c:U(Math.abs(Q),I),L&&(Q=CYt(Q)),oe&&+Q==0&&y!=="+"&&(oe=!1),q=(oe?y==="("?y:l:y==="-"||y==="("?"":y)+q,te=(F==="s"?m6e[8+Cze/3]:"")+te+(oe&&y==="("?")":""),Y){for(fe=-1,G=Q.length;++fe<G;)if(ie=Q.charCodeAt(fe),48>ie||ie>57){te=(ie===46?s+Q.slice(fe+1):Q.slice(fe))+te,Q=Q.slice(0,fe);break}}}T&&!C&&(Q=e(Q,1/0));var K=q.length+Q.length+te.length,H=K<S?new Array(S-K+1).join(x):"";switch(T&&C&&(Q=e(H+Q,H.length?S-te.length:1/0),H=""),g){case"<":Q=q+Q+te+H;break;case"=":Q=q+H+Q+te;break;case"^":Q=H.slice(0,K=H.length>>1)+q+Q+te+H.slice(K);break;default:Q=H+q+Q+te;break}return a(Q)}return re.toString=function(){return f+""},re}function d(f,x){var g=u((f=lk(f),f.type="f",f)),y=Math.max(-8,Math.min(8,Math.floor(nj(x)/3)))*3,v=Math.pow(10,-y),C=m6e[8+y/3];return function(S){return g(v*S)+C}}return{format:u,formatPrefix:d}}var AF,Xue,Nze;jYt({thousands:",",grouping:[3],currency:["$",""]});function jYt(t){return AF=SYt(t),Xue=AF.format,Nze=AF.formatPrefix,AF}function AYt(t){return Math.max(0,-nj(Math.abs(t)))}function _Yt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(nj(e)/3)))*3-nj(Math.abs(t)))}function EYt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,nj(e)-nj(t))+1}function Sze(t,e,n,r){var s=ure(t,e,n),a;switch(r=lk(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(a=_Yt(s,o))&&(r.precision=a),Nze(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=EYt(s,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=AYt(s))&&(r.precision=a-(r.type==="%")*2);break}}return Xue(r)}function B2(t){var e=t.domain;return t.ticks=function(n){var r=e();return lre(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var s=e();return Sze(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=cre(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 yD(){var t=Kue();return t.copy=function(){return oP(t,yD())},Np.apply(t,arguments),B2(t)}function jze(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,gD),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return jze(t).unknown(e)},t=arguments.length?Array.from(t,gD):[0,1],B2(n)}function Aze(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 x6e(t){return Math.log(t)}function g6e(t){return Math.exp(t)}function kYt(t){return-Math.log(-t)}function TYt(t){return-Math.exp(-t)}function PYt(t){return isFinite(t)?+("1e"+t):t<0?0:t}function IYt(t){return t===10?PYt:t===Math.E?Math.exp:e=>Math.pow(t,e)}function FYt(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 b6e(t){return(e,n)=>-t(-e,n)}function Que(t){const e=t(x6e,g6e),n=e.domain;let r=10,s,a;function o(){return s=FYt(r),a=IYt(r),n()[0]<0?(s=b6e(s),a=b6e(a),t(kYt,TYt)):t(x6e,g6e),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 S=[];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;S.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;S.push(v)}S.length*2<C&&(S=lre(u,d,C))}else S=lre(x,g,Math.min(g-x,C)).map(a);return f?S.reverse():S},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=lk(c)).precision==null&&(c.trim=!0),c=Xue(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(Aze(n(),{floor:l=>a(Math.floor(s(l))),ceil:l=>a(Math.ceil(s(l)))})),e}function _ze(){const t=Que(sz()).domain([1,10]);return t.copy=()=>oP(t,_ze()).base(t.base()),Np.apply(t,arguments),t}function y6e(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function v6e(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Zue(t){var e=1,n=t(y6e(e),v6e(e));return n.constant=function(r){return arguments.length?t(y6e(e=+r),v6e(e)):e},B2(n)}function Eze(){var t=Zue(sz());return t.copy=function(){return oP(t,Eze()).constant(t.constant())},Np.apply(t,arguments)}function w6e(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function OYt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function MYt(t){return t<0?-t*t:t*t}function Jue(t){var e=t(md,md),n=1;function r(){return n===1?t(md,md):n===.5?t(OYt,MYt):t(w6e(n),w6e(1/n))}return e.exponent=function(s){return arguments.length?(n=+s,r()):n},B2(e)}function ede(){var t=Jue(sz());return t.copy=function(){return oP(t,ede()).exponent(t.exponent())},Np.apply(t,arguments),t}function LYt(){return ede.apply(null,arguments).exponent(.5)}function C6e(t){return Math.sign(t)*t*t}function RYt(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function kze(){var t=Kue(),e=[0,1],n=!1,r;function s(a){var o=RYt(t(a));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(a){return t.invert(C6e(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,gD)).map(C6e)),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 kze(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Np.apply(s,arguments),B2(s)}function Tze(){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]=zKt(t,o/l);return a}function a(o){return o==null||isNaN(o=+o)?r:e[iP(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(Wy),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 Tze().domain(t).range(e).unknown(r)},Np.apply(a,arguments)}function Pze(){var t=0,e=1,n=1,r=[.5],s=[0,1],a;function o(c){return c!=null&&c<=c?s[iP(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 Pze().domain([t,e]).range(s).unknown(a)},Np.apply(B2(o),arguments)}function Ize(){var t=[.5],e=[0,1],n,r=1;function s(a){return a!=null&&a<=a?e[iP(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 Ize().domain(t).range(e).unknown(n)},Np.apply(s,arguments)}const fX=new Date,hX=new Date;function pc(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=>pc(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)=>(fX.setTime(+a),hX.setTime(+o),t(fX),t(hX),Math.floor(n(fX,hX))),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 vD=pc(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);vD.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?pc(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):vD);vD.range;const Kg=1e3,op=Kg*60,Yg=op*60,k1=Yg*24,tde=k1*7,N6e=k1*30,pX=k1*365,kw=pc(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Kg)},(t,e)=>(e-t)/Kg,t=>t.getUTCSeconds());kw.range;const nde=pc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kg)},(t,e)=>{t.setTime(+t+e*op)},(t,e)=>(e-t)/op,t=>t.getMinutes());nde.range;const rde=pc(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*op)},(t,e)=>(e-t)/op,t=>t.getUTCMinutes());rde.range;const sde=pc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kg-t.getMinutes()*op)},(t,e)=>{t.setTime(+t+e*Yg)},(t,e)=>(e-t)/Yg,t=>t.getHours());sde.range;const ide=pc(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Yg)},(t,e)=>(e-t)/Yg,t=>t.getUTCHours());ide.range;const lP=pc(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*op)/k1,t=>t.getDate()-1);lP.range;const iz=pc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/k1,t=>t.getUTCDate()-1);iz.range;const Fze=pc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/k1,t=>Math.floor(t/k1));Fze.range;function G5(t){return pc(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)/tde)}const az=G5(0),wD=G5(1),DYt=G5(2),BYt=G5(3),rj=G5(4),$Yt=G5(5),UYt=G5(6);az.range;wD.range;DYt.range;BYt.range;rj.range;$Yt.range;UYt.range;function K5(t){return pc(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)/tde)}const oz=K5(0),CD=K5(1),zYt=K5(2),HYt=K5(3),sj=K5(4),VYt=K5(5),WYt=K5(6);oz.range;CD.range;zYt.range;HYt.range;sj.range;VYt.range;WYt.range;const ade=pc(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());ade.range;const ode=pc(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());ode.range;const T1=pc(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());T1.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:pc(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)});T1.range;const P1=pc(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());P1.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:pc(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)});P1.range;function Oze(t,e,n,r,s,a){const o=[[kw,1,Kg],[kw,5,5*Kg],[kw,15,15*Kg],[kw,30,30*Kg],[a,1,op],[a,5,5*op],[a,15,15*op],[a,30,30*op],[s,1,Yg],[s,3,3*Yg],[s,6,6*Yg],[s,12,12*Yg],[r,1,k1],[r,2,2*k1],[n,1,tde],[e,1,N6e],[e,3,3*N6e],[t,1,pX]];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=Hue(([,,C])=>C).right(o,x);if(g===o.length)return t.every(ure(u/pX,d/pX,f));if(g===0)return vD.every(Math.max(ure(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[qYt,GYt]=Oze(P1,ode,oz,Fze,ide,rde),[KYt,YYt]=Oze(T1,ade,az,lP,sde,nde);function mX(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 xX(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 b7(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function XYt(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=y7(s),d=v7(s),f=y7(a),x=v7(a),g=y7(o),y=v7(o),v=y7(l),C=v7(l),S=y7(c),T=v7(c),I={a:oe,A:K,b:H,B:ee,c:null,d:k6e,e:k6e,f:yXt,g:kXt,G:PXt,H:xXt,I:gXt,j:bXt,L:Mze,m:vXt,M:wXt,p:se,q:pe,Q:I6e,s:F6e,S:CXt,u:NXt,U:SXt,V:jXt,w:AXt,W:_Xt,x:null,X:null,y:EXt,Y:TXt,Z:IXt,"%":P6e},L={a:Se,A:ge,b:ve,B:be,c:null,d:T6e,e:T6e,f:LXt,g:qXt,G:KXt,H:FXt,I:OXt,j:MXt,L:Rze,m:RXt,M:DXt,p:we,q:je,Q:I6e,s:F6e,S:BXt,u:$Xt,U:UXt,V:zXt,w:HXt,W:VXt,x:null,X:null,y:WXt,Y:GXt,Z:YXt,"%":P6e},F={a:re,A:Q,b:q,B:te,c:fe,d:_6e,e:_6e,f:fXt,g:A6e,G:j6e,H:E6e,I:E6e,j:lXt,L:dXt,m:oXt,M:cXt,p:Y,q:aXt,Q:pXt,s:mXt,S:uXt,u:tXt,U:nXt,V:rXt,w:eXt,W:sXt,x:G,X:ie,y:A6e,Y:j6e,Z:iXt,"%":hXt};I.x=$(n,I),I.X=$(r,I),I.c=$(e,I),L.x=$(n,L),L.X=$(r,L),L.c=$(e,L);function $(Fe,Re){return function(Qe){var Ye=[],dt=-1,st=0,at=Fe.length,He,qe,vt;for(Qe instanceof Date||(Qe=new Date(+Qe));++dt<at;)Fe.charCodeAt(dt)===37&&(Ye.push(Fe.slice(st,dt)),(qe=S6e[He=Fe.charAt(++dt)])!=null?He=Fe.charAt(++dt):qe=He==="e"?" ":"0",(vt=Re[He])&&(He=vt(Qe,qe)),Ye.push(He),st=dt+1);return Ye.push(Fe.slice(st,dt)),Ye.join("")}}function O(Fe,Re){return function(Qe){var Ye=b7(1900,void 0,1),dt=U(Ye,Fe,Qe+="",0),st,at;if(dt!=Qe.length)return null;if("Q"in Ye)return new Date(Ye.Q);if("s"in Ye)return new Date(Ye.s*1e3+("L"in Ye?Ye.L:0));if(Re&&!("Z"in Ye)&&(Ye.Z=0),"p"in Ye&&(Ye.H=Ye.H%12+Ye.p*12),Ye.m===void 0&&(Ye.m="q"in Ye?Ye.q:0),"V"in Ye){if(Ye.V<1||Ye.V>53)return null;"w"in Ye||(Ye.w=1),"Z"in Ye?(st=xX(b7(Ye.y,0,1)),at=st.getUTCDay(),st=at>4||at===0?CD.ceil(st):CD(st),st=iz.offset(st,(Ye.V-1)*7),Ye.y=st.getUTCFullYear(),Ye.m=st.getUTCMonth(),Ye.d=st.getUTCDate()+(Ye.w+6)%7):(st=mX(b7(Ye.y,0,1)),at=st.getDay(),st=at>4||at===0?wD.ceil(st):wD(st),st=lP.offset(st,(Ye.V-1)*7),Ye.y=st.getFullYear(),Ye.m=st.getMonth(),Ye.d=st.getDate()+(Ye.w+6)%7)}else("W"in Ye||"U"in Ye)&&("w"in Ye||(Ye.w="u"in Ye?Ye.u%7:"W"in Ye?1:0),at="Z"in Ye?xX(b7(Ye.y,0,1)).getUTCDay():mX(b7(Ye.y,0,1)).getDay(),Ye.m=0,Ye.d="W"in Ye?(Ye.w+6)%7+Ye.W*7-(at+5)%7:Ye.w+Ye.U*7-(at+6)%7);return"Z"in Ye?(Ye.H+=Ye.Z/100|0,Ye.M+=Ye.Z%100,xX(Ye)):mX(Ye)}}function U(Fe,Re,Qe,Ye){for(var dt=0,st=Re.length,at=Qe.length,He,qe;dt<st;){if(Ye>=at)return-1;if(He=Re.charCodeAt(dt++),He===37){if(He=Re.charAt(dt++),qe=F[He in S6e?Re.charAt(dt++):He],!qe||(Ye=qe(Fe,Qe,Ye))<0)return-1}else if(He!=Qe.charCodeAt(Ye++))return-1}return Ye}function Y(Fe,Re,Qe){var Ye=u.exec(Re.slice(Qe));return Ye?(Fe.p=d.get(Ye[0].toLowerCase()),Qe+Ye[0].length):-1}function re(Fe,Re,Qe){var Ye=g.exec(Re.slice(Qe));return Ye?(Fe.w=y.get(Ye[0].toLowerCase()),Qe+Ye[0].length):-1}function Q(Fe,Re,Qe){var Ye=f.exec(Re.slice(Qe));return Ye?(Fe.w=x.get(Ye[0].toLowerCase()),Qe+Ye[0].length):-1}function q(Fe,Re,Qe){var Ye=S.exec(Re.slice(Qe));return Ye?(Fe.m=T.get(Ye[0].toLowerCase()),Qe+Ye[0].length):-1}function te(Fe,Re,Qe){var Ye=v.exec(Re.slice(Qe));return Ye?(Fe.m=C.get(Ye[0].toLowerCase()),Qe+Ye[0].length):-1}function fe(Fe,Re,Qe){return U(Fe,e,Re,Qe)}function G(Fe,Re,Qe){return U(Fe,n,Re,Qe)}function ie(Fe,Re,Qe){return U(Fe,r,Re,Qe)}function oe(Fe){return o[Fe.getDay()]}function K(Fe){return a[Fe.getDay()]}function H(Fe){return c[Fe.getMonth()]}function ee(Fe){return l[Fe.getMonth()]}function se(Fe){return s[+(Fe.getHours()>=12)]}function pe(Fe){return 1+~~(Fe.getMonth()/3)}function Se(Fe){return o[Fe.getUTCDay()]}function ge(Fe){return a[Fe.getUTCDay()]}function ve(Fe){return c[Fe.getUTCMonth()]}function be(Fe){return l[Fe.getUTCMonth()]}function we(Fe){return s[+(Fe.getUTCHours()>=12)]}function je(Fe){return 1+~~(Fe.getUTCMonth()/3)}return{format:function(Fe){var Re=$(Fe+="",I);return Re.toString=function(){return Fe},Re},parse:function(Fe){var Re=O(Fe+="",!1);return Re.toString=function(){return Fe},Re},utcFormat:function(Fe){var Re=$(Fe+="",L);return Re.toString=function(){return Fe},Re},utcParse:function(Fe){var Re=O(Fe+="",!0);return Re.toString=function(){return Fe},Re}}}var S6e={"-":"",_:" ",0:"0"},zc=/^\s*\d+/,QYt=/^%/,ZYt=/[\\^$*+?|[\]().{}]/g;function Ca(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 JYt(t){return t.replace(ZYt,"\\$&")}function y7(t){return new RegExp("^(?:"+t.map(JYt).join("|")+")","i")}function v7(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function eXt(t,e,n){var r=zc.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function tXt(t,e,n){var r=zc.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function nXt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function rXt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function sXt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function j6e(t,e,n){var r=zc.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function A6e(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function iXt(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 aXt(t,e,n){var r=zc.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function oXt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function _6e(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function lXt(t,e,n){var r=zc.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function E6e(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function cXt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function uXt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function dXt(t,e,n){var r=zc.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function fXt(t,e,n){var r=zc.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function hXt(t,e,n){var r=QYt.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function pXt(t,e,n){var r=zc.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function mXt(t,e,n){var r=zc.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function k6e(t,e){return Ca(t.getDate(),e,2)}function xXt(t,e){return Ca(t.getHours(),e,2)}function gXt(t,e){return Ca(t.getHours()%12||12,e,2)}function bXt(t,e){return Ca(1+lP.count(T1(t),t),e,3)}function Mze(t,e){return Ca(t.getMilliseconds(),e,3)}function yXt(t,e){return Mze(t,e)+"000"}function vXt(t,e){return Ca(t.getMonth()+1,e,2)}function wXt(t,e){return Ca(t.getMinutes(),e,2)}function CXt(t,e){return Ca(t.getSeconds(),e,2)}function NXt(t){var e=t.getDay();return e===0?7:e}function SXt(t,e){return Ca(az.count(T1(t)-1,t),e,2)}function Lze(t){var e=t.getDay();return e>=4||e===0?rj(t):rj.ceil(t)}function jXt(t,e){return t=Lze(t),Ca(rj.count(T1(t),t)+(T1(t).getDay()===4),e,2)}function AXt(t){return t.getDay()}function _Xt(t,e){return Ca(wD.count(T1(t)-1,t),e,2)}function EXt(t,e){return Ca(t.getFullYear()%100,e,2)}function kXt(t,e){return t=Lze(t),Ca(t.getFullYear()%100,e,2)}function TXt(t,e){return Ca(t.getFullYear()%1e4,e,4)}function PXt(t,e){var n=t.getDay();return t=n>=4||n===0?rj(t):rj.ceil(t),Ca(t.getFullYear()%1e4,e,4)}function IXt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ca(e/60|0,"0",2)+Ca(e%60,"0",2)}function T6e(t,e){return Ca(t.getUTCDate(),e,2)}function FXt(t,e){return Ca(t.getUTCHours(),e,2)}function OXt(t,e){return Ca(t.getUTCHours()%12||12,e,2)}function MXt(t,e){return Ca(1+iz.count(P1(t),t),e,3)}function Rze(t,e){return Ca(t.getUTCMilliseconds(),e,3)}function LXt(t,e){return Rze(t,e)+"000"}function RXt(t,e){return Ca(t.getUTCMonth()+1,e,2)}function DXt(t,e){return Ca(t.getUTCMinutes(),e,2)}function BXt(t,e){return Ca(t.getUTCSeconds(),e,2)}function $Xt(t){var e=t.getUTCDay();return e===0?7:e}function UXt(t,e){return Ca(oz.count(P1(t)-1,t),e,2)}function Dze(t){var e=t.getUTCDay();return e>=4||e===0?sj(t):sj.ceil(t)}function zXt(t,e){return t=Dze(t),Ca(sj.count(P1(t),t)+(P1(t).getUTCDay()===4),e,2)}function HXt(t){return t.getUTCDay()}function VXt(t,e){return Ca(CD.count(P1(t)-1,t),e,2)}function WXt(t,e){return Ca(t.getUTCFullYear()%100,e,2)}function qXt(t,e){return t=Dze(t),Ca(t.getUTCFullYear()%100,e,2)}function GXt(t,e){return Ca(t.getUTCFullYear()%1e4,e,4)}function KXt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?sj(t):sj.ceil(t),Ca(t.getUTCFullYear()%1e4,e,4)}function YXt(){return"+0000"}function P6e(){return"%"}function I6e(t){return+t}function F6e(t){return Math.floor(+t/1e3)}var jC,Bze,$ze;XXt({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 XXt(t){return jC=XYt(t),Bze=jC.format,jC.parse,$ze=jC.utcFormat,jC.utcParse,jC}function QXt(t){return new Date(t)}function ZXt(t){return t instanceof Date?+t:+new Date(+t)}function lde(t,e,n,r,s,a,o,l,c,u){var d=Kue(),f=d.invert,x=d.domain,g=u(".%L"),y=u(":%S"),v=u("%I:%M"),C=u("%I %p"),S=u("%a %d"),T=u("%b %d"),I=u("%B"),L=u("%Y");function F($){return(c($)<$?g:l($)<$?y:o($)<$?v:a($)<$?C:r($)<$?s($)<$?S:T:n($)<$?I:L)($)}return d.invert=function($){return new Date(f($))},d.domain=function($){return arguments.length?x(Array.from($,ZXt)):x().map(QXt)},d.ticks=function($){var O=x();return t(O[0],O[O.length-1],$??10)},d.tickFormat=function($,O){return O==null?F:u(O)},d.nice=function($){var O=x();return(!$||typeof $.range!="function")&&($=e(O[0],O[O.length-1],$??10)),$?x(Aze(O,$)):d},d.copy=function(){return oP(d,lde(t,e,n,r,s,a,o,l,c,u))},d}function JXt(){return Np.apply(lde(KYt,YYt,T1,ade,az,lP,sde,nde,kw,Bze).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function eQt(){return Np.apply(lde(qYt,GYt,P1,ode,oz,iz,ide,rde,kw,$ze).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function lz(){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(I8),u.rangeRound=d(Gue),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 $2(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Uze(){var t=B2(lz()(md));return t.copy=function(){return $2(t,Uze())},W1.apply(t,arguments)}function zze(){var t=Que(lz()).domain([1,10]);return t.copy=function(){return $2(t,zze()).base(t.base())},W1.apply(t,arguments)}function Hze(){var t=Zue(lz());return t.copy=function(){return $2(t,Hze()).constant(t.constant())},W1.apply(t,arguments)}function cde(){var t=Jue(lz());return t.copy=function(){return $2(t,cde()).exponent(t.exponent())},W1.apply(t,arguments)}function tQt(){return cde.apply(null,arguments).exponent(.5)}function Vze(){var t=[],e=md;function n(r){if(r!=null&&!isNaN(r=+r))return e((iP(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(Wy),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)=>UKt(t,a/r))},n.copy=function(){return Vze(e).domain(t)},W1.apply(n,arguments)}function cz(){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 S,T,I;return arguments.length?([S,T,I]=C,u=hYt(v,[S,T,I]),g):[u(0),u(.5),u(1)]}}return g.range=y(I8),g.rangeRound=y(Gue),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 Wze(){var t=B2(cz()(md));return t.copy=function(){return $2(t,Wze())},W1.apply(t,arguments)}function qze(){var t=Que(cz()).domain([.1,1,10]);return t.copy=function(){return $2(t,qze()).base(t.base())},W1.apply(t,arguments)}function Gze(){var t=Zue(cz());return t.copy=function(){return $2(t,Gze()).constant(t.constant())},W1.apply(t,arguments)}function ude(){var t=Jue(cz());return t.copy=function(){return $2(t,ude()).exponent(t.exponent())},W1.apply(t,arguments)}function nQt(){return ude.apply(null,arguments).exponent(.5)}const O6e=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:sk,scaleDiverging:Wze,scaleDivergingLog:qze,scaleDivergingPow:ude,scaleDivergingSqrt:nQt,scaleDivergingSymlog:Gze,scaleIdentity:jze,scaleImplicit:dre,scaleLinear:yD,scaleLog:_ze,scaleOrdinal:Vue,scalePoint:q_,scalePow:ede,scaleQuantile:Tze,scaleQuantize:Pze,scaleRadial:kze,scaleSequential:Uze,scaleSequentialLog:zze,scaleSequentialPow:cde,scaleSequentialQuantile:Vze,scaleSequentialSqrt:tQt,scaleSequentialSymlog:Hze,scaleSqrt:LYt,scaleSymlog:Eze,scaleThreshold:Ize,scaleTime:JXt,scaleUtc:eQt,tickFormat:Sze},Symbol.toStringTag,{value:"Module"}));var gX,M6e;function Kze(){if(M6e)return gX;M6e=1;var t=E8();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 gX=e,gX}var bX,L6e;function rQt(){if(L6e)return bX;L6e=1;function t(e,n){return e>n}return bX=t,bX}var yX,R6e;function sQt(){if(R6e)return yX;R6e=1;var t=Kze(),e=rQt(),n=P8();function r(s){return s&&s.length?t(s,n,e):void 0}return yX=r,yX}var iQt=sQt();const Fy=Pi(iQt);var vX,D6e;function aQt(){if(D6e)return vX;D6e=1;function t(e,n){return e<n}return vX=t,vX}var wX,B6e;function oQt(){if(B6e)return wX;B6e=1;var t=Kze(),e=aQt(),n=P8();function r(s){return s&&s.length?t(s,n,e):void 0}return wX=r,wX}var lQt=oQt();const uz=Pi(lQt);var CX,$6e;function cQt(){if($6e)return CX;$6e=1;var t=Aue(),e=D2(),n=tze(),r=Cf();function s(a,o){var l=r(a)?t:n;return l(a,e(o,3))}return CX=s,CX}var NX,U6e;function uQt(){if(U6e)return NX;U6e=1;var t=JUe(),e=cQt();function n(r,s){return t(e(r,s),1)}return NX=n,NX}var dQt=uQt();const fQt=Pi(dQt);var SX,z6e;function hQt(){if(z6e)return SX;z6e=1;var t=Due();function e(n,r){return t(n,r)}return SX=e,SX}var pQt=hQt();const x5=Pi(pQt);var F8=1e9,mQt={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},fde,$o=!0,wp="[DecimalError] ",P3=wp+"Invalid argument: ",dde=wp+"Exponent out of range: ",O8=Math.floor,ew=Math.pow,xQt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Yf,kc=1e7,ko=7,Yze=9007199254740991,ND=O8(Yze/ko),Ds={};Ds.absoluteValue=Ds.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};Ds.comparedTo=Ds.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};Ds.decimalPlaces=Ds.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*ko;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Ds.dividedBy=Ds.div=function(t){return d1(this,new this.constructor(t))};Ds.dividedToIntegerBy=Ds.idiv=function(t){var e=this,n=e.constructor;return no(d1(e,new n(t),0,1),n.precision)};Ds.equals=Ds.eq=function(t){return!this.cmp(t)};Ds.exponent=function(){return Kl(this)};Ds.greaterThan=Ds.gt=function(t){return this.cmp(t)>0};Ds.greaterThanOrEqualTo=Ds.gte=function(t){return this.cmp(t)>=0};Ds.isInteger=Ds.isint=function(){return this.e>this.d.length-2};Ds.isNegative=Ds.isneg=function(){return this.s<0};Ds.isPositive=Ds.ispos=function(){return this.s>0};Ds.isZero=function(){return this.s===0};Ds.lessThan=Ds.lt=function(t){return this.cmp(t)<0};Ds.lessThanOrEqualTo=Ds.lte=function(t){return this.cmp(t)<1};Ds.logarithm=Ds.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(Yf))throw Error(wp+"NaN");if(n.s<1)throw Error(wp+(n.s?"NaN":"-Infinity"));return n.eq(Yf)?new r(0):($o=!1,e=d1(ck(n,a),ck(t,a),a),$o=!0,no(e,s))};Ds.minus=Ds.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Zze(e,t):Xze(e,(t.s=-t.s,t))};Ds.modulo=Ds.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?($o=!1,e=d1(n,t,0,1).times(t),$o=!0,n.minus(e)):no(new r(n),s)};Ds.naturalExponential=Ds.exp=function(){return Qze(this)};Ds.naturalLogarithm=Ds.ln=function(){return ck(this)};Ds.negated=Ds.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Ds.plus=Ds.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Xze(e,t):Zze(e,(t.s=-t.s,t))};Ds.precision=Ds.sd=function(t){var e,n,r,s=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(P3+t);if(e=Kl(s)+1,r=s.d.length-1,n=r*ko+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};Ds.squareRoot=Ds.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=Kl(l),$o=!1,s=Math.sqrt(+l),s==0||s==1/0?(e=$0(l.d),(e.length+t)%2==0&&(e+="0"),s=Math.sqrt(e),t=O8((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(d1(l,a,o+2)).times(.5),$0(a.d).slice(0,o)===(e=$0(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),s==o&&e=="4999"){if(no(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(e!="9999")break;o+=4}return $o=!0,no(r,n)};Ds.times=Ds.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%kc|0,e=l/kc|0;a[s]=(a[s]+e)%kc|0}for(;!a[--o];)a.pop();return e?++n:a.shift(),t.d=a,t.e=n,$o?no(t,f.precision):t};Ds.toDecimalPlaces=Ds.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(gx(t,0,F8),e===void 0?e=r.rounding:gx(e,0,8),no(n,t+Kl(n)+1,e))};Ds.toExponential=function(t,e){var n,r=this,s=r.constructor;return t===void 0?n=g5(r,!0):(gx(t,0,F8),e===void 0?e=s.rounding:gx(e,0,8),r=no(new s(r),t+1,e),n=g5(r,!0,t+1)),n};Ds.toFixed=function(t,e){var n,r,s=this,a=s.constructor;return t===void 0?g5(s):(gx(t,0,F8),e===void 0?e=a.rounding:gx(e,0,8),r=no(new a(s),t+Kl(s)+1,e),n=g5(r.abs(),!1,t+Kl(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};Ds.toInteger=Ds.toint=function(){var t=this,e=t.constructor;return no(new e(t),Kl(t)+1,e.rounding)};Ds.toNumber=function(){return+this};Ds.toPower=Ds.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(Yf);if(l=new c(l),!l.s){if(t.s<1)throw Error(wp+"Infinity");return l}if(l.eq(Yf))return l;if(r=c.precision,t.eq(Yf))return no(l,r);if(e=t.e,n=t.d.length-1,o=e>=n,a=l.s,o){if((n=d<0?-d:d)<=Yze){for(s=new c(Yf),e=Math.ceil(r/ko+4),$o=!1;n%2&&(s=s.times(l),V6e(s.d,e)),n=O8(n/2),n!==0;)l=l.times(l),V6e(l.d,e);return $o=!0,t.s<0?new c(Yf).div(s):no(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,$o=!1,s=t.times(ck(l,r+u)),$o=!0,s=Qze(s),s.s=a,s};Ds.toPrecision=function(t,e){var n,r,s=this,a=s.constructor;return t===void 0?(n=Kl(s),r=g5(s,n<=a.toExpNeg||n>=a.toExpPos)):(gx(t,1,F8),e===void 0?e=a.rounding:gx(e,0,8),s=no(new a(s),t,e),n=Kl(s),r=g5(s,t<=n||n<=a.toExpNeg,t)),r};Ds.toSignificantDigits=Ds.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(gx(t,1,F8),e===void 0?e=r.rounding:gx(e,0,8)),no(new r(n),t,e)};Ds.toString=Ds.valueOf=Ds.val=Ds.toJSON=Ds[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Kl(t),n=t.constructor;return g5(t,e<=n.toExpNeg||e>=n.toExpPos)};function Xze(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)),$o?no(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/ko),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)/kc|0,c[a]%=kc;for(n&&(c.unshift(n),++s),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=s,$o?no(e,f):e}function gx(t,e,n){if(t!==~~t||t<e||t>n)throw Error(P3+t)}function $0(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=ko-r.length,n&&(a+=Gb(n)),a+=r;o=t[e],r=o+"",n=ko-r.length,n&&(a+=Gb(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}var d1=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%kc|0,o=a/kc|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*kc+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,S,T,I,L,F,$,O,U,Y=r.constructor,re=r.s==s.s?1:-1,Q=r.d,q=s.d;if(!r.s)return new Y(r);if(!s.s)throw Error(wp+"Division by zero");for(c=r.e-s.e,O=q.length,F=Q.length,g=new Y(re),y=g.d=[],u=0;q[u]==(Q[u]||0);)++u;if(q[u]>(Q[u]||0)&&--c,a==null?T=a=Y.precision:o?T=a+(Kl(r)-Kl(s))+1:T=a,T<0)return new Y(0);if(T=T/ko+2|0,u=0,O==1)for(d=0,q=q[0],T++;(u<F||d)&&T--;u++)I=d*kc+(Q[u]||0),y[u]=I/q|0,d=I%q|0;else{for(d=kc/(q[0]+1)|0,d>1&&(q=t(q,d),Q=t(Q,d),O=q.length,F=Q.length),L=O,v=Q.slice(0,O),C=v.length;C<O;)v[C++]=0;U=q.slice(),U.unshift(0),$=q[0],q[1]>=kc/2&&++$;do d=0,l=e(q,v,O,C),l<0?(S=v[0],O!=C&&(S=S*kc+(v[1]||0)),d=S/$|0,d>1?(d>=kc&&(d=kc-1),f=t(q,d),x=f.length,C=v.length,l=e(f,v,x,C),l==1&&(d--,n(f,O<x?U:q,x))):(d==0&&(l=d=1),f=q.slice()),x=f.length,x<C&&f.unshift(0),n(v,f,C),l==-1&&(C=v.length,l=e(q,v,O,C),l<1&&(d++,n(v,O<C?U:q,C))),C=v.length):l===0&&(d++,v=[0]),y[u++]=d,l&&v[0]?v[C++]=Q[L]||0:(v=[Q[L]],C=1);while((L++<F||v[0]!==void 0)&&T--)}return y[0]||y.shift(),g.e=c,no(g,o?a+Kl(g)+1:a)}}();function Qze(t,e){var n,r,s,a,o,l,c=0,u=0,d=t.constructor,f=d.precision;if(Kl(t)>16)throw Error(dde+Kl(t));if(!t.s)return new d(Yf);for(e==null?($o=!1,l=f):l=e,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),u+=5;for(r=Math.log(ew(2,u))/Math.LN10*2+5|0,l+=r,n=s=a=new d(Yf),d.precision=l;;){if(s=no(s.times(t),l),n=n.times(++c),o=a.plus(d1(s,n,l)),$0(o.d).slice(0,l)===$0(a.d).slice(0,l)){for(;u--;)a=no(a.times(a),l);return d.precision=f,e==null?($o=!0,no(a,f)):a}a=o}}function Kl(t){for(var e=t.e*ko,n=t.d[0];n>=10;n/=10)e++;return e}function jX(t,e,n){if(e>t.LN10.sd())throw $o=!0,n&&(t.precision=n),Error(wp+"LN10 precision limit exceeded");return no(new t(t.LN10),e)}function Gb(t){for(var e="";t--;)e+="0";return e}function ck(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(Yf))return new v(0);if(e==null?($o=!1,u=C):u=e,g.eq(10))return e==null&&($o=!0),jX(v,u);if(u+=x,v.precision=u,n=$0(y),r=n.charAt(0),a=Kl(g),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(t),n=$0(g.d),r=n.charAt(0),f++;a=Kl(g),r>1?(g=new v("0."+n),a++):g=new v(r+"."+n.slice(1))}else return c=jX(v,u+2,C).times(a+""),g=ck(new v(r+"."+n.slice(1)),u-x).plus(c),v.precision=C,e==null?($o=!0,no(g,C)):g;for(l=o=g=d1(g.minus(Yf),g.plus(Yf),u),d=no(g.times(g),u),s=3;;){if(o=no(o.times(d),u),c=l.plus(d1(o,new v(s),u)),$0(c.d).slice(0,u)===$0(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(jX(v,u+2,C).times(a+""))),l=d1(l,new v(f),u),v.precision=C,e==null?($o=!0,no(l,C)):l;l=c,s+=2}}function H6e(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=O8(n/ko),t.d=[],r=(n+1)%ko,n<0&&(r+=ko),r<s){for(r&&t.d.push(+e.slice(0,r)),s-=ko;r<s;)t.d.push(+e.slice(r,r+=ko));e=e.slice(r),r=ko-e.length}else r-=s;for(;r--;)e+="0";if(t.d.push(+e),$o&&(t.e>ND||t.e<-ND))throw Error(dde+n)}else t.s=0,t.e=0,t.d=[0];return t}function no(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+=ko,s=e,u=f[d=0];else{if(d=Math.ceil((r+1)/ko),a=f.length,d>=a)return t;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=ko,s=r-ko+o}if(n!==void 0&&(a=ew(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/ew(10,o-s):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return c?(a=Kl(t),f.length=1,e=e-a-1,f[0]=ew(10,(ko-e%ko)%ko),t.e=O8(-e/ko)||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=ew(10,ko-r),f[d]=s>0?(u/ew(10,o-s)%ew(10,s)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==kc&&(f[0]=1,++t.e);break}else{if(f[d]+=a,f[d]!=kc)break;f[d--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if($o&&(t.e>ND||t.e<-ND))throw Error(dde+Kl(t));return t}function Zze(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),$o?no(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/ko),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]=kc-1;--c[a],c[s]+=kc}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,$o?no(e,g):e):new x(0)}function g5(t,e,n){var r,s=Kl(t),a=$0(t.d),o=a.length;return e?(n&&(r=n-o)>0?a=a.charAt(0)+"."+a.slice(1)+Gb(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(s<0?"e":"e+")+s):s<0?(a="0."+Gb(-s-1)+a,n&&(r=n-o)>0&&(a+=Gb(r))):s>=o?(a+=Gb(s+1-o),n&&(r=n-s-1)>0&&(a=a+"."+Gb(r))):((r=s+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),n&&(r=n-o)>0&&(s+1===o&&(a+="."),a+=Gb(r))),t.s<0?"-"+a:a}function V6e(t,e){if(t.length>e)return t.length=e,!0}function Jze(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(P3+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 H6e(o,a.toString())}else if(typeof a!="string")throw Error(P3+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,xQt.test(a))H6e(o,a);else throw Error(P3+a)}if(s.prototype=Ds,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=Jze,s.config=s.set=gQt,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 gQt(t){if(!t||typeof t!="object")throw Error(wp+"Object expected");var e,n,r,s=["precision",1,F8,"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(O8(r)===r&&r>=s[e+1]&&r<=s[e+2])this[n]=r;else throw Error(P3+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(P3+n+": "+r);return this}var fde=Jze(mQt);Yf=new fde(1);const Ka=fde;function bQt(t){return CQt(t)||wQt(t)||vQt(t)||yQt()}function yQt(){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 vQt(t,e){if(t){if(typeof t=="string")return mre(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 mre(t,e)}}function wQt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function CQt(t){if(Array.isArray(t))return mre(t)}function mre(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 NQt=function(e){return e},eHe={"@@functional/placeholder":!0},tHe=function(e){return e===eHe},W6e=function(e){return function n(){return arguments.length===0||arguments.length===1&&tHe(arguments.length<=0?void 0:arguments[0])?n:e.apply(void 0,arguments)}},SQt=function t(e,n){return e===1?n:W6e(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!==eHe}).length;return o>=e?n.apply(void 0,s):t(e-o,W6e(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 tHe(f)?c.shift():f});return n.apply(void 0,bQt(d).concat(c))}))})},dz=function(e){return SQt(e.length,e)},xre=function(e,n){for(var r=[],s=e;s<n;++s)r[s-e]=s;return r},jQt=dz(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(n){return e[n]}).map(t)}),AQt=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(!n.length)return NQt;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))}},gre=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},nHe=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 _Qt(t){var e;return t===0?e=1:e=Math.floor(new Ka(t).abs().log(10).toNumber())+1,e}function EQt(t,e,n){for(var r=new Ka(t),s=0,a=[];r.lt(e)&&s<1e5;)a.push(r.toNumber()),r=r.add(n),s++;return a}var kQt=dz(function(t,e,n){var r=+t,s=+e;return r+n*(s-r)}),TQt=dz(function(t,e,n){var r=e-+t;return r=r||1/0,(n-t)/r}),PQt=dz(function(t,e,n){var r=e-+t;return r=r||1/0,Math.max(0,Math.min(1,(n-t)/r))});const fz={rangeStep:EQt,getDigitCount:_Qt,interpolateNumber:kQt,uninterpolateNumber:TQt,uninterpolateTruncation:PQt};function bre(t){return OQt(t)||FQt(t)||rHe(t)||IQt()}function IQt(){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 FQt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function OQt(t){if(Array.isArray(t))return yre(t)}function uk(t,e){return RQt(t)||LQt(t,e)||rHe(t,e)||MQt()}function MQt(){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 rHe(t,e){if(t){if(typeof t=="string")return yre(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 yre(t,e)}}function yre(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 LQt(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 RQt(t){if(Array.isArray(t))return t}function sHe(t){var e=uk(t,2),n=e[0],r=e[1],s=n,a=r;return n>r&&(s=r,a=n),[s,a]}function iHe(t,e,n){if(t.lte(0))return new Ka(0);var r=fz.getDigitCount(t.toNumber()),s=new Ka(10).pow(r),a=t.div(s),o=r!==1?.05:.1,l=new Ka(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return e?c:new Ka(Math.ceil(c))}function DQt(t,e,n){var r=1,s=new Ka(t);if(!s.isint()&&n){var a=Math.abs(t);a<1?(r=new Ka(10).pow(fz.getDigitCount(t)-1),s=new Ka(Math.floor(s.div(r).toNumber())).mul(r)):a>1&&(s=new Ka(Math.floor(t)))}else t===0?s=new Ka(Math.floor((e-1)/2)):n||(s=new Ka(Math.floor(t)));var o=Math.floor((e-1)/2),l=AQt(jQt(function(c){return s.add(new Ka(c-o).mul(r)).toNumber()}),xre);return l(0,e)}function aHe(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 Ka(0),tickMin:new Ka(0),tickMax:new Ka(0)};var a=iHe(new Ka(e).sub(t).div(n-1),r,s),o;t<=0&&e>=0?o=new Ka(0):(o=new Ka(t).add(e).div(2),o=o.sub(new Ka(o).mod(a)));var l=Math.ceil(o.sub(t).div(a).toNumber()),c=Math.ceil(new Ka(e).sub(o).div(a).toNumber()),u=l+c+1;return u>n?aHe(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 Ka(l).mul(a)),tickMax:o.add(new Ka(c).mul(a))})}function BQt(t){var e=uk(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=sHe([n,r]),c=uk(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(bre(xre(0,s-1).map(function(){return 1/0}))):[].concat(bre(xre(0,s-1).map(function(){return-1/0})),[d]);return n>r?gre(f):f}if(u===d)return DQt(u,s,a);var x=aHe(u,d,o,a),g=x.step,y=x.tickMin,v=x.tickMax,C=fz.rangeStep(y,v.add(new Ka(.1).mul(g)),g);return n>r?gre(C):C}function $Qt(t,e){var n=uk(t,2),r=n[0],s=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=sHe([r,s]),l=uk(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=iHe(new Ka(u).sub(c).div(d-1),a,0),x=[].concat(bre(fz.rangeStep(new Ka(c),new Ka(u).sub(new Ka(.99).mul(f)),f)),[u]);return r>s?gre(x):x}var UQt=nHe(BQt),zQt=nHe($Qt),HQt="Invariant failed";function b5(t,e){throw new Error(HQt)}var VQt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function ij(t){"@babel/helpers - typeof";return ij=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},ij(t)}function SD(){return SD=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},SD.apply(this,arguments)}function WQt(t,e){return YQt(t)||KQt(t,e)||GQt(t,e)||qQt()}function qQt(){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 GQt(t,e){if(t){if(typeof t=="string")return q6e(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 q6e(t,e)}}function q6e(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 KQt(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 YQt(t){if(Array.isArray(t))return t}function XQt(t,e){if(t==null)return{};var n=QQt(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 QQt(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 ZQt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function JQt(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,cHe(r.key),r)}}function eZt(t,e,n){return JQt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function tZt(t,e,n){return e=jD(e),nZt(t,oHe()?Reflect.construct(e,n||[],jD(t).constructor):e.apply(t,n))}function nZt(t,e){if(e&&(ij(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rZt(t)}function rZt(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 jD(t){return jD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},jD(t)}function sZt(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 lHe(t,e,n){return e=cHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cHe(t){var e=iZt(t,"string");return ij(e)=="symbol"?e:e+""}function iZt(t,e){if(ij(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ij(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var M8=function(t){function e(){return ZQt(this,e),tZt(this,e,arguments)}return sZt(e,t),eZt(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=XQt(r,VQt),g=ji(x,!1);this.props.direction==="x"&&d.type!=="number"&&b5();var y=c.map(function(v){var C=u(v,l),S=C.x,T=C.y,I=C.value,L=C.errorVal;if(!L)return null;var F=[],$,O;if(Array.isArray(L)){var U=WQt(L,2);$=U[0],O=U[1]}else $=O=L;if(a==="vertical"){var Y=d.scale,re=T+s,Q=re+o,q=re-o,te=Y(I-$),fe=Y(I+O);F.push({x1:fe,y1:Q,x2:fe,y2:q}),F.push({x1:te,y1:re,x2:fe,y2:re}),F.push({x1:te,y1:Q,x2:te,y2:q})}else if(a==="horizontal"){var G=f.scale,ie=S+s,oe=ie-o,K=ie+o,H=G(I-$),ee=G(I+O);F.push({x1:oe,y1:ee,x2:K,y2:ee}),F.push({x1:ie,y1:H,x2:ie,y2:ee}),F.push({x1:oe,y1:H,x2:K,y2:H})}return ke.createElement(_a,SD({className:"recharts-errorBar",key:"bar-".concat(F.map(function(se){return"".concat(se.x1,"-").concat(se.x2,"-").concat(se.y1,"-").concat(se.y2)}))},g),F.map(function(se){return ke.createElement("line",SD({},se,{key:"line-".concat(se.x1,"-").concat(se.x2,"-").concat(se.y1,"-").concat(se.y2)}))}))});return ke.createElement(_a,{className:"recharts-errorBars"},y)}}])}(ke.Component);lHe(M8,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});lHe(M8,"displayName","ErrorBar");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 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 Fv(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){aZt(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 aZt(t,e,n){return e=oZt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oZt(t){var e=lZt(t,"string");return dk(e)=="symbol"?e:e+""}function lZt(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 uHe=function(e){var n=e.children,r=e.formattedGraphicalItems,s=e.legendWidth,a=e.legendContent,o=qf(n,k3);if(!o)return null;var l=k3.defaultProps,c=l!==void 0?Fv(Fv({},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?Fv(Fv({},x),f.props):{},y=g.dataKey,v=g.name,C=g.legendType,S=g.hide;return{inactive:S,dataKey:y,type:c.iconType||C||"square",color:hde(f),value:v||y,payload:g}}),Fv(Fv(Fv({},c),k3.getWithHeight(o,s)),{},{payload:u,item:o})};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)}function K6e(t){return fZt(t)||dZt(t)||uZt(t)||cZt()}function cZt(){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 uZt(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 dZt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function fZt(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 Y6e(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 ol(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Y6e(Object(n),!0).forEach(function(r){V4(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Y6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function V4(t,e,n){return e=hZt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hZt(t){var e=pZt(t,"string");return fk(e)=="symbol"?e:e+""}function pZt(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 uc(t,e,n){return Ai(t)||Ai(e)?n:cc(e)?dp(t,e,n):ki(e)?e(t):n}function G_(t,e,n,r){var s=fQt(t,function(l){return uc(l,e)});if(n==="number"){var a=s.filter(function(l){return fs(l)||parseFloat(l)});return a.length?[uz(a),Fy(a)]:[1/0,-1/0]}var o=r?s.filter(function(l){return!Ai(l)}):s;return o.map(function(l){return cc(l)||l instanceof Date?l:""})}var mZt=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 S=[Math.min(f,(g+f)/2),Math.max(f,(g+f)/2)];if(e>S[0]&&e<=S[1]||e>=y[0]&&e<=y[1]){o=s[u].index;break}}else{var T=Math.min(d,x),I=Math.max(d,x);if(e>(T+f)/2&&e<=(I+f)/2){o=s[u].index;break}}}else for(var L=0;L<l;L++)if(L===0&&e<=(r[L].coordinate+r[L+1].coordinate)/2||L>0&&L<l-1&&e>(r[L].coordinate+r[L-1].coordinate)/2&&e<=(r[L].coordinate+r[L+1].coordinate)/2||L===l-1&&e>(r[L].coordinate+r[L-1].coordinate)/2){o=r[L].index;break}return o},hde=function(e){var n,r=e,s=r.type.displayName,a=(n=e.type)!==null&&n!==void 0&&n.defaultProps?ol(ol({},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},xZt=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,S=v.filter(function(O){return c1(O.type).indexOf("Bar")>=0});if(S&&S.length){var T=S[0].type.defaultProps,I=T!==void 0?ol(ol({},T),S[0].props):S[0].props,L=I.barSize,F=I[C];o[F]||(o[F]=[]);var $=Ai(L)?n:L;o[F].push({item:S[0],stackList:S.slice(1),barSize:Ai($)?void 0:m5($,r,0)})}}return o},gZt=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=m5(n,s,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var x=!1,g=s/c,y=o.reduce(function(L,F){return L+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(L,F){var $={item:F.item,position:{offset:C.offset+C.size+u,size:x?g:F.barSize}},O=[].concat(K6e(L),[$]);return C=O[O.length-1].position,F.stackList&&F.stackList.length&&F.stackList.forEach(function(U){O.push({item:U,position:C})}),O},f)}else{var S=m5(r,s,0,!0);s-2*S-(c-1)*u<=0&&(u=0);var T=(s-2*S-(c-1)*u)/c;T>1&&(T>>=0);var I=l===+l?Math.min(T,l):T;d=o.reduce(function(L,F,$){var O=[].concat(K6e(L),[{item:F.item,position:{offset:S+(T+u)*$+(T-I)/2,size:I}}]);return F.stackList&&F.stackList.length&&F.stackList.forEach(function(U){O.push({item:U,position:O[O.length-1].position})}),O},f)}return d},bZt=function(e,n,r,s){var a=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=uHe({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"&&fs(e[g]))return ol(ol({},e),{},V4({},g,e[g]+(f||0)));if((v==="horizontal"||v==="vertical"&&g==="center")&&y!=="middle"&&fs(e[y]))return ol(ol({},e),{},V4({},y,e[y]+(x||0)))}return e},yZt=function(e,n,r){return Ai(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},dHe=function(e,n,r,s,a){var o=n.props.children,l=pf(o,M8).filter(function(u){return yZt(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=uc(d,r);if(Ai(f))return u;var x=Array.isArray(f)?[uz(f),Fy(f)]:[f,f],g=c.reduce(function(y,v){var C=uc(d,v,0),S=x[0]-Math.abs(Array.isArray(C)?C[0]:C),T=x[1]+Math.abs(Array.isArray(C)?C[1]:C);return[Math.min(S,y[0]),Math.max(T,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},vZt=function(e,n,r,s,a){var o=n.map(function(l){return dHe(e,l,r,a,s)}).filter(function(l){return!Ai(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},fHe=function(e,n,r,s,a){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&dHe(e,c,u,s)||G_(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},[])},hHe=function(e,n){return e==="horizontal"&&n==="xAxis"||e==="vertical"&&n==="yAxis"||e==="centric"&&n==="angleAxis"||e==="radial"&&n==="radiusAxis"},pHe=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},Xg=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!T8(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}})},AX=new WeakMap,_F=function(e,n){if(typeof n!="function")return e;AX.has(e)||AX.set(e,new WeakMap);var r=AX.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},wZt=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:sk(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:yD(),realScaleType:"linear"}:a==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:q_(),realScaleType:"point"}:a==="category"?{scale:sk(),realScaleType:"band"}:{scale:yD(),realScaleType:"linear"};if(p5(s)){var c="scale".concat(XU(s));return{scale:(O6e[c]||q_)(),realScaleType:O6e[c]?c:"point"}}return ki(s)?{scale:s}:{scale:q_(),realScaleType:"point"}},X6e=1e-4,CZt=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])-X6e,o=Math.max(s[0],s[1])+X6e,l=e(n[0]),c=e(n[r-1]);(l<a||l>o||c<a||c>o)&&e.domain([n[0],n[r-1]])}},NZt=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},SZt=function(e,n){if(!n||n.length!==2||!fs(n[0])||!fs(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(!fs(e[0])||e[0]<r)&&(a[0]=r),(!fs(e[1])||e[1]>s)&&(a[1]=s),a[0]>s&&(a[0]=s),a[1]<r&&(a[1]=r),a},jZt=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=T8(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])}},AZt=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=T8(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)}},_Zt={sign:jZt,expand:dWt,none:QS,silhouette:fWt,wiggle:hWt,positive:AZt},EZt=function(e,n,r){var s=n.map(function(l){return l.props.dataKey}),a=_Zt[r],o=uWt().keys(s).value(function(l,c){return+uc(l,c,0)}).order(Qne).offset(a);return o(e)},kZt=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?ol(ol({},x.type.defaultProps),x.props):x.props,v=y.stackId,C=y.hide;if(C)return f;var S=y[r],T=f[S]||{hasStack:!1,stackGroups:{}};if(cc(v)){var I=T.stackGroups[v]||{numericAxisId:r,cateAxisId:s,items:[]};I.items.push(x),T.hasStack=!0,T.stackGroups[v]=I}else T.stackGroups[q5("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[x]};return ol(ol({},f),{},V4({},S,T))},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 S=g.stackGroups[C];return ol(ol({},v),{},V4({},C,{numericAxisId:r,cateAxisId:s,items:S.items,stackedData:EZt(e,S.items,a)}))},y)}return ol(ol({},f),{},V4({},x,g))},d)},TZt=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=UQt(u,a,l);return e.domain([uz(d),Fy(d)]),{niceTicks:d}}if(a&&s==="number"){var f=e.domain(),x=zQt(f,a,l);return{niceTicks:x}}return null};function aj(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&&!Ai(s[e.dataKey])){var l=eD(n,"value",s[e.dataKey]);if(l)return l.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=uc(s,Ai(o)?e.dataKey:o);return Ai(c)?null:e.scale(c)}var Q6e=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=uc(o,n.dataKey,n.domain[l]);return Ai(c)?null:n.scale(c)-a/2+s},PZt=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]},IZt=function(e,n){var r,s=(r=e.type)!==null&&r!==void 0&&r.defaultProps?ol(ol({},e.type.defaultProps),e.props):e.props,a=s.stackId;if(cc(a)){var o=n[a];if(o){var l=o.items.indexOf(e);return l>=0?o.stackedData[l]:null}}return null},FZt=function(e){return e.reduce(function(n,r){return[uz(r.concat([n[0]]).filter(fs)),Fy(r.concat([n[1]]).filter(fs))]},[1/0,-1/0])},mHe=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=FZt(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})},Z6e=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,J6e=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Cre=function(e,n,r){if(ki(e))return e(n,r);if(!Array.isArray(e))return n;var s=[];if(fs(e[0]))s[0]=r?e[0]:Math.min(e[0],n[0]);else if(Z6e.test(e[0])){var a=+Z6e.exec(e[0])[1];s[0]=n[0]-a}else ki(e[0])?s[0]=e[0](n[0]):s[0]=n[0];if(fs(e[1]))s[1]=r?e[1]:Math.max(e[1],n[1]);else if(J6e.test(e[1])){var o=+J6e.exec(e[1])[1];s[1]=n[1]+o}else ki(e[1])?s[1]=e[1](n[1]):s[1]=n[1];return s},AD=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=$ue(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},eCe=function(e,n,r){return!e||!e.length||x5(e,dp(r,"type.defaultProps.domain"))?n:e},xHe=function(e,n){var r=e.type.defaultProps?ol(ol({},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 ol(ol({},ji(e,!1)),{},{dataKey:s,unit:o,formatter:l,name:a||s,color:hde(e),value:uc(n,s),type:c,payload:n,chartType:u,hide:d})};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 tCe(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?tCe(Object(n),!0).forEach(function(r){OZt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function OZt(t,e,n){return e=MZt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MZt(t){var e=LZt(t,"string");return hk(e)=="symbol"?e:e+""}function LZt(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 _D=Math.PI/180,RZt=function(e){return e*180/Math.PI},ou=function(e,n,r,s){return{x:e+Math.cos(-_D*s)*r,y:n+Math.sin(-_D*s)*r}},DZt=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))},BZt=function(e,n){var r=e.x,s=e.y,a=n.cx,o=n.cy,l=DZt({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:RZt(u),angleInRadian:u}},$Zt=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}},UZt=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},rCe=function(e,n){var r=e.x,s=e.y,a=BZt({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=$Zt(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?nCe(nCe({},n),{},{radius:o,angle:UZt(g,n)}):null};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)}var zZt=["offset"];function HZt(t){return GZt(t)||qZt(t)||WZt(t)||VZt()}function VZt(){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 WZt(t,e){if(t){if(typeof t=="string")return Nre(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 Nre(t,e)}}function qZt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function GZt(t){if(Array.isArray(t))return Nre(t)}function Nre(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 KZt(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}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 rc(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){XZt(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 XZt(t,e,n){return e=QZt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function QZt(t){var e=ZZt(t,"string");return pk(e)=="symbol"?e:e+""}function ZZt(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 mk(){return mk=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},mk.apply(this,arguments)}var JZt=function(e){var n=e.value,r=e.formatter,s=Ai(e.children)?n:e.children;return ki(r)?r(s):s},eJt=function(e,n){var r=gm(n-e),s=Math.min(Math.abs(n-e),360);return r*s},tJt=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,S=eJt(g,y),T=S>=0?1:-1,I,L;s==="insideStart"?(I=g+T*o,L=v):s==="insideEnd"?(I=y-T*o,L=!v):s==="end"&&(I=y+T*o,L=v),L=S<=0?L:!L;var F=ou(u,d,C,I),$=ou(u,d,C,I+(L?1:-1)*359),O="M".concat(F.x,",").concat(F.y,`
A`).concat(C,",").concat(C,",0,1,").concat(L?0:1,`,
`).concat($.x,",").concat($.y),U=Ai(e.id)?q5("recharts-radial-line-"):e.id;return ke.createElement("text",mk({},r,{dominantBaseline:"central",className:da("recharts-radial-bar-label",l)}),ke.createElement("defs",null,ke.createElement("path",{id:U,d:O})),ke.createElement("textPath",{xlinkHref:"#".concat(U)},n))},nJt=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=ou(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,S=ou(o,l,C,x),T=S.x,I=S.y;return{x:T,y:I,textAnchor:"middle",verticalAnchor:"middle"}},rJt=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,S=v>0?"end":"start",T=v>0?"start":"end";if(a==="top"){var I={x:l+u/2,y:c-f*s,textAnchor:"middle",verticalAnchor:g};return rc(rc({},I),r?{height:Math.max(c-r.y,0),width:u}:{})}if(a==="bottom"){var L={x:l+u/2,y:c+d+x,textAnchor:"middle",verticalAnchor:y};return rc(rc({},L),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:S,verticalAnchor:"middle"};return rc(rc({},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:T,verticalAnchor:"middle"};return rc(rc({},$),r?{width:Math.max(r.x+r.width-$.x,0),height:d}:{})}var O=r?{width:u,height:d}:{};return a==="insideLeft"?rc({x:l+C,y:c+d/2,textAnchor:T,verticalAnchor:"middle"},O):a==="insideRight"?rc({x:l+u-C,y:c+d/2,textAnchor:S,verticalAnchor:"middle"},O):a==="insideTop"?rc({x:l+u/2,y:c+x,textAnchor:"middle",verticalAnchor:y},O):a==="insideBottom"?rc({x:l+u/2,y:c+d-x,textAnchor:"middle",verticalAnchor:g},O):a==="insideTopLeft"?rc({x:l+C,y:c+x,textAnchor:T,verticalAnchor:y},O):a==="insideTopRight"?rc({x:l+u-C,y:c+x,textAnchor:S,verticalAnchor:y},O):a==="insideBottomLeft"?rc({x:l+C,y:c+d-x,textAnchor:T,verticalAnchor:g},O):a==="insideBottomRight"?rc({x:l+u-C,y:c+d-x,textAnchor:S,verticalAnchor:g},O):k8(a)&&(fs(a.x)||_w(a.x))&&(fs(a.y)||_w(a.y))?rc({x:l+m5(a.x,u),y:c+m5(a.y,d),textAnchor:"end",verticalAnchor:"end"},O):rc({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},O)},sJt=function(e){return"cx"in e&&fs(e.cx)};function Pu(t){var e=t.offset,n=e===void 0?5:e,r=KZt(t,zZt),s=rc({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||Ai(l)&&Ai(c)&&!h.isValidElement(u)&&!ki(u))return null;if(h.isValidElement(u))return h.cloneElement(u,s);var g;if(ki(u)){if(g=h.createElement(u,s),h.isValidElement(g))return g}else g=JZt(s);var y=sJt(a),v=ji(s,!0);if(y&&(o==="insideStart"||o==="insideEnd"||o==="end"))return tJt(s,g,v);var C=y?nJt(s):rJt(s);return ke.createElement(fD,mk({className:da("recharts-label",f)},v,C,{breakAll:x}),g)}Pu.displayName="Label";var gHe=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,S=e.clockWise,T=e.labelViewBox;if(T)return T;if(fs(v)&&fs(C)){if(fs(f)&&fs(x))return{x:f,y:x,width:v,height:C};if(fs(g)&&fs(y))return{x:g,y,width:v,height:C}}return fs(f)&&fs(x)?{x:f,y:x,width:0,height:0}:fs(n)&&fs(r)?{cx:n,cy:r,startAngle:a||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:S}:e.viewBox?e.viewBox:{}},iJt=function(e,n){return e?e===!0?ke.createElement(Pu,{key:"label-implicit",viewBox:n}):cc(e)?ke.createElement(Pu,{key:"label-implicit",viewBox:n,value:e}):h.isValidElement(e)?e.type===Pu?h.cloneElement(e,{key:"label-implicit",viewBox:n}):ke.createElement(Pu,{key:"label-implicit",content:e,viewBox:n}):ki(e)?ke.createElement(Pu,{key:"label-implicit",content:e,viewBox:n}):k8(e)?ke.createElement(Pu,mk({viewBox:n},e,{key:"label-implicit"})):null:null},aJt=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=gHe(e),o=pf(s,Pu).map(function(c,u){return h.cloneElement(c,{viewBox:n||a,key:"label-".concat(u)})});if(!r)return o;var l=iJt(e.label,n||a);return[l].concat(HZt(o))};Pu.parseViewBox=gHe;Pu.renderCallByParent=aJt;var _X,iCe;function oJt(){if(iCe)return _X;iCe=1;function t(e){var n=e==null?0:e.length;return n?e[n-1]:void 0}return _X=t,_X}var lJt=oJt();const cJt=Pi(lJt);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)}var uJt=["valueAccessor"],dJt=["data","dataKey","clockWise","id","textBreakAll"];function fJt(t){return xJt(t)||mJt(t)||pJt(t)||hJt()}function hJt(){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 pJt(t,e){if(t){if(typeof t=="string")return Sre(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 Sre(t,e)}}function mJt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xJt(t){if(Array.isArray(t))return Sre(t)}function Sre(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 ED(){return ED=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},ED.apply(this,arguments)}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){gJt(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 gJt(t,e,n){return e=bJt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bJt(t){var e=yJt(t,"string");return xk(e)=="symbol"?e:e+""}function yJt(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)}function lCe(t,e){if(t==null)return{};var n=vJt(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 vJt(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 wJt=function(e){return Array.isArray(e.value)?cJt(e.value):e.value};function ex(t){var e=t.valueAccessor,n=e===void 0?wJt:e,r=lCe(t,uJt),s=r.data,a=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=lCe(r,dJt);return!s||!s.length?null:ke.createElement(_a,{className:"recharts-label-list"},s.map(function(d,f){var x=Ai(a)?n(d,f):uc(d&&d.payload,a),g=Ai(l)?{}:{id:"".concat(l,"-").concat(f)};return ke.createElement(Pu,ED({},ji(d,!0),u,g,{parentViewBox:d.parentViewBox,value:x,textBreakAll:c,viewBox:Pu.parseViewBox(Ai(o)?d:oCe(oCe({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}ex.displayName="LabelList";function CJt(t,e){return t?t===!0?ke.createElement(ex,{key:"labelList-implicit",data:e}):ke.isValidElement(t)||ki(t)?ke.createElement(ex,{key:"labelList-implicit",data:e,content:t}):k8(t)?ke.createElement(ex,ED({data:e},t,{key:"labelList-implicit"})):null:null}function NJt(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=pf(r,ex).map(function(o,l){return h.cloneElement(o,{data:e,key:"labelList-".concat(l)})});if(!n)return s;var a=CJt(t.label,e);return[a].concat(fJt(s))}ex.renderCallByParent=NJt;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 jre(){return jre=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},jre.apply(this,arguments)}function cCe(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 uCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cCe(Object(n),!0).forEach(function(r){SJt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function SJt(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=AJt(t,"string");return gk(e)=="symbol"?e:e+""}function AJt(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)}var _Jt=function(e,n){var r=gm(n-e),s=Math.min(Math.abs(n-e),359.999);return r*s},EF=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)/_D,x=u?a:a+o*f,g=ou(n,r,d,x),y=ou(n,r,s,x),v=u?a-o*f:a,C=ou(n,r,d*Math.cos(f*_D),v);return{center:g,circleTangency:y,lineTangency:C,theta:f}},bHe=function(e){var n=e.cx,r=e.cy,s=e.innerRadius,a=e.outerRadius,o=e.startAngle,l=e.endAngle,c=_Jt(o,l),u=o+c,d=ou(n,r,a,o),f=ou(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=ou(n,r,s,o),y=ou(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},EJt=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=EF({cx:n,cy:r,radius:a,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),g=x.circleTangency,y=x.lineTangency,v=x.theta,C=EF({cx:n,cy:r,radius:a,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),S=C.circleTangency,T=C.lineTangency,I=C.theta,L=c?Math.abs(u-d):Math.abs(u-d)-v-I;if(L<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
`):bHe({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(+(L>180),",").concat(+(f<0),",").concat(S.x,",").concat(S.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(T.x,",").concat(T.y,`
`);if(s>0){var $=EF({cx:n,cy:r,radius:s,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),O=$.circleTangency,U=$.lineTangency,Y=$.theta,re=EF({cx:n,cy:r,radius:s,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),Q=re.circleTangency,q=re.lineTangency,te=re.theta,fe=c?Math.abs(u-d):Math.abs(u-d)-Y-te;if(fe<0&&o===0)return"".concat(F,"L").concat(n,",").concat(r,"Z");F+="L".concat(q.x,",").concat(q.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(Q.x,",").concat(Q.y,`
A`).concat(s,",").concat(s,",0,").concat(+(fe>180),",").concat(+(f>0),",").concat(O.x,",").concat(O.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(U.x,",").concat(U.y,"Z")}else F+="L".concat(n,",").concat(r,"Z");return F},kJt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},yHe=function(e){var n=uCe(uCe({},kJt),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=da("recharts-sector",x),y=o-a,v=m5(l,y,0,!0),C;return v>0&&Math.abs(d-f)<360?C=EJt({cx:r,cy:s,innerRadius:a,outerRadius:o,cornerRadius:Math.min(v,y/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):C=bHe({cx:r,cy:s,innerRadius:a,outerRadius:o,startAngle:d,endAngle:f}),ke.createElement("path",jre({},ji(n,!0),{className:g,d:C,role:"img"}))};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 Are(){return Are=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},Are.apply(this,arguments)}function dCe(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?dCe(Object(n),!0).forEach(function(r){TJt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function TJt(t,e,n){return e=PJt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function PJt(t){var e=IJt(t,"string");return bk(e)=="symbol"?e:e+""}function IJt(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 hCe={curveBasisClosed:JVt,curveBasisOpen:eWt,curveBasis:ZVt,curveBumpX:DVt,curveBumpY:BVt,curveLinearClosed:tWt,curveLinear:ZU,curveMonotoneX:nWt,curveMonotoneY:rWt,curveNatural:sWt,curveStep:iWt,curveStepAfter:oWt,curveStepBefore:aWt},kF=function(e){return e.x===+e.x&&e.y===+e.y},w7=function(e){return e.x},C7=function(e){return e.y},FJt=function(e,n){if(ki(e))return e;var r="curve".concat(XU(e));return(r==="curveMonotone"||r==="curveBump")&&n?hCe["".concat(r).concat(n==="vertical"?"Y":"X")]:hCe[r]||ZU},OJt=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=FJt(r,l),f=u?a.filter(function(v){return kF(v)}):a,x;if(Array.isArray(o)){var g=u?o.filter(function(v){return kF(v)}):o,y=f.map(function(v,C){return fCe(fCe({},v),{},{base:g[C]})});return l==="vertical"?x=vF().y(C7).x1(w7).x0(function(v){return v.base.x}):x=vF().x(w7).y1(C7).y0(function(v){return v.base.y}),x.defined(kF).curve(d),x(y)}return l==="vertical"&&fs(o)?x=vF().y(C7).x1(w7).x0(o):fs(o)?x=vF().x(w7).y1(C7).y0(o):x=CUe().x(w7).y(C7),x.defined(kF).curve(d),x(f)},I3=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?OJt(e):s;return ke.createElement("path",Are({},ji(e,!1),tD(e),{className:da("recharts-curve",n),d:o,ref:a}))},MJt=zU();const La=Pi(MJt);var LJt=Object.getOwnPropertyNames,RJt=Object.getOwnPropertySymbols,DJt=Object.prototype.hasOwnProperty;function pCe(t,e){return function(r,s,a){return t(r,s,a)&&e(r,s,a)}}function TF(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 mCe(t){return LJt(t).concat(RJt(t))}var BJt=Object.hasOwn||function(t,e){return DJt.call(t,e)};function Y5(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var $Jt="__v",UJt="__o",zJt="_owner",xCe=Object.getOwnPropertyDescriptor,gCe=Object.keys;function HJt(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 VJt(t,e){return Y5(t.getTime(),e.getTime())}function WJt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function qJt(t,e){return t===e}function bCe(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 GJt=Y5;function KJt(t,e,n){var r=gCe(t),s=r.length;if(gCe(e).length!==s)return!1;for(;s-- >0;)if(!vHe(t,e,n,r[s]))return!1;return!0}function N7(t,e,n){var r=mCe(t),s=r.length;if(mCe(e).length!==s)return!1;for(var a,o,l;s-- >0;)if(a=r[s],!vHe(t,e,n,a)||(o=xCe(t,a),l=xCe(e,a),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function YJt(t,e){return Y5(t.valueOf(),e.valueOf())}function XJt(t,e){return t.source===e.source&&t.flags===e.flags}function yCe(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 QJt(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 ZJt(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 vHe(t,e,n,r){return(r===zJt||r===UJt||r===$Jt)&&(t.$$typeof||e.$$typeof)?!0:BJt(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}var JJt="[object Arguments]",een="[object Boolean]",ten="[object Date]",nen="[object Error]",ren="[object Map]",sen="[object Number]",ien="[object Object]",aen="[object RegExp]",oen="[object Set]",len="[object String]",cen="[object URL]",uen=Array.isArray,vCe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,wCe=Object.assign,den=Object.prototype.toString.call.bind(Object.prototype.toString);function fen(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 S=typeof y;if(S!==typeof v)return!1;if(S!=="object")return S==="number"?o(y,v,C):S==="function"?s(y,v,C):!1;var T=y.constructor;if(T!==v.constructor)return!1;if(T===Object)return l(y,v,C);if(uen(y))return e(y,v,C);if(vCe!=null&&vCe(y))return f(y,v,C);if(T===Date)return n(y,v,C);if(T===RegExp)return u(y,v,C);if(T===Map)return a(y,v,C);if(T===Set)return d(y,v,C);var I=den(y);return I===ten?n(y,v,C):I===aen?u(y,v,C):I===ren?a(y,v,C):I===oen?d(y,v,C):I===ien?typeof y.then!="function"&&typeof v.then!="function"&&l(y,v,C):I===cen?x(y,v,C):I===nen?r(y,v,C):I===JJt?l(y,v,C):I===een||I===sen||I===len?c(y,v,C):!1}}function hen(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,s={areArraysEqual:r?N7:HJt,areDatesEqual:VJt,areErrorsEqual:WJt,areFunctionsEqual:qJt,areMapsEqual:r?pCe(bCe,N7):bCe,areNumbersEqual:GJt,areObjectsEqual:r?N7:KJt,arePrimitiveWrappersEqual:YJt,areRegExpsEqual:XJt,areSetsEqual:r?pCe(yCe,N7):yCe,areTypedArraysEqual:r?N7:QJt,areUrlsEqual:ZJt};if(n&&(s=wCe({},s,n(s))),e){var a=TF(s.areArraysEqual),o=TF(s.areMapsEqual),l=TF(s.areObjectsEqual),c=TF(s.areSetsEqual);s=wCe({},s,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return s}function pen(t){return function(e,n,r,s,a,o,l){return t(e,n,l)}}function men(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 xen=U2();U2({strict:!0});U2({circular:!0});U2({circular:!0,strict:!0});U2({createInternalComparator:function(){return Y5}});U2({strict:!0,createInternalComparator:function(){return Y5}});U2({circular:!0,createInternalComparator:function(){return Y5}});U2({circular:!0,createInternalComparator:function(){return Y5},strict:!0});function U2(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=hen(t),c=fen(l),u=r?r(c):pen(c);return men({circular:n,comparator:c,createState:s,equals:u,strict:o})}function gen(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function CCe(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):gen(s)};requestAnimationFrame(r)}function _re(t){"@babel/helpers - typeof";return _re=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},_re(t)}function ben(t){return Cen(t)||wen(t)||ven(t)||yen()}function yen(){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 ven(t,e){if(t){if(typeof t=="string")return NCe(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 NCe(t,e)}}function NCe(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 wen(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Cen(t){if(Array.isArray(t))return t}function Nen(){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=ben(o),c=l[0],u=l.slice(1);if(typeof c=="number"){CCe(s.bind(null,u),c);return}s(c),CCe(s.bind(null,u));return}_re(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 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 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 jCe(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){wHe(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 wHe(t,e,n){return e=Sen(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sen(t){var e=jen(t,"string");return yk(e)==="symbol"?e:String(e)}function jen(t,e){if(yk(t)!=="object"||t===null)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)}var Aen=function(e,n){return[Object.keys(e),Object.keys(n)].reduce(function(r,s){return r.filter(function(a){return s.includes(a)})})},_en=function(e){return e},Een=function(e){return e.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},K_=function(e,n){return Object.keys(n).reduce(function(r,s){return jCe(jCe({},r),{},wHe({},s,e(s,n[s])))},{})},ACe=function(e,n,r){return e.map(function(s){return"".concat(Een(s)," ").concat(n,"ms ").concat(r)}).join(",")};function ken(t,e){return Ien(t)||Pen(t,e)||CHe(t,e)||Ten()}function Ten(){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 Pen(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 Ien(t){if(Array.isArray(t))return t}function Fen(t){return Len(t)||Men(t)||CHe(t)||Oen()}function Oen(){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 CHe(t,e){if(t){if(typeof t=="string")return Ere(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 Ere(t,e)}}function Men(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Len(t){if(Array.isArray(t))return Ere(t)}function Ere(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 kD=1e-4,NHe=function(e,n){return[0,3*e,3*n-6*e,3*e-3*n+1]},SHe=function(e,n){return e.map(function(r,s){return r*Math.pow(n,s)}).reduce(function(r,s){return r+s})},_Ce=function(e,n){return function(r){var s=NHe(e,n);return SHe(s,r)}},Ren=function(e,n){return function(r){var s=NHe(e,n),a=[].concat(Fen(s.map(function(o,l){return o*l}).slice(1)),[0]);return SHe(a,r)}},ECe=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=ken(u,4);s=d[0],a=d[1],o=d[2],l=d[3]}}}var f=_Ce(s,o),x=_Ce(a,l),g=Ren(s,o),y=function(S){return S>1?1:S<0?0:S},v=function(S){for(var T=S>1?1:S,I=T,L=0;L<8;++L){var F=f(I)-T,$=g(I);if(Math.abs(F-T)<kD||$<kD)return x(I);I=y(I-F/$)}return x(I)};return v.isStepper=!1,v},Den=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)<kD&&Math.abs(v)<kD?[f,0]:[C,v]};return c.isStepper=!0,c.dt=l,c},Ben=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 ECe(s);case"spring":return Den();default:if(s.split("(")[0]==="cubic-bezier")return ECe(s)}return typeof s=="function"?s:null};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 kCe(t){return zen(t)||Uen(t)||jHe(t)||$en()}function $en(){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 Uen(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function zen(t){if(Array.isArray(t))return Tre(t)}function TCe(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 Zc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?TCe(Object(n),!0).forEach(function(r){kre(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function kre(t,e,n){return e=Hen(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hen(t){var e=Ven(t,"string");return vk(e)==="symbol"?e:String(e)}function Ven(t,e){if(vk(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(vk(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wen(t,e){return Ken(t)||Gen(t,e)||jHe(t,e)||qen()}function qen(){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 jHe(t,e){if(t){if(typeof t=="string")return Tre(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 Tre(t,e)}}function Tre(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 Gen(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 Ken(t){if(Array.isArray(t))return t}var TD=function(e,n,r){return e+(n-e)*r},Pre=function(e){var n=e.from,r=e.to;return n!==r},Yen=function t(e,n,r){var s=K_(function(a,o){if(Pre(o)){var l=e(o.from,o.to,o.velocity),c=Wen(l,2),u=c[0],d=c[1];return Zc(Zc({},o),{},{from:u,velocity:d})}return o},n);return r<1?K_(function(a,o){return Pre(o)?Zc(Zc({},o),{},{velocity:TD(o.velocity,s[a].velocity,r),from:TD(o.from,s[a].from,r)}):o},n):t(e,s,r-1)};const Xen=function(t,e,n,r,s){var a=Aen(t,e),o=a.reduce(function(C,S){return Zc(Zc({},C),{},kre({},S,[t[S],e[S]]))},{}),l=a.reduce(function(C,S){return Zc(Zc({},C),{},kre({},S,{from:t[S],velocity:0,to:e[S]}))},{}),c=-1,u,d,f=function(){return null},x=function(){return K_(function(S,T){return T.from},l)},g=function(){return!Object.values(l).filter(Pre).length},y=function(S){u||(u=S);var T=S-u,I=T/n.dt;l=Yen(n,l,I),s(Zc(Zc(Zc({},t),e),x())),u=S,g()||(c=requestAnimationFrame(f))},v=function(S){d||(d=S);var T=(S-d)/r,I=K_(function(F,$){return TD.apply(void 0,kCe($).concat([n(T)]))},o);if(s(Zc(Zc(Zc({},t),e),I)),T<1)c=requestAnimationFrame(f);else{var L=K_(function(F,$){return TD.apply(void 0,kCe($).concat([n(1)]))},o);s(Zc(Zc(Zc({},t),e),L))}};return f=n.isStepper?y:v,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};function oj(t){"@babel/helpers - typeof";return oj=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},oj(t)}var Qen=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function Zen(t,e){if(t==null)return{};var n=Jen(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 Jen(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 EX(t){return rtn(t)||ntn(t)||ttn(t)||etn()}function etn(){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 ttn(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 ntn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function rtn(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 PCe(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?PCe(Object(n),!0).forEach(function(r){m_(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function m_(t,e,n){return e=AHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function stn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function itn(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,AHe(r.key),r)}}function atn(t,e,n){return itn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function AHe(t){var e=otn(t,"string");return oj(e)==="symbol"?e:String(e)}function otn(t,e){if(oj(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(oj(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ltn(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&&Fre(t,e)}function Fre(t,e){return Fre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Fre(t,e)}function ctn(t){var e=utn();return function(){var r=PD(t),s;if(e){var a=PD(this).constructor;s=Reflect.construct(r,arguments,a)}else s=r.apply(this,arguments);return Ore(this,s)}}function Ore(t,e){if(e&&(oj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mre(t)}function Mre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function utn(){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 PD(t){return PD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},PD(t)}var Pm=function(t){ltn(n,t);var e=ctn(n);function n(r,s){var a;stn(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(Mre(a)),a.changeStyle=a.changeStyle.bind(Mre(a)),!l||g<=0)return a.state={style:{}},typeof x=="function"&&(a.state={style:d}),Ore(a);if(f&&f.length)a.state={style:f[0].style};else if(u){if(typeof x=="function")return a.state={style:u},Ore(a);a.state={style:c?m_({},c,u):u}}else a.state={style:{}};return a}return atn(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?m_({},c,d):d};this.state&&x&&(c&&x[c]!==d||!c&&x!==d)&&this.setState(g);return}if(!(xen(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?m_({},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=Xen(o,l,Ben(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,S){if(S===0)return v;var T=C.duration,I=C.easing,L=I===void 0?"ease":I,F=C.style,$=C.properties,O=C.onAnimationEnd,U=S>0?o[S-1]:C,Y=$||Object.keys(F);if(typeof L=="function"||L==="spring")return[].concat(EX(v),[a.runJSAnimation.bind(a,{from:U.style,to:F,duration:T,easing:L}),T]);var re=ACe(Y,T,L),Q=Up(Up(Up({},U.style),F),{},{transition:re});return[].concat(EX(v),[Q,T,O]).filter(_en)};return this.manager.start([c].concat(EX(o.reduce(g,[d,Math.max(x,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=Nen());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?m_({},l,c):c,C=ACe(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=Zen(s,Qen),u=h.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,S=y.className,T=h.cloneElement(g,Up(Up({},c),{},{style:Up(Up({},C),d),className:S}));return T};return u===1?f(h.Children.only(a)):ke.createElement("div",null,h.Children.map(a,function(x){return f(x)}))}}]),n}(h.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:La.oneOfType([La.object,La.string]),to:La.oneOfType([La.object,La.string]),attributeName:La.string,duration:La.number,begin:La.number,easing:La.oneOfType([La.string,La.func]),steps:La.arrayOf(La.shape({duration:La.number.isRequired,style:La.object.isRequired,easing:La.oneOfType([La.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),La.func]),properties:La.arrayOf("string"),onAnimationEnd:La.func})),children:La.oneOfType([La.node,La.func]),isActive:La.bool,canBegin:La.bool,onAnimationEnd:La.func,shouldReAnimate:La.bool,onAnimationStart:La.func,onAnimationReStart:La.func};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 ID(){return ID=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},ID.apply(this,arguments)}function dtn(t,e){return mtn(t)||ptn(t,e)||htn(t,e)||ftn()}function ftn(){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 htn(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 ptn(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 mtn(t){if(Array.isArray(t))return 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 OCe(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){xtn(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 xtn(t,e,n){return e=gtn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gtn(t){var e=btn(t,"string");return wk(e)=="symbol"?e:e+""}function btn(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)}var MCe=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},ytn=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},vtn={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},pde=function(e){var n=OCe(OCe({},vtn),e),r=h.useRef(),s=h.useState(-1),a=dtn(s,2),o=a[0],l=a[1];h.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var L=r.current.getTotalLength();L&&l(L)}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,S=n.isAnimationActive,T=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var I=da("recharts-rectangle",g);return T?ke.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:T},function(L){var F=L.width,$=L.height,O=L.x,U=L.y;return ke.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:S,easing:y},ke.createElement("path",ID({},ji(n,!0),{className:I,d:MCe(O,U,F,$,x),ref:r})))}):ke.createElement("path",ID({},ji(n,!0),{className:I,d:MCe(c,u,d,f,x)}))};function Lre(){return Lre=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},Lre.apply(this,arguments)}var hz=function(e){var n=e.cx,r=e.cy,s=e.r,a=e.className,o=da("recharts-dot",a);return n===+n&&r===+r&&s===+s?ke.createElement("circle",Lre({},ji(e,!1),tD(e),{className:o,cx:n,cy:r,r:s})):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)}var wtn=["x","y","top","left","width","height","className"];function Rre(){return Rre=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},Rre.apply(this,arguments)}function LCe(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 Ctn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?LCe(Object(n),!0).forEach(function(r){Ntn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):LCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ntn(t,e,n){return e=Stn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Stn(t){var e=jtn(t,"string");return Ck(e)=="symbol"?e:e+""}function jtn(t,e){if(Ck(t)!="object"||!t)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)}function Atn(t,e){if(t==null)return{};var n=_tn(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 _tn(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 Etn=function(e,n,r,s,a,o){return"M".concat(e,",").concat(a,"v").concat(s,"M").concat(o,",").concat(n,"h").concat(r)},ktn=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=Atn(e,wtn),C=Ctn({x:r,y:a,top:l,left:u,width:f,height:g},v);return!fs(r)||!fs(a)||!fs(f)||!fs(g)||!fs(l)||!fs(u)?null:ke.createElement("path",Rre({},ji(C,!0),{className:da("recharts-cross",y),d:Etn(r,a,f,g,l,u)}))},kX,RCe;function Ttn(){if(RCe)return kX;RCe=1;var t=WUe(),e=t(Object.getPrototypeOf,Object);return kX=e,kX}var TX,DCe;function Ptn(){if(DCe)return TX;DCe=1;var t=H1(),e=Ttn(),n=V1(),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 TX=u,TX}var Itn=Ptn();const Ftn=Pi(Itn);var PX,BCe;function Otn(){if(BCe)return PX;BCe=1;var t=H1(),e=V1(),n="[object Boolean]";function r(s){return s===!0||s===!1||e(s)&&t(s)==n}return PX=r,PX}var Mtn=Otn();const Ltn=Pi(Mtn);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 FD(){return FD=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},FD.apply(this,arguments)}function Rtn(t,e){return Utn(t)||$tn(t,e)||Btn(t,e)||Dtn()}function Dtn(){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 Btn(t,e){if(t){if(typeof t=="string")return $Ce(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 $Ce(t,e)}}function $Ce(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 $tn(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 Utn(t){if(Array.isArray(t))return t}function UCe(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 zCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?UCe(Object(n),!0).forEach(function(r){ztn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):UCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ztn(t,e,n){return e=Htn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Htn(t){var e=Vtn(t,"string");return Nk(e)=="symbol"?e:e+""}function Vtn(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)}var HCe=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},Wtn={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},qtn=function(e){var n=zCe(zCe({},Wtn),e),r=h.useRef(),s=h.useState(-1),a=Rtn(s,2),o=a[0],l=a[1];h.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var I=r.current.getTotalLength();I&&l(I)}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,S=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||x!==+x||d===0&&f===0||x===0)return null;var T=da("recharts-trapezoid",g);return S?ke.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:S},function(I){var L=I.upperWidth,F=I.lowerWidth,$=I.height,O=I.x,U=I.y;return ke.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},ke.createElement("path",FD({},ji(n,!0),{className:T,d:HCe(O,U,L,F,$),ref:r})))}):ke.createElement("g",null,ke.createElement("path",FD({},ji(n,!0),{className:T,d:HCe(c,u,d,f,x)})))},Gtn=["option","shapeType","propTransformer","activeClassName","isActive"];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)}function Ktn(t,e){if(t==null)return{};var n=Ytn(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 Ytn(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 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 OD(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){Xtn(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 Xtn(t,e,n){return e=Qtn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qtn(t){var e=Ztn(t,"string");return Sk(e)=="symbol"?e:e+""}function Ztn(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 Jtn(t,e){return OD(OD({},e),t)}function enn(t,e){return t==="symbols"}function WCe(t){var e=t.shapeType,n=t.elementProps;switch(e){case"rectangle":return ke.createElement(pde,n);case"trapezoid":return ke.createElement(qtn,n);case"sector":return ke.createElement(yHe,n);case"symbols":if(enn(e))return ke.createElement(ez,n);break;default:return null}}function tnn(t){return h.isValidElement(t)?t.props:t}function Dre(t){var e=t.option,n=t.shapeType,r=t.propTransformer,s=r===void 0?Jtn:r,a=t.activeClassName,o=a===void 0?"recharts-active-shape":a,l=t.isActive,c=Ktn(t,Gtn),u;if(h.isValidElement(e))u=h.cloneElement(e,OD(OD({},c),tnn(e)));else if(ki(e))u=e(c);else if(Ftn(e)&&!Ltn(e)){var d=s(e,c);u=ke.createElement(WCe,{shapeType:n,elementProps:d})}else{var f=c;u=ke.createElement(WCe,{shapeType:n,elementProps:f})}return l?ke.createElement(_a,{className:o},u):u}function pz(t,e){return e!=null&&"trapezoids"in t.props}function mz(t,e){return e!=null&&"sectors"in t.props}function jk(t,e){return e!=null&&"points"in t.props}function nnn(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 rnn(t,e){var n=t.endAngle===e.endAngle,r=t.startAngle===e.startAngle;return n&&r}function snn(t,e){var n=t.x===e.x,r=t.y===e.y,s=t.z===e.z;return n&&r&&s}function inn(t,e){var n;return pz(t,e)?n=nnn:mz(t,e)?n=rnn:jk(t,e)&&(n=snn),n}function ann(t,e){var n;return pz(t,e)?n="trapezoids":mz(t,e)?n="sectors":jk(t,e)&&(n="points"),n}function onn(t,e){if(pz(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(mz(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 jk(t,e)?e.payload:{}}function lnn(t){var e=t.activeTooltipItem,n=t.graphicalItem,r=t.itemData,s=ann(n,e),a=onn(n,e),o=r.filter(function(c,u){var d=x5(a,c),f=n.props[s].filter(function(y){var v=inn(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 IX,qCe;function cnn(){if(qCe)return IX;qCe=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 IX=n,IX}var FX,GCe;function _He(){if(GCe)return FX;GCe=1;var t=oze(),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 FX=r,FX}var OX,KCe;function unn(){if(KCe)return OX;KCe=1;var t=cnn(),e=rz(),n=_He();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 OX=r,OX}var MX,YCe;function dnn(){if(YCe)return MX;YCe=1;var t=unn(),e=t();return MX=e,MX}var fnn=dnn();const MD=Pi(fnn);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)}function XCe(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 QCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?XCe(Object(n),!0).forEach(function(r){EHe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):XCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function EHe(t,e,n){return e=hnn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hnn(t){var e=pnn(t,"string");return Ak(e)=="symbol"?e:e+""}function pnn(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)}var mnn=["Webkit","Moz","O","ms"],xnn=function(e,n){var r=e.replace(/(\w)/,function(a){return a.toUpperCase()}),s=mnn.reduce(function(a,o){return QCe(QCe({},a),{},EHe({},o+r,n))},{});return s[e]=n,s};function lj(t){"@babel/helpers - typeof";return lj=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},lj(t)}function LD(){return LD=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},LD.apply(this,arguments)}function ZCe(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 LX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ZCe(Object(n),!0).forEach(function(r){Uf(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ZCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gnn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function JCe(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 bnn(t,e,n){return JCe(t.prototype,e),JCe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ynn(t,e,n){return e=RD(e),vnn(t,kHe()?Reflect.construct(e,n,RD(t).constructor):e.apply(t,n))}function vnn(t,e){if(e&&(lj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wnn(t)}function wnn(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 RD(t){return RD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},RD(t)}function Cnn(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&&Bre(t,e)}function Bre(t,e){return Bre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Bre(t,e)}function Uf(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=Nnn(t,"string");return lj(e)=="symbol"?e:e+""}function Nnn(t,e){if(lj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(lj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Snn=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=q_().domain(MD(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}},e4e=function(e){return e.changedTouches&&!!e.changedTouches.length},cj=function(t){function e(n){var r;return gnn(this,e),r=ynn(this,e,[n]),Uf(r,"handleDrag",function(s){r.leaveTimer&&(clearTimeout(r.leaveTimer),r.leaveTimer=null),r.state.isTravellerMoving?r.handleTravellerMove(s):r.state.isSlideMoving&&r.handleSlideDrag(s)}),Uf(r,"handleTouchMove",function(s){s.changedTouches!=null&&s.changedTouches.length>0&&r.handleDrag(s.changedTouches[0])}),Uf(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()}),Uf(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Uf(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Uf(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Uf(r,"handleSlideDragStart",function(s){var a=e4e(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 Cnn(e,t),bnn(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=uc(a[r],l,r);return ki(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=e4e(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,S={startX:this.state.startX,endX:this.state.endX},T=r.pageX-a;T>0?T=Math.min(T,f+x-g-u):T<0&&(T=Math.max(T,f-u)),S[o]=u+T;var I=this.getIndex(S),L=I.startIndex,F=I.endIndex,$=function(){var U=C.length-1;return o==="startX"&&(l>c?L%v===0:F%v===0)||l<c&&F===U||o==="endX"&&(l>c?F%v===0:L%v===0)||l>c&&F===U};this.setState(Uf(Uf({},o,u+T),"brushMoveStartX",r.pageX),function(){y&&$()&&y(I)})}},{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(Uf({},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 ke.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=h.Children.only(u);return f?ke.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,S=Math.max(r,this.props.x),T=LX(LX({},ji(this.props,!1)),{},{x:S,y:u,width:d,height:f}),I=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 ke.createElement(_a,{tabIndex:0,role:"slider","aria-label":I,"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,T))}},{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 ke.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 ke.createElement(_a,{className:"recharts-brush-texts"},ke.createElement(fD,LD({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,x)-g,y:o+l/2},y),this.getTextOfTick(s)),ke.createElement(fD,LD({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,S=x.isTravellerMoving,T=x.isTravellerFocused;if(!s||!s.length||!fs(l)||!fs(c)||!fs(u)||!fs(d)||u<=0||d<=0)return null;var I=da("recharts-brush",a),L=ke.Children.count(o)===1,F=xnn("userSelect","none");return ke.createElement(_a,{className:I,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:F},this.renderBackground(),L&&this.renderPanorama(),this.renderSlide(g,y),this.renderTravellerLayer(g,"startX"),this.renderTravellerLayer(y,"endX"),(v||C||S||T||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 ke.createElement(ke.Fragment,null,ke.createElement("rect",{x:s,y:a,width:o,height:l,fill:c,stroke:"none"}),ke.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),ke.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 ke.isValidElement(r)?a=ke.cloneElement(r,s):ki(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 LX({prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},a&&a.length?Snn({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}}])}(h.PureComponent);Uf(cj,"displayName","Brush");Uf(cj,"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 RX,t4e;function jnn(){if(t4e)return RX;t4e=1;var t=Bue();function e(n,r){var s;return t(n,function(a,o,l){return s=r(a,o,l),!s}),!!s}return RX=e,RX}var DX,n4e;function Ann(){if(n4e)return DX;n4e=1;var t=DUe(),e=D2(),n=jnn(),r=Cf(),s=rz();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 DX=a,DX}var _nn=Ann();const Enn=Pi(_nn);var tx=function(e,n){var r=e.alwaysShow,s=e.ifOverflow;return r&&(s="extendDomain"),s===n},BX,r4e;function knn(){if(r4e)return BX;r4e=1;var t=nze();function e(n,r,s){r=="__proto__"&&t?t(n,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):n[r]=s}return BX=e,BX}var $X,s4e;function Tnn(){if(s4e)return $X;s4e=1;var t=knn(),e=eze(),n=D2();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 $X=r,$X}var Pnn=Tnn();const Inn=Pi(Pnn);var UX,i4e;function Fnn(){if(i4e)return UX;i4e=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 UX=t,UX}var zX,a4e;function Onn(){if(a4e)return zX;a4e=1;var t=Bue();function e(n,r){var s=!0;return t(n,function(a,o,l){return s=!!r(a,o,l),s}),s}return zX=e,zX}var HX,o4e;function Mnn(){if(o4e)return HX;o4e=1;var t=Fnn(),e=Onn(),n=D2(),r=Cf(),s=rz();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 HX=a,HX}var Lnn=Mnn();const PHe=Pi(Lnn);var Rnn=["x","y"];function _k(t){"@babel/helpers - typeof";return _k=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},_k(t)}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 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 S7(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){Dnn(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 Dnn(t,e,n){return e=Bnn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Bnn(t){var e=$nn(t,"string");return _k(e)=="symbol"?e:e+""}function $nn(t,e){if(_k(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(_k(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Unn(t,e){if(t==null)return{};var n=znn(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 znn(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 Hnn(t,e){var n=t.x,r=t.y,s=Unn(t,Rnn),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 S7(S7(S7(S7(S7({},e),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:x,name:e.name,radius:e.radius})}function c4e(t){return ke.createElement(Dre,$re({shapeType:"rectangle",propTransformer:Hnn,activeClassName:"recharts-active-bar"},t))}var Vnn=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||b5(),n)}},Wnn=["value","background"],IHe;function uj(t){"@babel/helpers - typeof";return uj=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},uj(t)}function qnn(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 DD(){return DD=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},DD.apply(this,arguments)}function u4e(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 $l(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?u4e(Object(n),!0).forEach(function(r){Oy(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Knn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d4e(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 Ynn(t,e,n){return d4e(t.prototype,e),d4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Xnn(t,e,n){return e=BD(e),Qnn(t,FHe()?Reflect.construct(e,n,BD(t).constructor):e.apply(t,n))}function Qnn(t,e){if(e&&(uj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Znn(t)}function Znn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function FHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(FHe=function(){return!!t})()}function BD(t){return BD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},BD(t)}function Jnn(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&&Ure(t,e)}function Ure(t,e){return Ure=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Ure(t,e)}function Oy(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 OHe(t){var e=ern(t,"string");return uj(e)=="symbol"?e:e+""}function ern(t,e){if(uj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(uj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var L8=function(t){function e(){var n;Knn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Xnn(this,e,[].concat(s)),Oy(n,"state",{isAnimationFinished:!1}),Oy(n,"id",q5("recharts-bar-")),Oy(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),o&&o()}),Oy(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),o&&o()}),n}return Jnn(e,t),Ynn(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=ji(this.props,!1);return r&&r.map(function(f,x){var g=x===c,y=g?u:o,v=$l($l($l({},d),f),{},{isActive:g,option:y,index:x,dataKey:l,onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd});return ke.createElement(_a,DD({className:"recharts-bar-rectangle"},XE(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)}),ke.createElement(c4e,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 ke.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,S){var T=x&&x[S];if(T){var I=_l(T.x,C.x),L=_l(T.y,C.y),F=_l(T.width,C.width),$=_l(T.height,C.height);return $l($l({},C),{},{x:I(y),y:L(y),width:F(y),height:$(y)})}if(o==="horizontal"){var O=_l(0,C.height),U=O(y);return $l($l({},C),{},{y:C.y+C.height-U,height:U})}var Y=_l(0,C.width),re=Y(y);return $l($l({},C),{},{width:re})});return ke.createElement(_a,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||!x5(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=ji(this.props.background,!1);return a.map(function(u,d){u.value;var f=u.background,x=qnn(u,Wnn);if(!f)return null;var g=$l($l($l($l($l({},x),{},{fill:"#eee"},f),c),XE(r.props,u,d)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:o,index:d,className:"recharts-bar-background-rectangle"});return ke.createElement(c4e,DD({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=pf(d,M8);if(!f)return null;var x=u==="vertical"?o[0].height/2:o[0].width/2,g=function(C,S){var T=Array.isArray(C.value)?C.value[1]:C.value;return{x:C.x,y:C.y,value:T,errorVal:uc(C,S)}},y={clipPath:r?"url(#clipPath-".concat(s,")"):null};return ke.createElement(_a,y,f.map(function(v){return ke.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,S=da("recharts-bar",o),T=l&&l.allowDataOverflow,I=c&&c.allowDataOverflow,L=T||I,F=Ai(v)?this.id:v;return ke.createElement(_a,{className:S},T||I?ke.createElement("defs",null,ke.createElement("clipPath",{id:"clipPath-".concat(F)},ke.createElement("rect",{x:T?u:u-f/2,y:I?d:d-x/2,width:T?f:f*2,height:I?x:x*2}))):null,ke.createElement(_a,{className:"recharts-bar-rectangles",clipPath:L?"url(#clipPath-".concat(F,")"):null},y?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(L,F),(!g||C)&&ex.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}}])}(h.PureComponent);IHe=L8;Oy(L8,"displayName","Bar");Oy(L8,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Nm.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Oy(L8,"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=NZt(r,n);if(!g)return null;var y=e.layout,v=n.type.defaultProps,C=v!==void 0?$l($l({},v),n.props):n.props,S=C.dataKey,T=C.children,I=C.minPointSize,L=y==="horizontal"?o:a,F=u?L.scale.domain():null,$=PZt({numericAxis:L}),O=pf(T,zue),U=f.map(function(Y,re){var Q,q,te,fe,G,ie;u?Q=SZt(u[d+re],F):(Q=uc(Y,S),Array.isArray(Q)||(Q=[$,Q]));var oe=Vnn(I,IHe.defaultProps.minPointSize)(Q[1],re);if(y==="horizontal"){var K,H=[o.scale(Q[0]),o.scale(Q[1])],ee=H[0],se=H[1];q=Q6e({axis:a,ticks:l,bandSize:s,offset:g.offset,entry:Y,index:re}),te=(K=se??ee)!==null&&K!==void 0?K:void 0,fe=g.size;var pe=ee-se;if(G=Number.isNaN(pe)?0:pe,ie={x:q,y:o.y,width:fe,height:o.height},Math.abs(oe)>0&&Math.abs(G)<Math.abs(oe)){var Se=gm(G||oe)*(Math.abs(oe)-Math.abs(G));te-=Se,G+=Se}}else{var ge=[a.scale(Q[0]),a.scale(Q[1])],ve=ge[0],be=ge[1];if(q=ve,te=Q6e({axis:o,ticks:c,bandSize:s,offset:g.offset,entry:Y,index:re}),fe=be-ve,G=g.size,ie={x:a.x,y:te,width:a.width,height:G},Math.abs(oe)>0&&Math.abs(fe)<Math.abs(oe)){var we=gm(fe||oe)*(Math.abs(oe)-Math.abs(fe));fe+=we}}return $l($l($l({},Y),{},{x:q,y:te,width:fe,height:G,value:u?Q:Q[1],payload:Y,background:ie},O[re]&&O[re].props),{},{tooltipPayload:[xHe(n,Y)],tooltipPosition:{x:q+fe/2,y:te+G/2}})});return $l({data:U,layout:y},x)});function Ek(t){"@babel/helpers - typeof";return Ek=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},Ek(t)}function trn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f4e(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 nrn(t,e,n){return f4e(t.prototype,e),f4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function h4e(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?h4e(Object(n),!0).forEach(function(r){xz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xz(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=rrn(t,"string");return Ek(e)=="symbol"?e:e+""}function rrn(t,e){if(Ek(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Ek(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var LHe=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=!!qf(u,L8);return d.reduce(function(g,y){var v=n[y],C=v.orientation,S=v.domain,T=v.padding,I=T===void 0?{}:T,L=v.mirror,F=v.reversed,$="".concat(C).concat(L?"Mirror":""),O,U,Y,re,Q;if(v.type==="number"&&(v.padding==="gap"||v.padding==="no-gap")){var q=S[1]-S[0],te=1/0,fe=v.categoricalDomain.sort(cVt);if(fe.forEach(function(ge,ve){ve>0&&(te=Math.min((ge||0)-(fe[ve-1]||0),te))}),Number.isFinite(te)){var G=te/q,ie=v.layout==="vertical"?r.height:r.width;if(v.padding==="gap"&&(O=G*ie/2),v.padding==="no-gap"){var oe=m5(e.barCategoryGap,G*ie),K=G*ie/2;O=K-oe-(K-oe)/ie*oe}}}s==="xAxis"?U=[r.left+(I.left||0)+(O||0),r.left+r.width-(I.right||0)-(O||0)]:s==="yAxis"?U=c==="horizontal"?[r.top+r.height-(I.bottom||0),r.top+(I.top||0)]:[r.top+(I.top||0)+(O||0),r.top+r.height-(I.bottom||0)-(O||0)]:U=v.range,F&&(U=[U[1],U[0]]);var H=wZt(v,a,x),ee=H.scale,se=H.realScaleType;ee.domain(S).range(U),CZt(ee);var pe=TZt(ee,im(im({},v),{},{realScaleType:se}));s==="xAxis"?(Q=C==="top"&&!L||C==="bottom"&&L,Y=r.left,re=f[$]-Q*v.height):s==="yAxis"&&(Q=C==="left"&&!L||C==="right"&&L,Y=f[$]-Q*v.width,re=r.top);var Se=im(im(im({},v),pe),{},{realScaleType:se,x:Y,y:re,scale:ee,width:s==="xAxis"?r.width:v.width,height:s==="yAxis"?r.height:v.height});return Se.bandSize=AD(Se,pe),!v.hide&&s==="xAxis"?f[$]+=(Q?-1:1)*Se.height:v.hide||(f[$]+=(Q?-1:1)*Se.width),im(im({},g),{},xz({},y,Se))},{})},RHe=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)}},srn=function(e){var n=e.x1,r=e.y1,s=e.x2,a=e.y2;return RHe({x:n,y:r},{x:s,y:a})},DHe=function(){function t(e){trn(this,t),this.scale=e}return nrn(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)}}])}();xz(DHe,"EPS",1e-4);var mde=function(e){var n=Object.keys(e).reduce(function(r,s){return im(im({},r),{},xz({},s,DHe.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 Inn(s,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return PHe(s,function(a,o){return n[o].isInRange(a)})}})};function irn(t){return(t%180+180)%180}var arn=function(e){var n=e.width,r=e.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=irn(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)},VX,p4e;function orn(){if(p4e)return VX;p4e=1;var t=D2(),e=sP(),n=tz();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 VX=r,VX}var WX,m4e;function lrn(){if(m4e)return WX;m4e=1;var t=_He();function e(n){var r=t(n),s=r%1;return r===r?s?r-s:r:0}return WX=e,WX}var qX,x4e;function crn(){if(x4e)return qX;x4e=1;var t=YUe(),e=D2(),n=lrn(),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 qX=s,qX}var GX,g4e;function urn(){if(g4e)return GX;g4e=1;var t=orn(),e=crn(),n=t(e);return GX=n,GX}var drn=urn();const frn=Pi(drn);var hrn=uUe();const prn=Pi(hrn);var mrn=prn(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("")}),xde=h.createContext(void 0),gde=h.createContext(void 0),BHe=h.createContext(void 0),$He=h.createContext({}),UHe=h.createContext(void 0),zHe=h.createContext(0),HHe=h.createContext(0),b4e=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=mrn(a);return ke.createElement(xde.Provider,{value:r},ke.createElement(gde.Provider,{value:s},ke.createElement($He.Provider,{value:a},ke.createElement(BHe.Provider,{value:d},ke.createElement(UHe.Provider,{value:o},ke.createElement(zHe.Provider,{value:u},ke.createElement(HHe.Provider,{value:c},l)))))))},xrn=function(){return h.useContext(UHe)},VHe=function(e){var n=h.useContext(xde);n==null&&b5();var r=n[e];return r==null&&b5(),r},grn=function(){var e=h.useContext(xde);return Qb(e)},brn=function(){var e=h.useContext(gde),n=frn(e,function(r){return PHe(r.domain,Number.isFinite)});return n||Qb(e)},WHe=function(e){var n=h.useContext(gde);n==null&&b5();var r=n[e];return r==null&&b5(),r},yrn=function(){var e=h.useContext(BHe);return e},vrn=function(){return h.useContext($He)},bde=function(){return h.useContext(HHe)},yde=function(){return h.useContext(zHe)};function dj(t){"@babel/helpers - typeof";return dj=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},dj(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,GHe(r.key),r)}}function Nrn(t,e,n){return Crn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Srn(t,e,n){return e=$D(e),jrn(t,qHe()?Reflect.construct(e,n||[],$D(t).constructor):e.apply(t,n))}function jrn(t,e){if(e&&(dj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Arn(t)}function Arn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qHe=function(){return!!t})()}function $D(t){return $D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},$D(t)}function _rn(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&&zre(t,e)}function zre(t,e){return zre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},zre(t,e)}function y4e(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 v4e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?y4e(Object(n),!0).forEach(function(r){vde(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):y4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vde(t,e,n){return e=GHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GHe(t){var e=Ern(t,"string");return dj(e)=="symbol"?e:e+""}function Ern(t,e){if(dj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(dj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function krn(t,e){return Frn(t)||Irn(t,e)||Prn(t,e)||Trn()}function Trn(){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 Prn(t,e){if(t){if(typeof t=="string")return w4e(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 w4e(t,e)}}function w4e(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 Irn(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 Frn(t){if(Array.isArray(t))return t}function Hre(){return Hre=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},Hre.apply(this,arguments)}var Orn=function(e,n){var r;return ke.isValidElement(e)?r=ke.cloneElement(e,n):ki(e)?r=e(n):r=ke.createElement("line",Hre({},n,{className:"recharts-reference-line-line"})),r},Mrn=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(tx(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 S=u.x,T=e.x.apply(S,{position:o});if(tx(u,"discard")&&!e.x.isInRange(T))return null;var I=[{x:T,y:f+g},{x:T,y:f}];return l==="top"?I.reverse():I}if(s){var L=u.segment,F=L.map(function($){return e.apply($,{position:o})});return tx(u,"discard")&&Enn(F,function($){return!e.isInRange($)})?null:F}return null};function Lrn(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=xrn(),d=VHe(s),f=WHe(a),x=yrn();if(!u||!x)return null;u1(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var g=mde({x:d.scale,y:f.scale}),y=cc(e),v=cc(n),C=r&&r.length===2,S=Mrn(g,y,v,C,x,t.position,d.orientation,f.orientation,t);if(!S)return null;var T=krn(S,2),I=T[0],L=I.x,F=I.y,$=T[1],O=$.x,U=$.y,Y=tx(t,"hidden")?"url(#".concat(u,")"):void 0,re=v4e(v4e({clipPath:Y},ji(t,!0)),{},{x1:L,y1:F,x2:O,y2:U});return ke.createElement(_a,{className:da("recharts-reference-line",l)},Orn(o,re),Pu.renderCallByParent(t,srn({x1:L,y1:F,x2:O,y2:U})))}var wde=function(t){function e(){return wrn(this,e),Srn(this,e,arguments)}return _rn(e,t),Nrn(e,[{key:"render",value:function(){return ke.createElement(Lrn,this.props)}}])}(ke.Component);vde(wde,"displayName","ReferenceLine");vde(wde,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});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)}function fj(t){"@babel/helpers - typeof";return fj=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},fj(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 N4e(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){gz(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 Rrn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Drn(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,YHe(r.key),r)}}function Brn(t,e,n){return Drn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function $rn(t,e,n){return e=UD(e),Urn(t,KHe()?Reflect.construct(e,n||[],UD(t).constructor):e.apply(t,n))}function Urn(t,e){if(e&&(fj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zrn(t)}function zrn(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 UD(t){return UD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},UD(t)}function Hrn(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&&Wre(t,e)}function Wre(t,e){return Wre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Wre(t,e)}function gz(t,e,n){return e=YHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YHe(t){var e=Vrn(t,"string");return fj(e)=="symbol"?e:e+""}function Vrn(t,e){if(fj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(fj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Wrn=function(e){var n=e.x,r=e.y,s=e.xAxis,a=e.yAxis,o=mde({x:s.scale,y:a.scale}),l=o.apply({x:n,y:r},{bandAware:!0});return tx(e,"discard")&&!o.isInRange(l)?null:l},bz=function(t){function e(){return Rrn(this,e),$rn(this,e,arguments)}return Hrn(e,t),Brn(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=cc(s),d=cc(a);if(u1(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=Wrn(this.props);if(!f)return null;var x=f.x,g=f.y,y=this.props,v=y.shape,C=y.className,S=tx(this.props,"hidden")?"url(#".concat(c,")"):void 0,T=N4e(N4e({clipPath:S},ji(this.props,!0)),{},{cx:x,cy:g});return ke.createElement(_a,{className:da("recharts-reference-dot",C)},e.renderDot(v,T),Pu.renderCallByParent(this.props,{x:x-o,y:g-o,width:2*o,height:2*o}))}}])}(ke.Component);gz(bz,"displayName","ReferenceDot");gz(bz,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});gz(bz,"renderDot",function(t,e){var n;return ke.isValidElement(t)?n=ke.cloneElement(t,e):ki(t)?n=t(e):n=ke.createElement(hz,Vre({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),n});function qre(){return qre=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},qre.apply(this,arguments)}function hj(t){"@babel/helpers - typeof";return hj=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},hj(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 j4e(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){yz(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 qrn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Grn(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 Krn(t,e,n){return Grn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yrn(t,e,n){return e=zD(e),Xrn(t,XHe()?Reflect.construct(e,n||[],zD(t).constructor):e.apply(t,n))}function Xrn(t,e){if(e&&(hj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qrn(t)}function Qrn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function XHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(XHe=function(){return!!t})()}function zD(t){return zD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},zD(t)}function Zrn(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 yz(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=Jrn(t,"string");return hj(e)=="symbol"?e:e+""}function Jrn(t,e){if(hj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(hj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var esn=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=mde({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 tx(a,"discard")&&(!x.isInRange(g)||!x.isInRange(y))?null:RHe(g,y)},vz=function(t){function e(){return qrn(this,e),Yrn(this,e,arguments)}return Zrn(e,t),Krn(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;u1(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=cc(s),x=cc(a),g=cc(o),y=cc(l),v=this.props.shape;if(!f&&!x&&!g&&!y&&!v)return null;var C=esn(f,x,g,y,this.props);if(!C&&!v)return null;var S=tx(this.props,"hidden")?"url(#".concat(d,")"):void 0;return ke.createElement(_a,{className:da("recharts-reference-area",c)},e.renderRect(v,j4e(j4e({clipPath:S},ji(this.props,!0)),C)),Pu.renderCallByParent(this.props,C))}}])}(ke.Component);yz(vz,"displayName","ReferenceArea");yz(vz,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});yz(vz,"renderRect",function(t,e){var n;return ke.isValidElement(t)?n=ke.cloneElement(t,e):ki(t)?n=t(e):n=ke.createElement(pde,qre({},e,{className:"recharts-reference-area-rect"})),n});function ZHe(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 tsn(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return arn(r,n)}function nsn(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 HD(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 rsn(t,e){return ZHe(t,e+1)}function ssn(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:ZHe(r,u)};var v=c,C,S=function(){return C===void 0&&(C=n(y,v)),C},T=y.coordinate,I=c===0||HD(t,T,S,d,l);I||(c=0,d=o,u+=1),I&&(d=T+t*(S()/2+s),c+=u)},x;u<=a.length;)if(x=f(),x)return x.v;return[]}function kk(t){"@babel/helpers - typeof";return kk=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},kk(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 _u(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){isn(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 isn(t,e,n){return e=asn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function asn(t){var e=osn(t,"string");return kk(e)=="symbol"?e:e+""}function osn(t,e){if(kk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(kk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lsn(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=_u(_u({},g),{},{tickCoord:C>0?g.coordinate-C*t:g.coordinate})}else a[x]=g=_u(_u({},g),{},{tickCoord:g.coordinate});var S=HD(t,g.tickCoord,v,l,c);S&&(c=g.tickCoord-t*(v()/2+s),a[x]=_u(_u({},g),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return a}function csn(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=_u(_u({},d),{},{tickCoord:x>0?d.coordinate-x*t:d.coordinate});var g=HD(t,d.tickCoord,function(){return f},c,u);g&&(u=d.tickCoord-t*(f/2+s),o[l-1]=_u(_u({},d),{},{isShow:!0}))}for(var y=a?l-1:l,v=function(T){var I=o[T],L,F=function(){return L===void 0&&(L=n(I,T)),L};if(T===0){var $=t*(I.coordinate-t*F()/2-c);o[T]=I=_u(_u({},I),{},{tickCoord:$<0?I.coordinate-$*t:I.coordinate})}else o[T]=I=_u(_u({},I),{},{tickCoord:I.coordinate});var O=HD(t,I.tickCoord,F,c,u);O&&(c=I.tickCoord+t*(F()/2+s),o[T]=_u(_u({},I),{},{isShow:!0}))},C=0;C<y;C++)v(C);return o}function Cde(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(fs(c)||Nm.isSsr)return rsn(s,typeof c=="number"&&fs(c)?c:0);var x=[],g=l==="top"||l==="bottom"?"width":"height",y=d&&g==="width"?W_(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},v=function(I,L){var F=ki(u)?u(I.value,L):I.value;return g==="width"?tsn(W_(F,{fontSize:e,letterSpacing:n}),y,f):W_(F,{fontSize:e,letterSpacing:n})[g]},C=s.length>=2?gm(s[1].coordinate-s[0].coordinate):1,S=nsn(a,C,g);return c==="equidistantPreserveStart"?ssn(C,S,v,s,o):(c==="preserveStart"||c==="preserveStartEnd"?x=csn(C,S,v,s,o,c==="preserveStartEnd"):x=lsn(C,S,v,s,o),x.filter(function(T){return T.isShow}))}var usn=["viewBox"],dsn=["viewBox"],fsn=["ticks"];function pj(t){"@babel/helpers - typeof";return pj=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},pj(t)}function p4(){return p4=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},p4.apply(this,arguments)}function _4e(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?_4e(Object(n),!0).forEach(function(r){Nde(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KX(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 psn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E4e(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 msn(t,e,n){return E4e(t.prototype,e),E4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xsn(t,e,n){return e=VD(e),gsn(t,JHe()?Reflect.construct(e,n,VD(t).constructor):e.apply(t,n))}function gsn(t,e){if(e&&(pj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bsn(t)}function bsn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function JHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(JHe=function(){return!!t})()}function VD(t){return VD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},VD(t)}function ysn(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 Nde(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=vsn(t,"string");return pj(e)=="symbol"?e:e+""}function vsn(t,e){if(pj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(pj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var R8=function(t){function e(n){var r;return psn(this,e),r=xsn(this,e,[n]),r.state={fontSize:"",letterSpacing:""},r}return ysn(e,t),msn(e,[{key:"shouldComponentUpdate",value:function(r,s){var a=r.viewBox,o=KX(r,usn),l=this.props,c=l.viewBox,u=KX(l,dsn);return!z4(a,c)||!z4(o,u)||!z4(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,S,T,I=f?-1:1,L=r.tickSize||d,F=fs(r.tickCoord)?r.tickCoord:r.coordinate;switch(u){case"top":g=y=r.coordinate,C=o+ +!f*c,v=C-I*L,T=v-I*x,S=F;break;case"left":v=C=r.coordinate,y=a+ +!f*l,g=y-I*L,S=g-I*x,T=F;break;case"right":v=C=r.coordinate,y=a+ +f*l,g=y+I*L,S=g+I*x,T=F;break;default:g=y=r.coordinate,C=o+ +f*c,v=C+I*L,T=v+I*x,S=F;break}return{line:{x1:g,y1:v,x2:y,y2:C},tick:{x:S,y:T}}}},{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({},ji(this.props,!1)),ji(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 ke.createElement("line",p4({},f,{className:da("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=Cde(ed(ed({},this.props),{},{ticks:r}),s,a),y=this.getTickTextAnchor(),v=this.getTickVerticalAnchor(),C=ji(this.props,!1),S=ji(d,!1),T=ed(ed({},C),{},{fill:"none"},ji(c,!1)),I=g.map(function(L,F){var $=o.getTickLineCoord(L),O=$.line,U=$.tick,Y=ed(ed(ed(ed({textAnchor:y,verticalAnchor:v},C),{},{stroke:"none",fill:u},S),U),{},{index:F,payload:L,visibleTicksCount:g.length,tickFormatter:f});return ke.createElement(_a,p4({className:"recharts-cartesian-axis-tick",key:"tick-".concat(L.value,"-").concat(L.coordinate,"-").concat(L.tickCoord)},XE(o.props,L,F)),c&&ke.createElement("line",p4({},T,O,{className:da("recharts-cartesian-axis-tick-line",dp(c,"className"))})),d&&e.renderTickItem(d,Y,"".concat(ki(f)?f(L.value,F):L.value).concat(x||"")))});return ke.createElement("g",{className:"recharts-cartesian-axis-ticks"},I)}},{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=KX(f,fsn),y=x;return ki(c)&&(y=x&&x.length>0?c(this.props):c(g)),o<=0||l<=0||!y||!y.length?null:ke.createElement(_a,{className:da("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 ke.isValidElement(r)?o=ke.cloneElement(r,s):ki(r)?o=r(s):o=ke.createElement(fD,p4({},s,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])}(h.Component);Nde(R8,"displayName","CartesianAxis");Nde(R8,"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 wsn=["x1","y1","x2","y2","key"],Csn=["offset"];function y5(t){"@babel/helpers - typeof";return y5=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},y5(t)}function k4e(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?k4e(Object(n),!0).forEach(function(r){Nsn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):k4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Nsn(t,e,n){return e=Ssn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ssn(t){var e=jsn(t,"string");return y5(e)=="symbol"?e:e+""}function jsn(t,e){if(y5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(y5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Tw(){return Tw=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},Tw.apply(this,arguments)}function T4e(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}var _sn=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 ke.createElement("rect",{x:s,y:a,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function tVe(t,e){var n;if(ke.isValidElement(t))n=ke.cloneElement(t,e);else if(ki(t))n=t(e);else{var r=e.x1,s=e.y1,a=e.x2,o=e.y2,l=e.key,c=T4e(e,wsn),u=ji(c,!1);u.offset;var d=T4e(u,Csn);n=ke.createElement("line",Tw({},d,{x1:r,y1:s,x2:a,y2:o,fill:"none",key:l}))}return n}function Esn(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 tVe(s,u)});return ke.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function ksn(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 tVe(s,u)});return ke.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Tsn(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 ke.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 ke.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Psn(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 ke.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 ke.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Isn=function(e,n){var r=e.xAxis,s=e.width,a=e.height,o=e.offset;return pHe(Cde(Iu(Iu(Iu({},R8.defaultProps),r),{},{ticks:Xg(r,!0),viewBox:{x:0,y:0,width:s,height:a}})),o.left,o.left+o.width,n)},Fsn=function(e,n){var r=e.yAxis,s=e.width,a=e.height,o=e.offset;return pHe(Cde(Iu(Iu(Iu({},R8.defaultProps),r),{},{ticks:Xg(r,!0),viewBox:{x:0,y:0,width:s,height:a}})),o.top,o.top+o.height,n)},AC={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function nVe(t){var e,n,r,s,a,o,l=bde(),c=yde(),u=vrn(),d=Iu(Iu({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:AC.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:AC.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:AC.horizontal,horizontalFill:(s=t.horizontalFill)!==null&&s!==void 0?s:AC.horizontalFill,vertical:(a=t.vertical)!==null&&a!==void 0?a:AC.vertical,verticalFill:(o=t.verticalFill)!==null&&o!==void 0?o:AC.verticalFill,x:fs(t.x)?t.x:u.left,y:fs(t.y)?t.y:u.top,width:fs(t.width)?t.width:u.width,height:fs(t.height)?t.height:u.height}),f=d.x,x=d.y,g=d.width,y=d.height,v=d.syncWithTicks,C=d.horizontalValues,S=d.verticalValues,T=grn(),I=brn();if(!fs(g)||g<=0||!fs(y)||y<=0||!fs(f)||f!==+f||!fs(x)||x!==+x)return null;var L=d.verticalCoordinatesGenerator||Isn,F=d.horizontalCoordinatesGenerator||Fsn,$=d.horizontalPoints,O=d.verticalPoints;if((!$||!$.length)&&ki(F)){var U=C&&C.length,Y=F({yAxis:I?Iu(Iu({},I),{},{ticks:U?C:I.ticks}):void 0,width:l,height:c,offset:u},U?!0:v);u1(Array.isArray(Y),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(y5(Y),"]")),Array.isArray(Y)&&($=Y)}if((!O||!O.length)&&ki(L)){var re=S&&S.length,Q=L({xAxis:T?Iu(Iu({},T),{},{ticks:re?S:T.ticks}):void 0,width:l,height:c,offset:u},re?!0:v);u1(Array.isArray(Q),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(y5(Q),"]")),Array.isArray(Q)&&(O=Q)}return ke.createElement("g",{className:"recharts-cartesian-grid"},ke.createElement(_sn,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),ke.createElement(Esn,Tw({},d,{offset:u,horizontalPoints:$,xAxis:T,yAxis:I})),ke.createElement(ksn,Tw({},d,{offset:u,verticalPoints:O,xAxis:T,yAxis:I})),ke.createElement(Tsn,Tw({},d,{horizontalPoints:$})),ke.createElement(Psn,Tw({},d,{verticalPoints:O})))}nVe.displayName="CartesianGrid";var Osn=["type","layout","connectNulls","ref"],Msn=["key"];function mj(t){"@babel/helpers - typeof";return mj=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},mj(t)}function P4e(t,e){if(t==null)return{};var n=Lsn(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 Lsn(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 Y_(){return Y_=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},Y_.apply(this,arguments)}function I4e(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 Df(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?I4e(Object(n),!0).forEach(function(r){am(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):I4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _C(t){return $sn(t)||Bsn(t)||Dsn(t)||Rsn()}function Rsn(){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 Dsn(t,e){if(t){if(typeof t=="string")return Yre(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 Yre(t,e)}}function Bsn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function $sn(t){if(Array.isArray(t))return Yre(t)}function Yre(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 Usn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function F4e(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,sVe(r.key),r)}}function zsn(t,e,n){return F4e(t.prototype,e),F4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Hsn(t,e,n){return e=WD(e),Vsn(t,rVe()?Reflect.construct(e,n,WD(t).constructor):e.apply(t,n))}function Vsn(t,e){if(e&&(mj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wsn(t)}function Wsn(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 WD(t){return WD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},WD(t)}function qsn(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&&Xre(t,e)}function Xre(t,e){return Xre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Xre(t,e)}function am(t,e,n){return e=sVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sVe(t){var e=Gsn(t,"string");return mj(e)=="symbol"?e:e+""}function Gsn(t,e){if(mj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(mj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var U0=function(t){function e(){var n;Usn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Hsn(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(S,T){return S+T});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(_C(c.slice(0,y)),[f-v]);break}var C=g.length%2===0?[0,x]:[x];return[].concat(_C(e.repeat(c,d)),_C(g),C).map(function(S){return"".concat(S,"px")}).join(", ")}),am(n,"id",q5("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 qsn(e,t),zsn(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=pf(d,M8);if(!f)return null;var x=function(v,C){return{x:v.x,y:v.y,value:v.value,errorVal:uc(v.payload,C)}},g={clipPath:r?"url(#clipPath-".concat(s,")"):null};return ke.createElement(_a,g,f.map(function(y){return ke.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=ji(this.props,!1),x=ji(c,!0),g=u.map(function(v,C){var S=Df(Df(Df({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,S)}),y={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(a,")"):null};return ke.createElement(_a,Y_({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=P4e(l,Osn),x=Df(Df(Df({},ji(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 ke.createElement(I3,Y_({},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,S=this.state,T=S.prevPoints,I=S.totalLength;return ke.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(L){var F=L.t;if(T){var $=T.length/l.length,O=l.map(function(q,te){var fe=Math.floor(te*$);if(T[fe]){var G=T[fe],ie=_l(G.x,q.x),oe=_l(G.y,q.y);return Df(Df({},q),{},{x:ie(F),y:oe(F)})}if(y){var K=_l(v*2,q.x),H=_l(C/2,q.y);return Df(Df({},q),{},{x:K(F),y:H(F)})}return Df(Df({},q),{},{x:q.x,y:q.y})});return a.renderCurveStatically(O,r,s)}var U=_l(0,I),Y=U(F),re;if(c){var Q="".concat(c).split(/[,\s]+/gim).map(function(q){return parseFloat(q)});re=a.getStrokeDasharray(Y,I,Q)}else re=a.generateSimpleStrokeDasharray(I,Y);return a.renderCurveStatically(l,r,s,{strokeDasharray:re})})}},{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||!x5(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 S=this.state.isAnimationFinished,T=l.length===1,I=da("recharts-line",c),L=u&&u.allowDataOverflow,F=d&&d.allowDataOverflow,$=L||F,O=Ai(C)?this.id:C,U=(r=ji(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},Y=U.r,re=Y===void 0?3:Y,Q=U.strokeWidth,q=Q===void 0?2:Q,te=mUe(o)?o:{},fe=te.clipDot,G=fe===void 0?!0:fe,ie=re*2+q;return ke.createElement(_a,{className:I},L||F?ke.createElement("defs",null,ke.createElement("clipPath",{id:"clipPath-".concat(O)},ke.createElement("rect",{x:L?x:x-g/2,y:F?f:f-y/2,width:L?g:g*2,height:F?y:y*2})),!G&&ke.createElement("clipPath",{id:"clipPath-dots-".concat(O)},ke.createElement("rect",{x:x-ie/2,y:f-ie/2,width:g+ie,height:y+ie}))):null,!T&&this.renderCurve($,O),this.renderErrorBar($,O),(T||o)&&this.renderDots($,G,O),(!v||S)&&ex.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(_C(r),[0]):r,o=[],l=0;l<s;++l)o=[].concat(_C(o),_C(a));return o}},{key:"renderDotItem",value:function(r,s){var a;if(ke.isValidElement(r))a=ke.cloneElement(r,s);else if(ki(r))a=r(s);else{var o=s.key,l=P4e(s,Msn),c=da("recharts-line-dot",typeof r!="boolean"?r.className:"");a=ke.createElement(hz,Y_({key:o},l,{className:c}))}return a}}])}(h.PureComponent);am(U0,"displayName","Line");am(U0,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Nm.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});am(U0,"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=uc(x,o);return d==="horizontal"?{x:aj({axis:n,ticks:s,bandSize:l,entry:x,index:g}),y:Ai(y)?null:r.scale(y),value:y,payload:x}:{x:Ai(y)?null:n.scale(y),y:aj({axis:r,ticks:a,bandSize:l,entry:x,index:g}),value:y,payload:x}});return Df({points:f,layout:d},u)});var Ksn=["layout","type","stroke","connectNulls","isRange","ref"],Ysn=["key"],iVe;function xj(t){"@babel/helpers - typeof";return xj=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},xj(t)}function aVe(t,e){if(t==null)return{};var n=Xsn(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 Xsn(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 Pw(){return Pw=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},Pw.apply(this,arguments)}function O4e(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 zb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?O4e(Object(n),!0).forEach(function(r){z0(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):O4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Qsn(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,lVe(r.key),r)}}function Zsn(t,e,n){return M4e(t.prototype,e),M4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Jsn(t,e,n){return e=qD(e),ein(t,oVe()?Reflect.construct(e,n,qD(t).constructor):e.apply(t,n))}function ein(t,e){if(e&&(xj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tin(t)}function tin(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function oVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oVe=function(){return!!t})()}function qD(t){return qD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},qD(t)}function nin(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&&Qre(t,e)}function Qre(t,e){return Qre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Qre(t,e)}function z0(t,e,n){return e=lVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lVe(t){var e=rin(t,"string");return xj(e)=="symbol"?e:e+""}function rin(t,e){if(xj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(xj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var X5=function(t){function e(){var n;Qsn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Jsn(this,e,[].concat(s)),z0(n,"state",{isAnimationFinished:!0}),z0(n,"id",q5("recharts-area-")),z0(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),ki(o)&&o()}),z0(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),ki(o)&&o()}),n}return nin(e,t),Zsn(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=ji(this.props,!1),g=ji(u,!0),y=d.map(function(C,S){var T=zb(zb(zb({key:"dot-".concat(S),r:3},x),g),{},{index:S,cx:C.x,cy:C.y,dataKey:f,value:C.value,payload:C.payload,points:d});return e.renderDotItem(u,T)}),v={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(a,")"):null};return ke.createElement(_a,Pw({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=Fy(o.map(function(x){return x.y||0}));return fs(a)&&typeof a=="number"?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(Fy(a.map(function(x){return x.y||0})),f)),fs(f)?ke.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=Fy(o.map(function(x){return x.x||0}));return fs(a)&&typeof a=="number"?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(Fy(a.map(function(x){return x.x||0})),f)),fs(f)?ke.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=aVe(l,Ksn);return ke.createElement(_a,{clipPath:a?"url(#clipPath-".concat(o,")"):null},ke.createElement(I3,Pw({},ji(g,!0),{points:r,connectNulls:f,type:u,baseLine:s,layout:c,stroke:"none",className:"recharts-area-area"})),d!=="none"&&ke.createElement(I3,Pw({},ji(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:r})),d!=="none"&&x&&ke.createElement(I3,Pw({},ji(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 ke.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(S){var T=S.t;if(v){var I=v.length/l.length,L=l.map(function(U,Y){var re=Math.floor(Y*I);if(v[re]){var Q=v[re],q=_l(Q.x,U.x),te=_l(Q.y,U.y);return zb(zb({},U),{},{x:q(T),y:te(T)})}return U}),F;if(fs(c)&&typeof c=="number"){var $=_l(C,c);F=$(T)}else if(Ai(c)||T8(c)){var O=_l(C,0);F=O(T)}else F=c.map(function(U,Y){var re=Math.floor(Y*I);if(C[re]){var Q=C[re],q=_l(Q.x,U.x),te=_l(Q.y,U.y);return zb(zb({},U),{},{x:q(T),y:te(T)})}return U});return a.renderAreaStatically(L,F,r,s)}return ke.createElement(_a,null,ke.createElement("defs",null,ke.createElement("clipPath",{id:"animationClipPath-".concat(s)},a.renderClipRect(T))),ke.createElement(_a,{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||!x5(d,o)||!x5(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 S=this.state.isAnimationFinished,T=l.length===1,I=da("recharts-area",c),L=f&&f.allowDataOverflow,F=x&&x.allowDataOverflow,$=L||F,O=Ai(C)?this.id:C,U=(r=ji(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},Y=U.r,re=Y===void 0?3:Y,Q=U.strokeWidth,q=Q===void 0?2:Q,te=mUe(o)?o:{},fe=te.clipDot,G=fe===void 0?!0:fe,ie=re*2+q;return ke.createElement(_a,{className:I},L||F?ke.createElement("defs",null,ke.createElement("clipPath",{id:"clipPath-".concat(O)},ke.createElement("rect",{x:L?d:d-g/2,y:F?u:u-y/2,width:L?g:g*2,height:F?y:y*2})),!G&&ke.createElement("clipPath",{id:"clipPath-dots-".concat(O)},ke.createElement("rect",{x:d-ie/2,y:u-ie/2,width:g+ie,height:y+ie}))):null,T?null:this.renderArea($,O),(o||T)&&this.renderDots($,G,O),(!v||S)&&ex.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}}])}(h.PureComponent);iVe=X5;z0(X5,"displayName","Area");z0(X5,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Nm.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});z0(X5,"getBaseValue",function(t,e,n,r){var s=t.layout,a=t.baseValue,o=e.props.baseValue,l=o??a;if(fs(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]});z0(X5,"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=iVe.getBaseValue(e,n,r,s),C=g==="horizontal",S=!1,T=f.map(function(L,F){var $;y?$=u[d+F]:($=uc(L,c),Array.isArray($)?S=!0:$=[v,$]);var O=$[1]==null||y&&uc(L,c)==null;return C?{x:aj({axis:r,ticks:a,bandSize:l,entry:L,index:F}),y:O?null:s.scale($[1]),value:$,payload:L}:{x:O?null:r.scale($[1]),y:aj({axis:s,ticks:o,bandSize:l,entry:L,index:F}),value:$,payload:L}}),I;return y||S?I=T.map(function(L){var F=Array.isArray(L.value)?L.value[0]:null;return C?{x:L.x,y:F!=null&&L.y!=null?s.scale(F):null}:{x:F!=null?r.scale(F):null,y:L.y}}):I=C?s.scale(v):r.scale(v),zb({points:T,baseLine:I,layout:g,isRange:S},x)});z0(X5,"renderDotItem",function(t,e){var n;if(ke.isValidElement(t))n=ke.cloneElement(t,e);else if(ki(t))n=t(e);else{var r=da("recharts-area-dot",typeof t!="boolean"?t.className:""),s=e.key,a=aVe(e,Ysn);n=ke.createElement(hz,Pw({},a,{key:s,className:r}))}return n});function gj(t){"@babel/helpers - typeof";return gj=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},gj(t)}function sin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iin(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,dVe(r.key),r)}}function ain(t,e,n){return iin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function oin(t,e,n){return e=GD(e),lin(t,cVe()?Reflect.construct(e,n||[],GD(t).constructor):e.apply(t,n))}function lin(t,e){if(e&&(gj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cin(t)}function cin(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function cVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cVe=function(){return!!t})()}function GD(t){return GD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},GD(t)}function uin(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&&Zre(t,e)}function Zre(t,e){return Zre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Zre(t,e)}function uVe(t,e,n){return e=dVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dVe(t){var e=din(t,"string");return gj(e)=="symbol"?e:e+""}function din(t,e){if(gj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(gj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wz=function(t){function e(){return sin(this,e),oin(this,e,arguments)}return uin(e,t),ain(e,[{key:"render",value:function(){return null}}])}(ke.Component);uVe(wz,"displayName","ZAxis");uVe(wz,"defaultProps",{zAxisId:0,range:[64,64],scale:"auto",type:"number"});var fin=["option","isActive"];function X_(){return X_=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},X_.apply(this,arguments)}function hin(t,e){if(t==null)return{};var n=pin(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 pin(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 min(t){var e=t.option,n=t.isActive,r=hin(t,fin);return typeof e=="string"?ke.createElement(Dre,X_({option:ke.createElement(ez,X_({type:e},r)),isActive:n,shapeType:"symbols"},r)):ke.createElement(Dre,X_({option:e,isActive:n,shapeType:"symbols"},r))}function bj(t){"@babel/helpers - typeof";return bj=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},bj(t)}function Q_(){return Q_=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},Q_.apply(this,arguments)}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 Vh(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){My(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 xin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function R4e(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,hVe(r.key),r)}}function gin(t,e,n){return R4e(t.prototype,e),R4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function bin(t,e,n){return e=KD(e),yin(t,fVe()?Reflect.construct(e,n,KD(t).constructor):e.apply(t,n))}function yin(t,e){if(e&&(bj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vin(t)}function vin(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function fVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(fVe=function(){return!!t})()}function KD(t){return KD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},KD(t)}function win(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 My(t,e,n){return e=hVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hVe(t){var e=Cin(t,"string");return bj(e)=="symbol"?e:e+""}function Cin(t,e){if(bj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(bj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Cz=function(t){function e(){var n;xin(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=bin(this,e,[].concat(s)),My(n,"state",{isAnimationFinished:!1}),My(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0})}),My(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1})}),My(n,"id",q5("recharts-scatter-")),n}return win(e,t),gin(e,[{key:"renderSymbolsStatically",value:function(r){var s=this,a=this.props,o=a.shape,l=a.activeShape,c=a.activeIndex,u=ji(this.props,!1);return r.map(function(d,f){var x=c===f,g=x?l:o,y=Vh(Vh({},u),d);return ke.createElement(_a,Q_({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)},XE(s.props,d,f),{role:"img"}),ke.createElement(min,Q_({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 ke.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 S=f&&f[C];if(S){var T=_l(S.cx,v.cx),I=_l(S.cy,v.cy),L=_l(S.size,v.size);return Vh(Vh({},v),{},{cx:T(g),cy:I(g),size:L(g)})}var F=_l(0,v.size);return Vh(Vh({},v),{},{size:F(g)})});return ke.createElement(_a,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||!x5(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=pf(c,M8);return u?u.map(function(d,f){var x=d.props,g=x.direction,y=x.dataKey;return ke.cloneElement(d,{key:"".concat(g,"-").concat(y,"-").concat(a[f]),data:a,xAxis:o,yAxis:l,layout:g==="x"?"vertical":"horizontal",dataPointFormatter:function(C,S){return{x:C.cx,y:C.cy,value:g==="x"?+C.node.x:+C.node.y,errorVal:uc(C,S)}}})}):null}},{key:"renderLine",value:function(){var r=this.props,s=r.points,a=r.line,o=r.lineType,l=r.lineJointType,c=ji(this.props,!1),u=ji(a,!1),d,f;if(o==="joint")d=s.map(function(I){return{x:I.cx,y:I.cy}});else if(o==="fitting"){var x=lVt(s),g=x.xmin,y=x.xmax,v=x.a,C=x.b,S=function(L){return v*L+C};d=[{x:g,y:S(g)},{x:y,y:S(y)}]}var T=Vh(Vh(Vh({},c),{},{fill:"none",stroke:c&&c.fill},u),{},{points:d});return ke.isValidElement(a)?f=ke.cloneElement(a,T):ki(a)?f=a(T):f=ke.createElement(I3,Q_({},T,{type:l})),ke.createElement(_a,{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,S=da("recharts-scatter",l),T=c&&c.allowDataOverflow,I=u&&u.allowDataOverflow,L=T||I,F=Ai(y)?this.id:y;return ke.createElement(_a,{className:S,clipPath:L?"url(#clipPath-".concat(F,")"):null},T||I?ke.createElement("defs",null,ke.createElement("clipPath",{id:"clipPath-".concat(F)},ke.createElement("rect",{x:T?d:d-x/2,y:I?f:f-g/2,width:T?x:x*2,height:I?g:g*2}))):null,o&&this.renderLine(),this.renderErrorBar(),ke.createElement(_a,{key:"recharts-scatter-symbols"},this.renderSymbols()),(!v||C)&&ex.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}}])}(h.PureComponent);My(Cz,"displayName","Scatter");My(Cz,"defaultProps",{xAxisId:0,yAxisId:0,zAxisId:0,legendType:"circle",lineType:"joint",lineJointType:"linear",data:[],shape:"circle",hide:!1,isAnimationActive:!Nm.isSsr,animationBegin:0,animationDuration:400,animationEasing:"linear"});My(Cz,"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=pf(s.props.children,zue),f=Ai(e.dataKey)?s.props.dataKey:e.dataKey,x=Ai(n.dataKey)?s.props.dataKey:n.dataKey,g=r&&r.dataKey,y=r?r.range:wz.defaultProps.range,v=y&&y[0],C=e.scale.bandwidth?e.scale.bandwidth():0,S=n.scale.bandwidth?n.scale.bandwidth():0,T=a.map(function(I,L){var F=uc(I,f),$=uc(I,x),O=!Ai(g)&&uc(I,g)||"-",U=[{name:Ai(e.dataKey)?s.props.name:e.name||e.dataKey,unit:e.unit||"",value:F,payload:I,dataKey:f,type:u},{name:Ai(n.dataKey)?s.props.name:n.name||n.dataKey,unit:n.unit||"",value:$,payload:I,dataKey:x,type:u}];O!=="-"&&U.push({name:r.name||r.dataKey,unit:r.unit||"",value:O,payload:I,dataKey:g,type:u});var Y=aj({axis:e,ticks:o,bandSize:C,entry:I,index:L,dataKey:f}),re=aj({axis:n,ticks:l,bandSize:S,entry:I,index:L,dataKey:x}),Q=O!=="-"?r.scale(O):v,q=Math.sqrt(Math.max(Q,0)/Math.PI);return Vh(Vh({},I),{},{cx:Y,cy:re,x:Y-q,y:re-q,xAxis:e,yAxis:n,zAxis:r,width:2*q,height:2*q,size:Q,node:{x:F,y:$,z:O},tooltipPayload:U,tooltipPosition:{x:Y,y:re},payload:I},d[L]&&d[L].props)});return Vh({points:T},c)});function yj(t){"@babel/helpers - typeof";return yj=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},yj(t)}function Nin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Sin(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,xVe(r.key),r)}}function jin(t,e,n){return Sin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ain(t,e,n){return e=YD(e),_in(t,pVe()?Reflect.construct(e,n||[],YD(t).constructor):e.apply(t,n))}function _in(t,e){if(e&&(yj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ein(t)}function Ein(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pVe=function(){return!!t})()}function YD(t){return YD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},YD(t)}function kin(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&&ese(t,e)}function ese(t,e){return ese=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},ese(t,e)}function mVe(t,e,n){return e=xVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xVe(t){var e=Tin(t,"string");return yj(e)=="symbol"?e:e+""}function Tin(t,e){if(yj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(yj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tse(){return tse=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},tse.apply(this,arguments)}function Pin(t){var e=t.xAxisId,n=bde(),r=yde(),s=VHe(e);return s==null?null:ke.createElement(R8,tse({},s,{className:da("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(o){return Xg(o,!0)}}))}var D8=function(t){function e(){return Nin(this,e),Ain(this,e,arguments)}return kin(e,t),jin(e,[{key:"render",value:function(){return ke.createElement(Pin,this.props)}}])}(ke.Component);mVe(D8,"displayName","XAxis");mVe(D8,"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 vj(t){"@babel/helpers - typeof";return vj=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},vj(t)}function Iin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fin(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,yVe(r.key),r)}}function Oin(t,e,n){return Fin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Min(t,e,n){return e=XD(e),Lin(t,gVe()?Reflect.construct(e,n||[],XD(t).constructor):e.apply(t,n))}function Lin(t,e){if(e&&(vj(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 gVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gVe=function(){return!!t})()}function XD(t){return XD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},XD(t)}function Din(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&&nse(t,e)}function nse(t,e){return nse=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},nse(t,e)}function bVe(t,e,n){return e=yVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yVe(t){var e=Bin(t,"string");return vj(e)=="symbol"?e:e+""}function Bin(t,e){if(vj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(vj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rse(){return rse=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},rse.apply(this,arguments)}var $in=function(e){var n=e.yAxisId,r=bde(),s=yde(),a=WHe(n);return a==null?null:ke.createElement(R8,rse({},a,{className:da("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:s},ticksGenerator:function(l){return Xg(l,!0)}}))},B8=function(t){function e(){return Iin(this,e),Min(this,e,arguments)}return Din(e,t),Oin(e,[{key:"render",value:function(){return ke.createElement($in,this.props)}}])}(ke.Component);bVe(B8,"displayName","YAxis");bVe(B8,"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 D4e(t){return Vin(t)||Hin(t)||zin(t)||Uin()}function Uin(){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 zin(t,e){if(t){if(typeof t=="string")return sse(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 sse(t,e)}}function Hin(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Vin(t){if(Array.isArray(t))return sse(t)}function sse(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 ise=function(e,n,r,s,a){var o=pf(e,wde),l=pf(e,bz),c=[].concat(D4e(o),D4e(l)),u=pf(e,vz),d="".concat(s,"Id"),f=s[0],x=n;if(c.length&&(x=c.reduce(function(v,C){if(C.props[d]===r&&tx(C.props,"extendDomain")&&fs(C.props[f])){var S=C.props[f];return[Math.min(v[0],S),Math.max(v[1],S)]}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&&tx(C.props,"extendDomain")&&fs(C.props[g])&&fs(C.props[y])){var S=C.props[g],T=C.props[y];return[Math.min(v[0],S,T),Math.max(v[1],S,T)]}return v},x)}return a&&a.length&&(x=a.reduce(function(v,C){return fs(C)?[Math.min(v[0],C),Math.max(v[1],C)]:v},x)),x},YX={exports:{}},B4e;function Win(){return B4e||(B4e=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],S=arguments.length,T,I;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),S){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(I=1,T=new Array(S-1);I<S;I++)T[I-1]=arguments[I];C.fn.apply(C.context,T)}else{var L=C.length,F;for(I=0;I<L;I++)switch(C[I].once&&this.removeListener(u,C[I].fn,void 0,!0),S){case 1:C[I].fn.call(C[I].context);break;case 2:C[I].fn.call(C[I].context,d);break;case 3:C[I].fn.call(C[I].context,d,f);break;case 4:C[I].fn.call(C[I].context,d,f,x);break;default:if(!T)for(F=1,T=new Array(S-1);F<S;F++)T[F-1]=arguments[F];C[I].fn.apply(C[I].context,T)}}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=[],S=y.length;v<S;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}(YX)),YX.exports}var qin=Win();const Gin=Pi(qin);var XX=new Gin,QX="recharts.syncMouseEvents";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 Kin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yin(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,vVe(r.key),r)}}function Xin(t,e,n){return Yin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ZX(t,e,n){return e=vVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vVe(t){var e=Qin(t,"string");return Tk(e)=="symbol"?e:e+""}function Qin(t,e){if(Tk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Tk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Zin=function(){function t(){Kin(this,t),ZX(this,"activeIndex",0),ZX(this,"coordinateList",[]),ZX(this,"layout","horizontal")}return Xin(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 Jin(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&&fs(r)&&fs(s))return!0}return!1}function ean(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 wVe(t){var e=t.cx,n=t.cy,r=t.radius,s=t.startAngle,a=t.endAngle,o=ou(e,n,r,s),l=ou(e,n,r,a);return{points:[o,l],cx:e,cy:n,radius:r,startAngle:s,endAngle:a}}function tan(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=ou(l,c,u,f),g=ou(l,c,d,f);r=x.x,s=x.y,a=g.x,o=g.y}else return wVe(e);return[{x:r,y:s},{x:a,y:o}]}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 $4e(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 PF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$4e(Object(n),!0).forEach(function(r){nan(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nan(t,e,n){return e=ran(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ran(t){var e=san(t,"string");return Pk(e)=="symbol"?e:e+""}function san(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 ian(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=I3;if(x==="ScatterChart")y=o,v=ktn;else if(x==="BarChart")y=ean(f,o,c,d),v=pde;else if(f==="radial"){var C=wVe(o),S=C.cx,T=C.cy,I=C.radius,L=C.startAngle,F=C.endAngle;y={cx:S,cy:T,startAngle:L,endAngle:F,innerRadius:I,outerRadius:I},v=yHe}else y={points:tan(f,o,c)},v=I3;var $=PF(PF(PF(PF({stroke:"#ccc",pointerEvents:"none"},c),y),ji(g,!1)),{},{payload:l,payloadIndex:u,className:da("recharts-tooltip-cursor",g.className)});return h.isValidElement(g)?h.cloneElement(g,$):h.createElement(v,$)}var aan=["item"],oan=["children","className","width","height","style","compact","title","desc"];function wj(t){"@babel/helpers - typeof";return wj=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},wj(t)}function m4(){return m4=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},m4.apply(this,arguments)}function U4e(t,e){return uan(t)||can(t,e)||NVe(t,e)||lan()}function lan(){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 can(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 uan(t){if(Array.isArray(t))return t}function z4e(t,e){if(t==null)return{};var n=dan(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 dan(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 fan(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function han(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,SVe(r.key),r)}}function pan(t,e,n){return han(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function man(t,e,n){return e=QD(e),xan(t,CVe()?Reflect.construct(e,n,QD(t).constructor):e.apply(t,n))}function xan(t,e){if(e&&(wj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gan(t)}function gan(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function CVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(CVe=function(){return!!t})()}function QD(t){return QD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},QD(t)}function ban(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&&ase(t,e)}function ase(t,e){return ase=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},ase(t,e)}function Cj(t){return wan(t)||van(t)||NVe(t)||yan()}function yan(){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 NVe(t,e){if(t){if(typeof t=="string")return ose(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 ose(t,e)}}function van(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function wan(t){if(Array.isArray(t))return ose(t)}function ose(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 H4e(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 Tr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?H4e(Object(n),!0).forEach(function(r){ii(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):H4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ii(t,e,n){return e=SVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function SVe(t){var e=Can(t,"string");return wj(e)=="symbol"?e:e+""}function Can(t,e){if(wj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(wj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Nan={xAxis:["bottom","top"],yAxis:["left","right"]},San={width:"100%",height:"100%"},jVe={x:0,y:0};function IF(t){return t}var jan=function(e,n){return n==="horizontal"?e.x:n==="vertical"?e.y:n==="centric"?e.angle:e.radius},Aan=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 Tr(Tr(Tr({},s),ou(s.cx,s.cy,l,o)),{},{angle:o,radius:l})}var c=a.coordinate,u=s.angle;return Tr(Tr(Tr({},s),ou(s.cx,s.cy,c,u)),{},{angle:u,radius:c})}return jVe},Nz=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(Cj(l),Cj(u)):l},[]);return o.length>0?o:e&&e.length&&fs(s)&&fs(a)?e.slice(s,a+1):[]};function AVe(t){return t==="number"?[0,"auto"]:void 0}var lse=function(e,n,r,s){var a=e.graphicalItems,o=e.tooltipAxis,l=Nz(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=eD(g,o.dataKey,s)}else x=f&&f[r]||l[r];return x?[].concat(Cj(c),[xHe(u,x)]):c},[])},V4e=function(e,n,r,s){var a=s||{x:e.chartX,y:e.chartY},o=jan(a,r),l=e.orderedTooltipTicks,c=e.tooltipAxis,u=e.tooltipTicks,d=mZt(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,x=lse(e,n,d,f),g=Aan(r,l,d,a);return{activeTooltipIndex:d,activeLabel:f,activePayload:x,activeCoordinate:g}}return null},_an=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=hHe(d,a);return r.reduce(function(y,v){var C,S=v.type.defaultProps!==void 0?Tr(Tr({},v.type.defaultProps),v.props):v.props,T=S.type,I=S.dataKey,L=S.allowDataOverflow,F=S.allowDuplicatedCategory,$=S.scale,O=S.ticks,U=S.includeHidden,Y=S[o];if(y[Y])return y;var re=Nz(e.data,{graphicalItems:s.filter(function(pe){var Se,ge=o in pe.props?pe.props[o]:(Se=pe.type.defaultProps)===null||Se===void 0?void 0:Se[o];return ge===Y}),dataStartIndex:c,dataEndIndex:u}),Q=re.length,q,te,fe;Jin(S.domain,L,T)&&(q=Cre(S.domain,null,L),g&&(T==="number"||$!=="auto")&&(fe=G_(re,I,"category")));var G=AVe(T);if(!q||q.length===0){var ie,oe=(ie=S.domain)!==null&&ie!==void 0?ie:G;if(I){if(q=G_(re,I,T),T==="category"&&g){var K=oVt(q);F&&K?(te=q,q=MD(0,Q)):F||(q=eCe(oe,q,v).reduce(function(pe,Se){return pe.indexOf(Se)>=0?pe:[].concat(Cj(pe),[Se])},[]))}else if(T==="category")F?q=q.filter(function(pe){return pe!==""&&!Ai(pe)}):q=eCe(oe,q,v).reduce(function(pe,Se){return pe.indexOf(Se)>=0||Se===""||Ai(Se)?pe:[].concat(Cj(pe),[Se])},[]);else if(T==="number"){var H=vZt(re,s.filter(function(pe){var Se,ge,ve=o in pe.props?pe.props[o]:(Se=pe.type.defaultProps)===null||Se===void 0?void 0:Se[o],be="hide"in pe.props?pe.props.hide:(ge=pe.type.defaultProps)===null||ge===void 0?void 0:ge.hide;return ve===Y&&(U||!be)}),I,a,d);H&&(q=H)}g&&(T==="number"||$!=="auto")&&(fe=G_(re,I,"category"))}else g?q=MD(0,Q):l&&l[Y]&&l[Y].hasStack&&T==="number"?q=x==="expand"?[0,1]:mHe(l[Y].stackGroups,c,u):q=fHe(re,s.filter(function(pe){var Se=o in pe.props?pe.props[o]:pe.type.defaultProps[o],ge="hide"in pe.props?pe.props.hide:pe.type.defaultProps.hide;return Se===Y&&(U||!ge)}),T,d,!0);if(T==="number")q=ise(f,q,Y,a,O),oe&&(q=Cre(oe,q,L));else if(T==="category"&&oe){var ee=oe,se=q.every(function(pe){return ee.indexOf(pe)>=0});se&&(q=ee)}}return Tr(Tr({},y),{},ii({},Y,Tr(Tr({},S),{},{axisType:a,domain:q,categoricalDomain:fe,duplicateDomain:te,originalDomain:(C=S.domain)!==null&&C!==void 0?C:G,isCategorical:g,layout:d})))},{})},Ean=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=Nz(e.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),g=x.length,y=hHe(d,a),v=-1;return r.reduce(function(C,S){var T=S.type.defaultProps!==void 0?Tr(Tr({},S.type.defaultProps),S.props):S.props,I=T[o],L=AVe("number");if(!C[I]){v++;var F;return y?F=MD(0,g):l&&l[I]&&l[I].hasStack?(F=mHe(l[I].stackGroups,c,u),F=ise(f,F,I,a)):(F=Cre(L,fHe(x,r.filter(function($){var O,U,Y=o in $.props?$.props[o]:(O=$.type.defaultProps)===null||O===void 0?void 0:O[o],re="hide"in $.props?$.props.hide:(U=$.type.defaultProps)===null||U===void 0?void 0:U.hide;return Y===I&&!re}),"number",d),s.defaultProps.allowDataOverflow),F=ise(f,F,I,a)),Tr(Tr({},C),{},ii({},I,Tr(Tr({axisType:a},s.defaultProps),{},{hide:!0,orientation:dp(Nan,"".concat(a,".").concat(v%2),null),domain:F,originalDomain:L,isCategorical:y,layout:d})))}return C},{})},kan=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=pf(d,a),g={};return x.length?g=_an(e,{axes:x,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(g=Ean(e,{Axis:a,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),g},Tan=function(e){var n=Qb(e),r=Xg(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:$ue(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:AD(n,r)}},W4e=function(e){var n=e.children,r=e.defaultShowTooltip,s=qf(n,cj),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}},Pan=function(e){return!e||!e.length?!1:e.some(function(n){var r=c1(n&&n.type);return r&&r.indexOf("Bar")>=0})},q4e=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"}},Ian=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=qf(f,cj),y=qf(f,k3),v=Object.keys(c).reduce(function(F,$){var O=c[$],U=O.orientation;return!O.mirror&&!O.hide?Tr(Tr({},F),{},ii({},U,F[U]+O.width)):F},{left:x.left||0,right:x.right||0}),C=Object.keys(o).reduce(function(F,$){var O=o[$],U=O.orientation;return!O.mirror&&!O.hide?Tr(Tr({},F),{},ii({},U,dp(F,"".concat(U))+O.height)):F},{top:x.top||0,bottom:x.bottom||0}),S=Tr(Tr({},C),v),T=S.bottom;g&&(S.bottom+=g.props.height||cj.defaultProps.height),y&&n&&(S=bZt(S,s,r,n));var I=u-S.left-S.right,L=d-S.top-S.bottom;return Tr(Tr({brushBottom:T},S),{},{width:Math.max(I,0),height:Math.max(L,0)})},Fan=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},_Ve=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(S,T){var I=T.graphicalItems,L=T.stackGroups,F=T.offset,$=T.updateId,O=T.dataStartIndex,U=T.dataEndIndex,Y=S.barSize,re=S.layout,Q=S.barGap,q=S.barCategoryGap,te=S.maxBarSize,fe=q4e(re),G=fe.numericAxisName,ie=fe.cateAxisName,oe=Pan(I),K=[];return I.forEach(function(H,ee){var se=Nz(S.data,{graphicalItems:[H],dataStartIndex:O,dataEndIndex:U}),pe=H.type.defaultProps!==void 0?Tr(Tr({},H.type.defaultProps),H.props):H.props,Se=pe.dataKey,ge=pe.maxBarSize,ve=pe["".concat(G,"Id")],be=pe["".concat(ie,"Id")],we={},je=c.reduce(function(jt,un){var vn=T["".concat(un.axisType,"Map")],Hn=pe["".concat(un.axisType,"Id")];vn&&vn[Hn]||un.axisType==="zAxis"||b5();var ln=vn[Hn];return Tr(Tr({},jt),{},ii(ii({},un.axisType,ln),"".concat(un.axisType,"Ticks"),Xg(ln)))},we),Fe=je[ie],Re=je["".concat(ie,"Ticks")],Qe=L&&L[ve]&&L[ve].hasStack&&IZt(H,L[ve].stackGroups),Ye=c1(H.type).indexOf("Bar")>=0,dt=AD(Fe,Re),st=[],at=oe&&xZt({barSize:Y,stackGroups:L,totalSize:Fan(je,ie)});if(Ye){var He,qe,vt=Ai(ge)?te:ge,yt=(He=(qe=AD(Fe,Re,!0))!==null&&qe!==void 0?qe:vt)!==null&&He!==void 0?He:0;st=gZt({barGap:Q,barCategoryGap:q,bandSize:yt!==dt?yt:dt,sizeList:at[be],maxBarSize:vt}),yt!==dt&&(st=st.map(function(jt){return Tr(Tr({},jt),{},{position:Tr(Tr({},jt.position),{},{offset:jt.position.offset-yt/2})})}))}var Kt=H&&H.type&&H.type.getComposedData;Kt&&K.push({props:Tr(Tr({},Kt(Tr(Tr({},je),{},{displayedData:se,props:S,dataKey:Se,item:H,bandSize:dt,barPosition:st,offset:F,stackedData:Qe,layout:re,dataStartIndex:O,dataEndIndex:U}))),{},ii(ii(ii({key:H.key||"item-".concat(ee)},G,je[G]),ie,je[ie]),"animationId",$)),childIndex:vVt(H,S.children),item:H})}),K},g=function(S,T){var I=S.props,L=S.dataStartIndex,F=S.dataEndIndex,$=S.updateId;if(!mwe({props:I}))return null;var O=I.children,U=I.layout,Y=I.stackOffset,re=I.data,Q=I.reverseStackOrder,q=q4e(U),te=q.numericAxisName,fe=q.cateAxisName,G=pf(O,r),ie=kZt(re,G,"".concat(te,"Id"),"".concat(fe,"Id"),Y,Q),oe=c.reduce(function(pe,Se){var ge="".concat(Se.axisType,"Map");return Tr(Tr({},pe),{},ii({},ge,kan(I,Tr(Tr({},Se),{},{graphicalItems:G,stackGroups:Se.axisType===te&&ie,dataStartIndex:L,dataEndIndex:F}))))},{}),K=Ian(Tr(Tr({},oe),{},{props:I,graphicalItems:G}),T==null?void 0:T.legendBBox);Object.keys(oe).forEach(function(pe){oe[pe]=d(I,oe[pe],K,pe.replace("Map",""),n)});var H=oe["".concat(fe,"Map")],ee=Tan(H),se=x(I,Tr(Tr({},oe),{},{dataStartIndex:L,dataEndIndex:F,updateId:$,graphicalItems:G,stackGroups:ie,offset:K}));return Tr(Tr({formattedGraphicalItems:se,graphicalItems:G,offset:K,stackGroups:ie},ee),oe)},y=function(C){function S(T){var I,L,F;return fan(this,S),F=man(this,S,[T]),ii(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ii(F,"accessibilityManager",new Zin),ii(F,"handleLegendBBoxUpdate",function($){if($){var O=F.state,U=O.dataStartIndex,Y=O.dataEndIndex,re=O.updateId;F.setState(Tr({legendBBox:$},g({props:F.props,dataStartIndex:U,dataEndIndex:Y,updateId:re},Tr(Tr({},F.state),{},{legendBBox:$}))))}}),ii(F,"handleReceiveSyncEvent",function($,O,U){if(F.props.syncId===$){if(U===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(O)}}),ii(F,"handleBrushChange",function($){var O=$.startIndex,U=$.endIndex;if(O!==F.state.dataStartIndex||U!==F.state.dataEndIndex){var Y=F.state.updateId;F.setState(function(){return Tr({dataStartIndex:O,dataEndIndex:U},g({props:F.props,dataStartIndex:O,dataEndIndex:U,updateId:Y},F.state))}),F.triggerSyncEvent({dataStartIndex:O,dataEndIndex:U})}}),ii(F,"handleMouseEnter",function($){var O=F.getMouseInfo($);if(O){var U=Tr(Tr({},O),{},{isTooltipActive:!0});F.setState(U),F.triggerSyncEvent(U);var Y=F.props.onMouseEnter;ki(Y)&&Y(U,$)}}),ii(F,"triggeredAfterMouseMove",function($){var O=F.getMouseInfo($),U=O?Tr(Tr({},O),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(U),F.triggerSyncEvent(U);var Y=F.props.onMouseMove;ki(Y)&&Y(U,$)}),ii(F,"handleItemMouseEnter",function($){F.setState(function(){return{isTooltipActive:!0,activeItem:$,activePayload:$.tooltipPayload,activeCoordinate:$.tooltipPosition||{x:$.cx,y:$.cy}}})}),ii(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),ii(F,"handleMouseMove",function($){$.persist(),F.throttleTriggeredAfterMouseMove($)}),ii(F,"handleMouseLeave",function($){F.throttleTriggeredAfterMouseMove.cancel();var O={isTooltipActive:!1};F.setState(O),F.triggerSyncEvent(O);var U=F.props.onMouseLeave;ki(U)&&U(O,$)}),ii(F,"handleOuterEvent",function($){var O=yVt($),U=dp(F.props,"".concat(O));if(O&&ki(U)){var Y,re;/.*touch.*/i.test(O)?re=F.getMouseInfo($.changedTouches[0]):re=F.getMouseInfo($),U((Y=re)!==null&&Y!==void 0?Y:{},$)}}),ii(F,"handleClick",function($){var O=F.getMouseInfo($);if(O){var U=Tr(Tr({},O),{},{isTooltipActive:!0});F.setState(U),F.triggerSyncEvent(U);var Y=F.props.onClick;ki(Y)&&Y(U,$)}}),ii(F,"handleMouseDown",function($){var O=F.props.onMouseDown;if(ki(O)){var U=F.getMouseInfo($);O(U,$)}}),ii(F,"handleMouseUp",function($){var O=F.props.onMouseUp;if(ki(O)){var U=F.getMouseInfo($);O(U,$)}}),ii(F,"handleTouchMove",function($){$.changedTouches!=null&&$.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove($.changedTouches[0])}),ii(F,"handleTouchStart",function($){$.changedTouches!=null&&$.changedTouches.length>0&&F.handleMouseDown($.changedTouches[0])}),ii(F,"handleTouchEnd",function($){$.changedTouches!=null&&$.changedTouches.length>0&&F.handleMouseUp($.changedTouches[0])}),ii(F,"handleDoubleClick",function($){var O=F.props.onDoubleClick;if(ki(O)){var U=F.getMouseInfo($);O(U,$)}}),ii(F,"handleContextMenu",function($){var O=F.props.onContextMenu;if(ki(O)){var U=F.getMouseInfo($);O(U,$)}}),ii(F,"triggerSyncEvent",function($){F.props.syncId!==void 0&&XX.emit(QX,F.props.syncId,$,F.eventEmitterSymbol)}),ii(F,"applySyncEvent",function($){var O=F.props,U=O.layout,Y=O.syncMethod,re=F.state.updateId,Q=$.dataStartIndex,q=$.dataEndIndex;if($.dataStartIndex!==void 0||$.dataEndIndex!==void 0)F.setState(Tr({dataStartIndex:Q,dataEndIndex:q},g({props:F.props,dataStartIndex:Q,dataEndIndex:q,updateId:re},F.state)));else if($.activeTooltipIndex!==void 0){var te=$.chartX,fe=$.chartY,G=$.activeTooltipIndex,ie=F.state,oe=ie.offset,K=ie.tooltipTicks;if(!oe)return;if(typeof Y=="function")G=Y(K,$);else if(Y==="value"){G=-1;for(var H=0;H<K.length;H++)if(K[H].value===$.activeLabel){G=H;break}}var ee=Tr(Tr({},oe),{},{x:oe.left,y:oe.top}),se=Math.min(te,ee.x+ee.width),pe=Math.min(fe,ee.y+ee.height),Se=K[G]&&K[G].value,ge=lse(F.state,F.props.data,G),ve=K[G]?{x:U==="horizontal"?K[G].coordinate:se,y:U==="horizontal"?pe:K[G].coordinate}:jVe;F.setState(Tr(Tr({},$),{},{activeLabel:Se,activeCoordinate:ve,activePayload:ge,activeTooltipIndex:G}))}else F.setState($)}),ii(F,"renderCursor",function($){var O,U=F.state,Y=U.isTooltipActive,re=U.activeCoordinate,Q=U.activePayload,q=U.offset,te=U.activeTooltipIndex,fe=U.tooltipAxisBandSize,G=F.getTooltipEventType(),ie=(O=$.props.active)!==null&&O!==void 0?O:Y,oe=F.props.layout,K=$.key||"_recharts-cursor";return ke.createElement(ian,{key:K,activeCoordinate:re,activePayload:Q,activeTooltipIndex:te,chartName:n,element:$,isActive:ie,layout:oe,offset:q,tooltipAxisBandSize:fe,tooltipEventType:G})}),ii(F,"renderPolarAxis",function($,O,U){var Y=dp($,"type.axisType"),re=dp(F.state,"".concat(Y,"Map")),Q=$.type.defaultProps,q=Q!==void 0?Tr(Tr({},Q),$.props):$.props,te=re&&re[q["".concat(Y,"Id")]];return h.cloneElement($,Tr(Tr({},te),{},{className:da(Y,te.className),key:$.key||"".concat(O,"-").concat(U),ticks:Xg(te,!0)}))}),ii(F,"renderPolarGrid",function($){var O=$.props,U=O.radialLines,Y=O.polarAngles,re=O.polarRadius,Q=F.state,q=Q.radiusAxisMap,te=Q.angleAxisMap,fe=Qb(q),G=Qb(te),ie=G.cx,oe=G.cy,K=G.innerRadius,H=G.outerRadius;return h.cloneElement($,{polarAngles:Array.isArray(Y)?Y:Xg(G,!0).map(function(ee){return ee.coordinate}),polarRadius:Array.isArray(re)?re:Xg(fe,!0).map(function(ee){return ee.coordinate}),cx:ie,cy:oe,innerRadius:K,outerRadius:H,key:$.key||"polar-grid",radialLines:U})}),ii(F,"renderLegend",function(){var $=F.state.formattedGraphicalItems,O=F.props,U=O.children,Y=O.width,re=O.height,Q=F.props.margin||{},q=Y-(Q.left||0)-(Q.right||0),te=uHe({children:U,formattedGraphicalItems:$,legendWidth:q,legendContent:u});if(!te)return null;var fe=te.item,G=z4e(te,aan);return h.cloneElement(fe,Tr(Tr({},G),{},{chartWidth:Y,chartHeight:re,margin:Q,onBBoxUpdate:F.handleLegendBBoxUpdate}))}),ii(F,"renderTooltip",function(){var $,O=F.props,U=O.children,Y=O.accessibilityLayer,re=qf(U,sm);if(!re)return null;var Q=F.state,q=Q.isTooltipActive,te=Q.activeCoordinate,fe=Q.activePayload,G=Q.activeLabel,ie=Q.offset,oe=($=re.props.active)!==null&&$!==void 0?$:q;return h.cloneElement(re,{viewBox:Tr(Tr({},ie),{},{x:ie.left,y:ie.top}),active:oe,label:G,payload:oe?fe:[],coordinate:te,accessibilityLayer:Y})}),ii(F,"renderBrush",function($){var O=F.props,U=O.margin,Y=O.data,re=F.state,Q=re.offset,q=re.dataStartIndex,te=re.dataEndIndex,fe=re.updateId;return h.cloneElement($,{key:$.key||"_recharts-brush",onChange:_F(F.handleBrushChange,$.props.onChange),data:Y,x:fs($.props.x)?$.props.x:Q.left,y:fs($.props.y)?$.props.y:Q.top+Q.height+Q.brushBottom-(U.bottom||0),width:fs($.props.width)?$.props.width:Q.width,startIndex:q,endIndex:te,updateId:"brush-".concat(fe)})}),ii(F,"renderReferenceElement",function($,O,U){if(!$)return null;var Y=F,re=Y.clipPathId,Q=F.state,q=Q.xAxisMap,te=Q.yAxisMap,fe=Q.offset,G=$.type.defaultProps||{},ie=$.props,oe=ie.xAxisId,K=oe===void 0?G.xAxisId:oe,H=ie.yAxisId,ee=H===void 0?G.yAxisId:H;return h.cloneElement($,{key:$.key||"".concat(O,"-").concat(U),xAxis:q[K],yAxis:te[ee],viewBox:{x:fe.left,y:fe.top,width:fe.width,height:fe.height},clipPathId:re})}),ii(F,"renderActivePoints",function($){var O=$.item,U=$.activePoint,Y=$.basePoint,re=$.childIndex,Q=$.isRange,q=[],te=O.props.key,fe=O.item.type.defaultProps!==void 0?Tr(Tr({},O.item.type.defaultProps),O.item.props):O.item.props,G=fe.activeDot,ie=fe.dataKey,oe=Tr(Tr({index:re,dataKey:ie,cx:U.x,cy:U.y,r:4,fill:hde(O.item),strokeWidth:2,stroke:"#fff",payload:U.payload,value:U.value},ji(G,!1)),tD(G));return q.push(S.renderActiveDot(G,oe,"".concat(te,"-activePoint-").concat(re))),Y?q.push(S.renderActiveDot(G,Tr(Tr({},oe),{},{cx:Y.x,cy:Y.y}),"".concat(te,"-basePoint-").concat(re))):Q&&q.push(null),q}),ii(F,"renderGraphicChild",function($,O,U){var Y=F.filterFormatItem($,O,U);if(!Y)return null;var re=F.getTooltipEventType(),Q=F.state,q=Q.isTooltipActive,te=Q.tooltipAxis,fe=Q.activeTooltipIndex,G=Q.activeLabel,ie=F.props.children,oe=qf(ie,sm),K=Y.props,H=K.points,ee=K.isRange,se=K.baseLine,pe=Y.item.type.defaultProps!==void 0?Tr(Tr({},Y.item.type.defaultProps),Y.item.props):Y.item.props,Se=pe.activeDot,ge=pe.hide,ve=pe.activeBar,be=pe.activeShape,we=!!(!ge&&q&&oe&&(Se||ve||be)),je={};re!=="axis"&&oe&&oe.props.trigger==="click"?je={onClick:_F(F.handleItemMouseEnter,$.props.onClick)}:re!=="axis"&&(je={onMouseLeave:_F(F.handleItemMouseLeave,$.props.onMouseLeave),onMouseEnter:_F(F.handleItemMouseEnter,$.props.onMouseEnter)});var Fe=h.cloneElement($,Tr(Tr({},Y.props),je));function Re(un){return typeof te.dataKey=="function"?te.dataKey(un.payload):null}if(we)if(fe>=0){var Qe,Ye;if(te.dataKey&&!te.allowDuplicatedCategory){var dt=typeof te.dataKey=="function"?Re:"payload.".concat(te.dataKey.toString());Qe=eD(H,dt,G),Ye=ee&&se&&eD(se,dt,G)}else Qe=H==null?void 0:H[fe],Ye=ee&&se&&se[fe];if(be||ve){var st=$.props.activeIndex!==void 0?$.props.activeIndex:fe;return[h.cloneElement($,Tr(Tr(Tr({},Y.props),je),{},{activeIndex:st})),null,null]}if(!Ai(Qe))return[Fe].concat(Cj(F.renderActivePoints({item:Y,activePoint:Qe,basePoint:Ye,childIndex:fe,isRange:ee})))}else{var at,He=(at=F.getItemByXY(F.state.activeCoordinate))!==null&&at!==void 0?at:{graphicalItem:Fe},qe=He.graphicalItem,vt=qe.item,yt=vt===void 0?$:vt,Kt=qe.childIndex,jt=Tr(Tr(Tr({},Y.props),je),{},{activeIndex:Kt});return[h.cloneElement(yt,jt),null,null]}return ee?[Fe,null,null]:[Fe,null]}),ii(F,"renderCustomized",function($,O,U){return h.cloneElement($,Tr(Tr({key:"recharts-customized-".concat(U)},F.props),F.state))}),ii(F,"renderMap",{CartesianGrid:{handler:IF,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:IF},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:IF},YAxis:{handler:IF},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((I=T.id)!==null&&I!==void 0?I:q5("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=cze(F.triggeredAfterMouseMove,(L=T.throttleDelay)!==null&&L!==void 0?L:1e3/60),F.state={},F}return ban(S,C),pan(S,[{key:"componentDidMount",value:function(){var I,L;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(I=this.props.margin.left)!==null&&I!==void 0?I:0,top:(L=this.props.margin.top)!==null&&L!==void 0?L:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var I=this.props,L=I.children,F=I.data,$=I.height,O=I.layout,U=qf(L,sm);if(U){var Y=U.props.defaultIndex;if(!(typeof Y!="number"||Y<0||Y>this.state.tooltipTicks.length-1)){var re=this.state.tooltipTicks[Y]&&this.state.tooltipTicks[Y].value,Q=lse(this.state,F,Y,re),q=this.state.tooltipTicks[Y].coordinate,te=(this.state.offset.top+$)/2,fe=O==="horizontal",G=fe?{x:q,y:te}:{y:q,x:te},ie=this.state.formattedGraphicalItems.find(function(K){var H=K.item;return H.type.name==="Scatter"});ie&&(G=Tr(Tr({},G),ie.props.points[Y].tooltipPosition),Q=ie.props.points[Y].tooltipPayload);var oe={activeTooltipIndex:Y,isTooltipActive:!0,activeLabel:re,activePayload:Q,activeCoordinate:G};this.setState(oe),this.renderCursor(U),this.accessibilityManager.setIndex(Y)}}}},{key:"getSnapshotBeforeUpdate",value:function(I,L){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==L.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==I.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==I.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(I){Vne([qf(I.children,sm)],[qf(this.props.children,sm)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var I=qf(this.props.children,sm);if(I&&typeof I.props.shared=="boolean"){var L=I.props.shared?"axis":"item";return l.indexOf(L)>=0?L:a}return a}},{key:"getMouseInfo",value:function(I){if(!this.container)return null;var L=this.container,F=L.getBoundingClientRect(),$=iKt(F),O={chartX:Math.round(I.pageX-$.left),chartY:Math.round(I.pageY-$.top)},U=F.width/L.offsetWidth||1,Y=this.inRange(O.chartX,O.chartY,U);if(!Y)return null;var re=this.state,Q=re.xAxisMap,q=re.yAxisMap,te=this.getTooltipEventType(),fe=V4e(this.state,this.props.data,this.props.layout,Y);if(te!=="axis"&&Q&&q){var G=Qb(Q).scale,ie=Qb(q).scale,oe=G&&G.invert?G.invert(O.chartX):null,K=ie&&ie.invert?ie.invert(O.chartY):null;return Tr(Tr({},O),{},{xValue:oe,yValue:K},fe)}return fe?Tr(Tr({},O),fe):null}},{key:"inRange",value:function(I,L){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,$=this.props.layout,O=I/F,U=L/F;if($==="horizontal"||$==="vertical"){var Y=this.state.offset,re=O>=Y.left&&O<=Y.left+Y.width&&U>=Y.top&&U<=Y.top+Y.height;return re?{x:O,y:U}:null}var Q=this.state,q=Q.angleAxisMap,te=Q.radiusAxisMap;if(q&&te){var fe=Qb(q);return rCe({x:O,y:U},fe)}return null}},{key:"parseEventsOfWrapper",value:function(){var I=this.props.children,L=this.getTooltipEventType(),F=qf(I,sm),$={};F&&L==="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 O=tD(this.props,this.handleOuterEvent);return Tr(Tr({},O),$)}},{key:"addListener",value:function(){XX.on(QX,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){XX.removeListener(QX,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(I,L,F){for(var $=this.state.formattedGraphicalItems,O=0,U=$.length;O<U;O++){var Y=$[O];if(Y.item===I||Y.props.key===I.key||L===c1(Y.item.type)&&F===Y.childIndex)return Y}return null}},{key:"renderClipPath",value:function(){var I=this.clipPathId,L=this.state.offset,F=L.left,$=L.top,O=L.height,U=L.width;return ke.createElement("defs",null,ke.createElement("clipPath",{id:I},ke.createElement("rect",{x:F,y:$,height:O,width:U})))}},{key:"getXScales",value:function(){var I=this.state.xAxisMap;return I?Object.entries(I).reduce(function(L,F){var $=U4e(F,2),O=$[0],U=$[1];return Tr(Tr({},L),{},ii({},O,U.scale))},{}):null}},{key:"getYScales",value:function(){var I=this.state.yAxisMap;return I?Object.entries(I).reduce(function(L,F){var $=U4e(F,2),O=$[0],U=$[1];return Tr(Tr({},L),{},ii({},O,U.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(I){var L;return(L=this.state.xAxisMap)===null||L===void 0||(L=L[I])===null||L===void 0?void 0:L.scale}},{key:"getYScaleByAxisId",value:function(I){var L;return(L=this.state.yAxisMap)===null||L===void 0||(L=L[I])===null||L===void 0?void 0:L.scale}},{key:"getItemByXY",value:function(I){var L=this.state,F=L.formattedGraphicalItems,$=L.activeItem;if(F&&F.length)for(var O=0,U=F.length;O<U;O++){var Y=F[O],re=Y.props,Q=Y.item,q=Q.type.defaultProps!==void 0?Tr(Tr({},Q.type.defaultProps),Q.props):Q.props,te=c1(Q.type);if(te==="Bar"){var fe=(re.data||[]).find(function(K){return ytn(I,K)});if(fe)return{graphicalItem:Y,payload:fe}}else if(te==="RadialBar"){var G=(re.data||[]).find(function(K){return rCe(I,K)});if(G)return{graphicalItem:Y,payload:G}}else if(pz(Y,$)||mz(Y,$)||jk(Y,$)){var ie=lnn({graphicalItem:Y,activeTooltipItem:$,itemData:q.data}),oe=q.activeIndex===void 0?ie:q.activeIndex;return{graphicalItem:Tr(Tr({},Y),{},{childIndex:oe}),payload:jk(Y,$)?q.data[ie]:Y.props.data[ie]}}}return null}},{key:"render",value:function(){var I=this;if(!mwe(this))return null;var L=this.props,F=L.children,$=L.className,O=L.width,U=L.height,Y=L.style,re=L.compact,Q=L.title,q=L.desc,te=z4e(L,oan),fe=ji(te,!1);if(re)return ke.createElement(b4e,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ke.createElement(qne,m4({},fe,{width:O,height:U,title:Q,desc:q}),this.renderClipPath(),gwe(F,this.renderMap)));if(this.props.accessibilityLayer){var G,ie;fe.tabIndex=(G=this.props.tabIndex)!==null&&G!==void 0?G:0,fe.role=(ie=this.props.role)!==null&&ie!==void 0?ie:"application",fe.onKeyDown=function(K){I.accessibilityManager.keyboardEvent(K)},fe.onFocus=function(){I.accessibilityManager.focus()}}var oe=this.parseEventsOfWrapper();return ke.createElement(b4e,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ke.createElement("div",m4({className:da("recharts-wrapper",$),style:Tr({position:"relative",cursor:"default",width:O,height:U},Y)},oe,{ref:function(H){I.container=H}}),ke.createElement(qne,m4({},fe,{width:O,height:U,title:Q,desc:q,style:San}),this.renderClipPath(),gwe(F,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(h.Component);ii(y,"displayName",n),ii(y,"defaultProps",Tr({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ii(y,"getDerivedStateFromProps",function(C,S){var T=C.dataKey,I=C.data,L=C.children,F=C.width,$=C.height,O=C.layout,U=C.stackOffset,Y=C.margin,re=S.dataStartIndex,Q=S.dataEndIndex;if(S.updateId===void 0){var q=W4e(C);return Tr(Tr(Tr({},q),{},{updateId:0},g(Tr(Tr({props:C},q),{},{updateId:0}),S)),{},{prevDataKey:T,prevData:I,prevWidth:F,prevHeight:$,prevLayout:O,prevStackOffset:U,prevMargin:Y,prevChildren:L})}if(T!==S.prevDataKey||I!==S.prevData||F!==S.prevWidth||$!==S.prevHeight||O!==S.prevLayout||U!==S.prevStackOffset||!z4(Y,S.prevMargin)){var te=W4e(C),fe={chartX:S.chartX,chartY:S.chartY,isTooltipActive:S.isTooltipActive},G=Tr(Tr({},V4e(S,I,O)),{},{updateId:S.updateId+1}),ie=Tr(Tr(Tr({},te),fe),G);return Tr(Tr(Tr({},ie),g(Tr({props:C},ie),S)),{},{prevDataKey:T,prevData:I,prevWidth:F,prevHeight:$,prevLayout:O,prevStackOffset:U,prevMargin:Y,prevChildren:L})}if(!Vne(L,S.prevChildren)){var oe,K,H,ee,se=qf(L,cj),pe=se&&(oe=(K=se.props)===null||K===void 0?void 0:K.startIndex)!==null&&oe!==void 0?oe:re,Se=se&&(H=(ee=se.props)===null||ee===void 0?void 0:ee.endIndex)!==null&&H!==void 0?H:Q,ge=pe!==re||Se!==Q,ve=!Ai(I),be=ve&&!ge?S.updateId:S.updateId+1;return Tr(Tr({updateId:be},g(Tr(Tr({props:C},S),{},{updateId:be,dataStartIndex:pe,dataEndIndex:Se}),S)),{},{prevChildren:L,dataStartIndex:pe,dataEndIndex:Se})}return null}),ii(y,"renderActiveDot",function(C,S,T){var I;return h.isValidElement(C)?I=h.cloneElement(C,S):ki(C)?I=C(S):I=ke.createElement(hz,S),ke.createElement(_a,{className:"recharts-active-dot",key:T},I)});var v=h.forwardRef(function(S,T){return ke.createElement(y,m4({},S,{ref:T}))});return v.displayName=y.displayName,v},Oan=_Ve({chartName:"LineChart",GraphicalChild:U0,axisComponents:[{axisType:"xAxis",AxisComp:D8},{axisType:"yAxis",AxisComp:B8}],formatAxisMap:LHe}),Man=_Ve({chartName:"ComposedChart",GraphicalChild:[U0,X5,L8,Cz],axisComponents:[{axisType:"xAxis",AxisComp:D8},{axisType:"yAxis",AxisComp:B8},{axisType:"zAxis",AxisComp:wz}],formatAxisMap:LHe});const Lan=({wallet:t})=>{const[e,n]=h.useState([]),[r]=h.useState("allTime"),[s]=h.useState("pnlHistory"),[a,o]=h.useState(!1),l=h.useRef(null),c=t||"";return h.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 T=(((g=(x=(await Ns.post("https://api-ui.hyperliquid.xyz/info",{type:"portfolio",user:c},{headers:{Accept:"*/*","Content-Type":"application/json"},signal:u.signal})).data.find(I=>I[0]===f))==null?void 0:x[1])==null?void 0:g[s])||[]).map(([I,L])=>({time:new Date(I).getTime(),value:parseFloat(L)}));n(T)}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(JAe,{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(uze,{width:"100%",height:40,children:i.jsxs(Oan,{data:e,children:[i.jsx(D8,{dataKey:"time",hide:!0}),i.jsx(B8,{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:["$",Ir(f.value)]})]})]})}return null},wrapperStyle:{marginLeft:"-40px",marginTop:"-50px"}}),i.jsx(U0,{type:"monotone",dataKey:"value",stroke:"#67FFBD",strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})},Ran="https://dextradata.nftinit.io/api/hyper/analytics/wallet_backtest_summary/?format=json&limit=48&offset=0&order_by=three_month_pnl&order_dir=desc",Dan=({handleAddedTime:t})=>{const{trackedWatchList:e,copyTradeWatchList:n,setSignModalOpen:r}=h.useContext(Qr),{address:s}=ds(),[a,o]=h.useState([]),[l,c]=h.useState(!0),[u,d]=h.useState(null),[f,x]=h.useState(1),g=typeof window<"u"&&window.innerWidth>640?4:2,[y,v]=h.useState(!1),[C,S]=h.useState(null),[T,I]=h.useState(null),[L,F]=h.useState("");h.useEffect(()=>{(async()=>{try{c(!0),d(null);const Q=await fetch(Ran);if(!Q.ok)throw new Error(`HTTP error! status: ${Q.status}`);const q=await Q.json();o((q==null?void 0:q.data)||[])}catch{d("Failed to fetch wallets.")}finally{c(!1)}})()},[]);const $=async({walletAddress:re,isFollow:Q,isScalper:q})=>{try{F(re);const te=window.localStorage.getItem("hyperToken"),fe=window.localStorage.getItem("hyperAddress");if(!te){r(!0);return}const G=Q?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",ie=Q?{address:s?s.toLowerCase():fe,token:te,follow_address:re.toLowerCase()}:{address:s?s.toLowerCase():fe,token:te},oe=await fetch(G,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ie)});if(!oe.ok)throw new Error(`Server responded with status ${oe.status}`);const K=await oe.json();K.success?(S(Array.isArray(K==null?void 0:K.data)?[...K.data].sort((H,ee)=>new Date(ee.created_at||0)-new Date(H.created_at||0)):K==null?void 0:K.data),I(q),v(!0)):fn.error(K.error_message)}catch(te){fn.error(te.message||"Something went wrong!")}},O=Math.ceil(a.length/g),U=(f-1)*g,Y=a.slice(U,U+g);return i.jsxs(i.Fragment,{children:[i.jsx(V5,{open:y,setOpen:v,copyTradeData:C,copyTradeWallet:L,setCopyTradeWallet:F,isScalper:T,setCopyTradeData:S}),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(ka,{})}):i.jsxs(i.Fragment,{children:[Y==null?void 0:Y.map((re,Q)=>{var fe,G,ie,oe,K,H,ee,se,pe;const q=e==null?void 0:e.some(Se=>Se.wallet_address===(re==null?void 0:re.user_token)),te=n==null?void 0:n.some(Se=>Se.wallet_address===(re==null?void 0:re.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:Q*.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:Hi,alt:"",className:"w-7 h-7 sm:w-8 sm:h-8 rounded-md"}),i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${re==null?void 0:re.user_token}`,"_blank"),t()},className:"text-white text-[12px] sm:text-base font-semibold font-manrope leading-none tracking-wide cursor-pointer",children:(re==null?void 0:re.user_token)&&(re==null?void 0:re.user_token.slice(0,6))+"..."+(re==null?void 0:re.user_token.slice(-4))}),i.jsx(H5,{walletAddress:re==null?void 0:re.user_token,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:q?i.jsx("img",{src:k5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:qj,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})}),i.jsx(Lan,{wallet:re==null?void 0:re.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(JX,{title:"PNL",data:[{label:"7D:",value:(fe=re==null?void 0:re.source_data)==null?void 0:fe.portfolio_perp_week_pnl,format:zs},{label:"30D:",value:(G=re==null?void 0:re.source_data)==null?void 0:G.portfolio_perp_month_pnl,format:zs},{label:"90D:",value:(ie=re==null?void 0:re.source_data)==null?void 0:ie.portfolio_perp_3month_pnl,format:zs}]}),i.jsx(JX,{title:"Growth Rate",data:[{label:"7D:",value:(oe=re==null?void 0:re.source_data)==null?void 0:oe.portfolio_perp_week_growth_rate},{label:"30D:",value:(K=re==null?void 0:re.source_data)==null?void 0:K.portfolio_perp_month_growth_rate},{label:"90D:",value:(H=re==null?void 0:re.source_data)==null?void 0:H.portfolio_perp_3month_growth_rate}]}),i.jsx(JX,{title:"Drawdown",data:[{label:"7D:",value:(ee=re==null?void 0:re.source_data)==null?void 0:ee.portfolio_perp_week_dd,format:zs},{label:"30D:",value:(se=re==null?void 0:re.source_data)==null?void 0:se.portfolio_perp_month_dd,format:zs},{label:"90D:",value:(pe=re==null?void 0:re.source_data)==null?void 0:pe.portfolio_perp_3month_dd,format:zs}]})]}),i.jsxs(pm.button,{onClick:Se=>{Se.preventDefault(),$({walletAddress:re==null?void 0:re.user_token,isFollow:te,isScalper:re==null?void 0:re.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"}})]})]})]})]})},`${U+Q}-${re==null?void 0:re.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(re=>re-1),disabled:f===1,children:"Prev"}),i.jsxs("span",{className:"text-white text-sm",children:["Page ",f," of ",O]}),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(re=>re+1),disabled:f===O,children:"Next"})]})]})})]})},JX=({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)):zs(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]"})]}),Ban=({open:t,setOpen:e,sevenSelectShow:n})=>{const[r,s]=h.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(ha,{open:t,onClose:a,className:"relative z-50",children:[i.jsx(fa,{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(Ji,{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:Na,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(Dan,{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"})]})]})})})})]})},$an=()=>{const[t,e]=h.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(Ban,{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 Uan(){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($an,{})}),i.jsxs("div",{className:"h-full w-full flex items-center justify-end gap-2",children:[i.jsx(sUt,{}),i.jsx(iUt,{}),i.jsx(aUt,{}),i.jsx(oUt,{})]})]})})}const zan=()=>{const t=Pl();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(rUt,{}),i.jsx("div",{className:"hidden sm:block",children:i.jsx(k$t,{})}),i.jsx("div",{className:"block sm:hidden",children:i.jsx(nUt,{})}),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(gZe,{})})}),i.jsx(Uan,{})]})},sa=({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})]}),ro=({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"})}),Sz=({sortKey:t,state:e,className:n})=>"-"+t===e?i.jsx(ro,{className:"text-white hover:text-[#D8D3D3] group-hover:text-[#D8D3D3] rotate-180 "+n}):t===e?i.jsx(ro,{className:"text-white hover:text-[#D8D3D3] group-hover:text-[#D8D3D3] "+n}):i.jsx(ro,{className:"text-[#9B9B9B] hover:text-[#D8D3D3] group-hover:text-[#D8D3D3] "+n}),tl=({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(Sz,{sortKey:e,state:n,className:""})]})})};function Bl(t){const[e,n]=h.useState(t.minFilterType||""),[r,s]=h.useState(t.maxFilterType||"");h.useEffect(()=>{n(t.minFilterType||"")},[t.minFilterType]),h.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(us,{className:"text-[#c9c9c9] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(Ra,{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 G4e(t){h.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 Han=({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"})}),eQ=({title:t,titleInfo:e,icon:n,children:r})=>{const[s,a]=h.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(Han,{})})]}),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})]})},Van=({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"})]}),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.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"})}),qan=({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"})});lze();function Gan(t){var Y,re,Q,q,te,fe,G,ie,oe,K;const[e,n]=h.useState(!1),r=h.useRef(null),[s,a]=h.useState(!1),o=h.useRef(null);h.useEffect(()=>{var ee;const H=(ee=t.advancedFilters)==null?void 0:ee.coin;if(t.dataCoin.length>0){const pe=H.split(",").map(Se=>t.dataCoin.find(ge=>ge.value===Se)).filter(Boolean);t.setSelectedCoins(pe)}},[t.dataCoin]),h.useEffect(()=>{var ee;const H=(ee=t.advancedFilters)==null?void 0:ee.refcode;if(H&&t.dataReferral.length>0){const pe=H.split(",").map(Se=>t.dataReferral.find(ge=>ge.value===Se)).filter(Boolean);t.setSelectedReferrals(pe)}},[t.dataReferral]);const l=H=>{if(!H)return;const se=Array.isArray(H)?H:[H],pe=t.selectedCoins||[],Se=[...pe,...se.filter(be=>!pe.some(we=>we.value===be.value))],ve=Se.map(be=>be.value).join(",");t.setSelectedCoins(Se),t.setAdvancedFilters(be=>({...be,coin:ve}))},c=H=>{if(!H)return;const se=Array.isArray(H)?H:[H],pe=t.selectedReferrals||[],Se=[...pe,...se.filter(ve=>!pe.some(be=>be.value===ve.value))],ge=Se.map(ve=>ve.value);ge.join(","),t.setSelectedReferrals(Se),t.setAdvancedFilters(ve=>({...ve,refcode:ge}))},u=H=>{const{name:ee,value:se}=H.target;t.setAdvancedFilters(pe=>({...pe,[ee]:se}))},d={control:(H,{isFocused:ee})=>{var se,pe,Se,ge,ve,be,we,je;return{...H,display:"flex",alignItems:"center",paddingLeft:"21px",backgroundColor:"#353535",minHeight:"32px",maxHeight:"32px",border:Array.isArray((se=t.advancedFilters)==null?void 0:se.coin)&&((pe=t.advancedFilters)==null?void 0:pe.coin.length)>0||typeof((Se=t.advancedFilters)==null?void 0:Se.coin)=="string"&&((ge=t.advancedFilters)==null?void 0:ge.coin.trim())!==""?"1px solid #8d67ff":"none",boxShadow:"none",borderRadius:"6px",":hover":{border:Array.isArray((ve=t.advancedFilters)==null?void 0:ve.coin)&&((be=t.advancedFilters)==null?void 0:be.coin.length)>0||typeof((we=t.advancedFilters)==null?void 0:we.coin)=="string"&&((je=t.advancedFilters)==null?void 0:je.coin.trim())!==""?"1px solid #8d67ff":"none"}}},menu:H=>({...H,backgroundColor:"#353535",maxWidth:"248px"}),menuList:H=>({...H,backgroundColor:"#353535",maxHeight:"180px",zIndex:50}),clearIndicator:H=>({...H,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:H=>({...H,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:(H,{data:ee,isDisabled:se,isFocused:pe,isSelected:Se})=>{const ge=wi(ee.color);return{...H,fontSize:"14px",fontWeight:"600",backgroundColor:se?void 0:Se?ee.color:pe?ge.alpha(.1).css():void 0,color:"white",cursor:se?"not-allowed":"pointer",":active":{...H[":active"],backgroundColor:se?void 0:Se?ee.color:ge.alpha(.9).css()}}},multiValue:(H,{data:ee})=>{const se=wi(ee.color);return{...H,backgroundColor:se.alpha(.4).css()}},multiValueLabel:(H,{data:ee})=>({...H,color:"white"}),multiValueRemove:(H,{data:ee})=>({...H,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.3)",color:"white"}}),input:H=>({...H,color:"white"}),valueContainer:H=>({...H,paddingTop:"0px",fontSize:"14px",fontWeight:"600"})},f={control:(H,{isFocused:ee})=>{var se,pe,Se,ge,ve,be,we,je;return{...H,display:"flex",alignItems:"center",paddingLeft:"21px",backgroundColor:"#353535",minHeight:"32px",maxHeight:"32px",border:Array.isArray((se=t.advancedFilters)==null?void 0:se.refcode)&&((pe=t.advancedFilters)==null?void 0:pe.refcode.length)>0||typeof((Se=t.advancedFilters)==null?void 0:Se.refcode)=="string"&&((ge=t.advancedFilters)==null?void 0:ge.refcode.trim())!==""?"1px solid #8d67ff":"none",boxShadow:"none",borderRadius:"6px",":hover":{border:Array.isArray((ve=t.advancedFilters)==null?void 0:ve.refcode)&&((be=t.advancedFilters)==null?void 0:be.refcode.length)>0||typeof((we=t.advancedFilters)==null?void 0:we.refcode)=="string"&&((je=t.advancedFilters)==null?void 0:je.refcode.trim())!==""?"1px solid #8d67ff":"none"}}},menu:H=>({...H,backgroundColor:"#353535",maxWidth:"248px"}),menuList:H=>({...H,backgroundColor:"#353535",maxHeight:"180px",zIndex:4}),clearIndicator:H=>({...H,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:H=>({...H,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:(H,{data:ee,isDisabled:se,isFocused:pe,isSelected:Se})=>{const ge=wi(ee.color);return{...H,fontSize:"14px",fontWeight:"600",backgroundColor:se?void 0:Se?ee.color:pe?ge.alpha(.1).css():void 0,color:"white",cursor:se?"not-allowed":"pointer",":active":{...H[":active"],backgroundColor:se?void 0:Se?ee.color:ge.alpha(.9).css()}}},multiValue:(H,{data:ee})=>{const se=wi(ee.color);return{...H,backgroundColor:se.alpha(.4).css()}},multiValueLabel:(H,{data:ee})=>({...H,color:"white"}),multiValueRemove:(H,{data:ee})=>({...H,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.3)",color:"white"}}),input:H=>({...H,color:"white"}),valueContainer:H=>({...H,paddingTop:"0px",fontSize:"14px",fontWeight:"600"})},x=(H,ee)=>{var pe;const se=(pe=ee.selectedCoins)==null?void 0:pe.filter(Se=>Se.value!==H.value);ee.setSelectedCoins(se),ee.setAdvancedFilters(Se=>({...Se,coin:se==null?void 0:se.map(ve=>ve.value)}))},g=(H,ee)=>{var pe;const se=(pe=ee.selectedReferrals)==null?void 0:pe.filter(Se=>Se.value!==H.value);ee.setSelectedReferrals(se),ee.setAdvancedFilters(Se=>({...Se,refcode:se==null?void 0:se.map(ve=>ve.value)}))};h.useEffect(()=>{const H=ee=>{r.current&&!r.current.contains(ee.target)&&n(!1)};return document.addEventListener("mousedown",H),()=>{document.removeEventListener("mousedown",H)}},[]),h.useEffect(()=>{const H=ee=>{o.current&&!o.current.contains(ee.target)&&a(!1)};return document.addEventListener("mousedown",H),()=>{document.removeEventListener("mousedown",H)}},[]);const y=async()=>{t.setAdvancedFilters(H=>({...H,user_token:""}))},v=({src:H,alt:ee})=>{const[se,pe]=ke.useState(!1);return se?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:H,alt:ee,className:"rounded-full w-5 h-5 min-w-5 min-h-5 mr-1",loading:"lazy",onError:()=>pe(!0)})},C=H=>{const{data:ee,innerRef:se,innerProps:pe,selectProps:Se}=H,ge=Se.styles.option({},H);return i.jsxs("div",{ref:se,...pe,style:ge,className:"flex items-center p-2",children:[i.jsx(v,{src:ee.icon,alt:ee.label}),ee.label]})},S=(H,ee)=>ee.reduce((se,pe)=>{const Se=H[pe];return Se!==void 0&&Se!==""&&Se!==null&&se++,se},0),T=()=>{const H=t.advancedFilters.is_favorite_wallet?"":!0;t.setAdvancedFilters(ee=>({...ee,is_favorite_wallet:H}))},I=["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"],L=["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"],O=["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"],U=["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:(Y=t.advancedFilters)==null?void 0:Y.user_token,onChange:u,type:"text",name:"user_token",placeholder:"Search Wallet",className:`${(re=t.advancedFilters)!=null&&re.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(Vy,{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(H=>({...H,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(Vy,{className:"text-[#646464] absolute left-[6px] top-[7px] z-10"}),i.jsx(pl,{closeMenuOnSelect:!1,value:[],isMulti:!0,options:t.dataCoin.filter(H=>Array.isArray(t.selectedCoins)&&!t.selectedCoins.some(ee=>ee.value===H.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&&((Q=t.selectedCoins)==null?void 0:Q.length)>0?"block":"hidden"}`,children:t.selectedCoins&&((q=t.selectedCoins)==null?void 0:q.map(H=>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:H==null?void 0:H.icon,alt:H==null?void 0:H.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:H.label}),i.jsx("div",{onClick:ee=>{ee.stopPropagation(),x(H,t)},className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(Aw,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},H.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(H=>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:H==null?void 0:H.icon,alt:H==null?void 0:H.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:H.label}),i.jsx("div",{onClick:()=>x(H,t),className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(Aw,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},H.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:$9e,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:T,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:T,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:xct,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(H=>({...H,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(Vy,{className:`${e?"-z-10":"z-10"} text-[#646464] absolute left-[6px] top-[7px]`}),i.jsx(pl,{closeMenuOnSelect:!1,value:[],isMulti:!0,options:t.dataReferral.filter(H=>Array.isArray(t.selectedReferrals)&&!t.selectedReferrals.some(ee=>ee.value===H.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&&((G=t.selectedReferrals)==null?void 0:G.length)>0?"block":"hidden"}`,children:t.selectedReferrals&&((ie=t.selectedReferrals)==null?void 0:ie.map(H=>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:H.label}),i.jsx("div",{onClick:ee=>{ee.stopPropagation(),g(H,t)},className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(Aw,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},H.value)))}),i.jsx("div",{className:`${((oe=t.selectedReferrals)==null?void 0:oe.length)>0?"mt-2.5":""} flex flex-wrap gap-1 max-w-[248px]`,children:t.selectedReferrals&&((K=t.selectedReferrals)==null?void 0:K.map(H=>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:H.label}),i.jsx("div",{onClick:()=>g(H,t),className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(Aw,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},H.value)))})]})})]})]}),i.jsxs(eQ,{title:"Wallet Filters",titleInfo:S(t.advancedFilters,t.period!=999?I:L),icon:i.jsx(Van,{className:"text-white"}),children:[i.jsx(Bl,{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(Bl,{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(Bl,{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(Bl,{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(Bl,{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(Bl,{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(Bl,{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(Bl,{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(eQ,{title:"Performance Filters",titleInfo:S(t.advancedFilters,t.period==999?$:t.period==1?O:F),icon:i.jsx(Wan,{}),children:[i.jsx(Bl,{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(Bl,{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(Bl,{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(Bl,{minFilterType:t.advancedFilters.min_sharpe,maxFilterType:t.advancedFilters.max_sharpe,handleChange:u,minInputName:"min_sharpe",maxInputName:"max_sharpe",name:"Sharpe",isTooltip:!1}),i.jsx(Bl,{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(Bl,{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(Bl,{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(Bl,{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(Bl,{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(Bl,{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(Bl,{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(Bl,{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(eQ,{title:"Date Filters",titleInfo:S(t.advancedFilters,U),icon:i.jsx(qan,{}),children:[i.jsx(G4e,{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(G4e,{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 Kan=({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:S,dataReferral:T,selectedReferrals:I,setSelectedReferrals:L,isLoadingReferral:F,setIsLoadingReferral:$})=>{const[O,U]=h.useState(!1);return h.useEffect(()=>{localStorage.getItem("fire_ref_modal_seen")||U(!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(Gan,{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:S,dataReferral:T,selectedReferrals:I,setSelectedReferrals:L,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"})})})})})]})})},EVe=()=>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:Dlt,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"]})]})]})]}),K4e=({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))?"-":zs(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"})})]})})},Sde=({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 Yan({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(us,{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 Xan=({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 Qan({open:t,setOpen:e}){return i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Hi,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 Zan(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 Jan=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function qy(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let EC=null;function kVe(t={}){return EC||(t.includeStyleProperties?(EC=t.includeStyleProperties,EC):(EC=qy(window.getComputedStyle(document.documentElement)),EC))}function ZD(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function eon(t){const e=ZD(t,"border-left-width"),n=ZD(t,"border-right-width");return t.clientWidth+e+n}function ton(t){const e=ZD(t,"border-top-width"),n=ZD(t,"border-bottom-width");return t.clientHeight+e+n}function TVe(t,e={}){const n=e.width||eon(t),r=e.height||ton(t);return{width:n,height:r}}function non(){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 Lf=16384;function ron(t){(t.width>Lf||t.height>Lf)&&(t.width>Lf&&t.height>Lf?t.width>t.height?(t.height*=Lf/t.width,t.width=Lf):(t.width*=Lf/t.height,t.height=Lf):t.width>Lf?(t.height*=Lf/t.width,t.width=Lf):(t.width*=Lf/t.height,t.height=Lf))}function JD(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 son(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function ion(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),son(s)}const mf=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||mf(n,e)};function aon(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function oon(t,e){return kVe(e).map(n=>{const r=t.getPropertyValue(n),s=t.getPropertyPriority(n);return`${n}: ${r}${s?" !important":""};`}).join(" ")}function lon(t,e,n,r){const s=`.${t}:${e}`,a=n.cssText?aon(n):oon(n,r);return document.createTextNode(`${s}{${a}}`)}function Y4e(t,e,n,r){const s=window.getComputedStyle(t,n),a=s.getPropertyValue("content");if(a===""||a==="none")return;const o=Jan();try{e.className=`${e.className} ${o}`}catch{return}const l=document.createElement("style");l.appendChild(lon(o,n,s,r)),e.appendChild(l)}function con(t,e,n){Y4e(t,e,":before",n),Y4e(t,e,":after",n)}const X4e="application/font-woff",Q4e="image/jpeg",uon={woff:X4e,woff2:X4e,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Q4e,jpeg:Q4e,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function don(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function jde(t){const e=don(t).toLowerCase();return uon[e]||""}function fon(t){return t.split(/,/)[1]}function cse(t){return t.search(/^(data:)/)!==-1}function hon(t,e){return`data:${e};base64,${t}`}async function PVe(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 tQ={};function pon(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 Ade(t,e,n){const r=pon(t,e,n.includeQueryParams);if(tQ[r]!=null)return tQ[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let s;try{const a=await PVe(t,n.fetchRequestInit,({res:o,result:l})=>(e||(e=o.headers.get("Content-Type")||""),fon(l)));s=hon(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 tQ[r]=s,s}async function mon(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):JD(e)}async function xon(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 JD(l)}const n=t.poster,r=jde(n),s=await Ade(n,r,e);return JD(s)}async function gon(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await jz(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function bon(t,e){return mf(t,HTMLCanvasElement)?mon(t):mf(t,HTMLVideoElement)?xon(t,e):mf(t,HTMLIFrameElement)?gon(t,e):t.cloneNode(IVe(t))}const yon=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",IVe=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function von(t,e,n){var r,s;if(IVe(e))return e;let a=[];return yon(t)&&t.assignedNodes?a=qy(t.assignedNodes()):mf(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?a=qy(t.contentDocument.body.childNodes):a=qy(((s=t.shadowRoot)!==null&&s!==void 0?s:t).childNodes),a.length===0||mf(t,HTMLVideoElement)||await a.reduce((o,l)=>o.then(()=>jz(l,n)).then(c=>{c&&e.appendChild(c)}),Promise.resolve()),e}function won(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):kVe(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`),mf(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 Con(t,e){mf(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),mf(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function Non(t,e){if(mf(t,HTMLSelectElement)){const n=e,r=Array.from(n.children).find(s=>t.value===s.getAttribute("value"));r&&r.setAttribute("selected","")}}function Son(t,e,n){return mf(e,Element)&&(won(t,e,n),con(t,e,n),Con(t,e),Non(t,e)),e}async function jon(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 jz(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 jz(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>bon(r,e)).then(r=>von(t,r,e)).then(r=>Son(t,r,e)).then(r=>jon(r,e))}const FVe=/url\((['"]?)([^'"]+?)\1\)/g,Aon=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,_on=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Eon(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function kon(t){const e=[];return t.replace(FVe,(n,r,s)=>(e.push(s),n)),e.filter(n=>!cse(n))}async function Ton(t,e,n,r,s){try{const a=n?Zan(e,n):e,o=jde(e);let l;return s||(l=await Ade(a,o,r)),t.replace(Eon(e),`$1${l}$3`)}catch{}return t}function Pon(t,{preferredFontFormat:e}){return e?t.replace(_on,n=>{for(;;){const[r,,s]=Aon.exec(n)||[];if(!s)return"";if(s===e)return`src: ${r};`}}):t}function OVe(t){return t.search(FVe)!==-1}async function MVe(t,e,n){if(!OVe(t))return t;const r=Pon(t,n);return kon(r).reduce((a,o)=>a.then(l=>Ton(l,o,e,n)),Promise.resolve(r))}async function kC(t,e,n){var r;const s=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(s){const a=await MVe(s,null,n);return e.style.setProperty(t,a,e.style.getPropertyPriority(t)),!0}return!1}async function Ion(t,e){await kC("background",t,e)||await kC("background-image",t,e),await kC("mask",t,e)||await kC("-webkit-mask",t,e)||await kC("mask-image",t,e)||await kC("-webkit-mask-image",t,e)}async function Fon(t,e){const n=mf(t,HTMLImageElement);if(!(n&&!cse(t.src))&&!(mf(t,SVGImageElement)&&!cse(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,s=await Ade(r,jde(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 Oon(t,e){const r=qy(t.childNodes).map(s=>LVe(s,e));await Promise.all(r).then(()=>t)}async function LVe(t,e){mf(t,Element)&&(await Ion(t,e),await Fon(t,e),await Oon(t,e))}function Mon(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 Z4e={};async function J4e(t){let e=Z4e[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},Z4e[t]=e,e}async function eNe(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),PVe(l,e.fetchRequestInit,({result:c})=>(n=n.replace(o,`url(${c})`),[o,c]))});return Promise.all(a).then(()=>n)}function tNe(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 Lon(t,e){const n=[],r=[];return t.forEach(s=>{if("cssRules"in s)try{qy(s.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let l=o+1;const c=a.href,u=J4e(c).then(d=>eNe(d,e)).then(d=>tNe(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(J4e(s.href).then(l=>eNe(l,e)).then(l=>tNe(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{qy(s.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${s.href}`,a)}}),n))}function Ron(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>OVe(e.style.getPropertyValue("src")))}async function Don(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=qy(t.ownerDocument.styleSheets),r=await Lon(n,e);return Ron(r)}function RVe(t){return t.trim().replace(/["']/g,"")}function Bon(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(a=>{e.add(RVe(a))}),Array.from(r.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(t),e}async function $on(t,e){const n=await Don(t,e),r=Bon(t);return(await Promise.all(n.filter(a=>r.has(RVe(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return MVe(a.cssText,o,e)}))).join(`
`)}async function Uon(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await $on(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 zon(t,e={}){const{width:n,height:r}=TVe(t,e),s=await jz(t,e,!0);return await Uon(s,e),await LVe(s,e),Mon(s,e),await ion(s,n,r)}async function Hon(t,e={}){const{width:n,height:r}=TVe(t,e),s=await zon(t,e),a=await JD(s),o=document.createElement("canvas"),l=o.getContext("2d"),c=e.pixelRatio||non(),u=e.canvasWidth||n,d=e.canvasHeight||r;return o.width=u*c,o.height=d*c,e.skipAutoScale||ron(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 q1(t,e={}){return(await Hon(t,e)).toDataURL()}function Von({open:t,setOpen:e,data:n,setTradeInfo:r,period:s}){const a=h.useRef(null),o=async()=>{if(a.current)try{await document.fonts.ready,await new Promise(u=>setTimeout(u,500));const l=await q1(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),fn.success("PNG successfully downloaded!")}catch(l){console.error("Error generating PNG:",l),fn.error("Failed to download PNG.")}};return i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),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:Yj,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))?"--":`$${zs(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))?"--":zs(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:Gj,alt:"",className:"h-full"}):i.jsx("img",{src:Kj,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))?"--":`$${zs(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))?"--":`$${zs(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"),fn.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${zs(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 Won({open:t,setOpen:e,data:n,setTradeInfo:r}){const s=h.useRef(null),a=async()=>{if(s.current)try{await document.fonts.ready,await new Promise(c=>setTimeout(c,500));const o=await q1(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),fn.success("PNG successfully downloaded!")}catch(o){console.error("Error generating PNG:",o),fn.error("Failed to download PNG.")}};return i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),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:Yj,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))?"--":`${zs(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))?"--":`$${zs(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:Gj,alt:"",className:"h-full"}):i.jsx("img",{src:Kj,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))?"--":`$${zs(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))?"--":`$${zs(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"),fn.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?"":"-"}$${zs(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 DVe=()=>{const[t,e]=h.useState(!1);h.useEffect(()=>{(()=>{localStorage.getItem("isCopyTradeIntroductionModal")||(e(!0),localStorage.removeItem("copyTradeIntroductionModal"))})()},[]),h.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(ha,{open:t,onClose:n,className:"relative z-50 font-manrope hidden lg:block",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-2 px-2",children:i.jsx("img",{src:Zlt,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. 🚀"})]})]})})})})})]})},qon=({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}`})]})})}),Gon=({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]=h.useState([]),[g,y]=h.useState(!0),[v,C]=h.useState(null),{hyperToken:S,copyTradeWatchList:T,getCopyTradeWatchList:I,trackedWatchList:L,getTrackedWatchList:F,setSignModalOpen:$,setTelegramChatId:O,setSubscriberRole:U,setSubsExpireDay:Y,setMushboomerETH:re,setMushboomerSOL:Q,setIsReferralCode:q,isReferralCodeName:te,setIsReferralCodeName:fe,setIsWhitelist:G,setHyperToken:ie,setHyperAddress:oe}=h.useContext(Qr),{isConnected:K,address:H}=ds();yo(),Pl();const[ee,se]=h.useState(!1),[pe,Se]=h.useState(null),[ge,ve]=h.useState(null),[be,we]=h.useState(""),[je,Fe]=h.useState(""),[Re,Qe]=h.useState(""),[Ye,dt]=h.useState(""),[st,at]=h.useState(""),[He,qe]=h.useState([]),[vt,yt]=h.useState(!0),[Kt,jt]=h.useState([]),[un,vn]=h.useState([]),[Hn,ln]=h.useState(!0),[Nn,dn]=h.useState([]),[rt,nt]=h.useState(!1),[Ut,wn]=h.useState(!1),Jt=`portfolio_perp_${{1:"day",7:"week",30:"month",90:"3month",999:"all_time"}[a]||"day"}_pnl`,Vt=`portfolio_perp_${{1:"day",7:"week",30:"month",90:"3month",999:"all_time"}[a]||"day"}_dd`,xt=`portfolio_perp_${{1:"day",7:"week",30:"month",90:"3month",999:"all_time"}[a]||"day"}_growth_rate`,We=`portfolio_perp_${{1:"day",7:"week",30:"month",90:"3month",999:"all_time"}[a]||"day"}_sharpe`;function Pt(xe){if(!xe)return"--";const Ge=parseInt(xe==null?void 0:xe.split(":")[0]),_e=parseInt(xe==null?void 0:xe.split(":")[1]);return`${Ge}h ${_e}m`}h.useEffect(()=>{(async()=>{var Be,qt;const Ge=window.localStorage.getItem("hyperToken"),_e=window.localStorage.getItem("hyperAddress");if(!(!Ge||!_e))try{const It=await bi(_e.toLowerCase(),Ge);It!=null&&It.success?(O(It==null?void 0:It.telegram_chat_id),U(It==null?void 0:It.subscriber_role),Y(It==null?void 0:It.subs_expire_day),re((Be=It==null?void 0:It.mushboomer_counts)==null?void 0:Be.eth),Q((qt=It==null?void 0:It.mushboomer_counts)==null?void 0:qt.sol),q(It==null?void 0:It.referral_code),fe(It==null?void 0:It.refcode),G(It==null?void 0:It.whitelist),ie(Ge),oe(_e)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),ie(""),oe(""))}catch(It){console.error("Token verification error:",It),console.error(It.message||"An unknown error occurred.")}})()},[]);const Ke={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};h.useEffect(()=>{(async()=>{var Ge,_e;try{const qt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/")).json(),It=()=>wi.random().hex(),mt=(_e=(Ge=qt.coins)==null?void 0:Ge.filter(Ft=>!Ft.startsWith("@")&&!Ft.endsWith("/USDC")))==null?void 0:_e.map(Ft=>({value:Ft,label:Ft.endsWith("/USDC")?Ft+" (Spot)":Ft,color:It(),icon:`https://app.hyperliquid.xyz/coins/${Ke[Ft]||(Ft==null?void 0:Ft.split("/")[0])}.svg`}));qe(mt),yt(!1)}catch(Be){console.error("Data retrieval error:",Be),yt(!1)}})()},[]),h.useEffect(()=>{(async()=>{var Ge,_e;try{const qt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_refcodes/")).json(),It=()=>wi.random().hex(),mt=(_e=(Ge=qt==null?void 0:qt.refcodes)==null?void 0:Ge.filter(Ft=>Ft.code!=="DEXTRABOT"))==null?void 0:_e.slice(0,1300).map(Ft=>({value:Ft.code,label:Ft.code,color:It()}));vn(mt),ln(!1)}catch(Be){console.error("Data retrieval error:",Be),ln(!1)}})()},[]);const ct=xe=>{const Ge=["Growth Rate","Drawdown","Drawdown PnL","Sharpe"],_e=[{header:"Popular Wallet",value:Be=>{const qt=Number(Be.copier_count)||0;return qt===0?"":qt<=5?"F":qt<=10?"FF":"FFF"}},{header:"Wallet",value:Be=>Be.user_token},{header:"PnL",value:Be=>(Be==null?void 0:Be[Jt])==null||isNaN(+(Be==null?void 0:Be[Jt]))?"--":`$${zs(Be==null?void 0:Be[Jt])}`},{header:"uPnL",value:Be=>Be.total_unrealized_pnl==null||isNaN(+Be.total_unrealized_pnl)?"--":`$${zs(Be.total_unrealized_pnl)}`},{header:"Perp Equity",value:Be=>Be.portfolio_perp_all_time_value==null||isNaN(+Be.portfolio_perp_all_time_value)?"--":`$${zs(Math.abs(Be.portfolio_perp_all_time_value))}`},{header:"Win Rate",value:Be=>Be.win_complated_rate==null||isNaN(+Be.win_complated_rate)||xe==999?"--":`%${Math.abs(Be.win_complated_rate)}`},{header:"Trades Count",value:Be=>Be.complated_trades_count==null||isNaN(+Be.complated_trades_count)||xe==999?"--":`${zs(Math.abs(Be.complated_trades_count))}`},{header:"Win Count",value:Be=>Be.complated_win_count==null||isNaN(+Be.complated_win_count)||xe==999?"--":`${zs(Math.abs(Be.complated_win_count))}`},{header:"Loss Count",value:Be=>Be.complated_loss_count==null||isNaN(+Be.complated_loss_count)?"--":`${zs(Math.abs(Be.complated_loss_count))}`},{header:"Long PnL",value:Be=>Be.long_kar==null||isNaN(+Be.long_kar)||xe==999?"--":`$${zs(Math.abs(Be.long_kar))}`},{header:"Short PnL",value:Be=>Be.short_kar==null||isNaN(+Be.short_kar)||xe==999?"--":`$${zs(Be.short_kar)}`},{header:"Growth Rate",value:Be=>(Be==null?void 0:Be[xt])==null||isNaN(+(Be==null?void 0:Be[xt]))||xe==1||xe==999?"--":`%${zs(Be==null?void 0:Be[xt])}`},{header:"Drawdown",value:Be=>(Be==null?void 0:Be[Vt])==null||isNaN(+(Be==null?void 0:Be[Vt]))||xe==999?"--":`%${zs(Be==null?void 0:Be[Vt])}`},{header:"Sharpe",value:Be=>(Be==null?void 0:Be[We])==null||isNaN(+(Be==null?void 0:Be[We]))||xe==999?"--":`${Be==null?void 0:Be[We]}`},{header:"Tx Count",value:Be=>Be.rtx_count==null||isNaN(+Be.rtx_count)||xe==999?"--":`${zs(Be.rtx_count)}`},{header:"ROE (%)",value:Be=>Be.margin_roi==null||isNaN(+Be.margin_roi)?"--":`${zs(Be.margin_roi)}%`},{header:"Margin / Used",value:Be=>Be.margin_used==null||isNaN(+Be.margin_used)||Be.margin_percentage==null||isNaN(+Be.margin_percentage)?"--":`${zs(Be.margin_used)} / %${parseFloat(Be.margin_percentage).toFixed(2)}`},{header:"Avg. Lvg.",value:Be=>Be.avg_uleverage_value==null||isNaN(+Be.avg_uleverage_value)?"--":`${parseFloat(Be.avg_uleverage_value).toFixed(2)}x`},{header:"Funding",value:Be=>Be.funding==null||isNaN(+Be.funding)?"--":`$${zs(Be.funding)}`},{header:"rToken #",value:Be=>Be.token_count==null||isNaN(+Be.token_count)||xe==999?"--":zs(Be.token_count)},{header:"uToken #",value:Be=>Be.position_count==null||isNaN(+Be.position_count)?"--":zs(Be.position_count)},{header:"Avg. Dur.",value:Be=>xe==999?"--":`${Pt(Be.complated_avg_duration)}`},{header:"First Tx Time",value:Be=>xe==999?"--":kI(Be.first_time)},{header:"Last Tx Time",value:Be=>xe==999?"--":kI(Be.end_time)}];return xe===1?_e.filter(Be=>!Ge.includes(Be.header)):_e},Nt=()=>{if(!(f!=null&&f.length))return;const xe=new Date,Ge=kn=>kn.toString().padStart(2,"0"),_e=`discoverwallet_${Ge(xe.getDate())}${Ge(xe.getMonth()+1)}${xe.getFullYear()}_${Ge(xe.getHours())}${Ge(xe.getMinutes())}.csv`,Be=ct(a),qt=Be.map(kn=>`"${kn.header}"`).join(","),It=f==null?void 0:f.map(kn=>Be==null?void 0:Be.map(Gt=>`"${Gt.value(kn)}"`).join(",")),mt=new Blob([qt+`\r
`+It.join(`\r
`)],{type:"text/csv;charset=utf-8;"}),Ft=URL.createObjectURL(mt);Object.assign(document.createElement("a"),{href:Ft,download:_e}).click(),URL.revokeObjectURL(Ft)},[Ht,Rt]=h.useState("-perp_pnl"),[hn,yn]=h.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:""});h.useEffect(()=>{async function xe(){try{y(!0);const Ge={period:a===999?"all_time":a,order:Ht,offset:e===-50?"0":e.toString(),limit:"50",...hn},_e=Object.entries(Ge).filter(([Ft,Tn])=>Tn!=null).map(([Ft,Tn])=>`${encodeURIComponent(Ft)}=${encodeURIComponent(Tn)}`).join("&"),Be=`https://dextradata.nftinit.io/api/hyper/${a==999?"get_wallets_profit_all_time":"get_wallets_profit_new"}/?${_e}`,qt=await fetch(Be.toString());if(!qt.ok)throw new Error(`HTTP error! status: ${qt.status}`);const It=await qt.json();r(Math.ceil(It.count/50)),s(It.count),t((e+50)/50),window.localStorage.getItem("hyperToken")&&(I(),F()),x(It.results)}catch(Ge){x([]),console.error("Error fetching data:",Ge),C(Ge.message)}finally{y(!1)}}xe()},[e,Ht,a]);async function Cn(xe){try{y(!0);const Ge={period:a===999?"all_time":a,order:Ht,offset:e===-50?"0":e.toString(),limit:"50",...hn},_e=Object.entries(Ge).filter(([Ft,Tn])=>Tn!=null).map(([Ft,Tn])=>`${encodeURIComponent(Ft)}=${encodeURIComponent(Tn)}`).join("&"),Be=`https://dextradata.nftinit.io/api/hyper/${a==999?"get_wallets_profit_all_time":"get_wallets_profit_new"}/?${_e}`,qt=await fetch(Be);if(!qt.ok)throw new Error(`HTTP error! status: ${qt.status}`);const It=await qt.json();t(1),r(Math.ceil(It.count/50)),s(It.count),n(0),window.localStorage.getItem("hyperToken")&&(I(),F()),x(It.results)}catch(Ge){x([]),console.error("Error fetching data:",Ge),C(Ge.message)}finally{y(!1)}}async function En(xe){try{y(!0);const Ge=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=${Ht}&offset=0&limit=50`);if(!Ge.ok)throw new Error(`HTTP error! status: ${Ge.status}`);const _e=await Ge.json();t(50/50),r(Math.ceil(_e.count/50)),s(_e.count),n(0),x(_e.results),window.localStorage.getItem("hyperToken")&&(I(),F()),yn({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:""}),Fe(""),Qe(""),dt(""),at(""),jt([])}catch(Ge){x([]),console.error("Error resetting filters:",Ge),C(Ge.message)}finally{y(!1)}}const Rn=async({walletAddress:xe,isFollow:Ge,isScalper:_e})=>{try{we(xe);const Be=window.localStorage.getItem("hyperToken"),qt=window.localStorage.getItem("hyperAddress");if(!Be){$(!0);return}const It=Ge?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",mt=Ge?{address:H?H.toLowerCase():qt,token:Be,follow_address:xe.toLowerCase()}:{address:H?H.toLowerCase():qt,token:Be},Ft=await fetch(It,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(mt)});if(!Ft.ok)throw new Error(`Server responded with status ${Ft.status}`);const Tn=await Ft.json();Tn.success?(Se(Array.isArray(Tn==null?void 0:Tn.data)?[...Tn.data].sort((kn,Gt)=>new Date(Gt.created_at||0)-new Date(kn.created_at||0)):Tn==null?void 0:Tn.data),ve(_e),se(!0)):(console.log(Tn.error_message),fn.error(Tn.error_message))}catch(Be){console.error("Error in like function:",Be),fn.error(Be.message||"Something went wrong!")}},Mn=xe=>xe>=640&&xe<1024?7:xe>=1024&&xe<1240?6:xe>=1240&&xe<1540?7:xe>=1540?10:4,[Yn,Zn]=h.useState(!1),[Vn,tr]=h.useState(!1),[Sn,ze]=h.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(DVe,{}),i.jsx(Qan,{open:rt,setOpen:nt}),i.jsx(V5,{open:ee,setOpen:se,copyTradeData:pe,setCopyTradeData:Se,copyTradeWallet:be,setCopyTradeWallet:we,isScalper:ge}),i.jsx(Von,{open:Yn,setOpen:Zn,data:Sn,setTradeInfo:ze,period:a}),i.jsx(Won,{open:Vn,setOpen:tr,data:Sn,setTradeInfo:ze}),i.jsxs("div",{className:"block lg:hidden w-full p-2 space-y-2",children:[i.jsx(cDe,{}),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:Nt,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:()=>wn(!Ut),children:Ut?"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:`${Ut?"block":"hidden"} lg:flex flex-shrink-0 lg:w-auto w-full lg:max-w-none max-w-full h-full`,children:i.jsx(Kan,{period:a,advancedFilters:hn,setAdvancedFilters:yn,resetFilters:En,setFilters:Cn,minFirstValue:je,setMinFirstValue:Fe,maxFirstValue:Re,setMaxFirstValue:Qe,minEndValue:Ye,setMinEndValue:dt,maxEndValue:st,setMaxEndValue:at,dataCoin:He,selectedCoins:Kt,setSelectedCoins:jt,isLoadingCoin:vt,setIsLoadingCoin:yt,dataReferral:un,selectedReferrals:Nn,setSelectedReferrals:dn,isLoadingReferral:Hn,setIsLoadingReferral:ln})}),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(Sde,{periods:o,selectedPeriod:a,handlePeriod:d,borderColor:"discover"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Yan,{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:Nt,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(fo,{content:"🔥🔥🔥 Copytrend indicator. More flames = more followers.",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[215px] min-w-[215px] leading-[16px] -mb-5"})})]})}),i.jsx(tl,{title:"",sortKey:"copier_count",sortOption:Ht,setSortOption:Rt,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(tl,{title:"Wallet",sortKey:"user_token",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(fo,{content:"Realized profit/loss from completed trades.",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[200px] min-w-[200px] leading-[16px] -mb-5"})})]})}),i.jsx(tl,{title:"PnL",sortKey:"perp_pnl",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"uPnL",sortKey:"total_unrealized_pnl",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Perp Equity",sortKey:"portfolio_perp_all_time_value",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Win Rate",sortKey:"win_complated_rate",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Total/Win/Loss",sortKey:"complated_trades_count",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Long PnL",sortKey:"long_kar",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Short PnL",sortKey:"short_kar",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(fo,{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(tl,{title:"Growth Rate",sortKey:"growth_rate",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(fo,{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(tl,{title:"Drawdown",sortKey:"perp_dd",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(fo,{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(tl,{title:"Sharpe",sortKey:"sharpe",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Tx Count",sortKey:"rtx_count",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"ROE",sortKey:"margin_roi",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Margin",sortKey:"margin_percentage",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Avg. Lvg.",sortKey:"avg_uleverage_value",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Funding",sortKey:"funding",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"rToken #",sortKey:"token_count",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"uToken #",sortKey:"position_count",sortOption:Ht,setSortOption:Rt,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(tl,{title:"Avg. Dur.",sortKey:"complated_avg_duration",sortOption:Ht,setSortOption:Rt,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(tl,{title:"First Tx Time",sortKey:"first_time",sortOption:Ht,setSortOption:Rt,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(tl,{title:"Last Tx Time",sortKey:"end_time",sortOption:Ht,setSortOption:Rt,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:Mn(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(ka,{})})})}):v&&!f?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Mn(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:Mn(window.innerWidth),className:"h-[30vh]",children:!Ut&&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(EVe,{})})})}):f&&(f==null?void 0:f.map((xe,Ge)=>i.jsxs(ke.Fragment,{children:[i.jsxs("tr",{className:`${Ge%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:`${Ge%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:_e=>{_e.preventDefault();const Be=T==null?void 0:T.some(qt=>qt.wallet_address===(xe==null?void 0:xe.user_token));Rn({walletAddress:xe==null?void 0:xe.user_token,isFollow:Be,isScalper:xe==null?void 0:xe.is_scalper})},className:`
${T.some(_e=>_e.wallet_address===(xe==null?void 0:xe.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(H5,{walletAddress:xe==null?void 0:xe.user_token,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:L.some(_e=>_e.wallet_address===(xe==null?void 0:xe.user_token))?i.jsx("img",{src:k5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:qj,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})})}),i.jsx("td",{scope:"row",className:`${Ge%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:`${xe!=null&&xe.is_favorite_wallet?"":"hidden"} relative w-1 h-[16px] bg-[#4a3131] rounded-md`,children:i.jsx("div",{className:`${(xe==null?void 0:xe.copier_count)>=1&&(xe==null?void 0:xe.copier_count)<=5?"bg-[#FFAA22] shadow-[0px_2px_4px_0px_rgba(255,170,34,0.32)]":(xe==null?void 0:xe.copier_count)>5&&(xe==null?void 0:xe.copier_count)<=10?"bg-[#FF8C00] shadow-[0px_2px_4px_0px_rgba(255,140,0,0.32)]":(xe==null?void 0:xe.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:`${(xe==null?void 0:xe.copier_count)>=1&&(xe==null?void 0:xe.copier_count)<=5?25:(xe==null?void 0:xe.copier_count)>5&&(xe==null?void 0:xe.copier_count)<=10?50:(xe==null?void 0:xe.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:xe!=null&&xe.is_favorite_wallet?"🔥":""})]})})})})}),i.jsx("td",{scope:"row",className:`${Ge%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/${xe==null?void 0:xe.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(sa,{info1:`${(xe==null?void 0:xe.user_token).slice(0,5)+"..."+(xe==null?void 0:xe.user_token).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:_e=>{_e.stopPropagation(),navigator.clipboard.writeText(xe==null?void 0:xe.user_token),fn.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:io,alt:"",className:"cursor-pointer"})]})})}),i.jsx("td",{className:"",children:i.jsxs("div",{onClick:_e=>{_e.preventDefault(),(xe==null?void 0:xe[Jt])!=null&&!isNaN(parseFloat(xe==null?void 0:xe[Jt]))&&(ze(Be=>({...Be,pnl:xe==null?void 0:xe[Jt],winRate:xe==null?void 0:xe.win_complated_rate,tradeCount:xe==null?void 0:xe.rtx_count,longWinRate:xe==null?void 0:xe.long_win_rate,shortWinRate:xe==null?void 0:xe.short_win_rate,roe:xe==null?void 0:xe.margin_roi,referral:window.localStorage.getItem("hyperToken")?te:null})),Zn(!0))},className:`${(xe==null?void 0:xe[Jt])!=null&&!isNaN(parseFloat(xe==null?void 0:xe[Jt]))?"cursor-pointer":""} flex justify-end items-center gap-1 min-w-max px-1`,children:[i.jsx(sa,{info1:`$${zs(Math.abs(xe==null?void 0:xe[Jt]))}`,info1_Color:`${(xe==null?void 0:xe[Jt])==null||isNaN(parseFloat(xe==null?void 0:xe[Jt]))||(xe==null?void 0:xe[Jt])==0?"text-white":(xe==null?void 0:xe[Jt])>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1}),(xe==null?void 0:xe[Jt])!=null&&!isNaN(parseFloat(xe==null?void 0:xe[Jt]))&&i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:jm,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})}),i.jsx("td",{className:"",children:i.jsxs("div",{onClick:_e=>{_e.preventDefault(),(xe==null?void 0:xe.total_unrealized_pnl)!=null&&!isNaN(parseFloat(xe==null?void 0:xe.total_unrealized_pnl))&&(ze(Be=>({...Be,pnl:xe==null?void 0:xe[Jt],unrealizedPnL:xe==null?void 0:xe.total_unrealized_pnl,roe:xe==null?void 0:xe.margin_roi,leverage:xe==null?void 0:xe.avg_uleverage_value,referral:S?te:null})),tr(!0))},className:`${(xe==null?void 0:xe.total_unrealized_pnl)!=null&&!isNaN(parseFloat(xe==null?void 0:xe.total_unrealized_pnl))?"cursor-pointer":""} flex justify-end items-center gap-1 min-w-max px-1`,children:[i.jsx(sa,{info1:(xe==null?void 0:xe.total_unrealized_pnl)==null||isNaN(parseFloat(xe==null?void 0:xe.total_unrealized_pnl))?"--":`$${zs(Math.abs(xe==null?void 0:xe.total_unrealized_pnl))}`,info1_Color:`${(xe==null?void 0:xe.total_unrealized_pnl)==null||isNaN(parseFloat(xe==null?void 0:xe.total_unrealized_pnl))||(xe==null?void 0:xe.total_unrealized_pnl)==0?"text-white":(xe==null?void 0:xe.total_unrealized_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1}),(xe==null?void 0:xe.total_unrealized_pnl)!=null&&!isNaN(parseFloat(xe==null?void 0:xe.total_unrealized_pnl))&&i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:jm,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})}),i.jsx("td",{className:"",children:i.jsx(sa,{info1:(xe==null?void 0:xe.portfolio_perp_all_time_value)==null||isNaN(parseFloat(xe==null?void 0:xe.portfolio_perp_all_time_value))?"--":`$${zs(Math.abs(xe==null?void 0:xe.portfolio_perp_all_time_value))}`,info1_Color:`${(xe==null?void 0:xe.portfolio_perp_all_time_value)==null||isNaN(parseFloat(xe==null?void 0:xe.portfolio_perp_all_time_value))||(xe==null?void 0:xe.portfolio_perp_all_time_value)==0?"text-white":(xe==null?void 0:xe.portfolio_perp_all_time_value)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(sa,{info1:(xe==null?void 0:xe.win_complated_rate)==null||isNaN(parseFloat(xe==null?void 0:xe.win_complated_rate))?"--":`${Math.abs(xe==null?void 0:xe.win_complated_rate)}%`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(qon,{info1:(xe==null?void 0:xe.complated_trades_count)==null||isNaN(parseFloat(xe==null?void 0:xe.complated_trades_count))?"--":`${zs(Math.abs(xe==null?void 0:xe.complated_trades_count))}`,info2:(xe==null?void 0:xe.complated_win_count)==null||isNaN(parseFloat(xe==null?void 0:xe.complated_win_count))?"--":`${zs(Math.abs(xe==null?void 0:xe.complated_win_count))}`,info3:(xe==null?void 0:xe.complated_loss_count)==null||isNaN(parseFloat(xe==null?void 0:xe.complated_loss_count))?"--":`${zs(Math.abs(xe==null?void 0:xe.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(sa,{info1:(xe==null?void 0:xe.long_kar)==null||isNaN(parseFloat(xe==null?void 0:xe.long_kar))?"--":`$${zs(Math.abs(xe==null?void 0:xe.long_kar))}`,info1_Color:`${(xe==null?void 0:xe.long_kar)==null||isNaN(parseFloat(xe==null?void 0:xe.long_kar))||(xe==null?void 0:xe.long_kar)==0?"text-white":(xe==null?void 0:xe.long_kar)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(sa,{info1:`$${(xe==null?void 0:xe.short_kar)==null||isNaN(parseFloat(xe==null?void 0:xe.short_kar))?"--":zs(Math.abs(xe==null?void 0:xe.short_kar))}`,info1_Color:`${(xe==null?void 0:xe.short_kar)==null||isNaN(parseFloat(xe==null?void 0:xe.short_kar))||(xe==null?void 0:xe.short_kar)==0?"text-white":(xe==null?void 0:xe.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(as,{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(sa,{info1:`${a==1||a==999||(xe==null?void 0:xe[xt])==null||isNaN(parseFloat(xe==null?void 0:xe[xt]))||xt=="portfolio_perp_day_growth_rate"?"--":`${zs(xe==null?void 0:xe[xt])}%`}`,info1_Color:`${a==1||a==999?"text-gray-600":(xe==null?void 0:xe[xt])==null||isNaN(parseFloat(xe==null?void 0:xe[xt]))||xt=="portfolio_perp_day_growth_rate"||(xe==null?void 0:xe[xt])==0?"text-white":(xe==null?void 0:xe[xt])>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(as,{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(sa,{info1:`${a==1||a==999||(xe==null?void 0:xe[Vt])==null||isNaN(parseFloat(xe==null?void 0:xe[Vt]))||Vt=="portfolio_perp_day_dd"?"--":`${zs(Math.abs(xe==null?void 0:xe[Vt]))}%`}`,info1_Color:`${a==1||a==999?"text-gray-600":(xe==null?void 0:xe[Vt])==null||isNaN(parseFloat(xe==null?void 0:xe[Vt]))||Vt=="portfolio_perp_day_dd"||(xe==null?void 0:xe[Vt])==0?"text-white":(xe==null?void 0:xe[Vt])>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(as,{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(sa,{info1:`${a==1||a==999||(xe==null?void 0:xe[We])==null||isNaN(parseFloat(xe==null?void 0:xe[We]))||We=="portfolio_perp_day_sharpe"?"--":`${Ir(xe==null?void 0:xe[We])}`}`,info1_Color:`${a==1||a==999?"text-gray-600":(xe==null?void 0:xe[We])==null||isNaN(parseFloat(xe==null?void 0:xe[We]))||We=="portfolio_perp_day_sharpe"?"text-white":(xe==null?void 0:xe[We])>=1&&(xe==null?void 0:xe[We])<=2?"text-[#E5BB18]":(xe==null?void 0:xe[We])>2?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(sa,{info1:`${(xe==null?void 0:xe.rtx_count)==null||isNaN(parseFloat(xe==null?void 0:xe.rtx_count))?"--":zs(xe==null?void 0:xe.rtx_count)}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{children:i.jsx(sa,{info1:`${(xe==null?void 0:xe.margin_roi)==null||isNaN(parseFloat(xe==null?void 0:xe.margin_roi))?"--":`${zs(Math.abs(xe==null?void 0:xe.margin_roi))}%`}`,info1_Color:`${(xe==null?void 0:xe.margin_roi)==null||isNaN(parseFloat(xe==null?void 0:xe.margin_roi))||(xe==null?void 0:xe.margin_roi)==0?"text-white":(xe==null?void 0:xe.margin_roi)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{children:i.jsx(Xan,{info1:`${(xe==null?void 0:xe.margin_used)==null||isNaN(parseFloat(xe==null?void 0:xe.margin_used))?"--":zs(xe==null?void 0:xe.margin_used)}`,info2:`${(xe==null?void 0:xe.margin_percentage)==null||isNaN(parseFloat(xe==null?void 0:xe.margin_percentage))?"--":parseFloat(xe==null?void 0:xe.margin_percentage).toFixed(2)+"%"}`,info1_Color:"text-white",info2_Color:"text-[#979797]",rowTwo:!1})}),i.jsx("td",{children:i.jsx(sa,{info1:`${(xe==null?void 0:xe.avg_uleverage_value)==null||isNaN(parseFloat(xe==null?void 0:xe.avg_uleverage_value))?"--":`${parseFloat(xe==null?void 0:xe.avg_uleverage_value).toFixed(2)}x`}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{children:i.jsx(sa,{info1:`${(xe==null?void 0:xe.funding)==null||isNaN(parseFloat(xe==null?void 0:xe.funding))?"--":`$${zs(Math.abs(xe==null?void 0:xe.funding))}`}`,info1_Color:`${(xe==null?void 0:xe.funding)==null||isNaN(parseFloat(xe==null?void 0:xe.funding))||(xe==null?void 0:xe.funding)==0?"text-white":(xe==null?void 0:xe.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:`${(xe==null?void 0:xe.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:(xe==null?void 0:xe.token_count)==null||isNaN(parseFloat(xe==null?void 0:xe.token_count))?"--":zs(xe==null?void 0:xe.token_count)})}),(xe==null?void 0:xe.token_count)>0&&i.jsx(K4e,{content:xe==null?void 0:xe.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:`${(xe==null?void 0:xe.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:(xe==null?void 0:xe.position_count)==null||isNaN(parseFloat(xe==null?void 0:xe.position_count))?"--":zs(xe==null?void 0:xe.position_count)})}),(xe==null?void 0:xe.position_count)>0&&i.jsx(K4e,{content:xe==null?void 0:xe.open_positions,positionTop:a!=999,alignRight:!1,type:"position"})]})})})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(sa,{info1:`${Pt(xe==null?void 0:xe.complated_avg_duration)}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(sa,{info1:`${kI(xe==null?void 0:xe.first_time)}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":"pr-6 sm:rounded-r-2xl"}`,children:i.jsx(sa,{info1:`${kI(xe==null?void 0:xe.end_time)}`,info1_Color:"text-white",rowTwo:!1})})]}),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},Ge)))})]})})]})]})]})};var nQ,nNe;function Kon(){if(nNe)return nQ;nNe=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 nQ=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}},nQ}var Yon=Kon();const Xon=Pi(Yon);var rQ,rNe;function Qon(){if(rNe)return rQ;rNe=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 rQ=t,rQ}var Zon=Qon();const sNe=Pi(Zon);var sQ,iNe;function Jon(){return iNe||(iNe=1,sQ=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}),sQ}var eln=Jon();const tln=Pi(eln);var BVe=(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))(BVe||{}),iQ={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"]}},aNe=Object.values(BVe),_de={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},nln=Object.entries(_de).reduce((t,[e,n])=>(t[n]=e,t),{}),bm="data-rh",W4={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},q4=(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},rln=t=>{let e=q4(t,"title");const n=q4(t,W4.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const r=q4(t,W4.DEFAULT_TITLE);return e||r||void 0},sln=t=>q4(t,W4.ON_CHANGE_CLIENT_STATE)||(()=>{}),aQ=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,r)=>({...n,...r}),{}),iln=(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},[]),aln=t=>console&&typeof console.warn=="function"&&console.warn(t),j7=(t,e,n)=>{const r={};return n.filter(s=>Array.isArray(s[t])?!0:(typeof s[t]<"u"&&aln(`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()},oln=(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},lln=t=>({baseTag:iln(["href"],t),bodyAttributes:aQ("bodyAttributes",t),defer:q4(t,W4.DEFER),encode:q4(t,W4.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:aQ("htmlAttributes",t),linkTags:j7("link",["rel","href"],t),metaTags:j7("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:j7("noscript",["innerHTML"],t),onChangeClientState:sln(t),scriptTags:j7("script",["src","innerHTML"],t),styleTags:j7("style",["cssText"],t),title:rln(t),titleAttributes:aQ("titleAttributes",t),prioritizeSeoTags:oln(t,W4.PRIORITIZE_SEO_TAGS)}),$Ve=t=>Array.isArray(t)?t.join(""):t,cln=(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},oQ=(t,e)=>Array.isArray(t)?t.reduce((n,r)=>(cln(r,e)?n.priority.push(r):n.default.push(r),n),{priority:[],default:[]}):{default:t,priority:[]},oNe=(t,e)=>({...t,[e]:void 0}),uln=["noscript","script","style"],use=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),UVe=t=>Object.keys(t).reduce((e,n)=>{const r=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${r}`:r},""),dln=(t,e,n,r)=>{const s=UVe(n),a=$Ve(e);return s?`<${t} ${bm}="true" ${s}>${use(a,r)}</${t}>`:`<${t} ${bm}="true">${use(a,r)}</${t}>`},fln=(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}="${use(a[d],n)}"`;return u?`${u} ${f}`:f},""),l=a.innerHTML||a.cssText||"",c=uln.indexOf(t)===-1;return`${r}<${t} ${bm}="true" ${o}${c?"/>":`>${l}</${t}>`}`},""),zVe=(t,e={})=>Object.keys(t).reduce((n,r)=>{const s=_de[r];return n[s||r]=t[r],n},e),hln=(t,e,n)=>{const r={key:e,[bm]:!0},s=zVe(n,r);return[ke.createElement("title",s,e)]},kM=(t,e)=>e.map((n,r)=>{const s={key:r,[bm]:!0};return Object.keys(n).forEach(a=>{const l=_de[a]||a;if(l==="innerHTML"||l==="cssText"){const c=n.innerHTML||n.cssText;s.dangerouslySetInnerHTML={__html:c}}else s[l]=n[a]}),ke.createElement(t,s)}),Wh=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>hln(t,e.title,e.titleAttributes),toString:()=>dln(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>zVe(e),toString:()=>UVe(e)};default:return{toComponent:()=>kM(t,e),toString:()=>fln(t,e,n)}}},pln=({metaTags:t,linkTags:e,scriptTags:n,encode:r})=>{const s=oQ(t,iQ.meta),a=oQ(e,iQ.link),o=oQ(n,iQ.script);return{priorityMethods:{toComponent:()=>[...kM("meta",s.priority),...kM("link",a.priority),...kM("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}},mln=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}=pln(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)}},HVe=mln,FF=[],VVe=!!(typeof window<"u"&&window.document&&window.document.createElement),dse=class{constructor(t,e){Qn(this,"instances",[]);Qn(this,"canUseDOM",VVe);Qn(this,"context");Qn(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?FF:this.instances,add:t=>{(this.canUseDOM?FF:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?FF:this.instances).indexOf(t);(this.canUseDOM?FF:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=HVe({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},xln={},WVe=ke.createContext(xln),d3,za=(d3=class extends h.Component{constructor(n){super(n);Qn(this,"helmetData");this.helmetData=new dse(this.props.context||{},d3.canUseDOM)}render(){return ke.createElement(WVe.Provider,{value:this.helmetData.value},this.props.children)}},Qn(d3,"canUseDOM",VVe),d3),TC=(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}},fse=(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(","))},gln=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=$Ve(t)),fse("title",e)},lNe=(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;fse("body",r),fse("html",s),gln(f,x);const g={baseTag:TC("base",n),linkTags:TC("link",a),metaTags:TC("meta",o),noscriptTags:TC("noscript",l),scriptTags:TC("script",u),styleTags:TC("style",d)},y={},v={};Object.keys(g).forEach(C=>{const{newTags:S,oldTags:T}=g[C];S.length&&(y[C]=S),T.length&&(v[C]=g[C].oldTags)}),e&&e(),c(t,y,v)},A7=null,bln=t=>{A7&&cancelAnimationFrame(A7),t.defer?A7=requestAnimationFrame(()=>{lNe(t,()=>{A7=null})}):(lNe(t),A7=null)},yln=bln,cNe=class extends h.Component{constructor(){super(...arguments);Qn(this,"rendered",!1)}shouldComponentUpdate(e){return!tln(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=lln(e.get().map(a=>{const o={...a.props};return delete o.context,o}));za.canUseDOM?yln(s):r=HVe(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}},VZ,Va=(VZ=class extends h.Component{shouldComponentUpdate(t){return!Xon(oNe(this.props,"helmetData"),oNe(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 sNe(aNe.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 ${aNe.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),sNe(!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 ke.Children.forEach(t,r=>{if(!r||!r.props)return;const{children:s,...a}=r.props,o=Object.keys(a).reduce((c,u)=>(c[nln[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 dse)){const s=r;r=new dse(s.context,!0),delete n.helmetData}return r?ke.createElement(cNe,{...n,context:r.value}):ke.createElement(WVe.Consumer,null,s=>ke.createElement(cNe,{...n,context:s}))}},Qn(VZ,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),VZ);const vln=()=>{const[t,e]=h.useState(1),[n,r]=h.useState("-"),[s,a]=h.useState("-"),o=0,[l,c]=h.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]=h.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(za,{children:i.jsxs(Va,{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(Gon,{currentPage:t,setCurrentPage:e,offset:l,setOffset:c,totalPage:n,totalWalletCount:s,setTotalPage:r,setTotalWalletCount:a,period:x,periods:u,handlePeriodChange:y})})]})},hi=({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(Sz,{sortKey:e,state:n,className:""})]})})};var OF={},MF={exports:{}};/*!
* ApexCharts v3.54.1
* (c) 2018-2024 ApexCharts
* Released under the MIT License.
*/var uNe;function wln(){return uNe||(uNe=1,function(t,e){function n(Ce,m){(m==null||m>Ce.length)&&(m=Ce.length);for(var p=0,N=Array(m);p<m;p++)N[p]=Ce[p];return N}function r(Ce){if(Ce===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ce}function s(Ce,m){if(!(Ce instanceof m))throw new TypeError("Cannot call a class as a function")}function a(Ce,m){for(var p=0;p<m.length;p++){var N=m[p];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(Ce,T(N.key),N)}}function o(Ce,m,p){return m&&a(Ce.prototype,m),p&&a(Ce,p),Object.defineProperty(Ce,"prototype",{writable:!1}),Ce}function l(Ce,m){var p=typeof Symbol<"u"&&Ce[Symbol.iterator]||Ce["@@iterator"];if(!p){if(Array.isArray(Ce)||(p=L(Ce))||m){p&&(Ce=p);var N=0,A=function(){};return{s:A,n:function(){return N>=Ce.length?{done:!0}:{done:!1,value:Ce[N++]}},e:function(V){throw V},f:A}}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,P=!0,D=!1;return{s:function(){p=p.call(Ce)},n:function(){var V=p.next();return P=V.done,V},e:function(V){D=!0,k=V},f:function(){try{P||p.return==null||p.return()}finally{if(D)throw k}}}}function c(Ce){var m=x();return function(){var p,N=d(Ce);if(m){var A=d(this).constructor;p=Reflect.construct(N,arguments,A)}else p=N.apply(this,arguments);return function(k,P){if(P&&(typeof P=="object"||typeof P=="function"))return P;if(P!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return r(k)}(this,p)}}function u(Ce,m,p){return(m=T(m))in Ce?Object.defineProperty(Ce,m,{value:p,enumerable:!0,configurable:!0,writable:!0}):Ce[m]=p,Ce}function d(Ce){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(m){return m.__proto__||Object.getPrototypeOf(m)},d(Ce)}function f(Ce,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");Ce.prototype=Object.create(m&&m.prototype,{constructor:{value:Ce,writable:!0,configurable:!0}}),Object.defineProperty(Ce,"prototype",{writable:!1}),m&&v(Ce,m)}function x(){try{var Ce=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(x=function(){return!!Ce})()}function g(Ce,m){var p=Object.keys(Ce);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(Ce);m&&(N=N.filter(function(A){return Object.getOwnPropertyDescriptor(Ce,A).enumerable})),p.push.apply(p,N)}return p}function y(Ce){for(var m=1;m<arguments.length;m++){var p=arguments[m]!=null?arguments[m]:{};m%2?g(Object(p),!0).forEach(function(N){u(Ce,N,p[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Ce,Object.getOwnPropertyDescriptors(p)):g(Object(p)).forEach(function(N){Object.defineProperty(Ce,N,Object.getOwnPropertyDescriptor(p,N))})}return Ce}function v(Ce,m){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(p,N){return p.__proto__=N,p},v(Ce,m)}function C(Ce,m){return function(p){if(Array.isArray(p))return p}(Ce)||function(p,N){var A=p==null?null:typeof Symbol<"u"&&p[Symbol.iterator]||p["@@iterator"];if(A!=null){var k,P,D,V,Z=[],ce=!0,ue=!1;try{if(D=(A=A.call(p)).next,N===0){if(Object(A)!==A)return;ce=!1}else for(;!(ce=(k=D.call(A)).done)&&(Z.push(k.value),Z.length!==N);ce=!0);}catch(me){ue=!0,P=me}finally{try{if(!ce&&A.return!=null&&(V=A.return(),Object(V)!==V))return}finally{if(ue)throw P}}return Z}}(Ce,m)||L(Ce,m)||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 S(Ce){return function(m){if(Array.isArray(m))return n(m)}(Ce)||function(m){if(typeof Symbol<"u"&&m[Symbol.iterator]!=null||m["@@iterator"]!=null)return Array.from(m)}(Ce)||L(Ce)||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 T(Ce){var m=function(p,N){if(typeof p!="object"||!p)return p;var A=p[Symbol.toPrimitive];if(A!==void 0){var k=A.call(p,N||"default");if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(N==="string"?String:Number)(p)}(Ce,"string");return typeof m=="symbol"?m:m+""}function I(Ce){return I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},I(Ce)}function L(Ce,m){if(Ce){if(typeof Ce=="string")return n(Ce,m);var p={}.toString.call(Ce).slice(8,-1);return p==="Object"&&Ce.constructor&&(p=Ce.constructor.name),p==="Map"||p==="Set"?Array.from(Ce):p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p)?n(Ce,m):void 0}}var F=function(){function Ce(){s(this,Ce)}return o(Ce,[{key:"shadeRGBColor",value:function(m,p){var N=p.split(","),A=m<0?0:255,k=m<0?-1*m:m,P=parseInt(N[0].slice(4),10),D=parseInt(N[1],10),V=parseInt(N[2],10);return"rgb("+(Math.round((A-P)*k)+P)+","+(Math.round((A-D)*k)+D)+","+(Math.round((A-V)*k)+V)+")"}},{key:"shadeHexColor",value:function(m,p){var N=parseInt(p.slice(1),16),A=m<0?0:255,k=m<0?-1*m:m,P=N>>16,D=N>>8&255,V=255&N;return"#"+(16777216+65536*(Math.round((A-P)*k)+P)+256*(Math.round((A-D)*k)+D)+(Math.round((A-V)*k)+V)).toString(16).slice(1)}},{key:"shadeColor",value:function(m,p){return Ce.isColorHex(p)?this.shadeHexColor(m,p):this.shadeRGBColor(m,p)}}],[{key:"bind",value:function(m,p){return function(){return m.apply(p,arguments)}}},{key:"isObject",value:function(m){return m&&I(m)==="object"&&!Array.isArray(m)&&m!=null}},{key:"is",value:function(m,p){return Object.prototype.toString.call(p)==="[object "+m+"]"}},{key:"listToArray",value:function(m){var p,N=[];for(p=0;p<m.length;p++)N[p]=m[p];return N}},{key:"extend",value:function(m,p){var N=this;typeof Object.assign!="function"&&(Object.assign=function(k){if(k==null)throw new TypeError("Cannot convert undefined or null to object");for(var P=Object(k),D=1;D<arguments.length;D++){var V=arguments[D];if(V!=null)for(var Z in V)V.hasOwnProperty(Z)&&(P[Z]=V[Z])}return P});var A=Object.assign({},m);return this.isObject(m)&&this.isObject(p)&&Object.keys(p).forEach(function(k){N.isObject(p[k])&&k in m?A[k]=N.extend(m[k],p[k]):Object.assign(A,u({},k,p[k]))}),A}},{key:"extendArray",value:function(m,p){var N=[];return m.map(function(A){N.push(Ce.extend(p,A))}),m=N}},{key:"monthMod",value:function(m){return m%12}},{key:"clone",value:function(m){if(Ce.is("Array",m)){for(var p=[],N=0;N<m.length;N++)p[N]=this.clone(m[N]);return p}if(Ce.is("Null",m))return null;if(Ce.is("Date",m))return m;if(I(m)==="object"){var A={};for(var k in m)m.hasOwnProperty(k)&&(A[k]=this.clone(m[k]));return A}return m}},{key:"log10",value:function(m){return Math.log(m)/Math.LN10}},{key:"roundToBase10",value:function(m){return Math.pow(10,Math.floor(Math.log10(m)))}},{key:"roundToBase",value:function(m,p){return Math.pow(p,Math.floor(Math.log(m)/Math.log(p)))}},{key:"parseNumber",value:function(m){return m===null?m:parseFloat(m)}},{key:"stripNumber",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Number.isInteger(m)?m:parseFloat(m.toPrecision(p))}},{key:"randomId",value:function(){return(Math.random()+1).toString(36).substring(4)}},{key:"noExponents",value:function(m){var p=String(m).split(/[eE]/);if(p.length===1)return p[0];var N="",A=m<0?"-":"",k=p[0].replace(".",""),P=Number(p[1])+1;if(P<0){for(N=A+"0.";P++;)N+="0";return N+k.replace(/^-/,"")}for(P-=k.length;P--;)N+="0";return k+N}},{key:"getDimensions",value:function(m){var p=getComputedStyle(m,null),N=m.clientHeight,A=m.clientWidth;return N-=parseFloat(p.paddingTop)+parseFloat(p.paddingBottom),[A-=parseFloat(p.paddingLeft)+parseFloat(p.paddingRight),N]}},{key:"getBoundingClientRect",value:function(m){var p=m.getBoundingClientRect();return{top:p.top,right:p.right,bottom:p.bottom,left:p.left,width:m.clientWidth,height:m.clientHeight,x:p.left,y:p.top}}},{key:"getLargestStringFromArr",value:function(m){return m.reduce(function(p,N){return Array.isArray(N)&&(N=N.reduce(function(A,k){return A.length>k.length?A:k})),p.length>N.length?p:N},0)}},{key:"hexToRgba",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"#999999",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.6;m.substring(0,1)!=="#"&&(m="#999999");var N=m.replace("#","");N=N.match(new RegExp("(.{"+N.length/3+"})","g"));for(var A=0;A<N.length;A++)N[A]=parseInt(N[A].length===1?N[A]+N[A]:N[A],16);return p!==void 0&&N.push(p),"rgba("+N.join(",")+")"}},{key:"getOpacityFromRGBA",value:function(m){return parseFloat(m.replace(/^.*,(.+)\)/,"$1"))}},{key:"rgb2hex",value:function(m){return(m=m.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&m.length===4?"#"+("0"+parseInt(m[1],10).toString(16)).slice(-2)+("0"+parseInt(m[2],10).toString(16)).slice(-2)+("0"+parseInt(m[3],10).toString(16)).slice(-2):""}},{key:"isColorHex",value:function(m){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)|(^#[0-9A-F]{8}$)/i.test(m)}},{key:"getPolygonPos",value:function(m,p){for(var N=[],A=2*Math.PI/p,k=0;k<p;k++){var P={};P.x=m*Math.sin(k*A),P.y=-m*Math.cos(k*A),N.push(P)}return N}},{key:"polarToCartesian",value:function(m,p,N,A){var k=(A-90)*Math.PI/180;return{x:m+N*Math.cos(k),y:p+N*Math.sin(k)}}},{key:"escapeString",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x",N=m.toString().slice();return N=N.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi,p)}},{key:"negToZero",value:function(m){return m<0?0:m}},{key:"moveIndexInArray",value:function(m,p,N){if(N>=m.length)for(var A=N-m.length+1;A--;)m.push(void 0);return m.splice(N,0,m.splice(p,1)[0]),m}},{key:"extractNumber",value:function(m){return parseFloat(m.replace(/[^\d.]*/g,""))}},{key:"findAncestor",value:function(m,p){for(;(m=m.parentElement)&&!m.classList.contains(p););return m}},{key:"setELstyles",value:function(m,p){for(var N in p)p.hasOwnProperty(N)&&(m.style.key=p[N])}},{key:"preciseAddition",value:function(m,p){var N=(String(m).split(".")[1]||"").length,A=(String(p).split(".")[1]||"").length,k=Math.pow(10,Math.max(N,A));return(Math.round(m*k)+Math.round(p*k))/k}},{key:"isNumber",value:function(m){return!isNaN(m)&&parseFloat(Number(m))===m&&!isNaN(parseInt(m,10))}},{key:"isFloat",value:function(m){return Number(m)===m&&m%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 m=window.navigator.userAgent,p=m.indexOf("Edge/");return p>0&&parseInt(m.substring(p+5,m.indexOf(".",p)),10)}},{key:"getGCD",value:function(m,p){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:7,A=Math.pow(10,N-Math.floor(Math.log10(Math.max(m,p))));for(m=Math.round(Math.abs(m)*A),p=Math.round(Math.abs(p)*A);p;){var k=p;p=m%p,m=k}return m/A}},{key:"getPrimeFactors",value:function(m){for(var p=[],N=2;m>=2;)m%N==0?(p.push(N),m/=N):N++;return p}},{key:"mod",value:function(m,p){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:7,A=Math.pow(10,N-Math.floor(Math.log10(Math.max(m,p))));return(m=Math.round(Math.abs(m)*A))%(p=Math.round(Math.abs(p)*A))/A}}]),Ce}(),$=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.setEasingFunctions()}return o(Ce,[{key:"setEasingFunctions",value:function(){var m;if(!this.w.globals.easing){switch(this.w.config.chart.animations.easing){case"linear":m="-";break;case"easein":m="<";break;case"easeout":m=">";break;case"easeinout":default:m="<>";break;case"swing":m=function(p){var N=1.70158;return(p-=1)*p*((N+1)*p+N)+1};break;case"bounce":m=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":m=function(p){return p===!!p?p:Math.pow(2,-10*p)*Math.sin((p-.075)*(2*Math.PI)/.3)+1}}this.w.globals.easing=m}}},{key:"animateLine",value:function(m,p,N,A){m.attr(p).animate(A).attr(N)}},{key:"animateMarker",value:function(m,p,N,A){m.attr({opacity:0}).animate(p,N).attr({opacity:1}).afterAll(function(){A()})}},{key:"animateRect",value:function(m,p,N,A,k){m.attr(p).animate(A).attr(N).afterAll(function(){return k()})}},{key:"animatePathsGradually",value:function(m){var p=m.el,N=m.realIndex,A=m.j,k=m.fill,P=m.pathFrom,D=m.pathTo,V=m.speed,Z=m.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,N,A,ce.config.chart.type!=="line"||ce.globals.comboCharts?k:"stroke",P,D,V,Z*ue)}},{key:"showDelayedElements",value:function(){this.w.globals.delayedElements.forEach(function(m){var p=m.el;p.classList.remove("apexcharts-element-hidden"),p.classList.add("apexcharts-hidden-element-shown")})}},{key:"animationCompleted",value:function(m){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:m,w:p}))}},{key:"morphSVG",value:function(m,p,N,A,k,P,D,V){var Z=this,ce=this.w;k||(k=m.attr("pathFrom")),P||(P=m.attr("pathTo"));var ue=function(me){return ce.config.chart.type==="radar"&&(D=1),"M 0 ".concat(ce.globals.gridHeight)};(!k||k.indexOf("undefined")>-1||k.indexOf("NaN")>-1)&&(k=ue()),(!P||P.indexOf("undefined")>-1||P.indexOf("NaN")>-1)&&(P=ue()),ce.globals.shouldAnimate||(D=1),m.plot(k).animate(1,ce.globals.easing,V).plot(k).animate(D,ce.globals.easing,V).plot(P).afterAll(function(){F.isNumber(N)?N===ce.globals.series[ce.globals.maxValsInArrayIndex].length-2&&ce.globals.shouldAnimate&&Z.animationCompleted(m):A!=="none"&&ce.globals.shouldAnimate&&(!ce.globals.comboCharts&&p===ce.globals.series.length-1||ce.globals.comboCharts)&&Z.animationCompleted(m),Z.showDelayedElements()})}}]),Ce}(),O=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"getDefaultFilter",value:function(m,p){var N=this.w;m.unfilter(!0),new window.SVG.Filter().size("120%","180%","-5%","-40%"),N.config.states.normal.filter!=="none"?this.applyFilter(m,p,N.config.states.normal.filter.type,N.config.states.normal.filter.value):N.config.chart.dropShadow.enabled&&this.dropShadow(m,N.config.chart.dropShadow,p)}},{key:"addNormalFilter",value:function(m,p){var N=this.w;N.config.chart.dropShadow.enabled&&!m.node.classList.contains("apexcharts-marker")&&this.dropShadow(m,N.config.chart.dropShadow,p)}},{key:"addLightenFilter",value:function(m,p,N){var A=this,k=this.w,P=N.intensity;m.unfilter(!0),new window.SVG.Filter,m.filter(function(D){var V=k.config.chart.dropShadow;(V.enabled?A.addShadow(D,p,V):D).componentTransfer({rgb:{type:"linear",slope:1.5,intercept:P}})}),m.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(m.filterer.node)}},{key:"addDarkenFilter",value:function(m,p,N){var A=this,k=this.w,P=N.intensity;m.unfilter(!0),new window.SVG.Filter,m.filter(function(D){var V=k.config.chart.dropShadow;(V.enabled?A.addShadow(D,p,V):D).componentTransfer({rgb:{type:"linear",slope:P}})}),m.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(m.filterer.node)}},{key:"applyFilter",value:function(m,p,N){var A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:.5;switch(N){case"none":this.addNormalFilter(m,p);break;case"lighten":this.addLightenFilter(m,p,{intensity:A});break;case"darken":this.addDarkenFilter(m,p,{intensity:A})}}},{key:"addShadow",value:function(m,p,N){var A,k=this.w,P=N.blur,D=N.top,V=N.left,Z=N.color,ce=N.opacity;if(((A=k.config.chart.dropShadow.enabledOnSeries)===null||A===void 0?void 0:A.length)>0&&k.config.chart.dropShadow.enabledOnSeries.indexOf(p)===-1)return m;var ue=m.flood(Array.isArray(Z)?Z[p]:Z,ce).composite(m.sourceAlpha,"in").offset(V,D).gaussianBlur(P).merge(m.source);return m.blend(m.source,ue)}},{key:"dropShadow",value:function(m,p){var N,A,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,P=p.top,D=p.left,V=p.blur,Z=p.color,ce=p.opacity,ue=p.noUserSpaceOnUse,me=this.w;return m.unfilter(!0),F.isMsEdge()&&me.config.chart.type==="radialBar"||((N=me.config.chart.dropShadow.enabledOnSeries)===null||N===void 0?void 0:N.length)>0&&((A=me.config.chart.dropShadow.enabledOnSeries)===null||A===void 0?void 0:A.indexOf(k))===-1||(Z=Array.isArray(Z)?Z[k]:Z,m.filter(function(Ne){var Ie=null;Ie=F.isSafari()||F.isFirefox()||F.isMsEdge()?Ne.flood(Z,ce).composite(Ne.sourceAlpha,"in").offset(D,P).gaussianBlur(V):Ne.flood(Z,ce).composite(Ne.sourceAlpha,"in").offset(D,P).gaussianBlur(V).merge(Ne.source),Ne.blend(Ne.source,Ie)}),ue||m.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(m.filterer.node)),m}},{key:"setSelectionFilter",value:function(m,p,N){var A=this.w;if(A.globals.selectedDataPoints[p]!==void 0&&A.globals.selectedDataPoints[p].indexOf(N)>-1){m.node.setAttribute("selected",!0);var k=A.config.states.active.filter;k!=="none"&&this.applyFilter(m,p,k.type,k.value)}}},{key:"_scaleFilterSize",value:function(m){(function(p){for(var N in p)p.hasOwnProperty(N)&&m.setAttribute(N,p[N])})({width:"200%",height:"200%",x:"-50%",y:"-50%"})}}]),Ce}(),U=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"roundPathCorners",value:function(m,p){function N(Ze,it,wt){var Dt=it.x-Ze.x,Qt=it.y-Ze.y,xn=Math.sqrt(Dt*Dt+Qt*Qt);return A(Ze,it,Math.min(1,wt/xn))}function A(Ze,it,wt){return{x:Ze.x+(it.x-Ze.x)*wt,y:Ze.y+(it.y-Ze.y)*wt}}function k(Ze,it){Ze.length>2&&(Ze[Ze.length-2]=it.x,Ze[Ze.length-1]=it.y)}function P(Ze){return{x:parseFloat(Ze[Ze.length-2]),y:parseFloat(Ze[Ze.length-1])}}m.indexOf("NaN")>-1&&(m="");var D=m.split(/[,\s]/).reduce(function(Ze,it){var wt=it.match("([a-zA-Z])(.+)");return wt?(Ze.push(wt[1]),Ze.push(wt[2])):Ze.push(it),Ze},[]).reduce(function(Ze,it){return parseFloat(it)==it&&Ze.length?Ze[Ze.length-1].push(it):Ze.push([it]),Ze},[]),V=[];if(D.length>1){var Z=P(D[0]),ce=null;D[D.length-1][0]=="Z"&&D[0].length>2&&(ce=["L",Z.x,Z.y],D[D.length-1]=ce),V.push(D[0]);for(var ue=1;ue<D.length;ue++){var me=V[V.length-1],Ne=D[ue],Ie=Ne==ce?D[1]:D[ue+1];if(Ie&&me&&me.length>2&&Ne[0]=="L"&&Ie.length>2&&Ie[0]=="L"){var Le,Xe,Oe=P(me),$e=P(Ne),ae=P(Ie);Le=N($e,Oe,p),Xe=N($e,ae,p),k(Ne,Le),Ne.origPoint=$e,V.push(Ne);var he=A(Le,$e,.5),Pe=A($e,Xe,.5),Ve=["C",he.x,he.y,Pe.x,Pe.y,Xe.x,Xe.y];Ve.origPoint=$e,V.push(Ve)}else V.push(Ne)}if(ce){var Te=P(V[V.length-1]);V.push(["Z"]),k(V[0],Te)}}else V=D;return V.reduce(function(Ze,it){return Ze+it.join(" ")+" "},"")}},{key:"drawLine",value:function(m,p,N,A){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"#a8a8a8",P=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,D=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,V=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"butt";return this.w.globals.dom.Paper.line().attr({x1:m,y1:p,x2:N,y2:A,stroke:k,"stroke-dasharray":P,"stroke-width":D,"stroke-linecap":V})}},{key:"drawRect",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,P=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"#fefefe",D=arguments.length>6&&arguments[6]!==void 0?arguments[6]:1,V=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,Z=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:m,y:p,width:N>0?N:0,height:A>0?A:0,rx:k,ry:k,opacity:D,"stroke-width":V!==null?V:0,stroke:Z!==null?Z:"none","stroke-dasharray":ce}),ue.node.setAttribute("fill",P),ue}},{key:"drawPolygon",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#e1e1e1",N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"none";return this.w.globals.dom.Paper.polygon(m).attr({fill:A,stroke:p,"stroke-width":N})}},{key:"drawCircle",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;m<0&&(m=0);var N=this.w.globals.dom.Paper.circle(2*m);return p!==null&&N.attr(p),N}},{key:"drawPath",value:function(m){var p=m.d,N=p===void 0?"":p,A=m.stroke,k=A===void 0?"#a8a8a8":A,P=m.strokeWidth,D=P===void 0?1:P,V=m.fill,Z=m.fillOpacity,ce=Z===void 0?1:Z,ue=m.strokeOpacity,me=ue===void 0?1:ue,Ne=m.classes,Ie=m.strokeLinecap,Le=Ie===void 0?null:Ie,Xe=m.strokeDashArray,Oe=Xe===void 0?0:Xe,$e=this.w;return Le===null&&(Le=$e.config.stroke.lineCap),(N.indexOf("undefined")>-1||N.indexOf("NaN")>-1)&&(N="M 0 ".concat($e.globals.gridHeight)),$e.globals.dom.Paper.path(N).attr({fill:V,"fill-opacity":ce,stroke:k,"stroke-opacity":me,"stroke-linecap":Le,"stroke-width":D,"stroke-dasharray":Oe,class:Ne})}},{key:"group",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,p=this.w.globals.dom.Paper.group();return m!==null&&p.attr(m),p}},{key:"move",value:function(m,p){var N=["M",m,p].join(" ");return N}},{key:"line",value:function(m,p){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,A=null;return N===null?A=[" L",m,p].join(" "):N==="H"?A=[" H",m].join(" "):N==="V"&&(A=[" V",p].join(" ")),A}},{key:"curve",value:function(m,p,N,A,k,P){var D=["C",m,p,N,A,k,P].join(" ");return D}},{key:"quadraticCurve",value:function(m,p,N,A){return["Q",m,p,N,A].join(" ")}},{key:"arc",value:function(m,p,N,A,k,P,D){var V="A";arguments.length>7&&arguments[7]!==void 0&&arguments[7]&&(V="a");var Z=[V,m,p,N,A,k,P,D].join(" ");return Z}},{key:"renderPaths",value:function(m){var p,N=m.j,A=m.realIndex,k=m.pathFrom,P=m.pathTo,D=m.stroke,V=m.strokeWidth,Z=m.strokeLinecap,ce=m.fill,ue=m.animationDelay,me=m.initialSpeed,Ne=m.dataChangeSpeed,Ie=m.className,Le=m.chartType,Xe=m.shouldClipToGrid,Oe=Xe===void 0||Xe,$e=m.bindEventsOnPaths,ae=$e===void 0||$e,he=m.drawShadow,Pe=he===void 0||he,Ve=this.w,Te=new O(this.ctx),Ze=new $(this.ctx),it=this.w.config.chart.animations.enabled,wt=it&&this.w.config.chart.animations.dynamicAnimation.enabled,Dt=!!(it&&!Ve.globals.resized||wt&&Ve.globals.dataChanged&&Ve.globals.shouldAnimate);Dt?p=k:(p=P,Ve.globals.animationEnded=!0);var Qt=Ve.config.stroke.dashArray,xn=0;xn=Array.isArray(Qt)?Qt[A]:Ve.config.stroke.dashArray;var pn=this.drawPath({d:p,stroke:D,strokeWidth:V,fill:ce,fillOpacity:1,classes:Ie,strokeLinecap:Z,strokeDashArray:xn});if(pn.attr("index",A),Oe&&(Le==="bar"&&!Ve.globals.isHorizontal||Ve.globals.comboCharts?pn.attr({"clip-path":"url(#gridRectBarMask".concat(Ve.globals.cuid,")")}):pn.attr({"clip-path":"url(#gridRectMask".concat(Ve.globals.cuid,")")})),Ve.config.states.normal.filter.type!=="none")Te.getDefaultFilter(pn,A);else if(Ve.config.chart.dropShadow.enabled&&Pe){var An=Ve.config.chart.dropShadow;Te.dropShadow(pn,An,A)}ae&&(pn.node.addEventListener("mouseenter",this.pathMouseEnter.bind(this,pn)),pn.node.addEventListener("mouseleave",this.pathMouseLeave.bind(this,pn)),pn.node.addEventListener("mousedown",this.pathMouseDown.bind(this,pn))),pn.attr({pathTo:P,pathFrom:k});var or={el:pn,j:N,realIndex:A,pathFrom:k,pathTo:P,fill:ce,strokeWidth:V,delay:ue};return!it||Ve.globals.resized||Ve.globals.dataChanged?!Ve.globals.resized&&Ve.globals.dataChanged||Ze.showDelayedElements():Ze.animatePathsGradually(y(y({},or),{},{speed:me})),Ve.globals.dataChanged&&wt&&Dt&&Ze.animatePathsGradually(y(y({},or),{},{speed:Ne})),pn}},{key:"drawPattern",value:function(m,p,N){var A=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,N,function(P){m==="horizontalLines"?P.line(0,0,N,0).stroke({color:A,width:k+1}):m==="verticalLines"?P.line(0,0,0,p).stroke({color:A,width:k+1}):m==="slantedLines"?P.line(0,0,p,N).stroke({color:A,width:k}):m==="squares"?P.rect(p,N).fill("none").stroke({color:A,width:k}):m==="circles"&&P.circle(p).fill("none").stroke({color:A,width:k})})}},{key:"drawGradient",value:function(m,p,N,A,k){var P,D=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,V=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,Z=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,A)),N.length<9&&N.indexOf("#")===0&&(N=F.hexToRgba(N,k));var me=0,Ne=1,Ie=1,Le=null;V!==null&&(me=V[0]!==void 0?V[0]/100:0,Ne=V[1]!==void 0?V[1]/100:1,Ie=V[2]!==void 0?V[2]/100:1,Le=V[3]!==void 0?V[3]/100:null);var Xe=!(ue.config.chart.type!=="donut"&&ue.config.chart.type!=="pie"&&ue.config.chart.type!=="polarArea"&&ue.config.chart.type!=="bubble");if(P=Z===null||Z.length===0?ue.globals.dom.Paper.gradient(Xe?"radial":"linear",function(ae){ae.at(me,p,A),ae.at(Ne,N,k),ae.at(Ie,N,k),Le!==null&&ae.at(Le,p,A)}):ue.globals.dom.Paper.gradient(Xe?"radial":"linear",function(ae){(Array.isArray(Z[ce])?Z[ce]:Z).forEach(function(he){ae.at(he.offset/100,he.color,he.opacity)})}),Xe){var Oe=ue.globals.gridWidth/2,$e=ue.globals.gridHeight/2;ue.config.chart.type!=="bubble"?P.attr({gradientUnits:"userSpaceOnUse",cx:Oe,cy:$e,r:D}):P.attr({cx:.5,cy:.5,r:.8,fx:.2,fy:.2})}else m==="vertical"?P.from(0,0).to(0,1):m==="diagonal"?P.from(0,0).to(1,1):m==="horizontal"?P.from(0,1).to(1,1):m==="diagonal2"&&P.from(1,0).to(0,1);return P}},{key:"getTextBasedOnMaxWidth",value:function(m){var p=m.text,N=m.maxWidth,A=m.fontSize,k=m.fontFamily,P=this.getTextRects(p,A,k),D=P.width/p.length,V=Math.floor(N/D);return N<P.width?p.slice(0,V-3)+"...":p}},{key:"drawText",value:function(m){var p=this,N=m.x,A=m.y,k=m.text,P=m.textAnchor,D=m.fontSize,V=m.fontFamily,Z=m.fontWeight,ce=m.foreColor,ue=m.opacity,me=m.maxWidth,Ne=m.cssClass,Ie=Ne===void 0?"":Ne,Le=m.isPlainText,Xe=Le===void 0||Le,Oe=m.dominantBaseline,$e=Oe===void 0?"auto":Oe,ae=this.w;k===void 0&&(k="");var he=k;P||(P="start"),ce&&ce.length||(ce=ae.config.chart.foreColor),V=V||ae.config.chart.fontFamily,Z=Z||"regular";var Pe,Ve={maxWidth:me,fontSize:D=D||"11px",fontFamily:V};return Array.isArray(k)?Pe=ae.globals.dom.Paper.text(function(Te){for(var Ze=0;Ze<k.length;Ze++)he=k[Ze],me&&(he=p.getTextBasedOnMaxWidth(y({text:k[Ze]},Ve))),Ze===0?Te.tspan(he):Te.tspan(he).newLine()}):(me&&(he=this.getTextBasedOnMaxWidth(y({text:k},Ve))),Pe=Xe?ae.globals.dom.Paper.plain(k):ae.globals.dom.Paper.text(function(Te){return Te.tspan(he)})),Pe.attr({x:N,y:A,"text-anchor":P,"dominant-baseline":$e,"font-size":D,"font-family":V,"font-weight":Z,fill:ce,class:"apexcharts-text "+Ie}),Pe.node.style.fontFamily=V,Pe.node.style.opacity=ue,Pe}},{key:"getMarkerPath",value:function(m,p,N,A){var k="";switch(N){case"cross":k="M ".concat(m-(A/=1.4)," ").concat(p-A," L ").concat(m+A," ").concat(p+A," M ").concat(m-A," ").concat(p+A," L ").concat(m+A," ").concat(p-A);break;case"plus":k="M ".concat(m-(A/=1.12)," ").concat(p," L ").concat(m+A," ").concat(p," M ").concat(m," ").concat(p-A," L ").concat(m," ").concat(p+A);break;case"star":case"sparkle":var P=5;A*=1.15,N==="sparkle"&&(A/=1.1,P=4);for(var D=Math.PI/P,V=0;V<=2*P;V++){var Z=V*D,ce=V%2==0?A:A/2;k+=(V===0?"M":"L")+(m+ce*Math.sin(Z))+","+(p-ce*Math.cos(Z))}k+="Z";break;case"triangle":k="M ".concat(m," ").concat(p-A,`
L `).concat(m+A," ").concat(p+A,`
L `).concat(m-A," ").concat(p+A,`
Z`);break;case"square":case"rect":k="M ".concat(m-(A/=1.125)," ").concat(p-A,`
L `).concat(m+A," ").concat(p-A,`
L `).concat(m+A," ").concat(p+A,`
L `).concat(m-A," ").concat(p+A,`
Z`);break;case"diamond":A*=1.05,k="M ".concat(m," ").concat(p-A,`
L `).concat(m+A," ").concat(p,`
L `).concat(m," ").concat(p+A,`
L `).concat(m-A," ").concat(p,`
Z`);break;case"line":k="M ".concat(m-(A/=1.1)," ").concat(p,`
L `).concat(m+A," ").concat(p);break;default:A*=2,k="M ".concat(m,", ").concat(p,`
m -`).concat(A/2,`, 0
a `).concat(A/2,",").concat(A/2," 0 1,0 ").concat(A,`,0
a `).concat(A/2,",").concat(A/2," 0 1,0 -").concat(A,",0")}return k}},{key:"drawMarkerShape",value:function(m,p,N,A,k){var P=this.drawPath({d:this.getMarkerPath(m,p,N,A,k),stroke:k.pointStrokeColor,strokeDashArray:k.pointStrokeDashArray,strokeWidth:k.pointStrokeWidth,fill:k.pointFillColor,fillOpacity:k.pointFillOpacity,strokeOpacity:k.pointStrokeOpacity});return P.attr({cx:m,cy:p,shape:k.shape,class:k.class?k.class:""}),P}},{key:"drawMarker",value:function(m,p,N){m=m||0;var A=N.pSize||0;return F.isNumber(p)||(A=0,p=0),this.drawMarkerShape(m,p,N==null?void 0:N.shape,A,y(y({},N),N.shape==="line"||N.shape==="plus"||N.shape==="cross"?{pointStrokeColor:N.pointFillColor,pointStrokeOpacity:N.pointFillOpacity}:{}))}},{key:"pathMouseEnter",value:function(m,p){var N=this.w,A=new O(this.ctx),k=parseInt(m.node.getAttribute("index"),10),P=parseInt(m.node.getAttribute("j"),10);if(typeof N.config.chart.events.dataPointMouseEnter=="function"&&N.config.chart.events.dataPointMouseEnter(p,this.ctx,{seriesIndex:k,dataPointIndex:P,w:N}),this.ctx.events.fireEvent("dataPointMouseEnter",[p,this.ctx,{seriesIndex:k,dataPointIndex:P,w:N}]),(N.config.states.active.filter.type==="none"||m.node.getAttribute("selected")!=="true")&&N.config.states.hover.filter.type!=="none"&&!N.globals.isTouchDevice){var D=N.config.states.hover.filter;A.applyFilter(m,k,D.type,D.value)}}},{key:"pathMouseLeave",value:function(m,p){var N=this.w,A=new O(this.ctx),k=parseInt(m.node.getAttribute("index"),10),P=parseInt(m.node.getAttribute("j"),10);typeof N.config.chart.events.dataPointMouseLeave=="function"&&N.config.chart.events.dataPointMouseLeave(p,this.ctx,{seriesIndex:k,dataPointIndex:P,w:N}),this.ctx.events.fireEvent("dataPointMouseLeave",[p,this.ctx,{seriesIndex:k,dataPointIndex:P,w:N}]),N.config.states.active.filter.type!=="none"&&m.node.getAttribute("selected")==="true"||N.config.states.hover.filter.type!=="none"&&A.getDefaultFilter(m,k)}},{key:"pathMouseDown",value:function(m,p){var N=this.w,A=new O(this.ctx),k=parseInt(m.node.getAttribute("index"),10),P=parseInt(m.node.getAttribute("j"),10),D="false";if(m.node.getAttribute("selected")==="true"){if(m.node.setAttribute("selected","false"),N.globals.selectedDataPoints[k].indexOf(P)>-1){var V=N.globals.selectedDataPoints[k].indexOf(P);N.globals.selectedDataPoints[k].splice(V,1)}}else{if(!N.config.states.active.allowMultipleDataPointsSelection&&N.globals.selectedDataPoints.length>0){N.globals.selectedDataPoints=[];var Z=N.globals.dom.Paper.select(".apexcharts-series path").members,ce=N.globals.dom.Paper.select(".apexcharts-series circle, .apexcharts-series rect").members,ue=function(Ie){Array.prototype.forEach.call(Ie,function(Le){Le.node.setAttribute("selected","false"),A.getDefaultFilter(Le,k)})};ue(Z),ue(ce)}m.node.setAttribute("selected","true"),D="true",N.globals.selectedDataPoints[k]===void 0&&(N.globals.selectedDataPoints[k]=[]),N.globals.selectedDataPoints[k].push(P)}if(D==="true"){var me=N.config.states.active.filter;if(me!=="none")A.applyFilter(m,k,me.type,me.value);else if(N.config.states.hover.filter!=="none"&&!N.globals.isTouchDevice){var Ne=N.config.states.hover.filter;A.applyFilter(m,k,Ne.type,Ne.value)}}else N.config.states.active.filter.type!=="none"&&(N.config.states.hover.filter.type==="none"||N.globals.isTouchDevice?A.getDefaultFilter(m,k):(Ne=N.config.states.hover.filter,A.applyFilter(m,k,Ne.type,Ne.value)));typeof N.config.chart.events.dataPointSelection=="function"&&N.config.chart.events.dataPointSelection(p,this.ctx,{selectedDataPoints:N.globals.selectedDataPoints,seriesIndex:k,dataPointIndex:P,w:N}),p&&this.ctx.events.fireEvent("dataPointSelection",[p,this.ctx,{selectedDataPoints:N.globals.selectedDataPoints,seriesIndex:k,dataPointIndex:P,w:N}])}},{key:"rotateAroundCenter",value:function(m){var p={};return m&&typeof m.getBBox=="function"&&(p=m.getBBox()),{x:p.x+p.width/2,y:p.y+p.height/2}}},{key:"getTextRects",value:function(m,p,N,A){var k=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],P=this.w,D=this.drawText({x:-200,y:-200,text:m,textAnchor:"start",fontSize:p,fontFamily:N,foreColor:"#fff",opacity:0});A&&D.attr("transform",A),P.globals.dom.Paper.add(D);var V=D.bbox();return k||(V=D.node.getBoundingClientRect()),D.remove(),{width:V.width,height:V.height}}},{key:"placeTextWithEllipsis",value:function(m,p,N){if(typeof m.getComputedTextLength=="function"&&(m.textContent=p,p.length>0&&m.getComputedTextLength()>=N/1.1)){for(var A=p.length-3;A>0;A-=3)if(m.getSubStringLength(0,A)<=N/1.1)return void(m.textContent=p.substring(0,A)+"...");m.textContent="."}}}],[{key:"setAttrs",value:function(m,p){for(var N in p)p.hasOwnProperty(N)&&m.setAttribute(N,p[N])}}]),Ce}(),Y=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"getStackedSeriesTotals",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=this.w,N=[];if(p.globals.series.length===0)return N;for(var A=0;A<p.globals.series[p.globals.maxValsInArrayIndex].length;A++){for(var k=0,P=0;P<p.globals.series.length;P++)p.globals.series[P][A]!==void 0&&m.indexOf(P)===-1&&(k+=p.globals.series[P][A]);N.push(k)}return N}},{key:"getSeriesTotalByIndex",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return m===null?this.w.config.series.reduce(function(p,N){return p+N},0):this.w.globals.series[m].reduce(function(p,N){return p+N},0)}},{key:"getStackedSeriesTotalsByGroups",value:function(){var m=this,p=this.w,N=[];return p.globals.seriesGroups.forEach(function(A){var k=[];p.config.series.forEach(function(D,V){A.indexOf(p.globals.seriesNames[V])>-1&&k.push(V)});var P=p.globals.series.map(function(D,V){return k.indexOf(V)===-1?V:-1}).filter(function(D){return D!==-1});N.push(m.getStackedSeriesTotals(P))}),N}},{key:"setSeriesYAxisMappings",value:function(){var m=this.w.globals,p=this.w.config,N=[],A=[],k=[],P=m.series.length>p.yaxis.length||p.yaxis.some(function(ue){return Array.isArray(ue.seriesName)});p.series.forEach(function(ue,me){k.push(me),A.push(null)}),p.yaxis.forEach(function(ue,me){N[me]=[]});var D=[];p.yaxis.forEach(function(ue,me){var Ne=!1;if(ue.seriesName){var Ie=[];Array.isArray(ue.seriesName)?Ie=ue.seriesName:Ie.push(ue.seriesName),Ie.forEach(function(Le){p.series.forEach(function(Xe,Oe){if(Xe.name===Le){var $e=Oe;me===Oe||P?!P||k.indexOf(Oe)>-1?N[me].push([me,Oe]):console.warn("Series '"+Xe.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."):(N[Oe].push([Oe,me]),$e=me),Ne=!0,($e=k.indexOf($e))!==-1&&k.splice($e,1)}})})}Ne||D.push(me)}),N=N.map(function(ue,me){var Ne=[];return ue.forEach(function(Ie){A[Ie[1]]=Ie[0],Ne.push(Ie[1])}),Ne});for(var V=p.yaxis.length-1,Z=0;Z<D.length&&(V=D[Z],N[V]=[],k);Z++){var ce=k[0];k.shift(),N[V].push(ce),A[ce]=V}k.forEach(function(ue){N[V].push(ue),A[ue]=V}),m.seriesYAxisMap=N.map(function(ue){return ue}),m.seriesYAxisReverseMap=A.map(function(ue){return ue}),m.seriesYAxisMap.forEach(function(ue,me){ue.forEach(function(Ne){p.series[Ne]&&p.series[Ne].group===void 0&&(p.series[Ne].group="apexcharts-axis-".concat(me.toString()))})})}},{key:"isSeriesNull",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return(m===null?this.w.config.series.filter(function(p){return p!==null}):this.w.config.series[m].data.filter(function(p){return p!==null})).length===0}},{key:"seriesHaveSameValues",value:function(m){return this.w.globals.series[m].every(function(p,N,A){return p===A[0]})}},{key:"getCategoryLabels",value:function(m){var p=this.w,N=m.slice();return p.config.xaxis.convertedCatToNumeric&&(N=m.map(function(A,k){return p.config.xaxis.labels.formatter(A-p.globals.minX+1)})),N}},{key:"getLargestSeries",value:function(){var m=this.w;m.globals.maxValsInArrayIndex=m.globals.series.map(function(p){return p.length}).indexOf(Math.max.apply(Math,m.globals.series.map(function(p){return p.length})))}},{key:"getLargestMarkerSize",value:function(){var m=this.w,p=0;return m.globals.markers.size.forEach(function(N){p=Math.max(p,N)}),m.config.markers.discrete&&m.config.markers.discrete.length&&m.config.markers.discrete.forEach(function(N){p=Math.max(p,N.size)}),p>0&&(m.config.markers.hover.size>0?p=m.config.markers.hover.size:p+=m.config.markers.hover.sizeOffset),m.globals.markers.largestSize=p,p}},{key:"getSeriesTotals",value:function(){var m=this.w;m.globals.seriesTotals=m.globals.series.map(function(p,N){var A=0;if(Array.isArray(p))for(var k=0;k<p.length;k++)A+=p[k];else A+=p;return A})}},{key:"getSeriesTotalsXRange",value:function(m,p){var N=this.w;return N.globals.series.map(function(A,k){for(var P=0,D=0;D<A.length;D++)N.globals.seriesX[k][D]>m&&N.globals.seriesX[k][D]<p&&(P+=A[D]);return P})}},{key:"getPercentSeries",value:function(){var m=this.w;m.globals.seriesPercent=m.globals.series.map(function(p,N){var A=[];if(Array.isArray(p))for(var k=0;k<p.length;k++){var P=m.globals.stackedSeriesTotals[k],D=0;P&&(D=100*p[k]/P),A.push(D)}else{var V=100*p/m.globals.seriesTotals.reduce(function(Z,ce){return Z+ce},0);A.push(V)}return A})}},{key:"getCalculatedRatios",value:function(){var m,p,N,A=this,k=this.w,P=k.globals,D=[],V=0,Z=[],ce=.1,ue=0;if(P.yRange=[],P.isMultipleYAxis)for(var me=0;me<P.minYArr.length;me++)P.yRange.push(Math.abs(P.minYArr[me]-P.maxYArr[me])),Z.push(0);else P.yRange.push(Math.abs(P.minY-P.maxY));P.xRange=Math.abs(P.maxX-P.minX),P.zRange=Math.abs(P.maxZ-P.minZ);for(var Ne=0;Ne<P.yRange.length;Ne++)D.push(P.yRange[Ne]/P.gridHeight);if(p=P.xRange/P.gridWidth,m=P.yRange/P.gridWidth,N=P.xRange/P.gridHeight,(V=P.zRange/P.gridHeight*16)||(V=1),P.minY!==Number.MIN_VALUE&&Math.abs(P.minY)!==0&&(P.hasNegs=!0),k.globals.seriesYAxisReverseMap.length>0){var Ie=function(Xe,Oe){var $e=k.config.yaxis[k.globals.seriesYAxisReverseMap[Oe]],ae=Xe<0?-1:1;return Xe=Math.abs(Xe),$e.logarithmic&&(Xe=A.getBaseLog($e.logBase,Xe)),-ae*Xe/D[Oe]};if(P.isMultipleYAxis){Z=[];for(var Le=0;Le<D.length;Le++)Z.push(Ie(P.minYArr[Le],Le))}else(Z=[]).push(Ie(P.minY,0)),P.minY!==Number.MIN_VALUE&&Math.abs(P.minY)!==0&&(ce=-P.minY/m,ue=P.minX/p)}else(Z=[]).push(0),ce=0,ue=0;return{yRatio:D,invertedYRatio:m,zRatio:V,xRatio:p,invertedXRatio:N,baseLineInvertedY:ce,baseLineY:Z,baseLineX:ue}}},{key:"getLogSeries",value:function(m){var p=this,N=this.w;return N.globals.seriesLog=m.map(function(A,k){var P=N.globals.seriesYAxisReverseMap[k];return N.config.yaxis[P]&&N.config.yaxis[P].logarithmic?A.map(function(D){return D===null?null:p.getLogVal(N.config.yaxis[P].logBase,D,k)}):A}),N.globals.invalidLogScale?m:N.globals.seriesLog}},{key:"getBaseLog",value:function(m,p){return Math.log(p)/Math.log(m)}},{key:"getLogVal",value:function(m,p,N){if(p<=0)return 0;var A=this.w,k=A.globals.minYArr[N]===0?-1:this.getBaseLog(m,A.globals.minYArr[N]),P=(A.globals.maxYArr[N]===0?0:this.getBaseLog(m,A.globals.maxYArr[N]))-k;return p<1?p/P:(this.getBaseLog(m,p)-k)/P}},{key:"getLogYRatios",value:function(m){var p=this,N=this.w,A=this.w.globals;return A.yLogRatio=m.slice(),A.logYRange=A.yRange.map(function(k,P){var D=N.globals.seriesYAxisReverseMap[P];if(N.config.yaxis[D]&&p.w.config.yaxis[D].logarithmic){var V,Z=-Number.MAX_VALUE,ce=Number.MIN_VALUE;return A.seriesLog.forEach(function(ue,me){ue.forEach(function(Ne){N.config.yaxis[me]&&N.config.yaxis[me].logarithmic&&(Z=Math.max(Ne,Z),ce=Math.min(Ne,ce))})}),V=Math.pow(A.yRange[P],Math.abs(ce-Z)/A.yRange[P]),A.yLogRatio[P]=V/A.gridHeight,V}}),A.invalidLogScale?m.slice():A.yLogRatio}},{key:"drawSeriesByGroup",value:function(m,p,N,A){var k=this.w,P=[];return m.series.length>0&&p.forEach(function(D){var V=[],Z=[];m.i.forEach(function(ce,ue){k.config.series[ce].group===D&&(V.push(m.series[ue]),Z.push(ce))}),V.length>0&&P.push(A.draw(V,N,Z))}),P}}],[{key:"checkComboSeries",value:function(m,p){var N=!1,A=0,k=0;return p===void 0&&(p="line"),m.length&&m[0].type!==void 0&&m.forEach(function(P){P.type!=="bar"&&P.type!=="column"&&P.type!=="candlestick"&&P.type!=="boxPlot"||A++,P.type!==void 0&&P.type!==p&&k++}),k>0&&(N=!0),{comboBarCount:A,comboCharts:N}}},{key:"extendArrayProps",value:function(m,p,N){var A,k,P,D,V,Z;return(A=p)!==null&&A!==void 0&&A.yaxis&&(p=m.extendYAxis(p,N)),(k=p)!==null&&k!==void 0&&k.annotations&&(p.annotations.yaxis&&(p=m.extendYAxisAnnotations(p)),(P=p)!==null&&P!==void 0&&(D=P.annotations)!==null&&D!==void 0&&D.xaxis&&(p=m.extendXAxisAnnotations(p)),(V=p)!==null&&V!==void 0&&(Z=V.annotations)!==null&&Z!==void 0&&Z.points&&(p=m.extendPointAnnotations(p))),p}}]),Ce}(),re=function(){function Ce(m){s(this,Ce),this.w=m.w,this.annoCtx=m}return o(Ce,[{key:"setOrientations",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,N=this.w;if(m.label.orientation==="vertical"){var A=p!==null?p:0,k=N.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(A,"']"));if(k!==null){var P=k.getBoundingClientRect();k.setAttribute("x",parseFloat(k.getAttribute("x"))-P.height+4);var D=m.label.position==="top"?P.width:-P.width;k.setAttribute("y",parseFloat(k.getAttribute("y"))+D);var V=this.annoCtx.graphics.rotateAroundCenter(k),Z=V.x,ce=V.y;k.setAttribute("transform","rotate(-90 ".concat(Z," ").concat(ce,")"))}}}},{key:"addBackgroundToAnno",value:function(m,p){var N=this.w;if(!m||!p.label.text||!String(p.label.text).trim())return null;var A=N.globals.dom.baseEl.querySelector(".apexcharts-grid").getBoundingClientRect(),k=m.getBoundingClientRect(),P=p.label.style.padding,D=P.left,V=P.right,Z=P.top,ce=P.bottom;if(p.label.orientation==="vertical"){var ue=[D,V,Z,ce];Z=ue[0],ce=ue[1],D=ue[2],V=ue[3]}var me=k.left-A.left-D,Ne=k.top-A.top-Z,Ie=this.annoCtx.graphics.drawRect(me-N.globals.barPadForNumericAxis,Ne,k.width+D+V,k.height+Z+ce,p.label.borderRadius,p.label.style.background,1,p.label.borderWidth,p.label.borderColor,0);return p.id&&Ie.node.classList.add(p.id),Ie}},{key:"annotationsBackground",value:function(){var m=this,p=this.w,N=function(A,k,P){var D=p.globals.dom.baseEl.querySelector(".apexcharts-".concat(P,"-annotations .apexcharts-").concat(P,"-annotation-label[rel='").concat(k,"']"));if(D){var V=D.parentNode,Z=m.addBackgroundToAnno(D,A);Z&&(V.insertBefore(Z.node,D),A.label.mouseEnter&&Z.node.addEventListener("mouseenter",A.label.mouseEnter.bind(m,A)),A.label.mouseLeave&&Z.node.addEventListener("mouseleave",A.label.mouseLeave.bind(m,A)),A.label.click&&Z.node.addEventListener("click",A.label.click.bind(m,A)))}};p.config.annotations.xaxis.forEach(function(A,k){return N(A,k,"xaxis")}),p.config.annotations.yaxis.forEach(function(A,k){return N(A,k,"yaxis")}),p.config.annotations.points.forEach(function(A,k){return N(A,k,"point")})}},{key:"getY1Y2",value:function(m,p){var N,A=this.w,k=m==="y1"?p.y:p.y2,P=!1;if(this.annoCtx.invertAxis){var D=A.config.xaxis.convertedCatToNumeric?A.globals.categoryLabels:A.globals.labels,V=D.indexOf(k),Z=A.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child(".concat(V+1,")"));N=Z?parseFloat(Z.getAttribute("y")):(A.globals.gridHeight/D.length-1)*(V+1)-A.globals.barHeight,p.seriesIndex!==void 0&&A.globals.barHeight&&(N-=A.globals.barHeight/2*(A.globals.series.length-1)-A.globals.barHeight*p.seriesIndex)}else{var ce,ue=A.globals.seriesYAxisMap[p.yAxisIndex][0],me=A.config.yaxis[p.yAxisIndex].logarithmic?new Y(this.annoCtx.ctx).getLogVal(A.config.yaxis[p.yAxisIndex].logBase,k,ue)/A.globals.yLogRatio[ue]:(k-A.globals.minYArr[ue])/(A.globals.yRange[ue]/A.globals.gridHeight);N=A.globals.gridHeight-Math.min(Math.max(me,0),A.globals.gridHeight),P=me>A.globals.gridHeight||me<0,!p.marker||p.y!==void 0&&p.y!==null||(N=0),(ce=A.config.yaxis[p.yAxisIndex])!==null&&ce!==void 0&&ce.reversed&&(N=me)}return typeof k=="string"&&k.includes("px")&&(N=parseFloat(k)),{yP:N,clipped:P}}},{key:"getX1X2",value:function(m,p){var N=this.w,A=m==="x1"?p.x:p.x2,k=this.annoCtx.invertAxis?N.globals.minY:N.globals.minX,P=this.annoCtx.invertAxis?N.globals.maxY:N.globals.maxX,D=this.annoCtx.invertAxis?N.globals.yRange[0]:N.globals.xRange,V=!1,Z=this.annoCtx.inversedReversedAxis?(P-A)/(D/N.globals.gridWidth):(A-k)/(D/N.globals.gridWidth);return N.config.xaxis.type!=="category"&&!N.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||N.globals.dataFormatXNumeric||N.config.chart.sparkline.enabled||(Z=this.getStringX(A)),typeof A=="string"&&A.includes("px")&&(Z=parseFloat(A)),A==null&&p.marker&&(Z=N.globals.gridWidth),p.seriesIndex!==void 0&&N.globals.barWidth&&!this.annoCtx.invertAxis&&(Z-=N.globals.barWidth/2*(N.globals.series.length-1)-N.globals.barWidth*p.seriesIndex),Z>N.globals.gridWidth?(Z=N.globals.gridWidth,V=!0):Z<0&&(Z=0,V=!0),{x:Z,clipped:V}}},{key:"getStringX",value:function(m){var p=this.w,N=m;p.config.xaxis.convertedCatToNumeric&&p.globals.categoryLabels.length&&(m=p.globals.categoryLabels.indexOf(m)+1);var A=p.globals.labels.map(function(P){return Array.isArray(P)?P.join(" "):P}).indexOf(m),k=p.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child(".concat(A+1,")"));return k&&(N=parseFloat(k.getAttribute("x"))),N}}]),Ce}(),Q=function(){function Ce(m){s(this,Ce),this.w=m.w,this.annoCtx=m,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new re(this.annoCtx)}return o(Ce,[{key:"addXaxisAnnotation",value:function(m,p,N){var A,k=this.w,P=this.helpers.getX1X2("x1",m),D=P.x,V=P.clipped,Z=!0,ce=m.label.text,ue=m.strokeDashArray;if(F.isNumber(D)){if(m.x2===null||m.x2===void 0){if(!V){var me=this.annoCtx.graphics.drawLine(D+m.offsetX,0+m.offsetY,D+m.offsetX,k.globals.gridHeight+m.offsetY,m.borderColor,ue,m.borderWidth);p.appendChild(me.node),m.id&&me.node.classList.add(m.id)}}else{var Ne=this.helpers.getX1X2("x2",m);if(A=Ne.x,Z=Ne.clipped,!V||!Z){if(A<D){var Ie=D;D=A,A=Ie}var Le=this.annoCtx.graphics.drawRect(D+m.offsetX,0+m.offsetY,A-D,k.globals.gridHeight+m.offsetY,0,m.fillColor,m.opacity,1,m.borderColor,ue);Le.node.classList.add("apexcharts-annotation-rect"),Le.attr("clip-path","url(#gridRectMask".concat(k.globals.cuid,")")),p.appendChild(Le.node),m.id&&Le.node.classList.add(m.id)}}if(!V||!Z){var Xe=this.annoCtx.graphics.getTextRects(ce,parseFloat(m.label.style.fontSize)),Oe=m.label.position==="top"?4:m.label.position==="center"?k.globals.gridHeight/2+(m.label.orientation==="vertical"?Xe.width/2:0):k.globals.gridHeight,$e=this.annoCtx.graphics.drawText({x:D+m.label.offsetX,y:Oe+m.label.offsetY-(m.label.orientation==="vertical"?m.label.position==="top"?Xe.width/2-12:-Xe.width/2:0),text:ce,textAnchor:m.label.textAnchor,fontSize:m.label.style.fontSize,fontFamily:m.label.style.fontFamily,fontWeight:m.label.style.fontWeight,foreColor:m.label.style.color,cssClass:"apexcharts-xaxis-annotation-label ".concat(m.label.style.cssClass," ").concat(m.id?m.id:"")});$e.attr({rel:N}),p.appendChild($e.node),this.annoCtx.helpers.setOrientations(m,N)}}}},{key:"drawXAxisAnnotations",value:function(){var m=this,p=this.w,N=this.annoCtx.graphics.group({class:"apexcharts-xaxis-annotations"});return p.config.annotations.xaxis.map(function(A,k){m.addXaxisAnnotation(A,N.node,k)}),N}}]),Ce}(),q=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.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(Ce,[{key:"isValidDate",value:function(m){return typeof m!="number"&&!isNaN(this.parseDate(m))}},{key:"getTimeStamp",value:function(m){return Date.parse(m)?this.w.config.xaxis.labels.datetimeUTC?new Date(new Date(m).toISOString().substr(0,25)).getTime():new Date(m).getTime():m}},{key:"getDate",value:function(m){return this.w.config.xaxis.labels.datetimeUTC?new Date(new Date(m).toUTCString()):new Date(m)}},{key:"parseDate",value:function(m){var p=Date.parse(m);if(!isNaN(p))return this.getTimeStamp(m);var N=Date.parse(m.replace(/-/g,"/").replace(/[a-z]+/gi," "));return N=this.getTimeStamp(N)}},{key:"parseDateWithTimezone",value:function(m){return Date.parse(m.replace(/-/g,"/").replace(/[a-z]+/gi," "))}},{key:"formatDate",value:function(m,p){var N=this.w.globals.locale,A=this.w.config.xaxis.labels.datetimeUTC,k=["\0"].concat(S(N.months)),P=[""].concat(S(N.shortMonths)),D=[""].concat(S(N.days)),V=[""].concat(S(N.shortDays));function Z(Ze,it){var wt=Ze+"";for(it=it||2;wt.length<it;)wt="0"+wt;return wt}var ce=A?m.getUTCFullYear():m.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=(A?m.getUTCMonth():m.getMonth())+1;p=(p=(p=(p=p.replace(/(^|[^\\])MMMM+/g,"$1"+k[0])).replace(/(^|[^\\])MMM/g,"$1"+P[0])).replace(/(^|[^\\])MM/g,"$1"+Z(ue))).replace(/(^|[^\\])M/g,"$1"+ue);var me=A?m.getUTCDate():m.getDate();p=(p=(p=(p=p.replace(/(^|[^\\])dddd+/g,"$1"+D[0])).replace(/(^|[^\\])ddd/g,"$1"+V[0])).replace(/(^|[^\\])dd/g,"$1"+Z(me))).replace(/(^|[^\\])d/g,"$1"+me);var Ne=A?m.getUTCHours():m.getHours(),Ie=Ne>12?Ne-12:Ne===0?12:Ne;p=(p=(p=(p=p.replace(/(^|[^\\])HH+/g,"$1"+Z(Ne))).replace(/(^|[^\\])H/g,"$1"+Ne)).replace(/(^|[^\\])hh+/g,"$1"+Z(Ie))).replace(/(^|[^\\])h/g,"$1"+Ie);var Le=A?m.getUTCMinutes():m.getMinutes();p=(p=p.replace(/(^|[^\\])mm+/g,"$1"+Z(Le))).replace(/(^|[^\\])m/g,"$1"+Le);var Xe=A?m.getUTCSeconds():m.getSeconds();p=(p=p.replace(/(^|[^\\])ss+/g,"$1"+Z(Xe))).replace(/(^|[^\\])s/g,"$1"+Xe);var Oe=A?m.getUTCMilliseconds():m.getMilliseconds();p=p.replace(/(^|[^\\])fff+/g,"$1"+Z(Oe,3)),Oe=Math.round(Oe/10),p=p.replace(/(^|[^\\])ff/g,"$1"+Z(Oe)),Oe=Math.round(Oe/10);var $e=Ne<12?"AM":"PM";p=(p=(p=p.replace(/(^|[^\\])f/g,"$1"+Oe)).replace(/(^|[^\\])TT+/g,"$1"+$e)).replace(/(^|[^\\])T/g,"$1"+$e.charAt(0));var ae=$e.toLowerCase();p=(p=p.replace(/(^|[^\\])tt+/g,"$1"+ae)).replace(/(^|[^\\])t/g,"$1"+ae.charAt(0));var he=-m.getTimezoneOffset(),Pe=A||!he?"Z":he>0?"+":"-";if(!A){var Ve=(he=Math.abs(he))%60;Pe+=Z(Math.floor(he/60))+":"+Z(Ve)}p=p.replace(/(^|[^\\])K/g,"$1"+Pe);var Te=(A?m.getUTCDay():m.getDay())+1;return p=(p=(p=(p=(p=p.replace(new RegExp(D[0],"g"),D[Te])).replace(new RegExp(V[0],"g"),V[Te])).replace(new RegExp(k[0],"g"),k[ue])).replace(new RegExp(P[0],"g"),P[ue])).replace(/\\(.)/g,"$1")}},{key:"getTimeUnitsfromTimestamp",value:function(m,p,N){var A=this.w;A.config.xaxis.min!==void 0&&(m=A.config.xaxis.min),A.config.xaxis.max!==void 0&&(p=A.config.xaxis.max);var k=this.getDate(m),P=this.getDate(p),D=this.formatDate(k,"yyyy MM dd HH mm ss fff").split(" "),V=this.formatDate(P,"yyyy MM dd HH mm ss fff").split(" ");return{minMillisecond:parseInt(D[6],10),maxMillisecond:parseInt(V[6],10),minSecond:parseInt(D[5],10),maxSecond:parseInt(V[5],10),minMinute:parseInt(D[4],10),maxMinute:parseInt(V[4],10),minHour:parseInt(D[3],10),maxHour:parseInt(V[3],10),minDate:parseInt(D[2],10),maxDate:parseInt(V[2],10),minMonth:parseInt(D[1],10)-1,maxMonth:parseInt(V[1],10)-1,minYear:parseInt(D[0],10),maxYear:parseInt(V[0],10)}}},{key:"isLeapYear",value:function(m){return m%4==0&&m%100!=0||m%400==0}},{key:"calculcateLastDaysOfMonth",value:function(m,p,N){return this.determineDaysOfMonths(m,p)-N}},{key:"determineDaysOfYear",value:function(m){var p=365;return this.isLeapYear(m)&&(p=366),p}},{key:"determineRemainingDaysOfYear",value:function(m,p,N){var A=this.daysCntOfYear[p]+N;return p>1&&this.isLeapYear()&&A++,A}},{key:"determineDaysOfMonths",value:function(m,p){var N=30;switch(m=F.monthMod(m),!0){case this.months30.indexOf(m)>-1:m===2&&(N=this.isLeapYear(p)?29:28);break;case this.months31.indexOf(m)>-1:default:N=31}return N}}]),Ce}(),te=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.tooltipKeyFormat="dd MMM"}return o(Ce,[{key:"xLabelFormat",value:function(m,p,N,A){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 P=new q(this.ctx);return P.formatDate(P.getDate(p),k.config.tooltip.x.format)}return m(p,N,A)}},{key:"defaultGeneralFormatter",value:function(m){return Array.isArray(m)?m.map(function(p){return p}):m}},{key:"defaultYFormatter",value:function(m,p,N){var A=this.w;if(F.isNumber(m))if(A.globals.yValueDecimal!==0)m=m.toFixed(p.decimalsInFloat!==void 0?p.decimalsInFloat:A.globals.yValueDecimal);else{var k=m.toFixed(0);m=m==k?k:m.toFixed(1)}return m}},{key:"setLabelFormatters",value:function(){var m=this,p=this.w;return p.globals.xaxisTooltipFormatter=function(N){return m.defaultGeneralFormatter(N)},p.globals.ttKeyFormatter=function(N){return m.defaultGeneralFormatter(N)},p.globals.ttZFormatter=function(N){return N},p.globals.legendFormatter=function(N){return m.defaultGeneralFormatter(N)},p.config.xaxis.labels.formatter!==void 0?p.globals.xLabelFormatter=p.config.xaxis.labels.formatter:p.globals.xLabelFormatter=function(N){if(F.isNumber(N)){if(!p.config.xaxis.convertedCatToNumeric&&p.config.xaxis.type==="numeric"){if(F.isNumber(p.config.xaxis.decimalsInFloat))return N.toFixed(p.config.xaxis.decimalsInFloat);var A=p.globals.maxX-p.globals.minX;return A>0&&A<100?N.toFixed(1):N.toFixed(0)}return p.globals.isBarHorizontal&&p.globals.maxY-p.globals.minYArr<4?N.toFixed(1):N.toFixed(0)}return N},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(N,A){N.labels.formatter!==void 0?p.globals.yLabelFormatters[A]=N.labels.formatter:p.globals.yLabelFormatters[A]=function(k){return p.globals.xyCharts?Array.isArray(k)?k.map(function(P){return m.defaultYFormatter(P,N,A)}):m.defaultYFormatter(k,N,A):k}}),p.globals}},{key:"heatmapLabelFormatters",value:function(){var m=this.w;if(m.config.chart.type==="heatmap"){m.globals.yAxisScale[0].result=m.globals.seriesNames.slice();var p=m.globals.seriesNames.reduce(function(N,A){return N.length>A.length?N:A},0);m.globals.yAxisScale[0].niceMax=p,m.globals.yAxisScale[0].niceMin=p}}}]),Ce}(),fe=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"getLabel",value:function(m,p,N,A){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],P=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"12px",D=!(arguments.length>6&&arguments[6]!==void 0)||arguments[6],V=this.w,Z=m[A]===void 0?"":m[A],ce=Z,ue=V.globals.xLabelFormatter,me=V.config.xaxis.labels.formatter,Ne=!1,Ie=new te(this.ctx),Le=Z;D&&(ce=Ie.xLabelFormat(ue,Z,Le,{i:A,dateFormatter:new q(this.ctx).formatDate,w:V}),me!==void 0&&(ce=me(Z,m[A],{i:A,dateFormatter:new q(this.ctx).formatDate,w:V})));var Xe,Oe;p.length>0?(Xe=p[A].unit,Oe=null,p.forEach(function(Pe){Pe.unit==="month"?Oe="year":Pe.unit==="day"?Oe="month":Pe.unit==="hour"?Oe="day":Pe.unit==="minute"&&(Oe="hour")}),Ne=Oe===Xe,N=p[A].position,ce=p[A].value):V.config.xaxis.type==="datetime"&&me===void 0&&(ce=""),ce===void 0&&(ce=""),ce=Array.isArray(ce)?ce:ce.toString();var $e=new U(this.ctx),ae={};ae=V.globals.rotateXLabels&&D?$e.getTextRects(ce,parseInt(P,10),null,"rotate(".concat(V.config.xaxis.labels.rotate," 0 0)"),!1):$e.getTextRects(ce,parseInt(P,10));var he=!V.config.xaxis.labels.showDuplicates&&this.ctx.timeScale;return!Array.isArray(ce)&&(String(ce)==="NaN"||k.indexOf(ce)>=0&&he)&&(ce=""),{x:N,text:ce,textRect:ae,isBold:Ne}}},{key:"checkLabelBasedOnTickamount",value:function(m,p,N){var A=this.w,k=A.config.xaxis.tickAmount;return k==="dataPoints"&&(k=Math.round(A.globals.gridWidth/120)),k>N||m%Math.round(N/(k+1))==0||(p.text=""),p}},{key:"checkForOverflowingLabels",value:function(m,p,N,A,k){var P=this.w;if(m===0&&P.globals.skipFirstTimelinelabel&&(p.text=""),m===N-1&&P.globals.skipLastTimelinelabel&&(p.text=""),P.config.xaxis.labels.hideOverlappingLabels&&A.length>0){var D=k[k.length-1];p.x<D.textRect.width/(P.globals.rotateXLabels?Math.abs(P.config.xaxis.labels.rotate)/12:1.01)+D.x&&(p.text="")}return p}},{key:"checkForReversedLabels",value:function(m,p){var N=this.w;return N.config.yaxis[m]&&N.config.yaxis[m].reversed&&p.reverse(),p}},{key:"yAxisAllSeriesCollapsed",value:function(m){var p=this.w.globals;return!p.seriesYAxisMap[m].some(function(N){return p.collapsedSeriesIndices.indexOf(N)===-1})}},{key:"translateYAxisIndex",value:function(m){var p=this.w,N=p.globals,A=p.config.yaxis;return N.series.length>A.length||A.some(function(k){return Array.isArray(k.seriesName)})?m:N.seriesYAxisReverseMap[m]}},{key:"isYAxisHidden",value:function(m){var p=this.w,N=p.config.yaxis[m];if(!N.show||this.yAxisAllSeriesCollapsed(m))return!0;if(!N.showForNullSeries){var A=p.globals.seriesYAxisMap[m],k=new Y(this.ctx);return A.every(function(P){return k.isSeriesNull(P)})}return!1}},{key:"getYAxisForeColor",value:function(m,p){var N=this.w;return Array.isArray(m)&&N.globals.yAxisScale[p]&&this.ctx.theme.pushExtraColors(m,N.globals.yAxisScale[p].result.length,!1),m}},{key:"drawYAxisTicks",value:function(m,p,N,A,k,P,D){var V=this.w,Z=new U(this.ctx),ce=V.globals.translateY+V.config.yaxis[k].labels.offsetY;if(V.globals.isBarHorizontal?ce=0:V.config.chart.type==="heatmap"&&(ce+=P/2),A.show&&p>0){V.config.yaxis[k].opposite===!0&&(m+=A.width);for(var ue=p;ue>=0;ue--){var me=Z.drawLine(m+N.offsetX-A.width+A.offsetX,ce+A.offsetY,m+N.offsetX+A.offsetX,ce+A.offsetY,A.color);D.add(me),ce+=P}}}}]),Ce}(),G=function(){function Ce(m){s(this,Ce),this.w=m.w,this.annoCtx=m,this.helpers=new re(this.annoCtx),this.axesUtils=new fe(this.annoCtx)}return o(Ce,[{key:"addYaxisAnnotation",value:function(m,p,N){var A,k=this.w,P=m.strokeDashArray,D=this.helpers.getY1Y2("y1",m),V=D.yP,Z=D.clipped,ce=!0,ue=!1,me=m.label.text;if(m.y2===null||m.y2===void 0){if(!Z){ue=!0;var Ne=this.annoCtx.graphics.drawLine(0+m.offsetX,V+m.offsetY,this._getYAxisAnnotationWidth(m),V+m.offsetY,m.borderColor,P,m.borderWidth);p.appendChild(Ne.node),m.id&&Ne.node.classList.add(m.id)}}else{if(A=(D=this.helpers.getY1Y2("y2",m)).yP,ce=D.clipped,A>V){var Ie=V;V=A,A=Ie}if(!Z||!ce){ue=!0;var Le=this.annoCtx.graphics.drawRect(0+m.offsetX,A+m.offsetY,this._getYAxisAnnotationWidth(m),V-A,0,m.fillColor,m.opacity,1,m.borderColor,P);Le.node.classList.add("apexcharts-annotation-rect"),Le.attr("clip-path","url(#gridRectMask".concat(k.globals.cuid,")")),p.appendChild(Le.node),m.id&&Le.node.classList.add(m.id)}}if(ue){var Xe=m.label.position==="right"?k.globals.gridWidth:m.label.position==="center"?k.globals.gridWidth/2:0,Oe=this.annoCtx.graphics.drawText({x:Xe+m.label.offsetX,y:(A??V)+m.label.offsetY-3,text:me,textAnchor:m.label.textAnchor,fontSize:m.label.style.fontSize,fontFamily:m.label.style.fontFamily,fontWeight:m.label.style.fontWeight,foreColor:m.label.style.color,cssClass:"apexcharts-yaxis-annotation-label ".concat(m.label.style.cssClass," ").concat(m.id?m.id:"")});Oe.attr({rel:N}),p.appendChild(Oe.node)}}},{key:"_getYAxisAnnotationWidth",value:function(m){var p=this.w;return p.globals.gridWidth,(m.width.indexOf("%")>-1?p.globals.gridWidth*parseInt(m.width,10)/100:parseInt(m.width,10))+m.offsetX}},{key:"drawYAxisAnnotations",value:function(){var m=this,p=this.w,N=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return p.config.annotations.yaxis.forEach(function(A,k){A.yAxisIndex=m.axesUtils.translateYAxisIndex(A.yAxisIndex),m.axesUtils.isYAxisHidden(A.yAxisIndex)&&m.axesUtils.yAxisAllSeriesCollapsed(A.yAxisIndex)||m.addYaxisAnnotation(A,N.node,k)}),N}}]),Ce}(),ie=function(){function Ce(m){s(this,Ce),this.w=m.w,this.annoCtx=m,this.helpers=new re(this.annoCtx)}return o(Ce,[{key:"addPointAnnotation",value:function(m,p,N){if(!(this.w.globals.collapsedSeriesIndices.indexOf(m.seriesIndex)>-1)){var A=this.helpers.getX1X2("x1",m),k=A.x,P=A.clipped,D=(A=this.helpers.getY1Y2("y1",m)).yP,V=A.clipped;if(F.isNumber(k)&&!V&&!P){var Z={pSize:m.marker.size,pointStrokeWidth:m.marker.strokeWidth,pointFillColor:m.marker.fillColor,pointStrokeColor:m.marker.strokeColor,shape:m.marker.shape,pRadius:m.marker.radius,class:"apexcharts-point-annotation-marker ".concat(m.marker.cssClass," ").concat(m.id?m.id:"")},ce=this.annoCtx.graphics.drawMarker(k+m.marker.offsetX,D+m.marker.offsetY,Z);p.appendChild(ce.node);var ue=m.label.text?m.label.text:"",me=this.annoCtx.graphics.drawText({x:k+m.label.offsetX,y:D+m.label.offsetY-m.marker.size-parseFloat(m.label.style.fontSize)/1.6,text:ue,textAnchor:m.label.textAnchor,fontSize:m.label.style.fontSize,fontFamily:m.label.style.fontFamily,fontWeight:m.label.style.fontWeight,foreColor:m.label.style.color,cssClass:"apexcharts-point-annotation-label ".concat(m.label.style.cssClass," ").concat(m.id?m.id:"")});if(me.attr({rel:N}),p.appendChild(me.node),m.customSVG.SVG){var Ne=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+m.customSVG.cssClass});Ne.attr({transform:"translate(".concat(k+m.customSVG.offsetX,", ").concat(D+m.customSVG.offsetY,")")}),Ne.node.innerHTML=m.customSVG.SVG,p.appendChild(Ne.node)}if(m.image.path){var Ie=m.image.width?m.image.width:20,Le=m.image.height?m.image.height:20;ce=this.annoCtx.addImage({x:k+m.image.offsetX-Ie/2,y:D+m.image.offsetY-Le/2,width:Ie,height:Le,path:m.image.path,appendTo:".apexcharts-point-annotations"})}m.mouseEnter&&ce.node.addEventListener("mouseenter",m.mouseEnter.bind(this,m)),m.mouseLeave&&ce.node.addEventListener("mouseleave",m.mouseLeave.bind(this,m)),m.click&&ce.node.addEventListener("click",m.click.bind(this,m))}}}},{key:"drawPointAnnotations",value:function(){var m=this,p=this.w,N=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return p.config.annotations.points.map(function(A,k){m.addPointAnnotation(A,N.node,k)}),N}}]),Ce}(),oe={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"}}},K=function(){function Ce(){s(this,Ce),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(Ce,[{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:[oe],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(m){return m}},value:{show:!0,fontSize:"14px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:16,formatter:function(m){return m+"%"}},total:{show:!1,label:"Total",fontSize:"16px",fontWeight:600,fontFamily:void 0,color:void 0,formatter:function(m){return m.globals.seriesTotals.reduce(function(p,N){return p+N},0)/m.globals.series.length+"%"}}},barLabels:{enabled:!1,offsetX:0,offsetY:0,useSeriesColors:!0,fontFamily:void 0,fontWeight:600,fontSize:"16px",formatter:function(m){return m},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(m){return m}},value:{show:!0,fontSize:"20px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:10,formatter:function(m){return m}},total:{show:!1,showAlways:!1,label:"Total",fontSize:"16px",fontWeight:400,fontFamily:void 0,color:void 0,formatter:function(m){return m.globals.seriesTotals.reduce(function(p,N){return p+N},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(m){return m!==null?m:""},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(m){return m?m+": ":""}}},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}}}}}]),Ce}(),H=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.graphics=new U(this.ctx),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new re(this),this.xAxisAnnotations=new Q(this),this.yAxisAnnotations=new G(this),this.pointsAnnotations=new ie(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(Ce,[{key:"drawAxesAnnotations",value:function(){var m=this.w;if(m.globals.axisCharts&&m.globals.dataPoints){for(var p=this.yAxisAnnotations.drawYAxisAnnotations(),N=this.xAxisAnnotations.drawXAxisAnnotations(),A=this.pointsAnnotations.drawPointAnnotations(),k=m.config.chart.animations.enabled,P=[p,N,A],D=[N.node,p.node,A.node],V=0;V<3;V++)m.globals.dom.elGraphical.add(P[V]),!k||m.globals.resized||m.globals.dataChanged||m.config.chart.type!=="scatter"&&m.config.chart.type!=="bubble"&&m.globals.dataPoints>1&&D[V].classList.add("apexcharts-element-hidden"),m.globals.delayedElements.push({el:D[V],index:0});this.helpers.annotationsBackground()}}},{key:"drawImageAnnos",value:function(){var m=this;this.w.config.annotations.images.map(function(p,N){m.addImage(p,N)})}},{key:"drawTextAnnos",value:function(){var m=this;this.w.config.annotations.texts.map(function(p,N){m.addText(p,N)})}},{key:"addXaxisAnnotation",value:function(m,p,N){this.xAxisAnnotations.addXaxisAnnotation(m,p,N)}},{key:"addYaxisAnnotation",value:function(m,p,N){this.yAxisAnnotations.addYaxisAnnotation(m,p,N)}},{key:"addPointAnnotation",value:function(m,p,N){this.pointsAnnotations.addPointAnnotation(m,p,N)}},{key:"addText",value:function(m,p){var N=m.x,A=m.y,k=m.text,P=m.textAnchor,D=m.foreColor,V=m.fontSize,Z=m.fontFamily,ce=m.fontWeight,ue=m.cssClass,me=m.backgroundColor,Ne=m.borderWidth,Ie=m.strokeDashArray,Le=m.borderRadius,Xe=m.borderColor,Oe=m.appendTo,$e=Oe===void 0?".apexcharts-svg":Oe,ae=m.paddingLeft,he=ae===void 0?4:ae,Pe=m.paddingRight,Ve=Pe===void 0?4:Pe,Te=m.paddingBottom,Ze=Te===void 0?2:Te,it=m.paddingTop,wt=it===void 0?2:it,Dt=this.w,Qt=this.graphics.drawText({x:N,y:A,text:k,textAnchor:P||"start",fontSize:V||"12px",fontWeight:ce||"regular",fontFamily:Z||Dt.config.chart.fontFamily,foreColor:D||Dt.config.chart.foreColor,cssClass:ue}),xn=Dt.globals.dom.baseEl.querySelector($e);xn&&xn.appendChild(Qt.node);var pn=Qt.bbox();if(k){var An=this.graphics.drawRect(pn.x-he,pn.y-wt,pn.width+he+Ve,pn.height+Ze+wt,Le,me||"transparent",1,Ne,Xe,Ie);xn.insertBefore(An.node,Qt.node)}}},{key:"addImage",value:function(m,p){var N=this.w,A=m.path,k=m.x,P=k===void 0?0:k,D=m.y,V=D===void 0?0:D,Z=m.width,ce=Z===void 0?20:Z,ue=m.height,me=ue===void 0?20:ue,Ne=m.appendTo,Ie=Ne===void 0?".apexcharts-svg":Ne,Le=N.globals.dom.Paper.image(A);Le.size(ce,me).move(P,V);var Xe=N.globals.dom.baseEl.querySelector(Ie);return Xe&&Xe.appendChild(Le.node),Le}},{key:"addXaxisAnnotationExternal",value:function(m,p,N){return this.addAnnotationExternal({params:m,pushToMemory:p,context:N,type:"xaxis",contextMethod:N.addXaxisAnnotation}),N}},{key:"addYaxisAnnotationExternal",value:function(m,p,N){return this.addAnnotationExternal({params:m,pushToMemory:p,context:N,type:"yaxis",contextMethod:N.addYaxisAnnotation}),N}},{key:"addPointAnnotationExternal",value:function(m,p,N){return this.invertAxis===void 0&&(this.invertAxis=N.w.globals.isBarHorizontal),this.addAnnotationExternal({params:m,pushToMemory:p,context:N,type:"point",contextMethod:N.addPointAnnotation}),N}},{key:"addAnnotationExternal",value:function(m){var p=m.params,N=m.pushToMemory,A=m.context,k=m.type,P=m.contextMethod,D=A,V=D.w,Z=V.globals.dom.baseEl.querySelector(".apexcharts-".concat(k,"-annotations")),ce=Z.childNodes.length+1,ue=new K,me=Object.assign({},k==="xaxis"?ue.xAxisAnnotation:k==="yaxis"?ue.yAxisAnnotation:ue.pointAnnotation),Ne=F.extend(me,p);switch(k){case"xaxis":this.addXaxisAnnotation(Ne,Z,ce);break;case"yaxis":this.addYaxisAnnotation(Ne,Z,ce);break;case"point":this.addPointAnnotation(Ne,Z,ce)}var Ie=V.globals.dom.baseEl.querySelector(".apexcharts-".concat(k,"-annotations .apexcharts-").concat(k,"-annotation-label[rel='").concat(ce,"']")),Le=this.helpers.addBackgroundToAnno(Ie,Ne);return Le&&Z.insertBefore(Le.node,Ie),N&&V.globals.memory.methodsToExec.push({context:D,id:Ne.id?Ne.id:F.randomId(),method:P,label:"addAnnotation",params:p}),A}},{key:"clearAnnotations",value:function(m){for(var p=m.w,N=p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations"),A=p.globals.memory.methodsToExec.length-1;A>=0;A--)p.globals.memory.methodsToExec[A].label!=="addText"&&p.globals.memory.methodsToExec[A].label!=="addAnnotation"||p.globals.memory.methodsToExec.splice(A,1);N=F.listToArray(N),Array.prototype.forEach.call(N,function(k){for(;k.firstChild;)k.removeChild(k.firstChild)})}},{key:"removeAnnotation",value:function(m,p){var N=m.w,A=N.globals.dom.baseEl.querySelectorAll(".".concat(p));A&&(N.globals.memory.methodsToExec.map(function(k,P){k.id===p&&N.globals.memory.methodsToExec.splice(P,1)}),Array.prototype.forEach.call(A,function(k){k.parentElement.removeChild(k)}))}}]),Ce}(),ee=function(Ce){var m,p=Ce.isTimeline,N=Ce.ctx,A=Ce.seriesIndex,k=Ce.dataPointIndex,P=Ce.y1,D=Ce.y2,V=Ce.w,Z=V.globals.seriesRangeStart[A][k],ce=V.globals.seriesRangeEnd[A][k],ue=V.globals.labels[k],me=V.config.series[A].name?V.config.series[A].name:"",Ne=V.globals.ttKeyFormatter,Ie=V.config.tooltip.y.title.formatter,Le={w:V,seriesIndex:A,dataPointIndex:k,start:Z,end:ce};typeof Ie=="function"&&(me=Ie(me,Le)),(m=V.config.series[A].data[k])!==null&&m!==void 0&&m.x&&(ue=V.config.series[A].data[k].x),p||V.config.xaxis.type==="datetime"&&(ue=new te(N).xLabelFormat(V.globals.ttKeyFormatter,ue,ue,{i:void 0,dateFormatter:new q(N).formatDate,w:V})),typeof Ne=="function"&&(ue=Ne(ue,Le)),Number.isFinite(P)&&Number.isFinite(D)&&(Z=P,ce=D);var Xe="",Oe="",$e=V.globals.colors[A];if(V.config.tooltip.x.formatter===void 0)if(V.config.xaxis.type==="datetime"){var ae=new q(N);Xe=ae.formatDate(ae.getDate(Z),V.config.tooltip.x.format),Oe=ae.formatDate(ae.getDate(ce),V.config.tooltip.x.format)}else Xe=Z,Oe=ce;else Xe=V.config.tooltip.x.formatter(Z),Oe=V.config.tooltip.x.formatter(ce);return{start:Z,end:ce,startVal:Xe,endVal:Oe,ylabel:ue,color:$e,seriesName:me}},se=function(Ce){var m=Ce.color,p=Ce.seriesName,N=Ce.ylabel,A=Ce.start,k=Ce.end,P=Ce.seriesIndex,D=Ce.dataPointIndex,V=Ce.ctx.tooltip.tooltipLabels.getFormatters(P);A=V.yLbFormatter(A),k=V.yLbFormatter(k);var Z=V.yLbFormatter(Ce.w.globals.series[P][D]),ce=`<span class="value start-value">
`.concat(A,`
</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: '+m+'">'+(p||"")+'</span></div><div> <span class="category">'+N+": </span> "+(Ce.w.globals.comboCharts?Ce.w.config.series[P].type==="rangeArea"||Ce.w.config.series[P].type==="rangeBar"?ce:"<span>".concat(Z,"</span>"):ce)+" </div></div>"},pe=function(){function Ce(m){s(this,Ce),this.opts=m}return o(Ce,[{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(m){return this.hideYAxis(),F.extend(m,{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(m,p){var N=p.w.config.series[p.seriesIndex].name;return m!==null?N+": "+m:""},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 m=this;return{stroke:{width:1,colors:["#333"]},fill:{opacity:1},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(p){var N=p.seriesIndex,A=p.dataPointIndex,k=p.w;return m._getBoxTooltip(k,N,A,["Open","High","","Low","Close"],"candlestick")}},states:{active:{filter:{type:"none"}}},xaxis:{crosshairs:{width:1}}}}},{key:"boxPlot",value:function(){var m=this;return{chart:{animations:{dynamicAnimation:{enabled:!1}}},stroke:{width:1,colors:["#24292e"]},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(p){var N=p.seriesIndex,A=p.dataPointIndex,k=p.w;return m._getBoxTooltip(k,N,A,["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(m,p){p.ctx;var N=p.seriesIndex,A=p.dataPointIndex,k=p.w,P=function(){var D=k.globals.seriesRangeStart[N][A];return k.globals.seriesRangeEnd[N][A]-D};return k.globals.comboCharts?k.config.series[N].type==="rangeBar"||k.config.series[N].type==="rangeArea"?P():m:P()},background:{enabled:!1},style:{colors:["#fff"]}},markers:{size:10},tooltip:{shared:!1,followCursor:!0,custom:function(m){return m.w.config.plotOptions&&m.w.config.plotOptions.bar&&m.w.config.plotOptions.bar.horizontal?function(p){var N=ee(y(y({},p),{},{isTimeline:!0})),A=N.color,k=N.seriesName,P=N.ylabel,D=N.startVal,V=N.endVal;return se(y(y({},p),{},{color:A,seriesName:k,ylabel:P,start:D,end:V}))}(m):function(p){var N=ee(p),A=N.color,k=N.seriesName,P=N.ylabel,D=N.start,V=N.end;return se(y(y({},p),{},{color:A,seriesName:k,ylabel:P,start:D,end:V}))}(m)}},xaxis:{tickPlacement:"between",tooltip:{enabled:!1},crosshairs:{stroke:{width:0}}}}}},{key:"dumbbell",value:function(m){var p,N;return(p=m.plotOptions.bar)!==null&&p!==void 0&&p.barHeight||(m.plotOptions.bar.barHeight=2),(N=m.plotOptions.bar)!==null&&N!==void 0&&N.columnWidth||(m.plotOptions.bar.columnWidth=2),m}},{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(m){return function(p){var N=ee(p),A=N.color,k=N.seriesName,P=N.ylabel,D=N.start,V=N.end;return se(y(y({},p),{},{color:A,seriesName:k,ylabel:P,start:D,end:V}))}(m)}}}}},{key:"brush",value:function(m){return F.extend(m,{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(m){m.dataLabels=m.dataLabels||{},m.dataLabels.formatter=m.dataLabels.formatter||void 0;var p=m.dataLabels.formatter;return m.yaxis.forEach(function(N,A){m.yaxis[A].min=0,m.yaxis[A].max=100}),m.chart.type==="bar"&&(m.dataLabels.formatter=p||function(N){return typeof N=="number"&&N?N.toFixed(0)+"%":N}),m}},{key:"stackedBars",value:function(){var m=this.bar();return y(y({},m),{},{plotOptions:y(y({},m.plotOptions),{},{bar:y(y({},m.plotOptions.bar),{},{borderRadiusApplication:"end",borderRadiusWhenStacked:"last"})})})}},{key:"convertCatToNumeric",value:function(m){return m.xaxis.convertedCatToNumeric=!0,m}},{key:"convertCatToNumericXaxis",value:function(m,p,N){m.xaxis.type="numeric",m.xaxis.labels=m.xaxis.labels||{},m.xaxis.labels.formatter=m.xaxis.labels.formatter||function(P){return F.isNumber(P)?Math.floor(P):P};var A=m.xaxis.labels.formatter,k=m.xaxis.categories&&m.xaxis.categories.length?m.xaxis.categories:m.labels;return N&&N.length&&(k=N.map(function(P){return Array.isArray(P)?P:String(P)})),k&&k.length&&(m.xaxis.labels.formatter=function(P){return F.isNumber(P)?A(k[Math.floor(P)-1]):A(P)}),m.xaxis.categories=[],m.labels=[],m.xaxis.tickAmount=m.xaxis.tickAmount||"dataPoints",m}},{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(m){return m.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(m){return m.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(m){return m.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(m){return m},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(m,p,N,A,k){var P=m.globals.seriesCandleO[p][N],D=m.globals.seriesCandleH[p][N],V=m.globals.seriesCandleM[p][N],Z=m.globals.seriesCandleL[p][N],ce=m.globals.seriesCandleC[p][N];return m.config.series[p].type&&m.config.series[p].type!==k?`<div class="apexcharts-custom-tooltip">
`.concat(m.config.series[p].name?m.config.series[p].name:"series-"+(p+1),": <strong>").concat(m.globals.series[p][N],`</strong>
</div>`):'<div class="apexcharts-tooltip-box apexcharts-tooltip-'.concat(m.config.chart.type,'">')+"<div>".concat(A[0],': <span class="value">')+P+"</span></div>"+"<div>".concat(A[1],': <span class="value">')+D+"</span></div>"+(V?"<div>".concat(A[2],': <span class="value">')+V+"</span></div>":"")+"<div>".concat(A[3],': <span class="value">')+Z+"</span></div>"+"<div>".concat(A[4],': <span class="value">')+ce+"</span></div></div>"}}]),Ce}(),Se=function(){function Ce(m){s(this,Ce),this.opts=m}return o(Ce,[{key:"init",value:function(m){var p=m.responsiveOverride,N=this.opts,A=new K,k=new pe(N);this.chartType=N.chart.type,N=this.extendYAxis(N),N=this.extendAnnotations(N);var P=A.init(),D={};if(N&&I(N)==="object"){var V,Z,ce,ue,me,Ne,Ie,Le,Xe,Oe,$e={};$e=["line","area","bar","candlestick","boxPlot","rangeBar","rangeArea","bubble","scatter","heatmap","treemap","pie","polarArea","donut","radar","radialBar"].indexOf(N.chart.type)!==-1?k[N.chart.type]():k.line(),(V=N.plotOptions)!==null&&V!==void 0&&(Z=V.bar)!==null&&Z!==void 0&&Z.isFunnel&&($e=k.funnel()),N.chart.stacked&&N.chart.type==="bar"&&($e=k.stackedBars()),(ce=N.chart.brush)!==null&&ce!==void 0&&ce.enabled&&($e=k.brush($e)),(ue=N.plotOptions)!==null&&ue!==void 0&&(me=ue.line)!==null&&me!==void 0&&me.isSlopeChart&&($e=k.slope()),N.chart.stacked&&N.chart.stackType==="100%"&&(N=k.stacked100(N)),(Ne=N.plotOptions)!==null&&Ne!==void 0&&(Ie=Ne.bar)!==null&&Ie!==void 0&&Ie.isDumbbell&&(N=k.dumbbell(N)),this.checkForDarkTheme(window.Apex),this.checkForDarkTheme(N),N.xaxis=N.xaxis||window.Apex.xaxis||{},p||(N.xaxis.convertedCatToNumeric=!1),((Le=(N=this.checkForCatToNumericXAxis(this.chartType,$e,N)).chart.sparkline)!==null&&Le!==void 0&&Le.enabled||(Xe=window.Apex.chart)!==null&&Xe!==void 0&&(Oe=Xe.sparkline)!==null&&Oe!==void 0&&Oe.enabled)&&($e=k.sparkline($e)),D=F.extend(P,$e)}var ae=F.extend(D,window.Apex);return P=F.extend(ae,N),P=this.handleUserInputErrors(P)}},{key:"checkForCatToNumericXAxis",value:function(m,p,N){var A,k,P=new pe(N),D=(m==="bar"||m==="boxPlot")&&((A=N.plotOptions)===null||A===void 0||(k=A.bar)===null||k===void 0?void 0:k.horizontal),V=m==="pie"||m==="polarArea"||m==="donut"||m==="radar"||m==="radialBar"||m==="heatmap",Z=N.xaxis.type!=="datetime"&&N.xaxis.type!=="numeric",ce=N.xaxis.tickPlacement?N.xaxis.tickPlacement:p.xaxis&&p.xaxis.tickPlacement;return D||V||!Z||ce==="between"||(N=P.convertCatToNumeric(N)),N}},{key:"extendYAxis",value:function(m,p){var N=new K;(m.yaxis===void 0||!m.yaxis||Array.isArray(m.yaxis)&&m.yaxis.length===0)&&(m.yaxis={}),m.yaxis.constructor!==Array&&window.Apex.yaxis&&window.Apex.yaxis.constructor!==Array&&(m.yaxis=F.extend(m.yaxis,window.Apex.yaxis)),m.yaxis.constructor!==Array?m.yaxis=[F.extend(N.yAxis,m.yaxis)]:m.yaxis=F.extendArray(m.yaxis,N.yAxis);var A=!1;m.yaxis.forEach(function(P){P.logarithmic&&(A=!0)});var k=m.series;return p&&!k&&(k=p.config.series),A&&k.length!==m.yaxis.length&&k.length&&(m.yaxis=k.map(function(P,D){if(P.name||(k[D].name="series-".concat(D+1)),m.yaxis[D])return m.yaxis[D].seriesName=k[D].name,m.yaxis[D];var V=F.extend(N.yAxis,m.yaxis[0]);return V.show=!1,V})),A&&k.length>1&&k.length!==m.yaxis.length&&console.warn("A multi-series logarithmic chart should have equal number of series and y-axes"),m}},{key:"extendAnnotations",value:function(m){return m.annotations===void 0&&(m.annotations={},m.annotations.yaxis=[],m.annotations.xaxis=[],m.annotations.points=[]),m=this.extendYAxisAnnotations(m),m=this.extendXAxisAnnotations(m),m=this.extendPointAnnotations(m)}},{key:"extendYAxisAnnotations",value:function(m){var p=new K;return m.annotations.yaxis=F.extendArray(m.annotations.yaxis!==void 0?m.annotations.yaxis:[],p.yAxisAnnotation),m}},{key:"extendXAxisAnnotations",value:function(m){var p=new K;return m.annotations.xaxis=F.extendArray(m.annotations.xaxis!==void 0?m.annotations.xaxis:[],p.xAxisAnnotation),m}},{key:"extendPointAnnotations",value:function(m){var p=new K;return m.annotations.points=F.extendArray(m.annotations.points!==void 0?m.annotations.points:[],p.pointAnnotation),m}},{key:"checkForDarkTheme",value:function(m){m.theme&&m.theme.mode==="dark"&&(m.tooltip||(m.tooltip={}),m.tooltip.theme!=="light"&&(m.tooltip.theme="dark"),m.chart.foreColor||(m.chart.foreColor="#f6f7f8"),m.theme.palette||(m.theme.palette="palette4"))}},{key:"handleUserInputErrors",value:function(m){var p=m;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}}]),Ce}(),ge=function(){function Ce(){s(this,Ce)}return o(Ce,[{key:"initGlobalVars",value:function(m){m.series=[],m.seriesCandleO=[],m.seriesCandleH=[],m.seriesCandleM=[],m.seriesCandleL=[],m.seriesCandleC=[],m.seriesRangeStart=[],m.seriesRangeEnd=[],m.seriesRange=[],m.seriesPercent=[],m.seriesGoals=[],m.seriesX=[],m.seriesZ=[],m.seriesNames=[],m.seriesTotals=[],m.seriesLog=[],m.seriesColors=[],m.stackedSeriesTotals=[],m.seriesXvalues=[],m.seriesYvalues=[],m.labels=[],m.hasXaxisGroups=!1,m.groups=[],m.barGroups=[],m.lineGroups=[],m.areaGroups=[],m.hasSeriesGroups=!1,m.seriesGroups=[],m.categoryLabels=[],m.timescaleLabels=[],m.noLabelsProvided=!1,m.resizeTimer=null,m.selectionResizeTimer=null,m.lastWheelExecution=0,m.delayedElements=[],m.pointsArray=[],m.dataLabelsRects=[],m.isXNumeric=!1,m.skipLastTimelinelabel=!1,m.skipFirstTimelinelabel=!1,m.isDataXYZ=!1,m.isMultiLineX=!1,m.isMultipleYAxis=!1,m.maxY=-Number.MAX_VALUE,m.minY=Number.MIN_VALUE,m.minYArr=[],m.maxYArr=[],m.maxX=-Number.MAX_VALUE,m.minX=Number.MAX_VALUE,m.initialMaxX=-Number.MAX_VALUE,m.initialMinX=Number.MAX_VALUE,m.maxDate=0,m.minDate=Number.MAX_VALUE,m.minZ=Number.MAX_VALUE,m.maxZ=-Number.MAX_VALUE,m.minXDiff=Number.MAX_VALUE,m.yAxisScale=[],m.xAxisScale=null,m.xAxisTicksPositions=[],m.yLabelsCoords=[],m.yTitleCoords=[],m.barPadForNumericAxis=0,m.padHorizontal=0,m.xRange=0,m.yRange=[],m.zRange=0,m.dataPoints=0,m.xTickAmount=0,m.multiAxisTickAmount=0}},{key:"globalVars",value:function(m){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:m.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:m.chart.toolbar.autoSelected==="zoom"&&m.chart.toolbar.tools.zoom&&m.chart.zoom.enabled,panEnabled:m.chart.toolbar.autoSelected==="pan"&&m.chart.toolbar.tools.pan,selectionEnabled:m.chart.toolbar.autoSelected==="selection"&&m.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:m.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(m){var p=this.globalVars(m);return this.initGlobalVars(p),p.initialConfig=F.extend({},m),p.initialSeries=F.clone(m.series),p.lastXAxis=F.clone(p.initialConfig.xaxis),p.lastYAxis=F.clone(p.initialConfig.yaxis),p}}]),Ce}(),ve=function(){function Ce(m){s(this,Ce),this.opts=m}return o(Ce,[{key:"init",value:function(){var m=new Se(this.opts).init({responsiveOverride:!1});return{config:m,globals:new ge().init(m)}}}]),Ce}(),be=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.opts=null,this.seriesIndex=0,this.patternIDs=[]}return o(Ce,[{key:"clippedImgArea",value:function(m){var p=this.w,N=p.config,A=parseInt(p.globals.gridWidth,10),k=parseInt(p.globals.gridHeight,10),P=A>k?A:k,D=m.image,V=0,Z=0;m.width===void 0&&m.height===void 0?N.fill.image.width!==void 0&&N.fill.image.height!==void 0?(V=N.fill.image.width+1,Z=N.fill.image.height):(V=P+1,Z=P):(V=m.width,Z=m.height);var ce=document.createElementNS(p.globals.SVGNS,"pattern");U.setAttrs(ce,{id:m.patternID,patternUnits:m.patternUnits?m.patternUnits:"userSpaceOnUse",width:V+"px",height:Z+"px"});var ue=document.createElementNS(p.globals.SVGNS,"image");ce.appendChild(ue),ue.setAttributeNS(window.SVG.xlink,"href",D),U.setAttrs(ue,{x:0,y:0,preserveAspectRatio:"none",width:V+"px",height:Z+"px"}),ue.style.opacity=m.opacity,p.globals.dom.elDefs.node.appendChild(ce)}},{key:"getSeriesIndex",value:function(m){var p=this.w,N=p.config.chart.type;return(N==="bar"||N==="rangeBar")&&p.config.plotOptions.bar.distributed||N==="heatmap"||N==="treemap"?this.seriesIndex=m.seriesNumber:this.seriesIndex=m.seriesNumber%p.globals.series.length,this.seriesIndex}},{key:"fillPath",value:function(m){var p=this.w;this.opts=m;var N,A,k,P=this.w.config;this.seriesIndex=this.getSeriesIndex(m);var D=this.getFillColors()[this.seriesIndex];p.globals.seriesColors[this.seriesIndex]!==void 0&&(D=p.globals.seriesColors[this.seriesIndex]),typeof D=="function"&&(D=D({seriesIndex:this.seriesIndex,dataPointIndex:m.dataPointIndex,value:m.value,w:p}));var V=m.fillType?m.fillType:this.getFillType(this.seriesIndex),Z=Array.isArray(P.fill.opacity)?P.fill.opacity[this.seriesIndex]:P.fill.opacity;m.color&&(D=m.color),D||(D="#fff",console.warn("undefined color - ApexCharts"));var ce=D;if(D.indexOf("rgb")===-1?D.length<9&&(ce=F.hexToRgba(D,Z)):D.indexOf("rgba")>-1&&(Z=F.getOpacityFromRGBA(D)),m.opacity&&(Z=m.opacity),V==="pattern"&&(A=this.handlePatternFill({fillConfig:m.fillConfig,patternFill:A,fillColor:D,fillOpacity:Z,defaultColor:ce})),V==="gradient"&&(k=this.handleGradientFill({fillConfig:m.fillConfig,fillColor:D,fillOpacity:Z,i:this.seriesIndex})),V==="image"){var ue=P.fill.image.src,me=m.patternID?m.patternID:"",Ne="pattern".concat(p.globals.cuid).concat(m.seriesNumber+1).concat(me);this.patternIDs.indexOf(Ne)===-1&&(this.clippedImgArea({opacity:Z,image:Array.isArray(ue)?m.seriesNumber<ue.length?ue[m.seriesNumber]:ue[0]:ue,width:m.width?m.width:void 0,height:m.height?m.height:void 0,patternUnits:m.patternUnits,patternID:Ne}),this.patternIDs.push(Ne)),N="url(#".concat(Ne,")")}else N=V==="gradient"?k:V==="pattern"?A:ce;return m.solid&&(N=ce),N}},{key:"getFillType",value:function(m){var p=this.w;return Array.isArray(p.config.fill.type)?p.config.fill.type[m]:p.config.fill.type}},{key:"getFillColors",value:function(){var m=this.w,p=m.config,N=this.opts,A=[];return m.globals.comboCharts?m.config.series[this.seriesIndex].type==="line"?Array.isArray(m.globals.stroke.colors)?A=m.globals.stroke.colors:A.push(m.globals.stroke.colors):Array.isArray(m.globals.fill.colors)?A=m.globals.fill.colors:A.push(m.globals.fill.colors):p.chart.type==="line"?Array.isArray(m.globals.stroke.colors)?A=m.globals.stroke.colors:A.push(m.globals.stroke.colors):Array.isArray(m.globals.fill.colors)?A=m.globals.fill.colors:A.push(m.globals.fill.colors),N.fillColors!==void 0&&(A=[],Array.isArray(N.fillColors)?A=N.fillColors.slice():A.push(N.fillColors)),A}},{key:"handlePatternFill",value:function(m){var p=m.fillConfig,N=m.patternFill,A=m.fillColor,k=m.fillOpacity,P=m.defaultColor,D=this.w.config.fill;p&&(D=p);var V=this.opts,Z=new U(this.ctx),ce=Array.isArray(D.pattern.strokeWidth)?D.pattern.strokeWidth[this.seriesIndex]:D.pattern.strokeWidth,ue=A;return Array.isArray(D.pattern.style)?N=D.pattern.style[V.seriesNumber]!==void 0?Z.drawPattern(D.pattern.style[V.seriesNumber],D.pattern.width,D.pattern.height,ue,ce,k):P:N=Z.drawPattern(D.pattern.style,D.pattern.width,D.pattern.height,ue,ce,k),N}},{key:"handleGradientFill",value:function(m){var p=m.fillColor,N=m.fillOpacity,A=m.fillConfig,k=m.i,P=this.w.config.fill;A&&(P=y(y({},P),A));var D,V=this.opts,Z=new U(this.ctx),ce=new F,ue=P.gradient.type,me=p,Ne=P.gradient.opacityFrom===void 0?N:Array.isArray(P.gradient.opacityFrom)?P.gradient.opacityFrom[k]:P.gradient.opacityFrom;me.indexOf("rgba")>-1&&(Ne=F.getOpacityFromRGBA(me));var Ie=P.gradient.opacityTo===void 0?N:Array.isArray(P.gradient.opacityTo)?P.gradient.opacityTo[k]:P.gradient.opacityTo;if(P.gradient.gradientToColors===void 0||P.gradient.gradientToColors.length===0)D=P.gradient.shade==="dark"?ce.shadeColor(-1*parseFloat(P.gradient.shadeIntensity),p.indexOf("rgb")>-1?F.rgb2hex(p):p):ce.shadeColor(parseFloat(P.gradient.shadeIntensity),p.indexOf("rgb")>-1?F.rgb2hex(p):p);else if(P.gradient.gradientToColors[V.seriesNumber]){var Le=P.gradient.gradientToColors[V.seriesNumber];D=Le,Le.indexOf("rgba")>-1&&(Ie=F.getOpacityFromRGBA(Le))}else D=p;if(P.gradient.gradientFrom&&(me=P.gradient.gradientFrom),P.gradient.gradientTo&&(D=P.gradient.gradientTo),P.gradient.inverseColors){var Xe=me;me=D,D=Xe}return me.indexOf("rgb")>-1&&(me=F.rgb2hex(me)),D.indexOf("rgb")>-1&&(D=F.rgb2hex(D)),Z.drawGradient(ue,me,D,Ne,Ie,V.size,P.gradient.stops,P.gradient.colorStops,k)}}]),Ce}(),we=function(){function Ce(m,p){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"setGlobalMarkerSize",value:function(){var m=this.w;if(m.globals.markers.size=Array.isArray(m.config.markers.size)?m.config.markers.size:[m.config.markers.size],m.globals.markers.size.length>0){if(m.globals.markers.size.length<m.globals.series.length+1)for(var p=0;p<=m.globals.series.length;p++)m.globals.markers.size[p]===void 0&&m.globals.markers.size.push(m.globals.markers.size[0])}else m.globals.markers.size=m.config.series.map(function(N){return m.config.markers.size})}},{key:"plotChartMarkers",value:function(m,p,N,A){var k,P=arguments.length>4&&arguments[4]!==void 0&&arguments[4],D=this.w,V=p,Z=m,ce=null,ue=new U(this.ctx),me=D.config.markers.discrete&&D.config.markers.discrete.length;if((D.globals.markers.size[p]>0||P||me)&&(ce=ue.group({class:P||me?"":"apexcharts-series-markers"})).attr("clip-path","url(#gridRectMarkerMask".concat(D.globals.cuid,")")),Array.isArray(Z.x))for(var Ne=0;Ne<Z.x.length;Ne++){var Ie=N;N===1&&Ne===0&&(Ie=0),N===1&&Ne===1&&(Ie=1);var Le="apexcharts-marker";if(D.config.chart.type!=="line"&&D.config.chart.type!=="area"||D.globals.comboCharts||D.config.tooltip.intersect||(Le+=" no-pointer-events"),(Array.isArray(D.config.markers.size)?D.globals.markers.size[p]>0:D.config.markers.size>0)||P||me){F.isNumber(Z.y[Ne])?Le+=" w".concat(F.randomId()):Le="apexcharts-nullpoint";var Xe=this.getMarkerConfig({cssClass:Le,seriesIndex:p,dataPointIndex:Ie});D.config.series[V].data[Ie]&&(D.config.series[V].data[Ie].fillColor&&(Xe.pointFillColor=D.config.series[V].data[Ie].fillColor),D.config.series[V].data[Ie].strokeColor&&(Xe.pointStrokeColor=D.config.series[V].data[Ie].strokeColor)),A!==void 0&&(Xe.pSize=A),(Z.x[Ne]<-D.globals.markers.largestSize||Z.x[Ne]>D.globals.gridWidth+D.globals.markers.largestSize||Z.y[Ne]<-D.globals.markers.largestSize||Z.y[Ne]>D.globals.gridHeight+D.globals.markers.largestSize)&&(Xe.pSize=0),(k=ue.drawMarker(Z.x[Ne],Z.y[Ne],Xe)).attr("rel",Ie),k.attr("j",Ie),k.attr("index",p),k.node.setAttribute("default-marker-size",Xe.pSize),new O(this.ctx).setSelectionFilter(k,p,Ie),this.addEvents(k),ce&&ce.add(k)}else D.globals.pointsArray[p]===void 0&&(D.globals.pointsArray[p]=[]),D.globals.pointsArray[p].push([Z.x[Ne],Z.y[Ne]])}return ce}},{key:"getMarkerConfig",value:function(m){var p=m.cssClass,N=m.seriesIndex,A=m.dataPointIndex,k=A===void 0?null:A,P=m.radius,D=P===void 0?null:P,V=m.size,Z=V===void 0?null:V,ce=m.strokeWidth,ue=ce===void 0?null:ce,me=this.w,Ne=this.getMarkerStyle(N),Ie=Z===null?me.globals.markers.size[N]:Z,Le=me.config.markers;return k!==null&&Le.discrete.length&&Le.discrete.map(function(Xe){Xe.seriesIndex===N&&Xe.dataPointIndex===k&&(Ne.pointStrokeColor=Xe.strokeColor,Ne.pointFillColor=Xe.fillColor,Ie=Xe.size,Ne.pointShape=Xe.shape)}),{pSize:D===null?Ie:D,pRadius:D!==null?D:Le.radius,pointStrokeWidth:ue!==null?ue:Array.isArray(Le.strokeWidth)?Le.strokeWidth[N]:Le.strokeWidth,pointStrokeColor:Ne.pointStrokeColor,pointFillColor:Ne.pointFillColor,shape:Ne.pointShape||(Array.isArray(Le.shape)?Le.shape[N]:Le.shape),class:p,pointStrokeOpacity:Array.isArray(Le.strokeOpacity)?Le.strokeOpacity[N]:Le.strokeOpacity,pointStrokeDashArray:Array.isArray(Le.strokeDashArray)?Le.strokeDashArray[N]:Le.strokeDashArray,pointFillOpacity:Array.isArray(Le.fillOpacity)?Le.fillOpacity[N]:Le.fillOpacity,seriesIndex:N}}},{key:"addEvents",value:function(m){var p=this.w,N=new U(this.ctx);m.node.addEventListener("mouseenter",N.pathMouseEnter.bind(this.ctx,m)),m.node.addEventListener("mouseleave",N.pathMouseLeave.bind(this.ctx,m)),m.node.addEventListener("mousedown",N.pathMouseDown.bind(this.ctx,m)),m.node.addEventListener("click",p.config.markers.onClick),m.node.addEventListener("dblclick",p.config.markers.onDblClick),m.node.addEventListener("touchstart",N.pathMouseDown.bind(this.ctx,m),{passive:!0})}},{key:"getMarkerStyle",value:function(m){var p=this.w,N=p.globals.markers.colors,A=p.config.markers.strokeColor||p.config.markers.strokeColors;return{pointStrokeColor:Array.isArray(A)?A[m]:A,pointFillColor:Array.isArray(N)?N[m]:N}}}]),Ce}(),je=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.initialAnim=this.w.config.chart.animations.enabled}return o(Ce,[{key:"draw",value:function(m,p,N){var A=this.w,k=new U(this.ctx),P=N.realIndex,D=N.pointsPos,V=N.zRatio,Z=N.elParent,ce=k.group({class:"apexcharts-series-markers apexcharts-series-".concat(A.config.chart.type)});if(ce.attr("clip-path","url(#gridRectMarkerMask".concat(A.globals.cuid,")")),Array.isArray(D.x))for(var ue=0;ue<D.x.length;ue++){var me=p+1,Ne=!0;p===0&&ue===0&&(me=0),p===0&&ue===1&&(me=1);var Ie=A.globals.markers.size[P];if(V!==1/0){var Le=A.config.plotOptions.bubble;Ie=A.globals.seriesZ[P][me],Le.zScaling&&(Ie/=V),Le.minBubbleRadius&&Ie<Le.minBubbleRadius&&(Ie=Le.minBubbleRadius),Le.maxBubbleRadius&&Ie>Le.maxBubbleRadius&&(Ie=Le.maxBubbleRadius)}var Xe=D.x[ue],Oe=D.y[ue];if(Ie=Ie||0,Oe!==null&&A.globals.series[P][me]!==void 0||(Ne=!1),Ne){var $e=this.drawPoint(Xe,Oe,Ie,P,me,p);ce.add($e)}Z.add(ce)}}},{key:"drawPoint",value:function(m,p,N,A,k,P){var D=this.w,V=A,Z=new $(this.ctx),ce=new O(this.ctx),ue=new be(this.ctx),me=new we(this.ctx),Ne=new U(this.ctx),Ie=me.getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:V,dataPointIndex:k,radius:D.config.chart.type==="bubble"||D.globals.comboCharts&&D.config.series[A]&&D.config.series[A].type==="bubble"?N:null}),Le=ue.fillPath({seriesNumber:A,dataPointIndex:k,color:Ie.pointFillColor,patternUnits:"objectBoundingBox",value:D.globals.series[A][P]}),Xe=Ne.drawMarker(m,p,Ie);if(D.config.series[V].data[k]&&D.config.series[V].data[k].fillColor&&(Le=D.config.series[V].data[k].fillColor),Xe.attr({fill:Le}),D.config.chart.dropShadow.enabled){var Oe=D.config.chart.dropShadow;ce.dropShadow(Xe,Oe,A)}if(!this.initialAnim||D.globals.dataChanged||D.globals.resized)D.globals.animationEnded=!0;else{var $e=D.config.chart.animations.speed;Z.animateMarker(Xe,$e,D.globals.easing,function(){window.setTimeout(function(){Z.animationCompleted(Xe)},100)})}return Xe.attr({rel:k,j:k,index:A,"default-marker-size":Ie.pSize}),ce.setSelectionFilter(Xe,A,k),me.addEvents(Xe),Xe.node.classList.add("apexcharts-marker"),Xe}},{key:"centerTextInBubble",value:function(m){var p=this.w;return{y:m+=parseInt(p.config.dataLabels.style.fontSize,10)/4}}}]),Ce}(),Fe=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"dataLabelsCorrection",value:function(m,p,N,A,k,P,D){var V=this.w,Z=!1,ce=new U(this.ctx).getTextRects(N,D),ue=ce.width,me=ce.height;p<0&&(p=0),p>V.globals.gridHeight+me&&(p=V.globals.gridHeight+me/2),V.globals.dataLabelsRects[A]===void 0&&(V.globals.dataLabelsRects[A]=[]),V.globals.dataLabelsRects[A].push({x:m,y:p,width:ue,height:me});var Ne=V.globals.dataLabelsRects[A].length-2,Ie=V.globals.lastDrawnDataLabelsIndexes[A]!==void 0?V.globals.lastDrawnDataLabelsIndexes[A][V.globals.lastDrawnDataLabelsIndexes[A].length-1]:0;if(V.globals.dataLabelsRects[A][Ne]!==void 0){var Le=V.globals.dataLabelsRects[A][Ie];(m>Le.x+Le.width||p>Le.y+Le.height||p+me<Le.y||m+ue<Le.x)&&(Z=!0)}return(k===0||P)&&(Z=!0),{x:m,y:p,textRects:ce,drawnextLabel:Z}}},{key:"drawDataLabel",value:function(m){var p=this,N=m.type,A=m.pos,k=m.i,P=m.j,D=m.isRangeStart,V=m.strokeWidth,Z=V===void 0?2:V,ce=this.w,ue=new U(this.ctx),me=ce.config.dataLabels,Ne=0,Ie=0,Le=P,Xe=null;if(ce.globals.collapsedSeriesIndices.indexOf(k)!==-1||!me.enabled||!Array.isArray(A.x))return Xe;Xe=ue.group({class:"apexcharts-data-labels"});for(var Oe=0;Oe<A.x.length;Oe++)if(Ne=A.x[Oe]+me.offsetX,Ie=A.y[Oe]+me.offsetY+Z,!isNaN(Ne)){P===1&&Oe===0&&(Le=0),P===1&&Oe===1&&(Le=1);var $e=ce.globals.series[k][Le];N==="rangeArea"&&($e=D?ce.globals.seriesRangeStart[k][Le]:ce.globals.seriesRangeEnd[k][Le]);var ae="",he=function(Ve){return ce.config.dataLabels.formatter(Ve,{ctx:p.ctx,seriesIndex:k,dataPointIndex:Le,w:ce})};ce.config.chart.type==="bubble"?(ae=he($e=ce.globals.seriesZ[k][Le]),Ie=A.y[Oe],Ie=new je(this.ctx).centerTextInBubble(Ie,k,Le).y):$e!==void 0&&(ae=he($e));var Pe=ce.config.dataLabels.textAnchor;ce.globals.isSlopeChart&&(Pe=Le===0?"end":Le===ce.config.series[k].data.length-1?"start":"middle"),this.plotDataLabelsText({x:Ne,y:Ie,text:ae,i:k,j:Le,parent:Xe,offsetCorrection:!0,dataLabelsConfig:ce.config.dataLabels,textAnchor:Pe})}return Xe}},{key:"plotDataLabelsText",value:function(m){var p=this.w,N=new U(this.ctx),A=m.x,k=m.y,P=m.i,D=m.j,V=m.text,Z=m.textAnchor,ce=m.fontSize,ue=m.parent,me=m.dataLabelsConfig,Ne=m.color,Ie=m.alwaysDrawDataLabel,Le=m.offsetCorrection,Xe=m.className,Oe=null;if(Array.isArray(p.config.dataLabels.enabledOnSeries)&&p.config.dataLabels.enabledOnSeries.indexOf(P)<0)return Oe;var $e={x:A,y:k,drawnextLabel:!0,textRects:null};Le&&($e=this.dataLabelsCorrection(A,k,V,P,D,Ie,parseInt(me.style.fontSize,10))),p.globals.zoomed||(A=$e.x,k=$e.y),$e.textRects&&(A<-20-$e.textRects.width||A>p.globals.gridWidth+$e.textRects.width+30)&&(V="");var ae=p.globals.dataLabels.style.colors[P];((p.config.chart.type==="bar"||p.config.chart.type==="rangeBar")&&p.config.plotOptions.bar.distributed||p.config.dataLabels.distributed)&&(ae=p.globals.dataLabels.style.colors[D]),typeof ae=="function"&&(ae=ae({series:p.globals.series,seriesIndex:P,dataPointIndex:D,w:p})),Ne&&(ae=Ne);var he=me.offsetX,Pe=me.offsetY;if(p.config.chart.type!=="bar"&&p.config.chart.type!=="rangeBar"||(he=0,Pe=0),p.globals.isSlopeChart&&(D!==0&&(he=-2*me.offsetX+5),D!==0&&D!==p.config.series[P].data.length-1&&(he=0)),$e.drawnextLabel){if((Oe=N.drawText({width:100,height:parseInt(me.style.fontSize,10),x:A+he,y:k+Pe,foreColor:ae,textAnchor:Z||me.textAnchor,text:V,fontSize:ce||me.style.fontSize,fontFamily:me.style.fontFamily,fontWeight:me.style.fontWeight||"normal"})).attr({class:Xe||"apexcharts-datalabel",cx:A,cy:k}),me.dropShadow.enabled){var Ve=me.dropShadow;new O(this.ctx).dropShadow(Oe,Ve)}ue.add(Oe),p.globals.lastDrawnDataLabelsIndexes[P]===void 0&&(p.globals.lastDrawnDataLabelsIndexes[P]=[]),p.globals.lastDrawnDataLabelsIndexes[P].push(D)}return Oe}},{key:"addBackgroundToDataLabel",value:function(m,p){var N=this.w,A=N.config.dataLabels.background,k=A.padding,P=A.padding/2,D=p.width,V=p.height,Z=new U(this.ctx).drawRect(p.x-k,p.y-P/2,D+2*k,V+P,A.borderRadius,N.config.chart.background!=="transparent"&&N.config.chart.background?N.config.chart.background:"#fff",A.opacity,A.borderWidth,A.borderColor);return A.dropShadow.enabled&&new O(this.ctx).dropShadow(Z,A.dropShadow),Z}},{key:"dataLabelsBackground",value:function(){var m=this.w;if(m.config.chart.type!=="bubble")for(var p=m.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels text"),N=0;N<p.length;N++){var A=p[N],k=A.getBBox(),P=null;if(k.width&&k.height&&(P=this.addBackgroundToDataLabel(A,k)),P){A.parentNode.insertBefore(P.node,A);var D=A.getAttribute("fill");m.config.chart.animations.enabled&&!m.globals.resized&&!m.globals.dataChanged?P.animate().attr({fill:D}):P.attr({fill:D}),A.setAttribute("fill",m.config.dataLabels.background.foreColor)}}}},{key:"bringForward",value:function(){for(var m=this.w,p=m.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels"),N=m.globals.dom.baseEl.querySelector(".apexcharts-plot-series:last-child"),A=0;A<p.length;A++)N&&N.insertBefore(p[A],N.nextSibling)}}]),Ce}(),Re=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.legendInactiveClass="legend-mouseover-inactive"}return o(Ce,[{key:"getAllSeriesEls",value:function(){return this.w.globals.dom.baseEl.getElementsByClassName("apexcharts-series")}},{key:"getSeriesByName",value:function(m){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner .apexcharts-series[seriesName='".concat(F.escapeString(m),"']"))}},{key:"isSeriesHidden",value:function(m){var p=this.getSeriesByName(m),N=parseInt(p.getAttribute("data:realIndex"),10);return{isHidden:p.classList.contains("apexcharts-series-collapsed"),realIndex:N}}},{key:"addCollapsedClassToSeries",value:function(m,p){var N=this.w;function A(k){for(var P=0;P<k.length;P++)k[P].index===p&&m.node.classList.add("apexcharts-series-collapsed")}A(N.globals.collapsedSeries),A(N.globals.ancillaryCollapsedSeries)}},{key:"toggleSeries",value:function(m){var p=this.isSeriesHidden(m);return this.ctx.legend.legendHelpers.toggleDataSeries(p.realIndex,p.isHidden),p.isHidden}},{key:"showSeries",value:function(m){var p=this.isSeriesHidden(m);p.isHidden&&this.ctx.legend.legendHelpers.toggleDataSeries(p.realIndex,!0)}},{key:"hideSeries",value:function(m){var p=this.isSeriesHidden(m);p.isHidden||this.ctx.legend.legendHelpers.toggleDataSeries(p.realIndex,!1)}},{key:"resetSeries",value:function(){var m=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],N=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],A=this.w,k=F.clone(A.globals.initialSeries);A.globals.previousPaths=[],N?(A.globals.collapsedSeries=[],A.globals.ancillaryCollapsedSeries=[],A.globals.collapsedSeriesIndices=[],A.globals.ancillaryCollapsedSeriesIndices=[]):k=this.emptyCollapsedSeries(k),A.config.series=k,m&&(p&&(A.globals.zoomed=!1,this.ctx.updateHelpers.revertDefaultAxisMinMax()),this.ctx.updateHelpers._updateSeries(k,A.config.chart.animations.dynamicAnimation.enabled))}},{key:"emptyCollapsedSeries",value:function(m){for(var p=this.w,N=0;N<m.length;N++)p.globals.collapsedSeriesIndices.indexOf(N)>-1&&(m[N].data=[]);return m}},{key:"highlightSeries",value:function(m){var p=this.w,N=this.getSeriesByName(m),A=parseInt(N==null?void 0:N.getAttribute("data:realIndex"),10),k=p.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"),P=null,D=null,V=null;if(p.globals.axisCharts||p.config.chart.type==="radialBar")if(p.globals.axisCharts){P=p.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(A,"']")),D=p.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(A,"']"));var Z=p.globals.seriesYAxisReverseMap[A];V=p.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(Z,"']"))}else P=p.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(A+1,"']"));else P=p.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(A+1,"'] path"));for(var ce=0;ce<k.length;ce++)k[ce].classList.add(this.legendInactiveClass);if(P)p.globals.axisCharts||P.parentNode.classList.remove(this.legendInactiveClass),P.classList.remove(this.legendInactiveClass),D!==null&&D.classList.remove(this.legendInactiveClass),V!==null&&V.classList.remove(this.legendInactiveClass);else for(var ue=0;ue<k.length;ue++)k[ue].classList.remove(this.legendInactiveClass)}},{key:"toggleSeriesOnHover",value:function(m,p){var N=this.w;p||(p=m.target);var A=N.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis");if(m.type==="mousemove"){var k=parseInt(p.getAttribute("rel"),10)-1;this.highlightSeries(N.globals.seriesNames[k])}else if(m.type==="mouseout")for(var P=0;P<A.length;P++)A[P].classList.remove(this.legendInactiveClass)}},{key:"highlightRangeInSeries",value:function(m,p){var N=this,A=this.w,k=A.globals.dom.baseEl.getElementsByClassName("apexcharts-heatmap-rect"),P=function(Z){for(var ce=0;ce<k.length;ce++)k[ce].classList[Z](N.legendInactiveClass)};if(m.type==="mousemove"){var D=parseInt(p.getAttribute("rel"),10)-1;P("add");var V=A.config.plotOptions.heatmap.colorScale.ranges;(function(Z,ce){for(var ue=0;ue<k.length;ue++){var me=Number(k[ue].getAttribute("val"));me>=Z.from&&(me<Z.to||Z.to===ce&&me===ce)&&k[ue].classList.remove(N.legendInactiveClass)}})(V[D],V.reduce(function(Z,ce){return Math.max(Z,ce.to)},0))}else m.type==="mouseout"&&P("remove")}},{key:"getActiveConfigSeriesIndex",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"asc",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],N=this.w,A=0;if(N.config.series.length>1){for(var k=N.config.series.map(function(D,V){return D.data&&D.data.length>0&&N.globals.collapsedSeriesIndices.indexOf(V)===-1&&(!N.globals.comboCharts||p.length===0||p.length&&p.indexOf(N.config.series[V].type)>-1)?V:-1}),P=m==="asc"?0:k.length-1;m==="asc"?P<k.length:P>=0;m==="asc"?P++:P--)if(k[P]!==-1){A=k[P];break}}return A}},{key:"getBarSeriesIndices",value:function(){return this.w.globals.comboCharts?this.w.config.series.map(function(m,p){return m.type==="bar"||m.type==="column"?p:-1}).filter(function(m){return m!==-1}):this.w.config.series.map(function(m,p){return p})}},{key:"getPreviousPaths",value:function(){var m=this.w;function p(P,D,V){for(var Z=P[D].childNodes,ce={type:V,paths:[],realIndex:P[D].getAttribute("data:realIndex")},ue=0;ue<Z.length;ue++)if(Z[ue].hasAttribute("pathTo")){var me=Z[ue].getAttribute("pathTo");ce.paths.push({d:me})}m.globals.previousPaths.push(ce)}m.globals.previousPaths=[],["line","area","bar","rangebar","rangeArea","candlestick","radar"].forEach(function(P){for(var D,V=(D=P,m.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(D,"-series .apexcharts-series"))),Z=0;Z<V.length;Z++)p(V,Z,P)}),this.handlePrevBubbleScatterPaths("bubble"),this.handlePrevBubbleScatterPaths("scatter");var N=m.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(m.config.chart.type," .apexcharts-series"));if(N.length>0)for(var A=function(P){for(var D=m.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(m.config.chart.type," .apexcharts-series[data\\:realIndex='").concat(P,"'] rect")),V=[],Z=function(ue){var me=function(Ie){return D[ue].getAttribute(Ie)},Ne={x:parseFloat(me("x")),y:parseFloat(me("y")),width:parseFloat(me("width")),height:parseFloat(me("height"))};V.push({rect:Ne,color:D[ue].getAttribute("color")})},ce=0;ce<D.length;ce++)Z(ce);m.globals.previousPaths.push(V)},k=0;k<N.length;k++)A(k);m.globals.axisCharts||(m.globals.previousPaths=m.globals.series)}},{key:"handlePrevBubbleScatterPaths",value:function(m){var p=this.w,N=p.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(m,"-series .apexcharts-series"));if(N.length>0)for(var A=0;A<N.length;A++){for(var k=p.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(m,"-series .apexcharts-series[data\\:realIndex='").concat(A,"'] circle")),P=[],D=0;D<k.length;D++)P.push({x:k[D].getAttribute("cx"),y:k[D].getAttribute("cy"),r:k[D].getAttribute("r")});p.globals.previousPaths.push(P)}}},{key:"clearPreviousPaths",value:function(){var m=this.w;m.globals.previousPaths=[],m.globals.allSeriesCollapsed=!1}},{key:"handleNoData",value:function(){var m=this.w,p=m.config.noData,N=new U(this.ctx),A=m.globals.svgWidth/2,k=m.globals.svgHeight/2,P="middle";if(m.globals.noData=!0,m.globals.animationEnded=!0,p.align==="left"?(A=10,P="start"):p.align==="right"&&(A=m.globals.svgWidth-10,P="end"),p.verticalAlign==="top"?k=50:p.verticalAlign==="bottom"&&(k=m.globals.svgHeight-50),A+=p.offsetX,k=k+parseInt(p.style.fontSize,10)+2+p.offsetY,p.text!==void 0&&p.text!==""){var D=N.drawText({x:A,y:k,text:p.text,textAnchor:P,fontSize:p.style.fontSize,fontFamily:p.style.fontFamily,foreColor:p.style.color,opacity:1,class:"apexcharts-text-nodata"});m.globals.dom.Paper.add(D)}}},{key:"setNullSeriesToZeroValues",value:function(m){for(var p=this.w,N=0;N<m.length;N++)if(m[N].length===0)for(var A=0;A<m[p.globals.maxValsInArrayIndex].length;A++)m[N].push(0);return m}},{key:"hasAllSeriesEqualX",value:function(){for(var m=!0,p=this.w,N=this.filteredSeriesX(),A=0;A<N.length-1;A++)if(N[A][0]!==N[A+1][0]){m=!1;break}return p.globals.allSeriesHasEqualX=m,m}},{key:"filteredSeriesX",value:function(){var m=this.w.globals.seriesX.map(function(p){return p.length>0?p:[]});return m}}]),Ce}(),Qe=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.twoDSeries=[],this.threeDSeries=[],this.twoDSeriesX=[],this.seriesGoals=[],this.coreUtils=new Y(this.ctx)}return o(Ce,[{key:"isMultiFormat",value:function(){return this.isFormatXY()||this.isFormat2DArray()}},{key:"isFormatXY",value:function(){var m=this.w.config.series.slice(),p=new Re(this.ctx);if(this.activeSeriesIndex=p.getActiveConfigSeriesIndex(),m[this.activeSeriesIndex].data!==void 0&&m[this.activeSeriesIndex].data.length>0&&m[this.activeSeriesIndex].data[0]!==null&&m[this.activeSeriesIndex].data[0].x!==void 0&&m[this.activeSeriesIndex].data[0]!==null)return!0}},{key:"isFormat2DArray",value:function(){var m=this.w.config.series.slice(),p=new Re(this.ctx);if(this.activeSeriesIndex=p.getActiveConfigSeriesIndex(),m[this.activeSeriesIndex].data!==void 0&&m[this.activeSeriesIndex].data.length>0&&m[this.activeSeriesIndex].data[0]!==void 0&&m[this.activeSeriesIndex].data[0]!==null&&m[this.activeSeriesIndex].data[0].constructor===Array)return!0}},{key:"handleFormat2DArray",value:function(m,p){for(var N=this.w.config,A=this.w.globals,k=N.chart.type==="boxPlot"||N.series[p].type==="boxPlot",P=0;P<m[p].data.length;P++)if(m[p].data[P][1]!==void 0&&(Array.isArray(m[p].data[P][1])&&m[p].data[P][1].length===4&&!k?this.twoDSeries.push(F.parseNumber(m[p].data[P][1][3])):m[p].data[P].length>=5?this.twoDSeries.push(F.parseNumber(m[p].data[P][4])):this.twoDSeries.push(F.parseNumber(m[p].data[P][1])),A.dataFormatXNumeric=!0),N.xaxis.type==="datetime"){var D=new Date(m[p].data[P][0]);D=new Date(D).getTime(),this.twoDSeriesX.push(D)}else this.twoDSeriesX.push(m[p].data[P][0]);for(var V=0;V<m[p].data.length;V++)m[p].data[V][2]!==void 0&&(this.threeDSeries.push(m[p].data[V][2]),A.isDataXYZ=!0)}},{key:"handleFormatXY",value:function(m,p){var N=this.w.config,A=this.w.globals,k=new q(this.ctx),P=p;A.collapsedSeriesIndices.indexOf(p)>-1&&(P=this.activeSeriesIndex);for(var D=0;D<m[p].data.length;D++)m[p].data[D].y!==void 0&&(Array.isArray(m[p].data[D].y)?this.twoDSeries.push(F.parseNumber(m[p].data[D].y[m[p].data[D].y.length-1])):this.twoDSeries.push(F.parseNumber(m[p].data[D].y))),m[p].data[D].goals!==void 0&&Array.isArray(m[p].data[D].goals)?(this.seriesGoals[p]===void 0&&(this.seriesGoals[p]=[]),this.seriesGoals[p].push(m[p].data[D].goals)):(this.seriesGoals[p]===void 0&&(this.seriesGoals[p]=[]),this.seriesGoals[p].push(null));for(var V=0;V<m[P].data.length;V++){var Z=typeof m[P].data[V].x=="string",ce=Array.isArray(m[P].data[V].x),ue=!ce&&!!k.isValidDate(m[P].data[V].x);if(Z||ue)if(Z||N.xaxis.convertedCatToNumeric){var me=A.isBarHorizontal&&A.isRangeData;N.xaxis.type!=="datetime"||me?(this.fallbackToCategory=!0,this.twoDSeriesX.push(m[P].data[V].x),isNaN(m[P].data[V].x)||this.w.config.xaxis.type==="category"||typeof m[P].data[V].x=="string"||(A.isXNumeric=!0)):this.twoDSeriesX.push(k.parseDate(m[P].data[V].x))}else N.xaxis.type==="datetime"?this.twoDSeriesX.push(k.parseDate(m[P].data[V].x.toString())):(A.dataFormatXNumeric=!0,A.isXNumeric=!0,this.twoDSeriesX.push(parseFloat(m[P].data[V].x)));else ce?(this.fallbackToCategory=!0,this.twoDSeriesX.push(m[P].data[V].x)):(A.isXNumeric=!0,A.dataFormatXNumeric=!0,this.twoDSeriesX.push(m[P].data[V].x))}if(m[p].data[0]&&m[p].data[0].z!==void 0){for(var Ne=0;Ne<m[p].data.length;Ne++)this.threeDSeries.push(m[p].data[Ne].z);A.isDataXYZ=!0}}},{key:"handleRangeData",value:function(m,p){var N=this.w.globals,A={};return this.isFormat2DArray()?A=this.handleRangeDataFormat("array",m,p):this.isFormatXY()&&(A=this.handleRangeDataFormat("xy",m,p)),N.seriesRangeStart.push(A.start===void 0?[]:A.start),N.seriesRangeEnd.push(A.end===void 0?[]:A.end),N.seriesRange.push(A.rangeUniques),N.seriesRange.forEach(function(k,P){k&&k.forEach(function(D,V){D.y.forEach(function(Z,ce){for(var ue=0;ue<D.y.length;ue++)if(ce!==ue){var me=Z.y1,Ne=Z.y2,Ie=D.y[ue].y1;me<=D.y[ue].y2&&Ie<=Ne&&(D.overlaps.indexOf(Z.rangeName)<0&&D.overlaps.push(Z.rangeName),D.overlaps.indexOf(D.y[ue].rangeName)<0&&D.overlaps.push(D.y[ue].rangeName))}})})}),A}},{key:"handleCandleStickBoxData",value:function(m,p){var N=this.w.globals,A={};return this.isFormat2DArray()?A=this.handleCandleStickBoxDataFormat("array",m,p):this.isFormatXY()&&(A=this.handleCandleStickBoxDataFormat("xy",m,p)),N.seriesCandleO[p]=A.o,N.seriesCandleH[p]=A.h,N.seriesCandleM[p]=A.m,N.seriesCandleL[p]=A.l,N.seriesCandleC[p]=A.c,A}},{key:"handleRangeDataFormat",value:function(m,p,N){var A=[],k=[],P=p[N].data.filter(function(ce,ue,me){return ue===me.findIndex(function(Ne){return Ne.x===ce.x})}).map(function(ce,ue){return{x:ce.x,overlaps:[],y:[]}});if(m==="array")for(var D=0;D<p[N].data.length;D++)Array.isArray(p[N].data[D])?(A.push(p[N].data[D][1][0]),k.push(p[N].data[D][1][1])):(A.push(p[N].data[D]),k.push(p[N].data[D]));else if(m==="xy")for(var V=function(ce){var ue=Array.isArray(p[N].data[ce].y),me=F.randomId(),Ne=p[N].data[ce].x,Ie={y1:ue?p[N].data[ce].y[0]:p[N].data[ce].y,y2:ue?p[N].data[ce].y[1]:p[N].data[ce].y,rangeName:me};p[N].data[ce].rangeName=me;var Le=P.findIndex(function(Xe){return Xe.x===Ne});P[Le].y.push(Ie),A.push(Ie.y1),k.push(Ie.y2)},Z=0;Z<p[N].data.length;Z++)V(Z);return{start:A,end:k,rangeUniques:P}}},{key:"handleCandleStickBoxDataFormat",value:function(m,p,N){var A=this.w,k=A.config.chart.type==="boxPlot"||A.config.series[N].type==="boxPlot",P=[],D=[],V=[],Z=[],ce=[];if(m==="array")if(k&&p[N].data[0].length===6||!k&&p[N].data[0].length===5)for(var ue=0;ue<p[N].data.length;ue++)P.push(p[N].data[ue][1]),D.push(p[N].data[ue][2]),k?(V.push(p[N].data[ue][3]),Z.push(p[N].data[ue][4]),ce.push(p[N].data[ue][5])):(Z.push(p[N].data[ue][3]),ce.push(p[N].data[ue][4]));else for(var me=0;me<p[N].data.length;me++)Array.isArray(p[N].data[me][1])&&(P.push(p[N].data[me][1][0]),D.push(p[N].data[me][1][1]),k?(V.push(p[N].data[me][1][2]),Z.push(p[N].data[me][1][3]),ce.push(p[N].data[me][1][4])):(Z.push(p[N].data[me][1][2]),ce.push(p[N].data[me][1][3])));else if(m==="xy")for(var Ne=0;Ne<p[N].data.length;Ne++)Array.isArray(p[N].data[Ne].y)&&(P.push(p[N].data[Ne].y[0]),D.push(p[N].data[Ne].y[1]),k?(V.push(p[N].data[Ne].y[2]),Z.push(p[N].data[Ne].y[3]),ce.push(p[N].data[Ne].y[4])):(Z.push(p[N].data[Ne].y[2]),ce.push(p[N].data[Ne].y[3])));return{o:P,h:D,m:V,l:Z,c:ce}}},{key:"parseDataAxisCharts",value:function(m){var p=this,N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.ctx,A=this.w.config,k=this.w.globals,P=new q(N),D=A.labels.length>0?A.labels.slice():A.xaxis.categories.slice();k.isRangeBar=A.chart.type==="rangeBar"&&k.isBarHorizontal,k.hasXaxisGroups=A.xaxis.type==="category"&&A.xaxis.group.groups.length>0,k.hasXaxisGroups&&(k.groups=A.xaxis.group.groups),m.forEach(function(Ne,Ie){Ne.name!==void 0?k.seriesNames.push(Ne.name):k.seriesNames.push("series-"+parseInt(Ie+1,10))}),this.coreUtils.setSeriesYAxisMappings();var V=[],Z=S(new Set(A.series.map(function(Ne){return Ne.group})));A.series.forEach(function(Ne,Ie){var Le=Z.indexOf(Ne.group);V[Le]||(V[Le]=[]),V[Le].push(k.seriesNames[Ie])}),k.seriesGroups=V;for(var ce=function(){for(var Ne=0;Ne<D.length;Ne++)if(typeof D[Ne]=="string"){if(!P.isValidDate(D[Ne]))throw new Error("You have provided invalid Date format. Please provide a valid JavaScript Date");p.twoDSeriesX.push(P.parseDate(D[Ne]))}else p.twoDSeriesX.push(D[Ne])},ue=0;ue<m.length;ue++){if(this.twoDSeries=[],this.twoDSeriesX=[],this.threeDSeries=[],m[ue].data===void 0)return void console.error("It is a possibility that you may have not included 'data' property in series.");if(A.chart.type!=="rangeBar"&&A.chart.type!=="rangeArea"&&m[ue].type!=="rangeBar"&&m[ue].type!=="rangeArea"||(k.isRangeData=!0,A.chart.type!=="rangeBar"&&A.chart.type!=="rangeArea"||this.handleRangeData(m,ue)),this.isMultiFormat())this.isFormat2DArray()?this.handleFormat2DArray(m,ue):this.isFormatXY()&&this.handleFormatXY(m,ue),A.chart.type!=="candlestick"&&m[ue].type!=="candlestick"&&A.chart.type!=="boxPlot"&&m[ue].type!=="boxPlot"||this.handleCandleStickBoxData(m,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{A.xaxis.type==="datetime"?(k.isXNumeric=!0,ce(),k.seriesX.push(this.twoDSeriesX)):A.xaxis.type==="numeric"&&(k.isXNumeric=!0,D.length>0&&(this.twoDSeriesX=D,k.seriesX.push(this.twoDSeriesX))),k.labels.push(this.twoDSeriesX);var me=m[ue].data.map(function(Ne){return F.parseNumber(Ne)});k.series.push(me)}k.seriesZ.push(this.threeDSeries),m[ue].color!==void 0?k.seriesColors.push(m[ue].color):k.seriesColors.push(void 0)}return this.w}},{key:"parseDataNonAxisCharts",value:function(m){var p=this.w.globals,N=this.w.config;p.series=m.slice(),p.seriesNames=N.labels.slice();for(var A=0;A<p.series.length;A++)p.seriesNames[A]===void 0&&p.seriesNames.push("series-"+(A+1));return this.w}},{key:"handleExternalLabelsData",value:function(m){var p=this.w.config,N=this.w.globals;p.xaxis.categories.length>0?N.labels=p.xaxis.categories:p.labels.length>0?N.labels=p.labels.slice():this.fallbackToCategory?(N.labels=N.labels[0],N.seriesRange.length&&(N.seriesRange.map(function(A){A.forEach(function(k){N.labels.indexOf(k.x)<0&&k.x&&N.labels.push(k.x)})}),N.labels=Array.from(new Set(N.labels.map(JSON.stringify)),JSON.parse)),p.xaxis.convertedCatToNumeric&&(new pe(p).convertCatToNumericXaxis(p,this.ctx,N.seriesX[0]),this._generateExternalLabels(m))):this._generateExternalLabels(m)}},{key:"_generateExternalLabels",value:function(m){var p=this.w.globals,N=this.w.config,A=[];if(p.axisCharts){if(p.series.length>0)if(this.isFormatXY())for(var k=N.series.map(function(ue,me){return ue.data.filter(function(Ne,Ie,Le){return Le.findIndex(function(Xe){return Xe.x===Ne.x})===Ie})}),P=k.reduce(function(ue,me,Ne,Ie){return Ie[ue].length>me.length?ue:Ne},0),D=0;D<k[P].length;D++)A.push(D+1);else for(var V=0;V<p.series[p.maxValsInArrayIndex].length;V++)A.push(V+1);p.seriesX=[];for(var Z=0;Z<m.length;Z++)p.seriesX.push(A);this.w.globals.isBarHorizontal||(p.isXNumeric=!0)}if(A.length===0){A=p.axisCharts?[]:p.series.map(function(ue,me){return me+1});for(var ce=0;ce<m.length;ce++)p.seriesX.push(A)}p.labels=A,N.xaxis.convertedCatToNumeric&&(p.categoryLabels=A.map(function(ue){return N.xaxis.labels.formatter(ue)})),p.noLabelsProvided=!0}},{key:"parseData",value:function(m){var p=this.w,N=p.config,A=p.globals;if(this.excludeCollapsedSeriesInYAxis(),this.fallbackToCategory=!1,this.ctx.core.resetGlobals(),this.ctx.core.isMultipleY(),A.axisCharts?(this.parseDataAxisCharts(m),this.coreUtils.getLargestSeries()):this.parseDataNonAxisCharts(m),N.chart.stacked){var k=new Re(this.ctx);A.series=k.setNullSeriesToZeroValues(A.series)}this.coreUtils.getSeriesTotals(),A.axisCharts&&(A.stackedSeriesTotals=this.coreUtils.getStackedSeriesTotals(),A.stackedSeriesTotalsByGroups=this.coreUtils.getStackedSeriesTotalsByGroups()),this.coreUtils.getPercentSeries(),A.dataFormatXNumeric||A.isXNumeric&&(N.xaxis.type!=="numeric"||N.labels.length!==0||N.xaxis.categories.length!==0)||this.handleExternalLabelsData(m);for(var P=this.coreUtils.getCategoryLabels(A.labels),D=0;D<P.length;D++)if(Array.isArray(P[D])){A.isMultiLineX=!0;break}}},{key:"excludeCollapsedSeriesInYAxis",value:function(){var m=this.w,p=[];m.globals.seriesYAxisMap.forEach(function(N,A){var k=0;N.forEach(function(P){m.globals.collapsedSeriesIndices.indexOf(P)!==-1&&k++}),k>0&&k==N.length&&p.push(A)}),m.globals.ignoreYAxisIndexes=p.map(function(N){return N})}}]),Ce}(),Ye=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"scaleSvgNode",value:function(m,p){var N=parseFloat(m.getAttributeNS(null,"width")),A=parseFloat(m.getAttributeNS(null,"height"));m.setAttributeNS(null,"width",N*p),m.setAttributeNS(null,"height",A*p),m.setAttributeNS(null,"viewBox","0 0 "+N+" "+A)}},{key:"getSvgString",value:function(){var m=this;return new Promise(function(p){var N=m.w,A=N.config.chart.toolbar.export.width,k=N.config.chart.toolbar.export.scale||A/N.globals.svgWidth;k||(k=1);var P=m.w.globals.dom.Paper.svg(),D=m.w.globals.dom.Paper.node.cloneNode(!0);k!==1&&m.scaleSvgNode(D,k),m.convertImagesToBase64(D).then(function(){P=new XMLSerializer().serializeToString(D),p(P.replace(/ /g," "))})})}},{key:"convertImagesToBase64",value:function(m){var p=this,N=m.getElementsByTagName("image"),A=Array.from(N).map(function(k){var P=k.getAttributeNS("http://www.w3.org/1999/xlink","href");return P&&!P.startsWith("data:")?p.getBase64FromUrl(P).then(function(D){k.setAttributeNS("http://www.w3.org/1999/xlink","href",D)}).catch(function(D){console.error("Error converting image to base64:",D)}):Promise.resolve()});return Promise.all(A)}},{key:"getBase64FromUrl",value:function(m){return new Promise(function(p,N){var A=new Image;A.crossOrigin="Anonymous",A.onload=function(){var k=document.createElement("canvas");k.width=A.width,k.height=A.height,k.getContext("2d").drawImage(A,0,0),p(k.toDataURL())},A.onerror=N,A.src=m})}},{key:"cleanup",value:function(){var m=this.w,p=m.globals.dom.baseEl.getElementsByClassName("apexcharts-xcrosshairs"),N=m.globals.dom.baseEl.getElementsByClassName("apexcharts-ycrosshairs"),A=m.globals.dom.baseEl.querySelectorAll(".apexcharts-zoom-rect, .apexcharts-selection-rect");Array.prototype.forEach.call(A,function(k){k.setAttribute("width",0)}),p&&p[0]&&(p[0].setAttribute("x",-500),p[0].setAttribute("x1",-500),p[0].setAttribute("x2",-500)),N&&N[0]&&(N[0].setAttribute("y",-100),N[0].setAttribute("y1",-100),N[0].setAttribute("y2",-100))}},{key:"svgUrl",value:function(){var m=this;return new Promise(function(p){m.cleanup(),m.getSvgString().then(function(N){var A=new Blob([N],{type:"image/svg+xml;charset=utf-8"});p(URL.createObjectURL(A))})})}},{key:"dataURI",value:function(m){var p=this;return new Promise(function(N){var A=p.w,k=m?m.scale||m.width/A.globals.svgWidth:1;p.cleanup();var P=document.createElement("canvas");P.width=A.globals.svgWidth*k,P.height=parseInt(A.globals.dom.elWrap.style.height,10)*k;var D=A.config.chart.background!=="transparent"&&A.config.chart.background?A.config.chart.background:"#fff",V=P.getContext("2d");V.fillStyle=D,V.fillRect(0,0,P.width*k,P.height*k),p.getSvgString().then(function(Z){var ce="data:image/svg+xml,"+encodeURIComponent(Z),ue=new Image;ue.crossOrigin="anonymous",ue.onload=function(){if(V.drawImage(ue,0,0),P.msToBlob){var me=P.msToBlob();N({blob:me})}else{var Ne=P.toDataURL("image/png");N({imgURI:Ne})}},ue.src=ce})})}},{key:"exportToSVG",value:function(){var m=this;this.svgUrl().then(function(p){m.triggerDownload(p,m.w.config.chart.toolbar.export.svg.filename,".svg")})}},{key:"exportToPng",value:function(){var m=this,p=this.w.config.chart.toolbar.export.scale,N=this.w.config.chart.toolbar.export.width,A=p?{scale:p}:N?{width:N}:void 0;this.dataURI(A).then(function(k){var P=k.imgURI,D=k.blob;D?navigator.msSaveOrOpenBlob(D,m.w.globals.chartID+".png"):m.triggerDownload(P,m.w.config.chart.toolbar.export.png.filename,".png")})}},{key:"exportToCSV",value:function(m){var p=this,N=m.series,A=m.fileName,k=m.columnDelimiter,P=k===void 0?",":k,D=m.lineDelimiter,V=D===void 0?`
`:D,Z=this.w;N||(N=Z.config.series);var ce,ue,me=[],Ne=[],Ie="",Le=Z.globals.series.map(function(Te,Ze){return Z.globals.collapsedSeriesIndices.indexOf(Ze)===-1?Te:[]}),Xe=function(Te){return typeof Z.config.chart.toolbar.export.csv.categoryFormatter=="function"?Z.config.chart.toolbar.export.csv.categoryFormatter(Te):Z.config.xaxis.type==="datetime"&&String(Te).length>=10?new Date(Te).toDateString():F.isNumber(Te)?Te:Te.split(P).join("")},Oe=function(Te){return typeof Z.config.chart.toolbar.export.csv.valueFormatter=="function"?Z.config.chart.toolbar.export.csv.valueFormatter(Te):Te},$e=Math.max.apply(Math,S(N.map(function(Te){return Te.data?Te.data.length:0}))),ae=new Qe(this.ctx),he=new fe(this.ctx),Pe=function(Te){var Ze="";if(Z.globals.axisCharts){if(Z.config.xaxis.type==="category"||Z.config.xaxis.convertedCatToNumeric)if(Z.globals.isBarHorizontal){var it=Z.globals.yLabelFormatters[0],wt=new Re(p.ctx).getActiveConfigSeriesIndex();Ze=it(Z.globals.labels[Te],{seriesIndex:wt,dataPointIndex:Te,w:Z})}else Ze=he.getLabel(Z.globals.labels,Z.globals.timescaleLabels,0,Te).text;Z.config.xaxis.type==="datetime"&&(Z.config.xaxis.categories.length?Ze=Z.config.xaxis.categories[Te]:Z.config.labels.length&&(Ze=Z.config.labels[Te]))}else Ze=Z.config.labels[Te];return Ze===null?"nullvalue":(Array.isArray(Ze)&&(Ze=Ze.join(" ")),F.isNumber(Ze)?Ze:Ze.split(P).join(""))},Ve=function(Te,Ze){if(me.length&&Ze===0&&Ne.push(me.join(P)),Te.data){Te.data=Te.data.length&&Te.data||S(Array($e)).map(function(){return""});for(var it=0;it<Te.data.length;it++){me=[];var wt=Pe(it);if(wt!=="nullvalue"){if(wt||(ae.isFormatXY()?wt=N[Ze].data[it].x:ae.isFormat2DArray()&&(wt=N[Ze].data[it]?N[Ze].data[it][0]:"")),Ze===0){me.push(Xe(wt));for(var Dt=0;Dt<Z.globals.series.length;Dt++){var Qt,xn=ae.isFormatXY()?(Qt=N[Dt].data[it])===null||Qt===void 0?void 0:Qt.y:Le[Dt][it];me.push(Oe(xn))}}(Z.config.chart.type==="candlestick"||Te.type&&Te.type==="candlestick")&&(me.pop(),me.push(Z.globals.seriesCandleO[Ze][it]),me.push(Z.globals.seriesCandleH[Ze][it]),me.push(Z.globals.seriesCandleL[Ze][it]),me.push(Z.globals.seriesCandleC[Ze][it])),(Z.config.chart.type==="boxPlot"||Te.type&&Te.type==="boxPlot")&&(me.pop(),me.push(Z.globals.seriesCandleO[Ze][it]),me.push(Z.globals.seriesCandleH[Ze][it]),me.push(Z.globals.seriesCandleM[Ze][it]),me.push(Z.globals.seriesCandleL[Ze][it]),me.push(Z.globals.seriesCandleC[Ze][it])),Z.config.chart.type==="rangeBar"&&(me.pop(),me.push(Z.globals.seriesRangeStart[Ze][it]),me.push(Z.globals.seriesRangeEnd[Ze][it])),me.length&&Ne.push(me.join(P))}}}};me.push(Z.config.chart.toolbar.export.csv.headerCategory),Z.config.chart.type==="boxPlot"?(me.push("minimum"),me.push("q1"),me.push("median"),me.push("q3"),me.push("maximum")):Z.config.chart.type==="candlestick"?(me.push("open"),me.push("high"),me.push("low"),me.push("close")):Z.config.chart.type==="rangeBar"?(me.push("minimum"),me.push("maximum")):N.map(function(Te,Ze){var it=(Te.name?Te.name:"series-".concat(Ze))+"";Z.globals.axisCharts&&me.push(it.split(P).join("")?it.split(P).join(""):"series-".concat(Ze))}),Z.globals.axisCharts||(me.push(Z.config.chart.toolbar.export.csv.headerValue),Ne.push(me.join(P))),Z.globals.allSeriesHasEqualX||!Z.globals.axisCharts||Z.config.xaxis.categories.length||Z.config.labels.length?N.map(function(Te,Ze){Z.globals.axisCharts?Ve(Te,Ze):((me=[]).push(Xe(Z.globals.labels[Ze])),me.push(Oe(Le[Ze])),Ne.push(me.join(P)))}):(ce=new Set,ue={},N.forEach(function(Te,Ze){Te==null||Te.data.forEach(function(it){var wt,Dt;if(ae.isFormatXY())wt=it.x,Dt=it.y;else{if(!ae.isFormat2DArray())return;wt=it[0],Dt=it[1]}ue[wt]||(ue[wt]=Array(N.length).fill("")),ue[wt][Ze]=Oe(Dt),ce.add(wt)})}),me.length&&Ne.push(me.join(P)),Array.from(ce).sort().forEach(function(Te){Ne.push([Xe(Te),ue[Te].join(P)])})),Ie+=Ne.join(V),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\uFEFF"+Ie),A||Z.config.chart.toolbar.export.csv.filename,".csv")}},{key:"triggerDownload",value:function(m,p,N){var A=document.createElement("a");A.href=m,A.download=(p||this.w.globals.chartID)+N,document.body.appendChild(A),A.click(),document.body.removeChild(A)}}]),Ce}(),dt=function(){function Ce(m,p){s(this,Ce),this.ctx=m,this.elgrid=p,this.w=m.w;var N=this.w;this.axesUtils=new fe(m),this.xaxisLabels=N.globals.labels.slice(),N.globals.timescaleLabels.length>0&&!N.globals.isBarHorizontal&&(this.xaxisLabels=N.globals.timescaleLabels.slice()),N.config.xaxis.overwriteCategories&&(this.xaxisLabels=N.config.xaxis.overwriteCategories),this.drawnLabels=[],this.drawnLabelsRects=[],N.config.xaxis.position==="top"?this.offY=0:this.offY=N.globals.gridHeight,this.offY=this.offY+N.config.xaxis.axisBorder.offsetY,this.isCategoryBarHorizontal=N.config.chart.type==="bar"&&N.config.plotOptions.bar.horizontal,this.xaxisFontSize=N.config.xaxis.labels.style.fontSize,this.xaxisFontFamily=N.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=N.config.xaxis.labels.style.colors,this.xaxisBorderWidth=N.config.xaxis.axisBorder.width,this.isCategoryBarHorizontal&&(this.xaxisBorderWidth=N.config.yaxis[0].axisBorder.width.toString()),this.xaxisBorderWidth.indexOf("%")>-1?this.xaxisBorderWidth=N.globals.gridWidth*parseInt(this.xaxisBorderWidth,10)/100:this.xaxisBorderWidth=parseInt(this.xaxisBorderWidth,10),this.xaxisBorderHeight=N.config.xaxis.axisBorder.height,this.yaxis=N.config.yaxis[0]}return o(Ce,[{key:"drawXaxis",value:function(){var m=this.w,p=new U(this.ctx),N=p.group({class:"apexcharts-xaxis",transform:"translate(".concat(m.config.xaxis.offsetX,", ").concat(m.config.xaxis.offsetY,")")}),A=p.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(m.globals.translateXAxisX,", ").concat(m.globals.translateXAxisY,")")});N.add(A);for(var k=[],P=0;P<this.xaxisLabels.length;P++)k.push(this.xaxisLabels[P]);if(this.drawXAxisLabelAndGroup(!0,p,A,k,m.globals.isXNumeric,function(Ie,Le){return Le}),m.globals.hasXaxisGroups){var D=m.globals.groups;k=[];for(var V=0;V<D.length;V++)k.push(D[V].title);var Z={};m.config.xaxis.group.style&&(Z.xaxisFontSize=m.config.xaxis.group.style.fontSize,Z.xaxisFontFamily=m.config.xaxis.group.style.fontFamily,Z.xaxisForeColors=m.config.xaxis.group.style.colors,Z.fontWeight=m.config.xaxis.group.style.fontWeight,Z.cssClass=m.config.xaxis.group.style.cssClass),this.drawXAxisLabelAndGroup(!1,p,A,k,!1,function(Ie,Le){return D[Ie].cols*Le},Z)}if(m.config.xaxis.title.text!==void 0){var ce=p.group({class:"apexcharts-xaxis-title"}),ue=p.drawText({x:m.globals.gridWidth/2+m.config.xaxis.title.offsetX,y:this.offY+parseFloat(this.xaxisFontSize)+(m.config.xaxis.position==="bottom"?m.globals.xAxisLabelsHeight:-m.globals.xAxisLabelsHeight-10)+m.config.xaxis.title.offsetY,text:m.config.xaxis.title.text,textAnchor:"middle",fontSize:m.config.xaxis.title.style.fontSize,fontFamily:m.config.xaxis.title.style.fontFamily,fontWeight:m.config.xaxis.title.style.fontWeight,foreColor:m.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text "+m.config.xaxis.title.style.cssClass});ce.add(ue),N.add(ce)}if(m.config.xaxis.axisBorder.show){var me=m.globals.barPadForNumericAxis,Ne=p.drawLine(m.globals.padHorizontal+m.config.xaxis.axisBorder.offsetX-me,this.offY,this.xaxisBorderWidth+me,this.offY,m.config.xaxis.axisBorder.color,0,this.xaxisBorderHeight);this.elgrid&&this.elgrid.elGridBorders&&m.config.grid.show?this.elgrid.elGridBorders.add(Ne):N.add(Ne)}return N}},{key:"drawXAxisLabelAndGroup",value:function(m,p,N,A,k,P){var D,V=this,Z=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{},ce=[],ue=[],me=this.w,Ne=Z.xaxisFontSize||this.xaxisFontSize,Ie=Z.xaxisFontFamily||this.xaxisFontFamily,Le=Z.xaxisForeColors||this.xaxisForeColors,Xe=Z.fontWeight||me.config.xaxis.labels.style.fontWeight,Oe=Z.cssClass||me.config.xaxis.labels.style.cssClass,$e=me.globals.padHorizontal,ae=A.length,he=me.config.xaxis.type==="category"?me.globals.dataPoints:ae;if(he===0&&ae>he&&(he=ae),k){var Pe=he>1?he-1:he;D=me.globals.gridWidth/Math.min(Pe,ae-1),$e=$e+P(0,D)/2+me.config.xaxis.labels.offsetX}else D=me.globals.gridWidth/he,$e=$e+P(0,D)+me.config.xaxis.labels.offsetX;for(var Ve=function(Ze){var it=$e-P(Ze,D)/2+me.config.xaxis.labels.offsetX;Ze===0&&ae===1&&D/2===$e&&he===1&&(it=me.globals.gridWidth/2);var wt=V.axesUtils.getLabel(A,me.globals.timescaleLabels,it,Ze,ce,Ne,m),Dt=28;if(me.globals.rotateXLabels&&m&&(Dt=22),me.config.xaxis.title.text&&me.config.xaxis.position==="top"&&(Dt+=parseFloat(me.config.xaxis.title.style.fontSize)+2),m||(Dt=Dt+parseFloat(Ne)+(me.globals.xAxisLabelsHeight-me.globals.xAxisGroupLabelsHeight)+(me.globals.rotateXLabels?10:0)),wt=me.config.xaxis.tickAmount!==void 0&&me.config.xaxis.tickAmount!=="dataPoints"&&me.config.xaxis.type!=="datetime"?V.axesUtils.checkLabelBasedOnTickamount(Ze,wt,ae):V.axesUtils.checkForOverflowingLabels(Ze,wt,ae,ce,ue),me.config.xaxis.labels.show){var Qt=p.drawText({x:wt.x,y:V.offY+me.config.xaxis.labels.offsetY+Dt-(me.config.xaxis.position==="top"?me.globals.xAxisHeight+me.config.xaxis.axisTicks.height-2:0),text:wt.text,textAnchor:"middle",fontWeight:wt.isBold?600:Xe,fontSize:Ne,fontFamily:Ie,foreColor:Array.isArray(Le)?m&&me.config.xaxis.convertedCatToNumeric?Le[me.globals.minX+Ze-1]:Le[Ze]:Le,isPlainText:!1,cssClass:(m?"apexcharts-xaxis-label ":"apexcharts-xaxis-group-label ")+Oe});if(N.add(Qt),Qt.on("click",function(pn){if(typeof me.config.chart.events.xAxisLabelClick=="function"){var An=Object.assign({},me,{labelIndex:Ze});me.config.chart.events.xAxisLabelClick(pn,V.ctx,An)}}),m){var xn=document.createElementNS(me.globals.SVGNS,"title");xn.textContent=Array.isArray(wt.text)?wt.text.join(" "):wt.text,Qt.node.appendChild(xn),wt.text!==""&&(ce.push(wt.text),ue.push(wt))}}Ze<ae-1&&($e+=P(Ze+1,D))},Te=0;Te<=ae-1;Te++)Ve(Te)}},{key:"drawXaxisInversed",value:function(m){var p,N,A=this,k=this.w,P=new U(this.ctx),D=k.config.yaxis[0].opposite?k.globals.translateYAxisX[m]:0,V=P.group({class:"apexcharts-yaxis apexcharts-xaxis-inversed",rel:m}),Z=P.group({class:"apexcharts-yaxis-texts-g apexcharts-xaxis-inversed-texts-g",transform:"translate("+D+", 0)"});V.add(Z);var ce=[];if(k.config.yaxis[m].show)for(var ue=0;ue<this.xaxisLabels.length;ue++)ce.push(this.xaxisLabels[ue]);p=k.globals.gridHeight/ce.length,N=-p/2.2;var me=k.globals.yLabelFormatters[0],Ne=k.config.yaxis[0].labels;if(Ne.show)for(var Ie=function(Pe){var Ve=ce[Pe]===void 0?"":ce[Pe];Ve=me(Ve,{seriesIndex:m,dataPointIndex:Pe,w:k});var Te=A.axesUtils.getYAxisForeColor(Ne.style.colors,m),Ze=0;Array.isArray(Ve)&&(Ze=Ve.length/2*parseInt(Ne.style.fontSize,10));var it=Ne.offsetX-15,wt="end";A.yaxis.opposite&&(wt="start"),k.config.yaxis[0].labels.align==="left"?(it=Ne.offsetX,wt="start"):k.config.yaxis[0].labels.align==="center"?(it=Ne.offsetX,wt="middle"):k.config.yaxis[0].labels.align==="right"&&(wt="end");var Dt=P.drawText({x:it,y:N+p+Ne.offsetY-Ze,text:Ve,textAnchor:wt,foreColor:Array.isArray(Te)?Te[Pe]:Te,fontSize:Ne.style.fontSize,fontFamily:Ne.style.fontFamily,fontWeight:Ne.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-yaxis-label "+Ne.style.cssClass,maxWidth:Ne.maxWidth});Z.add(Dt),Dt.on("click",function(pn){if(typeof k.config.chart.events.xAxisLabelClick=="function"){var An=Object.assign({},k,{labelIndex:Pe});k.config.chart.events.xAxisLabelClick(pn,A.ctx,An)}});var Qt=document.createElementNS(k.globals.SVGNS,"title");if(Qt.textContent=Array.isArray(Ve)?Ve.join(" "):Ve,Dt.node.appendChild(Qt),k.config.yaxis[m].labels.rotate!==0){var xn=P.rotateAroundCenter(Dt.node);Dt.node.setAttribute("transform","rotate(".concat(k.config.yaxis[m].labels.rotate," 0 ").concat(xn.y,")"))}N+=p},Le=0;Le<=ce.length-1;Le++)Ie(Le);if(k.config.yaxis[0].title.text!==void 0){var Xe=P.group({class:"apexcharts-yaxis-title apexcharts-xaxis-title-inversed",transform:"translate("+D+", 0)"}),Oe=P.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});Xe.add(Oe),V.add(Xe)}var $e=0;this.isCategoryBarHorizontal&&k.config.yaxis[0].opposite&&($e=k.globals.gridWidth);var ae=k.config.xaxis.axisBorder;if(ae.show){var he=P.drawLine(k.globals.padHorizontal+ae.offsetX+$e,1+ae.offsetY,k.globals.padHorizontal+ae.offsetX+$e,k.globals.gridHeight+ae.offsetY,ae.color,0);this.elgrid&&this.elgrid.elGridBorders&&k.config.grid.show?this.elgrid.elGridBorders.add(he):V.add(he)}return k.config.yaxis[0].axisTicks.show&&this.axesUtils.drawYAxisTicks($e,ce.length,k.config.yaxis[0].axisBorder,k.config.yaxis[0].axisTicks,0,p,V),V}},{key:"drawXaxisTicks",value:function(m,p,N){var A=this.w,k=m;if(!(m<0||m-2>A.globals.gridWidth)){var P=this.offY+A.config.xaxis.axisTicks.offsetY;if(p=p+P+A.config.xaxis.axisTicks.height,A.config.xaxis.position==="top"&&(p=P-A.config.xaxis.axisTicks.height),A.config.xaxis.axisTicks.show){var D=new U(this.ctx).drawLine(m+A.config.xaxis.axisTicks.offsetX,P+A.config.xaxis.offsetY,k+A.config.xaxis.axisTicks.offsetX,p+A.config.xaxis.offsetY,A.config.xaxis.axisTicks.color);N.add(D),D.node.classList.add("apexcharts-xaxis-tick")}}}},{key:"getXAxisTicksPositions",value:function(){var m=this.w,p=[],N=this.xaxisLabels.length,A=m.globals.padHorizontal;if(m.globals.timescaleLabels.length>0)for(var k=0;k<N;k++)A=this.xaxisLabels[k].position,p.push(A);else for(var P=N,D=0;D<P;D++){var V=P;m.globals.isXNumeric&&m.config.chart.type!=="bar"&&(V-=1),A+=m.globals.gridWidth/V,p.push(A)}return p}},{key:"xAxisLabelCorrections",value:function(){var m=this.w,p=new U(this.ctx),N=m.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g"),A=m.globals.dom.baseEl.querySelectorAll(".apexcharts-xaxis-texts-g text:not(.apexcharts-xaxis-group-label)"),k=m.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-inversed text"),P=m.globals.dom.baseEl.querySelectorAll(".apexcharts-xaxis-inversed-texts-g text tspan");if(m.globals.rotateXLabels||m.config.xaxis.labels.rotateAlways)for(var D=0;D<A.length;D++){var V=p.rotateAroundCenter(A[D]);V.y=V.y-1,V.x=V.x+1,A[D].setAttribute("transform","rotate(".concat(m.config.xaxis.labels.rotate," ").concat(V.x," ").concat(V.y,")")),A[D].setAttribute("text-anchor","end"),N.setAttribute("transform","translate(0, ".concat(-10,")"));var Z=A[D].childNodes;m.config.xaxis.labels.trim&&Array.prototype.forEach.call(Z,function(Ne){p.placeTextWithEllipsis(Ne,Ne.textContent,m.globals.xAxisLabelsHeight-(m.config.legend.position==="bottom"?20:10))})}else(function(){for(var Ne=m.globals.gridWidth/(m.globals.labels.length+1),Ie=0;Ie<A.length;Ie++){var Le=A[Ie].childNodes;m.config.xaxis.labels.trim&&m.config.xaxis.type!=="datetime"&&Array.prototype.forEach.call(Le,function(Xe){p.placeTextWithEllipsis(Xe,Xe.textContent,Ne)})}})();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>m.globals.gridWidth&&!m.globals.isBarHorizontal&&k[0].parentNode.removeChild(k[0]);for(var me=0;me<P.length;me++)p.placeTextWithEllipsis(P[me],P[me].textContent,m.config.yaxis[0].labels.maxWidth-(m.config.yaxis[0].title.text?2*parseFloat(m.config.yaxis[0].title.style.fontSize):0)-15)}}}]),Ce}(),st=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w;var p=this.w;this.xaxisLabels=p.globals.labels.slice(),this.axesUtils=new fe(m),this.isRangeBar=p.globals.seriesRange.length&&p.globals.isBarHorizontal,p.globals.timescaleLabels.length>0&&(this.xaxisLabels=p.globals.timescaleLabels.slice())}return o(Ce,[{key:"drawGridArea",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,p=this.w,N=new U(this.ctx);m||(m=N.group({class:"apexcharts-grid"}));var A=N.drawLine(p.globals.padHorizontal,1,p.globals.padHorizontal,p.globals.gridHeight,"transparent"),k=N.drawLine(p.globals.padHorizontal,p.globals.gridHeight,p.globals.gridWidth,p.globals.gridHeight,"transparent");return m.add(k),m.add(A),m}},{key:"drawGrid",value:function(){if(this.w.globals.axisCharts){var m=this.renderGrid();return this.drawGridArea(m.el),m}return null}},{key:"createGridMask",value:function(){var m=this.w,p=m.globals,N=new U(this.ctx),A=Array.isArray(m.config.stroke.width)?Math.max.apply(Math,S(m.config.stroke.width)):m.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 P=0,D=0;(["bar","rangeBar","candlestick","boxPlot"].includes(m.config.chart.type)||m.globals.comboBarCount>0)&&m.globals.isXNumeric&&!m.globals.isBarHorizontal&&(P=Math.max(m.config.grid.padding.left,p.barPadForNumericAxis),D=Math.max(m.config.grid.padding.right,p.barPadForNumericAxis)),p.dom.elGridRect=N.drawRect(0,0,p.gridWidth,p.gridHeight,0,"#fff"),p.dom.elGridRectBar=N.drawRect(-A/2-P-2,-A/2-2,p.gridWidth+A+D+P+4,p.gridHeight+A+4,0,"#fff");var V=m.globals.markers.largestSize;p.dom.elGridRectMarker=N.drawRect(-V,-V,p.gridWidth+2*V,p.gridHeight+2*V,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 Z=p.dom.baseEl.querySelector("defs");Z.appendChild(p.dom.elGridRectMask),Z.appendChild(p.dom.elGridRectBarMask),Z.appendChild(p.dom.elGridRectMarkerMask),Z.appendChild(p.dom.elForecastMask),Z.appendChild(p.dom.elNonForecastMask)}},{key:"_drawGridLines",value:function(m){var p=m.i,N=m.x1,A=m.y1,k=m.x2,P=m.y2,D=m.xCount,V=m.parent,Z=this.w;if(!(p===0&&Z.globals.skipFirstTimelinelabel||p===D-1&&Z.globals.skipLastTimelinelabel&&!Z.config.xaxis.labels.formatter||Z.config.chart.type==="radar")){Z.config.grid.xaxis.lines.show&&this._drawGridLine({i:p,x1:N,y1:A,x2:k,y2:P,xCount:D,parent:V});var ce=0;if(Z.globals.hasXaxisGroups&&Z.config.xaxis.tickPlacement==="between"){var ue=Z.globals.groups;if(ue){for(var me=0,Ne=0;me<p&&Ne<ue.length;Ne++)me+=ue[Ne].cols;me===p&&(ce=.6*Z.globals.xAxisLabelsHeight)}}new dt(this.ctx).drawXaxisTicks(N,ce,Z.globals.dom.elGraphical)}}},{key:"_drawGridLine",value:function(m){var p=m.i,N=m.x1,A=m.y1,k=m.x2,P=m.y2,D=m.xCount,V=m.parent,Z=this.w,ce=V.node.classList.contains("apexcharts-gridlines-horizontal"),ue=Z.globals.barPadForNumericAxis,me=A===0&&P===0||N===0&&k===0||A===Z.globals.gridHeight&&P===Z.globals.gridHeight||Z.globals.isBarHorizontal&&(p===0||p===D-1),Ne=new U(this).drawLine(N-(ce?ue:0),A,k+(ce?ue:0),P,Z.config.grid.borderColor,Z.config.grid.strokeDashArray);Ne.node.classList.add("apexcharts-gridline"),me&&Z.config.grid.show?this.elGridBorders.add(Ne):V.add(Ne)}},{key:"_drawGridBandRect",value:function(m){var p=m.c,N=m.x1,A=m.y1,k=m.x2,P=m.y2,D=m.type,V=this.w,Z=new U(this.ctx),ce=V.globals.barPadForNumericAxis,ue=V.config.grid[D].colors[p],me=Z.drawRect(N-(D==="row"?ce:0),A,k+(D==="row"?2*ce:0),P,0,ue,V.config.grid[D].opacity);this.elg.add(me),me.attr("clip-path","url(#gridRectMask".concat(V.globals.cuid,")")),me.node.classList.add("apexcharts-grid-".concat(D))}},{key:"_drawXYLines",value:function(m){var p=this,N=m.xCount,A=m.tickAmount,k=this.w;if(k.config.grid.xaxis.lines.show||k.config.xaxis.axisTicks.show){var P,D=k.globals.padHorizontal,V=k.globals.gridHeight;k.globals.timescaleLabels.length?function(Ie){for(var Le=Ie.xC,Xe=Ie.x1,Oe=Ie.y1,$e=Ie.x2,ae=Ie.y2,he=0;he<Le;he++)Xe=p.xaxisLabels[he].position,$e=p.xaxisLabels[he].position,p._drawGridLines({i:he,x1:Xe,y1:Oe,x2:$e,y2:ae,xCount:N,parent:p.elgridLinesV})}({xC:N,x1:D,y1:0,x2:P,y2:V}):(k.globals.isXNumeric&&(N=k.globals.xAxisScale.result.length),function(Ie){for(var Le=Ie.xC,Xe=Ie.x1,Oe=Ie.y1,$e=Ie.x2,ae=Ie.y2,he=0;he<Le+(k.globals.isXNumeric?0:1);he++)he===0&&Le===1&&k.globals.dataPoints===1&&($e=Xe=k.globals.gridWidth/2),p._drawGridLines({i:he,x1:Xe,y1:Oe,x2:$e,y2:ae,xCount:N,parent:p.elgridLinesV}),$e=Xe+=k.globals.gridWidth/(k.globals.isXNumeric?Le-1:Le)}({xC:N,x1:D,y1:0,x2:P,y2:V}))}if(k.config.grid.yaxis.lines.show){var Z=0,ce=0,ue=k.globals.gridWidth,me=A+1;this.isRangeBar&&(me=k.globals.labels.length);for(var Ne=0;Ne<me+(this.isRangeBar?1:0);Ne++)this._drawGridLine({i:Ne,xCount:me+(this.isRangeBar?1:0),x1:0,y1:Z,x2:ue,y2:ce,parent:this.elgridLinesH}),ce=Z+=k.globals.gridHeight/(this.isRangeBar?me:A)}}},{key:"_drawInvertedXYLines",value:function(m){var p=m.xCount,N=this.w;if(N.config.grid.xaxis.lines.show||N.config.xaxis.axisTicks.show)for(var A,k=N.globals.padHorizontal,P=N.globals.gridHeight,D=0;D<p+1;D++)N.config.grid.xaxis.lines.show&&this._drawGridLine({i:D,xCount:p+1,x1:k,y1:0,x2:A,y2:P,parent:this.elgridLinesV}),new dt(this.ctx).drawXaxisTicks(k,0,N.globals.dom.elGraphical),A=k+=N.globals.gridWidth/p;if(N.config.grid.yaxis.lines.show)for(var V=0,Z=0,ce=N.globals.gridWidth,ue=0;ue<N.globals.dataPoints+1;ue++)this._drawGridLine({i:ue,xCount:N.globals.dataPoints+1,x1:0,y1:V,x2:ce,y2:Z,parent:this.elgridLinesH}),Z=V+=N.globals.gridHeight/N.globals.dataPoints}},{key:"renderGrid",value:function(){var m=this.w,p=m.globals,N=new U(this.ctx);this.elg=N.group({class:"apexcharts-grid"}),this.elgridLinesH=N.group({class:"apexcharts-gridlines-horizontal"}),this.elgridLinesV=N.group({class:"apexcharts-gridlines-vertical"}),this.elGridBorders=N.group({class:"apexcharts-grid-borders"}),this.elg.add(this.elgridLinesH),this.elg.add(this.elgridLinesV),m.config.grid.show||(this.elgridLinesV.hide(),this.elgridLinesH.hide(),this.elGridBorders.hide());for(var A=0;A<p.seriesYAxisMap.length&&p.ignoreYAxisIndexes.includes(A);)A++;A===p.seriesYAxisMap.length&&(A=0);var k,P=p.yAxisScale[A].result.length-1;if(!p.isBarHorizontal||this.isRangeBar){var D,V,Z;k=this.xaxisLabels.length,this.isRangeBar&&(P=p.labels.length,m.config.xaxis.tickAmount&&m.config.xaxis.labels.formatter&&(k=m.config.xaxis.tickAmount),((D=p.yAxisScale)===null||D===void 0||(V=D[A])===null||V===void 0||(Z=V.result)===null||Z===void 0?void 0:Z.length)>0&&m.config.xaxis.type!=="datetime"&&(k=p.yAxisScale[A].result.length-1)),this._drawXYLines({xCount:k,tickAmount:P})}else k=P,P=p.xTickAmount,this._drawInvertedXYLines({xCount:k,tickAmount:P});return this.drawGridBands(k,P),{el:this.elg,elGridBorders:this.elGridBorders,xAxisTickWidth:p.gridWidth/k}}},{key:"drawGridBands",value:function(m,p){var N,A,k=this,P=this.w;if(((N=P.config.grid.row.colors)===null||N===void 0?void 0:N.length)>0&&function(Ie,Le,Xe,Oe,$e,ae){for(var he=0,Pe=0;he<Le;he++,Pe++)Pe>=P.config.grid[Ie].colors.length&&(Pe=0),k._drawGridBandRect({c:Pe,x1:Xe,y1:Oe,x2:$e,y2:ae,type:Ie}),Oe+=P.globals.gridHeight/p}("row",p,0,0,P.globals.gridWidth,P.globals.gridHeight/p),((A=P.config.grid.column.colors)===null||A===void 0?void 0:A.length)>0){var D=P.globals.isBarHorizontal||P.config.xaxis.tickPlacement!=="on"||P.config.xaxis.type!=="category"&&!P.config.xaxis.convertedCatToNumeric?m:m-1;P.globals.isXNumeric&&(D=P.globals.xAxisScale.result.length-1);for(var V=P.globals.padHorizontal,Z=P.globals.padHorizontal+P.globals.gridWidth/D,ce=P.globals.gridHeight,ue=0,me=0;ue<m;ue++,me++){var Ne;me>=P.config.grid.column.colors.length&&(me=0),P.config.xaxis.type==="datetime"&&(V=this.xaxisLabels[ue].position,Z=(((Ne=this.xaxisLabels[ue+1])===null||Ne===void 0?void 0:Ne.position)||P.globals.gridWidth)-this.xaxisLabels[ue].position),this._drawGridBandRect({c:me,x1:V,y1:0,x2:Z,y2:ce,type:"column"}),V+=P.globals.gridWidth/D}}}}]),Ce}(),at=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.coreUtils=new Y(this.ctx)}return o(Ce,[{key:"niceScale",value:function(m,p){var N,A,k,P,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,V=1e-11,Z=this.w,ce=Z.globals;ce.isBarHorizontal?(N=Z.config.xaxis,A=Math.max((ce.svgWidth-100)/25,2)):(N=Z.config.yaxis[D],A=Math.max((ce.svgHeight-100)/15,2)),F.isNumber(A)||(A=10),k=N.min!==void 0&&N.min!==null,P=N.max!==void 0&&N.min!==null;var ue=N.stepSize!==void 0&&N.stepSize!==null,me=N.tickAmount!==void 0&&N.tickAmount!==null,Ne=me?N.tickAmount:ce.niceScaleDefaultTicks[Math.min(Math.round(A/2),ce.niceScaleDefaultTicks.length-1)];if(ce.isMultipleYAxis&&!me&&ce.multiAxisTickAmount>0&&(Ne=ce.multiAxisTickAmount,me=!0),Ne=Ne==="dataPoints"?ce.dataPoints-1:Math.abs(Math.round(Ne)),(m===Number.MIN_VALUE&&p===0||!F.isNumber(m)&&!F.isNumber(p)||m===Number.MIN_VALUE&&p===-Number.MAX_VALUE)&&(m=F.isNumber(N.min)?N.min:0,p=F.isNumber(N.max)?N.max:m+Ne,ce.allSeriesCollapsed=!1),m>p){console.warn("axis.min cannot be greater than axis.max: swapping min and max");var Ie=p;p=m,m=Ie}else m===p&&(m=m===0?0:m-1,p=p===0?2:p+1);var Le=[];Ne<1&&(Ne=1);var Xe=Ne,Oe=Math.abs(p-m);!k&&m>0&&m/Oe<.15&&(m=0,k=!0),!P&&p<0&&-p/Oe<.15&&(p=0,P=!0);var $e=(Oe=Math.abs(p-m))/Xe,ae=$e,he=Math.floor(Math.log10(ae)),Pe=Math.pow(10,he),Ve=Math.ceil(ae/Pe);if($e=ae=(Ve=ce.niceScaleAllowedMagMsd[ce.yValueDecimal===0?0:1][Ve])*Pe,ce.isBarHorizontal&&N.stepSize&&N.type!=="datetime"?($e=N.stepSize,ue=!0):ue&&($e=N.stepSize),ue&&N.forceNiceScale){var Te=Math.floor(Math.log10($e));$e*=Math.pow(10,he-Te)}if(k&&P){var Ze=Oe/Xe;if(me)if(ue)if(F.mod(Oe,$e)!=0){var it=F.getGCD($e,Ze);$e=Ze/it<10?it:Ze}else F.mod($e,Ze)==0?$e=Ze:(Ze=$e,me=!1);else $e=Ze;else if(ue)F.mod(Oe,$e)==0?Ze=$e:$e=Ze;else if(F.mod(Oe,$e)==0)Ze=$e;else{Ze=Oe/(Xe=Math.ceil(Oe/$e));var wt=F.getGCD(Oe,$e);Oe/wt<A&&(Ze=wt),$e=Ze}Xe=Math.round(Oe/$e)}else{if(k||P){if(P)if(me)m=p-$e*Xe;else{var Dt=m;m=$e*Math.floor(m/$e),Math.abs(p-m)/F.getGCD(Oe,$e)>A&&(m=p-$e*Ne,m+=$e*Math.floor((Dt-m)/$e))}else if(k)if(me)p=m+$e*Xe;else{var Qt=p;p=$e*Math.ceil(p/$e),Math.abs(p-m)/F.getGCD(Oe,$e)>A&&(p=m+$e*Ne,p+=$e*Math.ceil((Qt-p)/$e))}}else if(ce.isMultipleYAxis&&me){var xn=$e*Math.floor(m/$e),pn=xn+$e*Xe;pn<p&&($e*=2),pn=p,p=(m=xn)+$e*Xe,Oe=Math.abs(p-m),m>0&&m<Math.abs(pn-p)&&(m=0,p=$e*Xe),p<0&&-p<Math.abs(xn-m)&&(p=0,m=-$e*Xe)}else m=$e*Math.floor(m/$e),p=$e*Math.ceil(p/$e);Oe=Math.abs(p-m),$e=F.getGCD(Oe,$e),Xe=Math.round(Oe/$e)}if(me||k||P||(Xe=Math.ceil((Oe-V)/($e+V)))>16&&F.getPrimeFactors(Xe).length<2&&Xe++,!me&&N.forceNiceScale&&ce.yValueDecimal===0&&Xe>Oe&&(Xe=Oe,$e=Math.round(Oe/Xe)),Xe>A&&(!me&&!ue||N.forceNiceScale)){var An=F.getPrimeFactors(Xe),or=An.length-1,$t=Xe;e:for(var bt=0;bt<or;bt++)for(var rn=0;rn<=or-bt;rn++){for(var ur=Math.min(rn+bt,or),gr=$t,br=1,Br=rn;Br<=ur;Br++)br*=An[Br];if((gr/=br)<A){$t=gr;break e}}$e=$t===Xe?Oe:Oe/$t,Xe=Math.round(Oe/$e)}ce.isMultipleYAxis&&ce.multiAxisTickAmount==0&&ce.ignoreYAxisIndexes.indexOf(D)<0&&(ce.multiAxisTickAmount=Xe);var Gr=m-$e,Or=$e*V;do Gr+=$e,Le.push(F.stripNumber(Gr,7));while(p-Gr>Or);return{result:Le,niceMin:Le[0],niceMax:Le[Le.length-1]}}},{key:"linearScale",value:function(m,p){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:void 0,P=Math.abs(p-m),D=[];if(m===p)return{result:D=[m],niceMin:D[0],niceMax:D[D.length-1]};(N=this._adjustTicksForSmallRange(N,A,P))==="dataPoints"&&(N=this.w.globals.dataPoints-1),k||(k=P/N),k=Math.round(10*(k+Number.EPSILON))/10,N===Number.MAX_VALUE&&(N=5,k=1);for(var V=m;N>=0;)D.push(V),V=F.preciseAddition(V,k),N-=1;return{result:D,niceMin:D[0],niceMax:D[D.length-1]}}},{key:"logarithmicScaleNice",value:function(m,p,N){p<=0&&(p=Math.max(m,N)),m<=0&&(m=Math.min(p,N));for(var A=[],k=Math.ceil(Math.log(p)/Math.log(N)+1),P=Math.floor(Math.log(m)/Math.log(N));P<k;P++)A.push(Math.pow(N,P));return{result:A,niceMin:A[0],niceMax:A[A.length-1]}}},{key:"logarithmicScale",value:function(m,p,N){p<=0&&(p=Math.max(m,N)),m<=0&&(m=Math.min(p,N));for(var A=[],k=Math.log(p)/Math.log(N),P=Math.log(m)/Math.log(N),D=k-P,V=Math.round(D),Z=D/V,ce=0,ue=P;ce<V;ce++,ue+=Z)A.push(Math.pow(N,ue));return A.push(Math.pow(N,k)),{result:A,niceMin:m,niceMax:p}}},{key:"_adjustTicksForSmallRange",value:function(m,p,N){var A=m;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&&(A=Math.ceil(N))}return A<m?A:m}},{key:"setYScaleForIndex",value:function(m,p,N){var A=this.w.globals,k=this.w.config,P=A.isBarHorizontal?k.xaxis:k.yaxis[m];A.yAxisScale[m]===void 0&&(A.yAxisScale[m]=[]);var D=Math.abs(N-p);P.logarithmic&&D<=5&&(A.invalidLogScale=!0),P.logarithmic&&D>5?(A.allSeriesCollapsed=!1,A.yAxisScale[m]=P.forceNiceScale?this.logarithmicScaleNice(p,N,P.logBase):this.logarithmicScale(p,N,P.logBase)):N!==-Number.MAX_VALUE&&F.isNumber(N)&&p!==Number.MAX_VALUE&&F.isNumber(p)?(A.allSeriesCollapsed=!1,A.yAxisScale[m]=this.niceScale(p,N,m)):A.yAxisScale[m]=this.niceScale(Number.MIN_VALUE,0,m)}},{key:"setXScale",value:function(m,p){var N=this.w,A=N.globals,k=Math.abs(p-m);if(p!==-Number.MAX_VALUE&&F.isNumber(p)){var P=A.xTickAmount+1;k<10&&k>1&&(P=k),A.xAxisScale=this.linearScale(m,p,P,0,N.config.xaxis.stepSize)}else A.xAxisScale=this.linearScale(0,10,10);return A.xAxisScale}},{key:"scaleMultipleYAxes",value:function(){var m=this,p=this.w.config,N=this.w.globals;this.coreUtils.setSeriesYAxisMappings();var A=N.seriesYAxisMap,k=N.minYArr,P=N.maxYArr;N.allSeriesCollapsed=!0,N.barGroups=[],A.forEach(function(D,V){var Z=[];D.forEach(function(ce){var ue=p.series[ce].group;Z.indexOf(ue)<0&&Z.push(ue)}),D.length>0?function(){var ce,ue,me=Number.MAX_VALUE,Ne=-Number.MAX_VALUE,Ie=me,Le=Ne;if(p.chart.stacked)(function(){var $e=new Array(N.dataPoints).fill(0),ae=[],he=[],Pe=[];Z.forEach(function(){ae.push($e.map(function(){return Number.MIN_VALUE})),he.push($e.map(function(){return Number.MIN_VALUE})),Pe.push($e.map(function(){return Number.MIN_VALUE}))});for(var Ve=function(Ze){!ce&&p.series[D[Ze]].type&&(ce=p.series[D[Ze]].type);var it=D[Ze];ue=p.series[it].group?p.series[it].group:"axis-".concat(V),!(N.collapsedSeriesIndices.indexOf(it)<0&&N.ancillaryCollapsedSeriesIndices.indexOf(it)<0)||(N.allSeriesCollapsed=!1,Z.forEach(function(wt,Dt){if(p.series[it].group===wt)for(var Qt=0;Qt<N.series[it].length;Qt++){var xn=N.series[it][Qt];xn>=0?he[Dt][Qt]+=xn:Pe[Dt][Qt]+=xn,ae[Dt][Qt]+=xn,Ie=Math.min(Ie,xn),Le=Math.max(Le,xn)}})),ce!=="bar"&&ce!=="column"||N.barGroups.push(ue)},Te=0;Te<D.length;Te++)Ve(Te);ce||(ce=p.chart.type),ce==="bar"||ce==="column"?Z.forEach(function(Ze,it){me=Math.min(me,Math.min.apply(null,Pe[it])),Ne=Math.max(Ne,Math.max.apply(null,he[it]))}):(Z.forEach(function(Ze,it){Ie=Math.min(Ie,Math.min.apply(null,ae[it])),Le=Math.max(Le,Math.max.apply(null,ae[it]))}),me=Ie,Ne=Le),me===Number.MIN_VALUE&&Ne===Number.MIN_VALUE&&(Ne=-Number.MAX_VALUE)})();else for(var Xe=0;Xe<D.length;Xe++){var Oe=D[Xe];me=Math.min(me,k[Oe]),Ne=Math.max(Ne,P[Oe]),!(N.collapsedSeriesIndices.indexOf(Oe)<0&&N.ancillaryCollapsedSeriesIndices.indexOf(Oe)<0)||(N.allSeriesCollapsed=!1)}p.yaxis[V].min!==void 0&&(me=typeof p.yaxis[V].min=="function"?p.yaxis[V].min(me):p.yaxis[V].min),p.yaxis[V].max!==void 0&&(Ne=typeof p.yaxis[V].max=="function"?p.yaxis[V].max(Ne):p.yaxis[V].max),N.barGroups=N.barGroups.filter(function($e,ae,he){return he.indexOf($e)===ae}),m.setYScaleForIndex(V,me,Ne),D.forEach(function($e){k[$e]=N.yAxisScale[V].niceMin,P[$e]=N.yAxisScale[V].niceMax})}():m.setYScaleForIndex(V,0,-Number.MAX_VALUE)})}}]),Ce}(),He=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.scales=new at(m)}return o(Ce,[{key:"init",value:function(){this.setYRange(),this.setXRange(),this.setZRange()}},{key:"getMinYMaxY",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-Number.MAX_VALUE,A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,k=this.w.config,P=this.w.globals,D=-Number.MAX_VALUE,V=Number.MIN_VALUE;A===null&&(A=m+1);var Z=P.series,ce=Z,ue=Z;k.chart.type==="candlestick"?(ce=P.seriesCandleL,ue=P.seriesCandleH):k.chart.type==="boxPlot"?(ce=P.seriesCandleO,ue=P.seriesCandleC):P.isRangeData&&(ce=P.seriesRangeStart,ue=P.seriesRangeEnd);var me=!1;if(P.seriesX.length>=A){var Ne,Ie=(Ne=P.brushSource)===null||Ne===void 0?void 0:Ne.w.config.chart.brush;(k.chart.zoom.enabled&&k.chart.zoom.autoScaleYaxis||Ie!=null&&Ie.enabled&&Ie!=null&&Ie.autoScaleYaxis)&&(me=!0)}for(var Le=m;Le<A;Le++){P.dataPoints=Math.max(P.dataPoints,Z[Le].length);var Xe=k.series[Le].type;P.categoryLabels.length&&(P.dataPoints=P.categoryLabels.filter(function(Pe){return Pe!==void 0}).length),P.labels.length&&k.xaxis.type!=="datetime"&&P.series.reduce(function(Pe,Ve){return Pe+Ve.length},0)!==0&&(P.dataPoints=Math.max(P.dataPoints,P.labels.length));var Oe=0,$e=Z[Le].length-1;if(me){if(k.xaxis.min)for(;Oe<$e&&P.seriesX[Le][Oe]<k.xaxis.min;Oe++);if(k.xaxis.max)for(;$e>Oe&&P.seriesX[Le][$e]>k.xaxis.max;$e--);}for(var ae=Oe;ae<=$e&&ae<P.series[Le].length;ae++){var he=Z[Le][ae];if(he!==null&&F.isNumber(he)){switch(ue[Le][ae]!==void 0&&(D=Math.max(D,ue[Le][ae]),p=Math.min(p,ue[Le][ae])),ce[Le][ae]!==void 0&&(p=Math.min(p,ce[Le][ae]),N=Math.max(N,ce[Le][ae])),Xe){case"candlestick":P.seriesCandleC[Le][ae]!==void 0&&(D=Math.max(D,P.seriesCandleH[Le][ae]),p=Math.min(p,P.seriesCandleL[Le][ae]));break;case"boxPlot":P.seriesCandleC[Le][ae]!==void 0&&(D=Math.max(D,P.seriesCandleC[Le][ae]),p=Math.min(p,P.seriesCandleO[Le][ae]))}Xe&&Xe!=="candlestick"&&Xe!=="boxPlot"&&Xe!=="rangeArea"&&Xe!=="rangeBar"&&(D=Math.max(D,P.series[Le][ae]),p=Math.min(p,P.series[Le][ae])),N=D,P.seriesGoals[Le]&&P.seriesGoals[Le][ae]&&Array.isArray(P.seriesGoals[Le][ae])&&P.seriesGoals[Le][ae].forEach(function(Pe){V!==Number.MIN_VALUE&&(V=Math.min(V,Pe.value),p=V),D=Math.max(D,Pe.value),N=D}),F.isFloat(he)&&(he=F.noExponents(he),P.yValueDecimal=Math.max(P.yValueDecimal,he.toString().split(".")[1].length)),V>ce[Le][ae]&&ce[Le][ae]<0&&(V=ce[Le][ae])}else P.hasNullValues=!0}Xe!=="bar"&&Xe!=="column"||(V<0&&D<0&&(D=0,N=Math.max(N,0)),V===Number.MIN_VALUE&&(V=0,p=Math.min(p,0)))}return k.chart.type==="rangeBar"&&P.seriesRangeStart.length&&P.isBarHorizontal&&(V=p),k.chart.type==="bar"&&(V<0&&D<0&&(D=0),V===Number.MIN_VALUE&&(V=0)),{minY:V,maxY:D,lowestY:p,highestY:N}}},{key:"setYRange",value:function(){var m=this.w.globals,p=this.w.config;m.maxY=-Number.MAX_VALUE,m.minY=Number.MIN_VALUE;var N,A=Number.MAX_VALUE;if(m.isMultipleYAxis){A=Number.MAX_VALUE;for(var k=0;k<m.series.length;k++)N=this.getMinYMaxY(k),m.minYArr[k]=N.lowestY,m.maxYArr[k]=N.highestY,A=Math.min(A,N.lowestY)}return N=this.getMinYMaxY(0,A,null,m.series.length),p.chart.type==="bar"?(m.minY=N.minY,m.maxY=N.maxY):(m.minY=N.lowestY,m.maxY=N.highestY),A=N.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"&&!m.isBarHorizontal?m.minY===Number.MIN_VALUE&&A!==-Number.MAX_VALUE&&A!==m.maxY&&(m.minY=A):m.minY=m.minY!==Number.MIN_VALUE?Math.min(N.minY,m.minY):N.minY,p.yaxis.forEach(function(P,D){P.max!==void 0&&(typeof P.max=="number"?m.maxYArr[D]=P.max:typeof P.max=="function"&&(m.maxYArr[D]=P.max(m.isMultipleYAxis?m.maxYArr[D]:m.maxY)),m.maxY=m.maxYArr[D]),P.min!==void 0&&(typeof P.min=="number"?m.minYArr[D]=P.min:typeof P.min=="function"&&(m.minYArr[D]=P.min(m.isMultipleYAxis?m.minYArr[D]===Number.MIN_VALUE?0:m.minYArr[D]:m.minY)),m.minY=m.minYArr[D])}),m.isBarHorizontal&&["min","max"].forEach(function(P){p.xaxis[P]!==void 0&&typeof p.xaxis[P]=="number"&&(P==="min"?m.minY=p.xaxis[P]:m.maxY=p.xaxis[P])}),m.isMultipleYAxis?(this.scales.scaleMultipleYAxes(),m.minY=A):(this.scales.setYScaleForIndex(0,m.minY,m.maxY),m.minY=m.yAxisScale[0].niceMin,m.maxY=m.yAxisScale[0].niceMax,m.minYArr[0]=m.minY,m.maxYArr[0]=m.maxY),m.barGroups=[],m.lineGroups=[],m.areaGroups=[],p.series.forEach(function(P){switch(P.type||p.chart.type){case"bar":case"column":m.barGroups.push(P.group);break;case"line":m.lineGroups.push(P.group);break;case"area":m.areaGroups.push(P.group)}}),m.barGroups=m.barGroups.filter(function(P,D,V){return V.indexOf(P)===D}),m.lineGroups=m.lineGroups.filter(function(P,D,V){return V.indexOf(P)===D}),m.areaGroups=m.areaGroups.filter(function(P,D,V){return V.indexOf(P)===D}),{minY:m.minY,maxY:m.maxY,minYArr:m.minYArr,maxYArr:m.maxYArr,yAxisScale:m.yAxisScale}}},{key:"setXRange",value:function(){var m=this.w.globals,p=this.w.config,N=p.xaxis.type==="numeric"||p.xaxis.type==="datetime"||p.xaxis.type==="category"&&!m.noLabelsProvided||m.noLabelsProvided||m.isXNumeric;if(m.isXNumeric&&function(){for(var V=0;V<m.series.length;V++)if(m.labels[V])for(var Z=0;Z<m.labels[V].length;Z++)m.labels[V][Z]!==null&&F.isNumber(m.labels[V][Z])&&(m.maxX=Math.max(m.maxX,m.labels[V][Z]),m.initialMaxX=Math.max(m.maxX,m.labels[V][Z]),m.minX=Math.min(m.minX,m.labels[V][Z]),m.initialMinX=Math.min(m.minX,m.labels[V][Z]))}(),m.noLabelsProvided&&p.xaxis.categories.length===0&&(m.maxX=m.labels[m.labels.length-1],m.initialMaxX=m.labels[m.labels.length-1],m.minX=1,m.initialMinX=1),m.isXNumeric||m.noLabelsProvided||m.dataFormatXNumeric){var A=10;if(p.xaxis.tickAmount===void 0)A=Math.round(m.svgWidth/150),p.xaxis.type==="numeric"&&m.dataPoints<30&&(A=m.dataPoints-1),A>m.dataPoints&&m.dataPoints!==0&&(A=m.dataPoints-1);else if(p.xaxis.tickAmount==="dataPoints"){if(m.series.length>1&&(A=m.series[m.maxValsInArrayIndex].length-1),m.isXNumeric){var k=m.maxX-m.minX;k<30&&(A=k-1)}}else A=p.xaxis.tickAmount;if(m.xTickAmount=A,p.xaxis.max!==void 0&&typeof p.xaxis.max=="number"&&(m.maxX=p.xaxis.max),p.xaxis.min!==void 0&&typeof p.xaxis.min=="number"&&(m.minX=p.xaxis.min),p.xaxis.range!==void 0&&(m.minX=m.maxX-p.xaxis.range),m.minX!==Number.MAX_VALUE&&m.maxX!==-Number.MAX_VALUE)if(p.xaxis.convertedCatToNumeric&&!m.dataFormatXNumeric){for(var P=[],D=m.minX-1;D<m.maxX;D++)P.push(D+1);m.xAxisScale={result:P,niceMin:P[0],niceMax:P[P.length-1]}}else m.xAxisScale=this.scales.setXScale(m.minX,m.maxX);else m.xAxisScale=this.scales.linearScale(0,A,A,0,p.xaxis.stepSize),m.noLabelsProvided&&m.labels.length>0&&(m.xAxisScale=this.scales.linearScale(1,m.labels.length,A-1,0,p.xaxis.stepSize),m.seriesX=m.labels.slice());N&&(m.labels=m.xAxisScale.result.slice())}return m.isBarHorizontal&&m.labels.length&&(m.xTickAmount=m.labels.length),this._handleSingleDataPoint(),this._getMinXDiff(),{minX:m.minX,maxX:m.maxX}}},{key:"setZRange",value:function(){var m=this.w.globals;if(m.isDataXYZ){for(var p=0;p<m.series.length;p++)if(m.seriesZ[p]!==void 0)for(var N=0;N<m.seriesZ[p].length;N++)m.seriesZ[p][N]!==null&&F.isNumber(m.seriesZ[p][N])&&(m.maxZ=Math.max(m.maxZ,m.seriesZ[p][N]),m.minZ=Math.min(m.minZ,m.seriesZ[p][N]))}}},{key:"_handleSingleDataPoint",value:function(){var m=this.w.globals,p=this.w.config;if(m.minX===m.maxX){var N=new q(this.ctx);if(p.xaxis.type==="datetime"){var A=N.getDate(m.minX);p.xaxis.labels.datetimeUTC?A.setUTCDate(A.getUTCDate()-2):A.setDate(A.getDate()-2),m.minX=new Date(A).getTime();var k=N.getDate(m.maxX);p.xaxis.labels.datetimeUTC?k.setUTCDate(k.getUTCDate()+2):k.setDate(k.getDate()+2),m.maxX=new Date(k).getTime()}else(p.xaxis.type==="numeric"||p.xaxis.type==="category"&&!m.noLabelsProvided)&&(m.minX=m.minX-2,m.initialMinX=m.minX,m.maxX=m.maxX+2,m.initialMaxX=m.maxX)}}},{key:"_getMinXDiff",value:function(){var m=this.w.globals;m.isXNumeric&&m.seriesX.forEach(function(p,N){p.length===1&&p.push(m.seriesX[m.maxValsInArrayIndex][m.seriesX[m.maxValsInArrayIndex].length-1]);var A=p.slice();A.sort(function(k,P){return k-P}),A.forEach(function(k,P){if(P>0){var D=k-A[P-1];D>0&&(m.minXDiff=Math.min(D,m.minXDiff))}}),m.dataPoints!==1&&m.minXDiff!==Number.MAX_VALUE||(m.minXDiff=.5)})}},{key:"_setStackedMinMax",value:function(){var m=this,p=this.w.globals;if(p.series.length){var N=p.seriesGroups;N.length||(N=[this.w.globals.seriesNames.map(function(P){return P})]);var A={},k={};N.forEach(function(P){A[P]=[],k[P]=[],m.w.config.series.map(function(D,V){return P.indexOf(p.seriesNames[V])>-1?V:null}).filter(function(D){return D!==null}).forEach(function(D){for(var V=0;V<p.series[p.maxValsInArrayIndex].length;V++){var Z,ce,ue,me;A[P][V]===void 0&&(A[P][V]=0,k[P][V]=0),(m.w.config.chart.stacked&&!p.comboCharts||m.w.config.chart.stacked&&p.comboCharts&&(!m.w.config.chart.stackOnlyBar||((Z=m.w.config.series)===null||Z===void 0||(ce=Z[D])===null||ce===void 0?void 0:ce.type)==="bar"||((ue=m.w.config.series)===null||ue===void 0||(me=ue[D])===null||me===void 0?void 0:me.type)==="column"))&&p.series[D][V]!==null&&F.isNumber(p.series[D][V])&&(p.series[D][V]>0?A[P][V]+=parseFloat(p.series[D][V])+1e-4:k[P][V]+=parseFloat(p.series[D][V]))}})}),Object.entries(A).forEach(function(P){var D=C(P,1)[0];A[D].forEach(function(V,Z){p.maxY=Math.max(p.maxY,A[D][Z]),p.minY=Math.min(p.minY,k[D][Z])})})}}}]),Ce}(),qe=function(){function Ce(m,p){s(this,Ce),this.ctx=m,this.elgrid=p,this.w=m.w;var N=this.w;this.xaxisFontSize=N.config.xaxis.labels.style.fontSize,this.axisFontFamily=N.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=N.config.xaxis.labels.style.colors,this.isCategoryBarHorizontal=N.config.chart.type==="bar"&&N.config.plotOptions.bar.horizontal,this.xAxisoffX=N.config.xaxis.position==="bottom"?N.globals.gridHeight:0,this.drawnLabels=[],this.axesUtils=new fe(m)}return o(Ce,[{key:"drawYaxis",value:function(m){var p=this.w,N=new U(this.ctx),A=p.config.yaxis[m].labels.style,k=A.fontSize,P=A.fontFamily,D=A.fontWeight,V=N.group({class:"apexcharts-yaxis",rel:m,transform:"translate(".concat(p.globals.translateYAxisX[m],", 0)")});if(this.axesUtils.isYAxisHidden(m))return V;var Z=N.group({class:"apexcharts-yaxis-texts-g"});V.add(Z);var ce=p.globals.yAxisScale[m].result.length-1,ue=p.globals.gridHeight/ce,me=p.globals.yLabelFormatters[m],Ne=this.axesUtils.checkForReversedLabels(m,p.globals.yAxisScale[m].result.slice());if(p.config.yaxis[m].labels.show){var Ie=p.globals.translateY+p.config.yaxis[m].labels.offsetY;p.globals.isBarHorizontal?Ie=0:p.config.chart.type==="heatmap"&&(Ie-=ue/2),Ie+=parseInt(k,10)/3;for(var Le=ce;Le>=0;Le--){var Xe=me(Ne[Le],Le,p),Oe=p.config.yaxis[m].labels.padding;p.config.yaxis[m].opposite&&p.config.yaxis.length!==0&&(Oe*=-1);var $e=this.getTextAnchor(p.config.yaxis[m].labels.align,p.config.yaxis[m].opposite),ae=this.axesUtils.getYAxisForeColor(A.colors,m),he=Array.isArray(ae)?ae[Le]:ae,Pe=F.listToArray(p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(m,"'] .apexcharts-yaxis-label tspan"))).map(function(Te){return Te.textContent}),Ve=N.drawText({x:Oe,y:Ie,text:Pe.includes(Xe)&&!p.config.yaxis[m].labels.showDuplicates?"":Xe,textAnchor:$e,fontSize:k,fontFamily:P,fontWeight:D,maxWidth:p.config.yaxis[m].labels.maxWidth,foreColor:he,isPlainText:!1,cssClass:"apexcharts-yaxis-label ".concat(A.cssClass)});Z.add(Ve),this.addTooltip(Ve,Xe),p.config.yaxis[m].labels.rotate!==0&&this.rotateLabel(N,Ve,firstLabel,p.config.yaxis[m].labels.rotate),Ie+=ue}}return this.addYAxisTitle(N,V,m),this.addAxisBorder(N,V,m,ce,ue),V}},{key:"getTextAnchor",value:function(m,p){return m==="left"?"start":m==="center"?"middle":m==="right"?"end":p?"start":"end"}},{key:"addTooltip",value:function(m,p){var N=document.createElementNS(this.w.globals.SVGNS,"title");N.textContent=Array.isArray(p)?p.join(" "):p,m.node.appendChild(N)}},{key:"rotateLabel",value:function(m,p,N,A){var k=m.rotateAroundCenter(N.node),P=m.rotateAroundCenter(p.node);p.node.setAttribute("transform","rotate(".concat(A," ").concat(k.x," ").concat(P.y,")"))}},{key:"addYAxisTitle",value:function(m,p,N){var A=this.w;if(A.config.yaxis[N].title.text!==void 0){var k=m.group({class:"apexcharts-yaxis-title"}),P=A.config.yaxis[N].opposite?A.globals.translateYAxisX[N]:0,D=m.drawText({x:P,y:A.globals.gridHeight/2+A.globals.translateY+A.config.yaxis[N].title.offsetY,text:A.config.yaxis[N].title.text,textAnchor:"end",foreColor:A.config.yaxis[N].title.style.color,fontSize:A.config.yaxis[N].title.style.fontSize,fontWeight:A.config.yaxis[N].title.style.fontWeight,fontFamily:A.config.yaxis[N].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text ".concat(A.config.yaxis[N].title.style.cssClass)});k.add(D),p.add(k)}}},{key:"addAxisBorder",value:function(m,p,N,A,k){var P=this.w,D=P.config.yaxis[N].axisBorder,V=31+D.offsetX;if(P.config.yaxis[N].opposite&&(V=-31-D.offsetX),D.show){var Z=m.drawLine(V,P.globals.translateY+D.offsetY-2,V,P.globals.gridHeight+P.globals.translateY+D.offsetY+2,D.color,0,D.width);p.add(Z)}P.config.yaxis[N].axisTicks.show&&this.axesUtils.drawYAxisTicks(V,A,D,P.config.yaxis[N].axisTicks,N,k,p)}},{key:"drawYaxisInversed",value:function(m){var p=this.w,N=new U(this.ctx),A=N.group({class:"apexcharts-xaxis apexcharts-yaxis-inversed"}),k=N.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(p.globals.translateXAxisX,", ").concat(p.globals.translateXAxisY,")")});A.add(k);var P=p.globals.yAxisScale[m].result.length-1,D=p.globals.gridWidth/P+.1,V=D+p.config.xaxis.labels.offsetX,Z=p.globals.xLabelFormatter,ce=this.axesUtils.checkForReversedLabels(m,p.globals.yAxisScale[m].result.slice()),ue=p.globals.timescaleLabels;if(ue.length>0&&(this.xaxisLabels=ue.slice(),P=(ce=ue.slice()).length),p.config.xaxis.labels.show)for(var me=ue.length?0:P;ue.length?me<ue.length:me>=0;ue.length?me++:me--){var Ne=Z(ce[me],me,p),Ie=p.globals.gridWidth+p.globals.padHorizontal-(V-D+p.config.xaxis.labels.offsetX);if(ue.length){var Le=this.axesUtils.getLabel(ce,ue,Ie,me,this.drawnLabels,this.xaxisFontSize);Ie=Le.x,Ne=Le.text,this.drawnLabels.push(Le.text),me===0&&p.globals.skipFirstTimelinelabel&&(Ne=""),me===ce.length-1&&p.globals.skipLastTimelinelabel&&(Ne="")}var Xe=N.drawText({x:Ie,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:Ne,textAnchor:"middle",foreColor:Array.isArray(this.xaxisForeColors)?this.xaxisForeColors[m]: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(Xe),Xe.tspan(Ne),this.addTooltip(Xe,Ne),V+=D}return this.inversedYAxisTitleText(A),this.inversedYAxisBorder(A),A}},{key:"inversedYAxisBorder",value:function(m){var p=this.w,N=new U(this.ctx),A=p.config.xaxis.axisBorder;if(A.show){var k=0;p.config.chart.type==="bar"&&p.globals.isXNumeric&&(k-=15);var P=N.drawLine(p.globals.padHorizontal+k+A.offsetX,this.xAxisoffX,p.globals.gridWidth,this.xAxisoffX,A.color,0,A.height);this.elgrid&&this.elgrid.elGridBorders&&p.config.grid.show?this.elgrid.elGridBorders.add(P):m.add(P)}}},{key:"inversedYAxisTitleText",value:function(m){var p=this.w,N=new U(this.ctx);if(p.config.xaxis.title.text!==void 0){var A=N.group({class:"apexcharts-xaxis-title apexcharts-yaxis-title-inversed"}),k=N.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)});A.add(k),m.add(A)}}},{key:"yAxisTitleRotate",value:function(m,p){var N=this.w,A=new U(this.ctx),k=N.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(m,"'] .apexcharts-yaxis-texts-g")),P=k?k.getBoundingClientRect():{width:0,height:0},D=N.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(m,"'] .apexcharts-yaxis-title text")),V=D?D.getBoundingClientRect():{width:0,height:0};if(D){var Z=this.xPaddingForYAxisTitle(m,P,V,p);D.setAttribute("x",Z.xPos-(p?10:0));var ce=A.rotateAroundCenter(D);D.setAttribute("transform","rotate(".concat(p?-1*N.config.yaxis[m].title.rotate:N.config.yaxis[m].title.rotate," ").concat(ce.x," ").concat(ce.y,")"))}}},{key:"xPaddingForYAxisTitle",value:function(m,p,N,A){var k=this.w,P=0,D=10;return k.config.yaxis[m].title.text===void 0||m<0?{xPos:P,padd:0}:(A?P=p.width+k.config.yaxis[m].title.offsetX+N.width/2+D/2:(P=-1*p.width+k.config.yaxis[m].title.offsetX+D/2+N.width/2,k.globals.isBarHorizontal&&(D=25,P=-1*p.width-k.config.yaxis[m].title.offsetX-D)),{xPos:P,padd:D})}},{key:"setYAxisXPosition",value:function(m,p){var N=this.w,A=0,k=0,P=18,D=1;N.config.yaxis.length>1&&(this.multipleYs=!0),N.config.yaxis.forEach(function(V,Z){var ce=N.globals.ignoreYAxisIndexes.includes(Z)||!V.show||V.floating||m[Z].width===0,ue=m[Z].width+p[Z].width;V.opposite?N.globals.isBarHorizontal?(k=N.globals.gridWidth+N.globals.translateX-1,N.globals.translateYAxisX[Z]=k-V.labels.offsetX):(k=N.globals.gridWidth+N.globals.translateX+D,ce||(D+=ue+20),N.globals.translateYAxisX[Z]=k-V.labels.offsetX+20):(A=N.globals.translateX-P,ce||(P+=ue+20),N.globals.translateYAxisX[Z]=A+V.labels.offsetX)})}},{key:"setYAxisTextAlignments",value:function(){var m=this.w;F.listToArray(m.globals.dom.baseEl.getElementsByClassName("apexcharts-yaxis")).forEach(function(p,N){var A=m.config.yaxis[N];if(A&&!A.floating&&A.labels.align!==void 0){var k=m.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(N,"'] .apexcharts-yaxis-texts-g")),P=F.listToArray(m.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(N,"'] .apexcharts-yaxis-label"))),D=k.getBoundingClientRect();P.forEach(function(V){V.setAttribute("text-anchor",A.labels.align)}),A.labels.align!=="left"||A.opposite?A.labels.align==="center"?k.setAttribute("transform","translate(".concat(D.width/2*(A.opposite?1:-1),", 0)")):A.labels.align==="right"&&A.opposite&&k.setAttribute("transform","translate(".concat(D.width,", 0)")):k.setAttribute("transform","translate(-".concat(D.width,", 0)"))}})}}]),Ce}(),vt=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.documentEvent=F.bind(this.documentEvent,this)}return o(Ce,[{key:"addEventListener",value:function(m,p){var N=this.w;N.globals.events.hasOwnProperty(m)?N.globals.events[m].push(p):N.globals.events[m]=[p]}},{key:"removeEventListener",value:function(m,p){var N=this.w;if(N.globals.events.hasOwnProperty(m)){var A=N.globals.events[m].indexOf(p);A!==-1&&N.globals.events[m].splice(A,1)}}},{key:"fireEvent",value:function(m,p){var N=this.w;if(N.globals.events.hasOwnProperty(m)){p&&p.length||(p=[]);for(var A=N.globals.events[m],k=A.length,P=0;P<k;P++)A[P].apply(null,p)}}},{key:"setupEventHandlers",value:function(){var m=this,p=this.w,N=this.ctx,A=p.globals.dom.baseEl.querySelector(p.globals.chartClass);this.ctx.eventList.forEach(function(k){A.addEventListener(k,function(P){var D=Object.assign({},p,{seriesIndex:p.globals.axisCharts?p.globals.capturedSeriesIndex:0,dataPointIndex:p.globals.capturedDataPointIndex});P.type==="mousemove"||P.type==="touchmove"?typeof p.config.chart.events.mouseMove=="function"&&p.config.chart.events.mouseMove(P,N,D):P.type==="mouseleave"||P.type==="touchleave"?typeof p.config.chart.events.mouseLeave=="function"&&p.config.chart.events.mouseLeave(P,N,D):(P.type==="mouseup"&&P.which===1||P.type==="touchend")&&(typeof p.config.chart.events.click=="function"&&p.config.chart.events.click(P,N,D),N.ctx.events.fireEvent("click",[P,N,D]))},{capture:!1,passive:!0})}),this.ctx.eventList.forEach(function(k){p.globals.dom.baseEl.addEventListener(k,m.documentEvent,{passive:!0})}),this.ctx.core.setupBrushHandler()}},{key:"documentEvent",value:function(m){var p=this.w,N=m.target.className;if(m.type==="click"){var A=p.globals.dom.baseEl.querySelector(".apexcharts-menu");A&&A.classList.contains("apexcharts-menu-open")&&N!=="apexcharts-menu-icon"&&A.classList.remove("apexcharts-menu-open")}p.globals.clientX=m.type==="touchmove"?m.touches[0].clientX:m.clientX,p.globals.clientY=m.type==="touchmove"?m.touches[0].clientY:m.clientY}}]),Ce}(),yt=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"setCurrentLocaleValues",value:function(m){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 N=p.filter(function(k){return k.name===m})[0];if(!N)throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options");var A=F.extend(oe,N);this.w.globals.locale=A.options}}]),Ce}(),Kt=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"drawAxis",value:function(m,p){var N,A,k=this,P=this.w.globals,D=this.w.config,V=new dt(this.ctx,p),Z=new qe(this.ctx,p);P.axisCharts&&m!=="radar"&&(P.isBarHorizontal?(A=Z.drawYaxisInversed(0),N=V.drawXaxisInversed(0),P.dom.elGraphical.add(N),P.dom.elGraphical.add(A)):(N=V.drawXaxis(),P.dom.elGraphical.add(N),D.yaxis.map(function(ce,ue){if(P.ignoreYAxisIndexes.indexOf(ue)===-1&&(A=Z.drawYaxis(ue),P.dom.Paper.add(A),k.w.config.grid.position==="back")){var me=P.dom.Paper.children()[1];me.remove(),P.dom.Paper.add(me)}})))}}]),Ce}(),jt=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"drawXCrosshairs",value:function(){var m=this.w,p=new U(this.ctx),N=new O(this.ctx),A=m.config.xaxis.crosshairs.fill.gradient,k=m.config.xaxis.crosshairs.dropShadow,P=m.config.xaxis.crosshairs.fill.type,D=A.colorFrom,V=A.colorTo,Z=A.opacityFrom,ce=A.opacityTo,ue=A.stops,me=k.enabled,Ne=k.left,Ie=k.top,Le=k.blur,Xe=k.color,Oe=k.opacity,$e=m.config.xaxis.crosshairs.fill.color;if(m.config.xaxis.crosshairs.show){P==="gradient"&&($e=p.drawGradient("vertical",D,V,Z,ce,null,ue,null));var ae=p.drawRect();m.config.xaxis.crosshairs.width===1&&(ae=p.drawLine());var he=m.globals.gridHeight;(!F.isNumber(he)||he<0)&&(he=0);var Pe=m.config.xaxis.crosshairs.width;(!F.isNumber(Pe)||Pe<0)&&(Pe=0),ae.attr({class:"apexcharts-xcrosshairs",x:0,y:0,y2:he,width:Pe,height:he,fill:$e,filter:"none","fill-opacity":m.config.xaxis.crosshairs.opacity,stroke:m.config.xaxis.crosshairs.stroke.color,"stroke-width":m.config.xaxis.crosshairs.stroke.width,"stroke-dasharray":m.config.xaxis.crosshairs.stroke.dashArray}),me&&(ae=N.dropShadow(ae,{left:Ne,top:Ie,blur:Le,color:Xe,opacity:Oe})),m.globals.dom.elGraphical.add(ae)}}},{key:"drawYCrosshairs",value:function(){var m=this.w,p=new U(this.ctx),N=m.config.yaxis[0].crosshairs,A=m.globals.barPadForNumericAxis;if(m.config.yaxis[0].crosshairs.show){var k=p.drawLine(-A,0,m.globals.gridWidth+A,0,N.stroke.color,N.stroke.dashArray,N.stroke.width);k.attr({class:"apexcharts-ycrosshairs"}),m.globals.dom.elGraphical.add(k)}var P=p.drawLine(-A,0,m.globals.gridWidth+A,0,N.stroke.color,0,0);P.attr({class:"apexcharts-ycrosshairs-hidden"}),m.globals.dom.elGraphical.add(P)}}]),Ce}(),un=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"checkResponsiveConfig",value:function(m){var p=this,N=this.w,A=N.config;if(A.responsive.length!==0){var k=A.responsive.slice();k.sort(function(Z,ce){return Z.breakpoint>ce.breakpoint?1:ce.breakpoint>Z.breakpoint?-1:0}).reverse();var P=new Se({}),D=function(){var Z=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 me=F.clone(N.globals.initialConfig);me.series=F.clone(N.config.series);var Ne=Y.extendArrayProps(P,me,N);Z=F.extend(Ne,Z),Z=F.extend(N.config,Z),p.overrideResponsiveOptions(Z)}else for(var Ie=0;Ie<k.length;Ie++)ue<k[Ie].breakpoint&&(Z=Y.extendArrayProps(P,k[Ie].options,N),Z=F.extend(N.config,Z),p.overrideResponsiveOptions(Z))};if(m){var V=Y.extendArrayProps(P,m,N);V=F.extend(N.config,V),D(V=F.extend(V,m))}else D({})}}},{key:"overrideResponsiveOptions",value:function(m){var p=new Se(m).init({responsiveOverride:!0});this.w.config=p}}]),Ce}(),vn=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.colors=[],this.isColorFn=!1,this.isHeatmapDistributed=this.checkHeatmapDistributed(),this.isBarDistributed=this.checkBarDistributed()}return o(Ce,[{key:"checkHeatmapDistributed",value:function(){var m=this.w.config,p=m.chart,N=m.plotOptions;return p.type==="treemap"&&N.treemap&&N.treemap.distributed||p.type==="heatmap"&&N.heatmap&&N.heatmap.distributed}},{key:"checkBarDistributed",value:function(){var m=this.w.config,p=m.chart,N=m.plotOptions;return N.bar&&N.bar.distributed&&(p.type==="bar"||p.type==="rangeBar")}},{key:"init",value:function(){this.setDefaultColors()}},{key:"setDefaultColors",value:function(){var m=this.w,p=new F;m.globals.dom.elWrap.classList.add("apexcharts-theme-".concat(m.config.theme.mode));var N=S(m.config.colors||m.config.fill.colors||[]);m.globals.colors=this.getColors(N),this.applySeriesColors(m.globals.seriesColors,m.globals.colors),m.config.theme.monochrome.enabled&&(m.globals.colors=this.getMonochromeColors(m.config.theme.monochrome,m.globals.series,p));var A=m.globals.colors.slice();this.pushExtraColors(m.globals.colors),this.applyColorTypes(["fill","stroke"],A),this.applyDataLabelsColors(A),this.applyRadarPolygonsColors(),this.applyMarkersColors(A)}},{key:"getColors",value:function(m){var p=this,N=this.w;return m&&m.length!==0?Array.isArray(m)&&m.length>0&&typeof m[0]=="function"?(this.isColorFn=!0,N.config.series.map(function(A,k){var P=m[k]||m[0];return typeof P=="function"?P({value:N.globals.axisCharts?N.globals.series[k][0]||0:N.globals.series[k],seriesIndex:k,dataPointIndex:k,w:p.w}):P})):m:this.predefined()}},{key:"applySeriesColors",value:function(m,p){m.forEach(function(N,A){N&&(p[A]=N)})}},{key:"getMonochromeColors",value:function(m,p,N){var A=m.color,k=m.shadeIntensity,P=m.shadeTo,D=this.isBarDistributed||this.isHeatmapDistributed?p[0].length*p.length:p.length,V=1/(D/k),Z=0;return Array.from({length:D},function(){var ce=P==="dark"?N.shadeColor(-1*Z,A):N.shadeColor(Z,A);return Z+=V,ce})}},{key:"applyColorTypes",value:function(m,p){var N=this,A=this.w;m.forEach(function(k){A.globals[k].colors=A.config[k].colors===void 0?N.isColorFn?A.config.colors:p:A.config[k].colors.slice(),N.pushExtraColors(A.globals[k].colors)})}},{key:"applyDataLabelsColors",value:function(m){var p=this.w;p.globals.dataLabels.style.colors=p.config.dataLabels.style.colors===void 0?m:p.config.dataLabels.style.colors.slice(),this.pushExtraColors(p.globals.dataLabels.style.colors,50)}},{key:"applyRadarPolygonsColors",value:function(){var m=this.w;m.globals.radarPolygons.fill.colors=m.config.plotOptions.radar.polygons.fill.colors===void 0?[m.config.theme.mode==="dark"?"#424242":"none"]:m.config.plotOptions.radar.polygons.fill.colors.slice(),this.pushExtraColors(m.globals.radarPolygons.fill.colors,20)}},{key:"applyMarkersColors",value:function(m){var p=this.w;p.globals.markers.colors=p.config.markers.colors===void 0?m:p.config.markers.colors.slice(),this.pushExtraColors(p.globals.markers.colors)}},{key:"pushExtraColors",value:function(m,p){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,A=this.w,k=p||A.globals.series.length;if(N===null&&(N=this.isBarDistributed||this.isHeatmapDistributed||A.config.chart.type==="heatmap"&&A.config.plotOptions.heatmap&&A.config.plotOptions.heatmap.colorScale.inverse),N&&A.globals.series.length&&(k=A.globals.series[A.globals.maxValsInArrayIndex].length*A.globals.series.length),m.length<k)for(var P=k-m.length,D=0;D<P;D++)m.push(m[D])}},{key:"updateThemeOptions",value:function(m){m.chart=m.chart||{},m.tooltip=m.tooltip||{};var p=m.theme.mode,N=p==="dark"?"palette4":p==="light"?"palette1":m.theme.palette||"palette1",A=p==="dark"?"#f6f7f8":p==="light"?"#373d3f":m.chart.foreColor||"#373d3f";return m.tooltip.theme=p||"light",m.chart.foreColor=A,m.theme.palette=N,m}},{key:"predefined",value:function(){var m={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 m[this.w.config.theme.palette]||m.default}}]),Ce}(),Hn=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"draw",value:function(){this.drawTitleSubtitle("title"),this.drawTitleSubtitle("subtitle")}},{key:"drawTitleSubtitle",value:function(m){var p=this.w,N=m==="title"?p.config.title:p.config.subtitle,A=p.globals.svgWidth/2,k=N.offsetY,P="middle";if(N.align==="left"?(A=10,P="start"):N.align==="right"&&(A=p.globals.svgWidth-10,P="end"),A+=N.offsetX,k=k+parseInt(N.style.fontSize,10)+N.margin/2,N.text!==void 0){var D=new U(this.ctx).drawText({x:A,y:k,text:N.text,textAnchor:P,fontSize:N.style.fontSize,fontFamily:N.style.fontFamily,fontWeight:N.style.fontWeight,foreColor:N.style.color,opacity:1});D.node.setAttribute("class","apexcharts-".concat(m,"-text")),p.globals.dom.Paper.add(D)}}}]),Ce}(),ln=function(){function Ce(m){s(this,Ce),this.w=m.w,this.dCtx=m}return o(Ce,[{key:"getTitleSubtitleCoords",value:function(m){var p=this.w,N=0,A=0,k=m==="title"?p.config.title.floating:p.config.subtitle.floating,P=p.globals.dom.baseEl.querySelector(".apexcharts-".concat(m,"-text"));if(P!==null&&!k){var D=P.getBoundingClientRect();N=D.width,A=p.globals.axisCharts?D.height+5:D.height}return{width:N,height:A}}},{key:"getLegendsRect",value:function(){var m=this.w,p=m.globals.dom.elLegendWrap;m.config.legend.height||m.config.legend.position!=="top"&&m.config.legend.position!=="bottom"||(p.style.maxHeight=m.globals.svgHeight/2+"px");var N=Object.assign({},F.getBoundingClientRect(p));return p!==null&&!m.config.legend.floating&&m.config.legend.show?this.dCtx.lgRect={x:N.x,y:N.y,height:N.height,width:N.height===0?0:N.width}:this.dCtx.lgRect={x:0,y:0,height:0,width:0},m.config.legend.position!=="left"&&m.config.legend.position!=="right"||1.5*this.dCtx.lgRect.width>m.globals.svgWidth&&(this.dCtx.lgRect.width=m.globals.svgWidth/1.5),this.dCtx.lgRect}},{key:"getDatalabelsRect",value:function(){var m=this,p=this.w,N=[];p.config.series.forEach(function(V,Z){V.data.forEach(function(ce,ue){var me;me=p.globals.series[Z][ue],A=p.config.dataLabels.formatter(me,{ctx:m.dCtx.ctx,seriesIndex:Z,dataPointIndex:ue,w:p}),N.push(A)})});var A=F.getLargestStringFromArr(N),k=new U(this.dCtx.ctx),P=p.config.dataLabels.style,D=k.getTextRects(A,parseInt(P.fontSize),P.fontFamily);return{width:1.05*D.width,height:D.height}}},{key:"getLargestStringFromMultiArr",value:function(m,p){var N=m;if(this.w.globals.isMultiLineX){var A=p.map(function(P,D){return Array.isArray(P)?P.length:1}),k=Math.max.apply(Math,S(A));N=p[A.indexOf(k)]}return N}}]),Ce}(),Nn=function(){function Ce(m){s(this,Ce),this.w=m.w,this.dCtx=m}return o(Ce,[{key:"getxAxisLabelsCoords",value:function(){var m,p=this.w,N=p.globals.labels.slice();if(p.config.xaxis.convertedCatToNumeric&&N.length===0&&(N=p.globals.categoryLabels),p.globals.timescaleLabels.length>0){var A=this.getxAxisTimeScaleLabelsCoords();m={width:A.width,height:A.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,P=F.getLargestStringFromArr(N),D=this.dCtx.dimHelpers.getLargestStringFromMultiArr(P,N);p.globals.isBarHorizontal&&(D=P=p.globals.yAxisScale[0].result.reduce(function(Ie,Le){return Ie.length>Le.length?Ie:Le},0));var V=new te(this.dCtx.ctx),Z=P;P=V.xLabelFormat(k,P,Z,{i:void 0,dateFormatter:new q(this.dCtx.ctx).formatDate,w:p}),D=V.xLabelFormat(k,D,Z,{i:void 0,dateFormatter:new q(this.dCtx.ctx).formatDate,w:p}),(p.config.xaxis.convertedCatToNumeric&&P===void 0||String(P).trim()==="")&&(D=P="1");var ce=new U(this.dCtx.ctx),ue=ce.getTextRects(P,p.config.xaxis.labels.style.fontSize),me=ue;if(P!==D&&(me=ce.getTextRects(D,p.config.xaxis.labels.style.fontSize)),(m={width:ue.width>=me.width?ue.width:me.width,height:ue.height>=me.height?ue.height:me.height}).width*N.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 Ne=function(Ie){return ce.getTextRects(Ie,p.config.xaxis.labels.style.fontSize,p.config.xaxis.labels.style.fontFamily,"rotate(".concat(p.config.xaxis.labels.rotate," 0 0)"),!1)};ue=Ne(P),P!==D&&(me=Ne(D)),m.height=(ue.height>me.height?ue.height:me.height)/1.5,m.width=ue.width>me.width?ue.width:me.width}}else p.globals.rotateXLabels=!1}return p.config.xaxis.labels.show||(m={width:0,height:0}),{width:m.width,height:m.height}}},{key:"getxAxisGroupLabelsCoords",value:function(){var m,p=this.w;if(!p.globals.hasXaxisGroups)return{width:0,height:0};var N,A=((m=p.config.xaxis.group.style)===null||m===void 0?void 0:m.fontSize)||p.config.xaxis.labels.style.fontSize,k=p.globals.groups.map(function(ue){return ue.title}),P=F.getLargestStringFromArr(k),D=this.dCtx.dimHelpers.getLargestStringFromMultiArr(P,k),V=new U(this.dCtx.ctx),Z=V.getTextRects(P,A),ce=Z;return P!==D&&(ce=V.getTextRects(D,A)),N={width:Z.width>=ce.width?Z.width:ce.width,height:Z.height>=ce.height?Z.height:ce.height},p.config.xaxis.labels.show||(N={width:0,height:0}),{width:N.width,height:N.height}}},{key:"getxAxisTitleCoords",value:function(){var m=this.w,p=0,N=0;if(m.config.xaxis.title.text!==void 0){var A=new U(this.dCtx.ctx).getTextRects(m.config.xaxis.title.text,m.config.xaxis.title.style.fontSize);p=A.width,N=A.height}return{width:p,height:N}}},{key:"getxAxisTimeScaleLabelsCoords",value:function(){var m,p=this.w;this.dCtx.timescaleLabels=p.globals.timescaleLabels.slice();var N=this.dCtx.timescaleLabels.map(function(k){return k.value}),A=N.reduce(function(k,P){return k===void 0?(console.error("You have possibly supplied invalid Date format. Please supply a valid JavaScript Date"),0):k.length>P.length?k:P},0);return 1.05*(m=new U(this.dCtx.ctx).getTextRects(A,p.config.xaxis.labels.style.fontSize)).width*N.length>p.globals.gridWidth&&p.config.xaxis.labels.rotate!==0&&(p.globals.overlappingXLabels=!0),m}},{key:"additionalPaddingXLabels",value:function(m){var p=this,N=this.w,A=N.globals,k=N.config,P=k.xaxis.type,D=m.width;A.skipLastTimelinelabel=!1,A.skipFirstTimelinelabel=!1;var V=N.config.yaxis[0].opposite&&N.globals.isBarHorizontal,Z=function(ce,ue){k.yaxis.length>1&&function(me){return A.collapsedSeriesIndices.indexOf(me)!==-1}(ue)||function(me){if(p.dCtx.timescaleLabels&&p.dCtx.timescaleLabels.length){var Ne=p.dCtx.timescaleLabels[0],Ie=p.dCtx.timescaleLabels[p.dCtx.timescaleLabels.length-1].position+D/1.75-p.dCtx.yAxisWidthRight,Le=Ne.position-D/1.75+p.dCtx.yAxisWidthLeft,Xe=N.config.legend.position==="right"&&p.dCtx.lgRect.width>0?p.dCtx.lgRect.width:0;Ie>A.svgWidth-A.translateX-Xe&&(A.skipLastTimelinelabel=!0),Le<-(me.show&&!me.floating||k.chart.type!=="bar"&&k.chart.type!=="candlestick"&&k.chart.type!=="rangeBar"&&k.chart.type!=="boxPlot"?10:D/1.75)&&(A.skipFirstTimelinelabel=!0)}else P==="datetime"?p.dCtx.gridPad.right<D&&!A.rotateXLabels&&(A.skipLastTimelinelabel=!0):P!=="datetime"&&p.dCtx.gridPad.right<D/2-p.dCtx.yAxisWidthRight&&!A.rotateXLabels&&!N.config.xaxis.labels.trim&&(p.dCtx.xPadRight=D/2+1)}(ce)};k.yaxis.forEach(function(ce,ue){V?(p.dCtx.gridPad.left<D&&(p.dCtx.xPadLeft=D/2+1),p.dCtx.xPadRight=D/2+1):Z(ce,ue)})}}]),Ce}(),dn=function(){function Ce(m){s(this,Ce),this.w=m.w,this.dCtx=m}return o(Ce,[{key:"getyAxisLabelsCoords",value:function(){var m=this,p=this.w,N=[],A=10,k=new fe(this.dCtx.ctx);return p.config.yaxis.map(function(P,D){var V={seriesIndex:D,dataPointIndex:-1,w:p},Z=p.globals.yAxisScale[D],ce=0;if(!k.isYAxisHidden(D)&&P.labels.show&&P.labels.minWidth!==void 0&&(ce=P.labels.minWidth),!k.isYAxisHidden(D)&&P.labels.show&&Z.result.length){var ue=p.globals.yLabelFormatters[D],me=Z.niceMin===Number.MIN_VALUE?0:Z.niceMin,Ne=Z.result.reduce(function(he,Pe){var Ve,Te;return((Ve=String(ue(he,V)))===null||Ve===void 0?void 0:Ve.length)>((Te=String(ue(Pe,V)))===null||Te===void 0?void 0:Te.length)?he:Pe},me),Ie=Ne=ue(Ne,V);if(Ne!==void 0&&Ne.length!==0||(Ne=Z.niceMax),p.globals.isBarHorizontal){A=0;var Le=p.globals.labels.slice();Ne=F.getLargestStringFromArr(Le),Ne=ue(Ne,{seriesIndex:D,dataPointIndex:-1,w:p}),Ie=m.dCtx.dimHelpers.getLargestStringFromMultiArr(Ne,Le)}var Xe=new U(m.dCtx.ctx),Oe="rotate(".concat(P.labels.rotate," 0 0)"),$e=Xe.getTextRects(Ne,P.labels.style.fontSize,P.labels.style.fontFamily,Oe,!1),ae=$e;Ne!==Ie&&(ae=Xe.getTextRects(Ie,P.labels.style.fontSize,P.labels.style.fontFamily,Oe,!1)),N.push({width:(ce>ae.width||ce>$e.width?ce:ae.width>$e.width?ae.width:$e.width)+A,height:ae.height>$e.height?ae.height:$e.height})}else N.push({width:0,height:0})}),N}},{key:"getyAxisTitleCoords",value:function(){var m=this,p=this.w,N=[];return p.config.yaxis.map(function(A,k){if(A.show&&A.title.text!==void 0){var P=new U(m.dCtx.ctx),D="rotate(".concat(A.title.rotate," 0 0)"),V=P.getTextRects(A.title.text,A.title.style.fontSize,A.title.style.fontFamily,D,!1);N.push({width:V.width,height:V.height})}else N.push({width:0,height:0})}),N}},{key:"getTotalYAxisWidth",value:function(){var m=this.w,p=0,N=0,A=0,k=m.globals.yAxisScale.length>1?10:0,P=new fe(this.dCtx.ctx),D=function(V,Z){var ce=m.config.yaxis[Z].floating,ue=0;V.width>0&&!ce?(ue=V.width+k,function(me){return m.globals.ignoreYAxisIndexes.indexOf(me)>-1}(Z)&&(ue=ue-V.width-k)):ue=ce||P.isYAxisHidden(Z)?0:5,m.config.yaxis[Z].opposite?A+=ue:N+=ue,p+=ue};return m.globals.yLabelsCoords.map(function(V,Z){D(V,Z)}),m.globals.yTitleCoords.map(function(V,Z){D(V,Z)}),m.globals.isBarHorizontal&&!m.config.yaxis[0].floating&&(p=m.globals.yLabelsCoords[0].width+m.globals.yTitleCoords[0].width+15),this.dCtx.yAxisWidthLeft=N,this.dCtx.yAxisWidthRight=A,p}}]),Ce}(),rt=function(){function Ce(m){s(this,Ce),this.w=m.w,this.dCtx=m}return o(Ce,[{key:"gridPadForColumnsInNumericAxis",value:function(m){var p=this.w,N=p.config,A=p.globals;if(A.noData||A.collapsedSeries.length+A.ancillaryCollapsedSeries.length===N.series.length)return 0;var k=function(Ne){return["bar","rangeBar","candlestick","boxPlot"].includes(Ne)},P=N.chart.type,D=0,V=k(P)?N.series.length:1;A.comboBarCount>0&&(V=A.comboBarCount),A.collapsedSeries.forEach(function(Ne){k(Ne.type)&&(V-=1)}),N.chart.stacked&&(V=1);var Z=k(P)||A.comboBarCount>0,ce=Math.abs(A.initialMaxX-A.initialMinX);if(Z&&A.isXNumeric&&!A.isBarHorizontal&&V>0&&ce!==0){ce<=3&&(ce=A.dataPoints);var ue=ce/m,me=A.minXDiff&&A.minXDiff/ue>0?A.minXDiff/ue:0;me>m/2&&(me/=2),(D=me*parseInt(N.plotOptions.bar.columnWidth,10)/100)<1&&(D=1),A.barPadForNumericAxis=D}return D}},{key:"gridPadFortitleSubtitle",value:function(){var m=this,p=this.w,N=p.globals,A=this.dCtx.isSparkline||!N.axisCharts?0:10;["title","subtitle"].forEach(function(D){p.config[D].text!==void 0?A+=p.config[D].margin:A+=m.dCtx.isSparkline||!N.axisCharts?0:5}),!p.config.legend.show||p.config.legend.position!=="bottom"||p.config.legend.floating||N.axisCharts||(A+=10);var k=this.dCtx.dimHelpers.getTitleSubtitleCoords("title"),P=this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle");N.gridHeight-=k.height+P.height+A,N.translateY+=k.height+P.height+A}},{key:"setGridXPosForDualYAxis",value:function(m,p){var N=this.w,A=new fe(this.dCtx.ctx);N.config.yaxis.forEach(function(k,P){N.globals.ignoreYAxisIndexes.indexOf(P)!==-1||k.floating||A.isYAxisHidden(P)||(k.opposite&&(N.globals.translateX-=p[P].width+m[P].width+parseInt(k.labels.style.fontSize,10)/1.2+12),N.globals.translateX<2&&(N.globals.translateX=2))})}}]),Ce}(),nt=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.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 ln(this),this.dimYAxis=new dn(this),this.dimXAxis=new Nn(this),this.dimGrid=new rt(this),this.lgWidthForSideLegends=0,this.gridPad=this.w.config.grid.padding,this.xPadRight=0,this.xPadLeft=0}return o(Ce,[{key:"plotCoords",value:function(){var m=this,p=this.w,N=p.globals;this.lgRect=this.dimHelpers.getLegendsRect(),this.datalabelsCoords={width:0,height:0};var A=Array.isArray(p.config.stroke.width)?Math.max.apply(Math,S(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(P){var D=C(P,2),V=D[0],Z=D[1];m.gridPad[V]=Math.max(Z,m.w.globals.markers.largestSize/1.5)}),this.gridPad.top=Math.max(A/2,this.gridPad.top),this.gridPad.bottom=Math.max(A/2,this.gridPad.bottom)),N.axisCharts?this.setDimensionsForAxisCharts():this.setDimensionsForNonAxisCharts(),this.dimGrid.gridPadFortitleSubtitle(),N.gridHeight=N.gridHeight-this.gridPad.top-this.gridPad.bottom,N.gridWidth=N.gridWidth-this.gridPad.left-this.gridPad.right-this.xPadRight-this.xPadLeft;var k=this.dimGrid.gridPadForColumnsInNumericAxis(N.gridWidth);N.gridWidth=N.gridWidth-2*k,N.translateX=N.translateX+this.gridPad.left+this.xPadLeft+(k>0?k:0),N.translateY=N.translateY+this.gridPad.top}},{key:"setDimensionsForAxisCharts",value:function(){var m=this,p=this.w,N=p.globals,A=this.dimYAxis.getyAxisLabelsCoords(),k=this.dimYAxis.getyAxisTitleCoords();N.isSlopeChart&&(this.datalabelsCoords=this.dimHelpers.getDatalabelsRect()),p.globals.yLabelsCoords=[],p.globals.yTitleCoords=[],p.config.yaxis.map(function(Ne,Ie){p.globals.yLabelsCoords.push({width:A[Ie].width,index:Ie}),p.globals.yTitleCoords.push({width:k[Ie].width,index:Ie})}),this.yAxisWidth=this.dimYAxis.getTotalYAxisWidth();var P=this.dimXAxis.getxAxisLabelsCoords(),D=this.dimXAxis.getxAxisGroupLabelsCoords(),V=this.dimXAxis.getxAxisTitleCoords();this.conditionalChecksForAxisCoords(P,V,D),N.translateXAxisY=p.globals.rotateXLabels?this.xAxisHeight/8:-4,N.translateXAxisX=p.globals.rotateXLabels&&p.globals.isXNumeric&&p.config.xaxis.labels.rotate<=-45?-this.xAxisWidth/4:0,p.globals.isBarHorizontal&&(N.rotateXLabels=!1,N.translateXAxisY=parseInt(p.config.xaxis.labels.style.fontSize,10)/1.5*-1),N.translateXAxisY=N.translateXAxisY+p.config.xaxis.labels.offsetY,N.translateXAxisX=N.translateXAxisX+p.config.xaxis.labels.offsetX;var Z=this.yAxisWidth,ce=this.xAxisHeight;N.xAxisLabelsHeight=this.xAxisHeight-V.height,N.xAxisGroupLabelsHeight=N.xAxisLabelsHeight-P.height,N.xAxisLabelsWidth=this.xAxisWidth,N.xAxisHeight=this.xAxisHeight;var ue=10;(p.config.chart.type==="radar"||this.isSparkline)&&(Z=0,ce=0),this.isSparkline&&(this.lgRect={height:0,width:0}),(this.isSparkline||p.config.chart.type==="treemap")&&(Z=0,ce=0,ue=0),this.isSparkline||p.config.chart.type==="treemap"||this.dimXAxis.additionalPaddingXLabels(P);var me=function(){N.translateX=Z+m.datalabelsCoords.width,N.gridHeight=N.svgHeight-m.lgRect.height-ce-(m.isSparkline||p.config.chart.type==="treemap"?0:p.globals.rotateXLabels?10:15),N.gridWidth=N.svgWidth-Z-2*m.datalabelsCoords.width};switch(p.config.xaxis.position==="top"&&(ue=N.xAxisHeight-p.config.xaxis.axisTicks.height-5),p.config.legend.position){case"bottom":N.translateY=ue,me();break;case"top":N.translateY=this.lgRect.height+ue,me();break;case"left":N.translateY=ue,N.translateX=this.lgRect.width+Z+this.datalabelsCoords.width,N.gridHeight=N.svgHeight-ce-12,N.gridWidth=N.svgWidth-this.lgRect.width-Z-2*this.datalabelsCoords.width;break;case"right":N.translateY=ue,N.translateX=Z+this.datalabelsCoords.width,N.gridHeight=N.svgHeight-ce-12,N.gridWidth=N.svgWidth-this.lgRect.width-Z-2*this.datalabelsCoords.width-5;break;default:throw new Error("Legend position not supported")}this.dimGrid.setGridXPosForDualYAxis(k,A),new qe(this.ctx).setYAxisXPosition(A,k)}},{key:"setDimensionsForNonAxisCharts",value:function(){var m=this.w,p=m.globals,N=m.config,A=0;m.config.legend.show&&!m.config.legend.floating&&(A=20);var k=N.chart.type==="pie"||N.chart.type==="polarArea"||N.chart.type==="donut"?"pie":"radialBar",P=N.plotOptions[k].offsetY,D=N.plotOptions[k].offsetX;if(!N.legend.show||N.legend.floating){p.gridHeight=p.svgHeight;var V=p.dom.elWrap.getBoundingClientRect().width;return p.gridWidth=Math.min(V,p.gridHeight),p.translateY=P,void(p.translateX=D+(p.svgWidth-p.gridWidth)/2)}switch(N.legend.position){case"bottom":p.gridHeight=p.svgHeight-this.lgRect.height,p.gridWidth=p.svgWidth,p.translateY=P-10,p.translateX=D+(p.svgWidth-p.gridWidth)/2;break;case"top":p.gridHeight=p.svgHeight-this.lgRect.height,p.gridWidth=p.svgWidth,p.translateY=this.lgRect.height+P+10,p.translateX=D+(p.svgWidth-p.gridWidth)/2;break;case"left":p.gridWidth=p.svgWidth-this.lgRect.width-A,p.gridHeight=N.chart.height!=="auto"?p.svgHeight:p.gridWidth,p.translateY=P,p.translateX=D+this.lgRect.width+A;break;case"right":p.gridWidth=p.svgWidth-this.lgRect.width-A-5,p.gridHeight=N.chart.height!=="auto"?p.svgHeight:p.gridWidth,p.translateY=P,p.translateX=D+10;break;default:throw new Error("Legend position not supported")}}},{key:"conditionalChecksForAxisCoords",value:function(m,p,N){var A=this.w,k=A.globals.hasXaxisGroups?2:1,P=N.height+m.height+p.height,D=A.globals.isMultiLineX?1.2:A.globals.LINE_HEIGHT_RATIO,V=A.globals.rotateXLabels?22:10,Z=A.globals.rotateXLabels&&A.config.legend.position==="bottom"?10:0;this.xAxisHeight=P*D+k*V+Z,this.xAxisWidth=m.width,this.xAxisHeight-p.height>A.config.xaxis.labels.maxHeight&&(this.xAxisHeight=A.config.xaxis.labels.maxHeight),A.config.xaxis.labels.minHeight&&this.xAxisHeight<A.config.xaxis.labels.minHeight&&(this.xAxisHeight=A.config.xaxis.labels.minHeight),A.config.xaxis.floating&&(this.xAxisHeight=0);var ce=0,ue=0;A.config.yaxis.forEach(function(me){ce+=me.labels.minWidth,ue+=me.labels.maxWidth}),this.yAxisWidth<ce&&(this.yAxisWidth=ce),this.yAxisWidth>ue&&(this.yAxisWidth=ue)}}]),Ce}(),Ut=function(){function Ce(m){s(this,Ce),this.w=m.w,this.lgCtx=m}return o(Ce,[{key:"getLegendStyles",value:function(){var m,p,N,A=document.createElement("style");A.setAttribute("type","text/css");var k=((m=this.lgCtx.ctx)===null||m===void 0||(p=m.opts)===null||p===void 0||(N=p.chart)===null||N===void 0?void 0:N.nonce)||this.w.config.chart.nonce;k&&A.setAttribute("nonce",k);var P=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 A.appendChild(P),A}},{key:"getLegendDimensions",value:function(){var m=this.w.globals.dom.baseEl.querySelector(".apexcharts-legend").getBoundingClientRect(),p=m.width;return{clwh:m.height,clww:p}}},{key:"appendToForeignObject",value:function(){this.w.globals.dom.elLegendForeign.appendChild(this.getLegendStyles())}},{key:"toggleDataSeries",value:function(m,p){var N=this,A=this.w;if(A.globals.axisCharts||A.config.chart.type==="radialBar"){A.globals.resized=!0;var k=null,P=null;A.globals.risingSeries=[],A.globals.axisCharts?(k=A.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(m,"']")),P=parseInt(k.getAttribute("data:realIndex"),10)):(k=A.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(m+1,"']")),P=parseInt(k.getAttribute("rel"),10)-1),p?[{cs:A.globals.collapsedSeries,csi:A.globals.collapsedSeriesIndices},{cs:A.globals.ancillaryCollapsedSeries,csi:A.globals.ancillaryCollapsedSeriesIndices}].forEach(function(ce){N.riseCollapsedSeries(ce.cs,ce.csi,P)}):this.hideSeries({seriesEl:k,realIndex:P})}else{var D=A.globals.dom.Paper.select(" .apexcharts-series[rel='".concat(m+1,"'] path")),V=A.config.chart.type;if(V==="pie"||V==="polarArea"||V==="donut"){var Z=A.config.plotOptions.pie.donut.labels;new U(this.lgCtx.ctx).pathMouseDown(D.members[0],null),this.lgCtx.ctx.pie.printDataLabelsInner(D.members[0].node,Z)}D.fire("click")}}},{key:"getSeriesAfterCollapsing",value:function(m){var p=m.realIndex,N=this.w,A=N.globals,k=F.clone(N.config.series);if(A.axisCharts){var P=N.config.yaxis[A.seriesYAxisReverseMap[p]],D={index:p,data:k[p].data.slice(),type:k[p].type||N.config.chart.type};if(P&&P.show&&P.showAlways)A.ancillaryCollapsedSeriesIndices.indexOf(p)<0&&(A.ancillaryCollapsedSeries.push(D),A.ancillaryCollapsedSeriesIndices.push(p));else if(A.collapsedSeriesIndices.indexOf(p)<0){A.collapsedSeries.push(D),A.collapsedSeriesIndices.push(p);var V=A.risingSeries.indexOf(p);A.risingSeries.splice(V,1)}}else A.collapsedSeries.push({index:p,data:k[p]}),A.collapsedSeriesIndices.push(p);return A.allSeriesCollapsed=A.collapsedSeries.length+A.ancillaryCollapsedSeries.length===N.config.series.length,this._getSeriesBasedOnCollapsedState(k)}},{key:"hideSeries",value:function(m){for(var p=m.seriesEl,N=m.realIndex,A=this.w,k=this.getSeriesAfterCollapsing({realIndex:N}),P=p.childNodes,D=0;D<P.length;D++)P[D].classList.contains("apexcharts-series-markers-wrap")&&(P[D].classList.contains("apexcharts-hide")?P[D].classList.remove("apexcharts-hide"):P[D].classList.add("apexcharts-hide"));this.lgCtx.ctx.updateHelpers._updateSeries(k,A.config.chart.animations.dynamicAnimation.enabled)}},{key:"riseCollapsedSeries",value:function(m,p,N){var A=this.w,k=F.clone(A.config.series);if(m.length>0){for(var P=0;P<m.length;P++)m[P].index===N&&(A.globals.axisCharts?k[N].data=m[P].data.slice():k[N]=m[P].data,k[N].hidden=!1,m.splice(P,1),p.splice(P,1),A.globals.risingSeries.push(N));k=this._getSeriesBasedOnCollapsedState(k),this.lgCtx.ctx.updateHelpers._updateSeries(k,A.config.chart.animations.dynamicAnimation.enabled)}}},{key:"_getSeriesBasedOnCollapsedState",value:function(m){var p=this.w,N=0;return p.globals.axisCharts?m.forEach(function(A,k){p.globals.collapsedSeriesIndices.indexOf(k)<0&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(k)<0||(m[k].data=[],N++)}):m.forEach(function(A,k){!p.globals.collapsedSeriesIndices.indexOf(k)<0&&(m[k]=0,N++)}),p.globals.allSeriesCollapsed=N===m.length,m}}]),Ce}(),wn=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.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 Ut(this)}return o(Ce,[{key:"init",value:function(){var m=this.w,p=m.globals,N=m.config,A=N.legend.showForSingleSeries&&p.series.length===1||this.isBarsDistributed||p.series.length>1;if(this.legendHelpers.appendToForeignObject(),(A||!p.axisCharts)&&N.legend.show){for(;p.dom.elLegendWrap.firstChild;)p.dom.elLegendWrap.removeChild(p.dom.elLegendWrap.firstChild);this.drawLegends(),N.legend.position==="bottom"||N.legend.position==="top"?this.legendAlignHorizontal():N.legend.position!=="right"&&N.legend.position!=="left"||this.legendAlignVertical()}}},{key:"createLegendMarker",value:function(m){var p=m.i,N=m.fillcolor,A=this.w,k=document.createElement("span");k.classList.add("apexcharts-legend-marker");var P=A.config.legend.markers.shape||A.config.markers.shape,D=P;Array.isArray(P)&&(D=P[p]);var V=Array.isArray(A.config.legend.markers.size)?parseFloat(A.config.legend.markers.size[p]):parseFloat(A.config.legend.markers.size),Z=Array.isArray(A.config.legend.markers.offsetX)?parseFloat(A.config.legend.markers.offsetX[p]):parseFloat(A.config.legend.markers.offsetX),ce=Array.isArray(A.config.legend.markers.offsetY)?parseFloat(A.config.legend.markers.offsetY[p]):parseFloat(A.config.legend.markers.offsetY),ue=Array.isArray(A.config.legend.markers.strokeWidth)?parseFloat(A.config.legend.markers.strokeWidth[p]):parseFloat(A.config.legend.markers.strokeWidth),me=k.style;if(me.height=2*(V+ue)+"px",me.width=2*(V+ue)+"px",me.left=Z+"px",me.top=ce+"px",A.config.legend.markers.customHTML)me.background="transparent",me.color=N[p],Array.isArray(A.config.legend.markers.customHTML)?A.config.legend.markers.customHTML[p]&&(k.innerHTML=A.config.legend.markers.customHTML[p]()):k.innerHTML=A.config.legend.markers.customHTML();else{var Ne=new we(this.ctx).getMarkerConfig({cssClass:"apexcharts-legend-marker apexcharts-marker apexcharts-marker-".concat(D),seriesIndex:p,strokeWidth:ue,size:V}),Ie=SVG(k).size("100%","100%"),Le=new U(this.ctx).drawMarker(0,0,y(y({},Ne),{},{pointFillColor:Array.isArray(N)?N[p]:Ne.pointFillColor,shape:D}));SVG.select(".apexcharts-legend-marker.apexcharts-marker").members.forEach(function(Xe){Xe.node.classList.contains("apexcharts-marker-triangle")?Xe.node.style.transform="translate(50%, 45%)":Xe.node.style.transform="translate(50%, 50%)"}),Ie.add(Le)}return k}},{key:"drawLegends",value:function(){var m=this,p=this.w,N=p.config.legend.fontFamily,A=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 P=p.config.plotOptions.heatmap.colorScale.ranges;A=P.map(function(Pe){return Pe.name?Pe.name:Pe.from+" - "+Pe.to}),k=P.map(function(Pe){return Pe.color})}else this.isBarsDistributed&&(A=p.globals.labels.slice());p.config.legend.customLegendItems.length&&(A=p.config.legend.customLegendItems);for(var D=p.globals.legendFormatter,V=p.config.legend.inverseOrder,Z=V?A.length-1:0;V?Z>=0:Z<=A.length-1;V?Z--:Z++){var ce,ue=D(A[Z],{seriesIndex:Z,w:p}),me=!1,Ne=!1;if(p.globals.collapsedSeries.length>0)for(var Ie=0;Ie<p.globals.collapsedSeries.length;Ie++)p.globals.collapsedSeries[Ie].index===Z&&(me=!0);if(p.globals.ancillaryCollapsedSeriesIndices.length>0)for(var Le=0;Le<p.globals.ancillaryCollapsedSeriesIndices.length;Le++)p.globals.ancillaryCollapsedSeriesIndices[Le]===Z&&(Ne=!0);var Xe=this.createLegendMarker({i:Z,fillcolor:k});U.setAttrs(Xe,{rel:Z+1,"data:collapsed":me||Ne}),(me||Ne)&&Xe.classList.add("apexcharts-inactive-legend");var Oe=document.createElement("div"),$e=document.createElement("span");$e.classList.add("apexcharts-legend-text"),$e.innerHTML=Array.isArray(ue)?ue.join(" "):ue;var ae=p.config.legend.labels.useSeriesColors?p.globals.colors[Z]:Array.isArray(p.config.legend.labels.colors)?(ce=p.config.legend.labels.colors)===null||ce===void 0?void 0:ce[Z]:p.config.legend.labels.colors;ae||(ae=p.config.chart.foreColor),$e.style.color=ae,$e.style.fontSize=parseFloat(p.config.legend.fontSize)+"px",$e.style.fontWeight=p.config.legend.fontWeight,$e.style.fontFamily=N||p.config.chart.fontFamily,U.setAttrs($e,{rel:Z+1,i:Z,"data:default-text":encodeURIComponent(ue),"data:collapsed":me||Ne}),Oe.appendChild(Xe),Oe.appendChild($e);var he=new Y(this.ctx);p.config.legend.showForZeroSeries||he.getSeriesTotalByIndex(Z)===0&&he.seriesHaveSameValues(Z)&&!he.isSeriesNull(Z)&&p.globals.collapsedSeriesIndices.indexOf(Z)===-1&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(Z)===-1&&Oe.classList.add("apexcharts-hidden-zero-series"),p.config.legend.showForNullSeries||he.isSeriesNull(Z)&&p.globals.collapsedSeriesIndices.indexOf(Z)===-1&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(Z)===-1&&Oe.classList.add("apexcharts-hidden-null-series"),p.globals.dom.elLegendWrap.appendChild(Oe),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),Oe.classList.add("apexcharts-legend-series"),Oe.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":"",U.setAttrs(Oe,{rel:Z+1,seriesName:F.escapeString(A[Z]),"data:collapsed":me||Ne}),(me||Ne)&&Oe.classList.add("apexcharts-inactive-legend"),p.config.legend.onItemClick.toggleDataSeries||Oe.classList.add("apexcharts-no-click")}p.globals.dom.elWrap.addEventListener("click",m.onLegendClick,!0),p.config.legend.onItemHover.highlightDataSeries&&p.config.legend.customLegendItems.length===0&&(p.globals.dom.elWrap.addEventListener("mousemove",m.onLegendHovered,!0),p.globals.dom.elWrap.addEventListener("mouseout",m.onLegendHovered,!0))}},{key:"setLegendWrapXY",value:function(m,p){var N=this.w,A=N.globals.dom.elLegendWrap,k=A.clientHeight,P=0,D=0;if(N.config.legend.position==="bottom")D=N.globals.svgHeight-Math.min(k,N.globals.svgHeight/2)-5;else if(N.config.legend.position==="top"){var V=new nt(this.ctx),Z=V.dimHelpers.getTitleSubtitleCoords("title").height,ce=V.dimHelpers.getTitleSubtitleCoords("subtitle").height;D=(Z>0?Z-10:0)+(ce>0?ce-10:0)}A.style.position="absolute",P=P+m+N.config.legend.offsetX,D=D+p+N.config.legend.offsetY,A.style.left=P+"px",A.style.top=D+"px",N.config.legend.position==="right"&&(A.style.left="auto",A.style.right=25+N.config.legend.offsetX+"px"),["width","height"].forEach(function(ue){A.style[ue]&&(A.style[ue]=parseInt(N.config.legend[ue],10)+"px")})}},{key:"legendAlignHorizontal",value:function(){var m=this.w;m.globals.dom.elLegendWrap.style.right=0;var p=new nt(this.ctx),N=p.dimHelpers.getTitleSubtitleCoords("title"),A=p.dimHelpers.getTitleSubtitleCoords("subtitle"),k=0;m.config.legend.position==="top"&&(k=N.height+A.height+m.config.title.margin+m.config.subtitle.margin-10),this.setLegendWrapXY(20,k)}},{key:"legendAlignVertical",value:function(){var m=this.w,p=this.legendHelpers.getLegendDimensions(),N=0;m.config.legend.position==="left"&&(N=20),m.config.legend.position==="right"&&(N=m.globals.svgWidth-p.clww-10),this.setLegendWrapXY(N,20)}},{key:"onLegendHovered",value:function(m){var p=this.w,N=m.target.classList.contains("apexcharts-legend-series")||m.target.classList.contains("apexcharts-legend-text")||m.target.classList.contains("apexcharts-legend-marker");if(p.config.chart.type==="heatmap"||this.isBarsDistributed){if(N){var A=parseInt(m.target.getAttribute("rel"),10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,A,this.w]),new Re(this.ctx).highlightRangeInSeries(m,m.target)}}else!m.target.classList.contains("apexcharts-inactive-legend")&&N&&new Re(this.ctx).toggleSeriesOnHover(m,m.target)}},{key:"onLegendClick",value:function(m){var p=this.w;if(!p.config.legend.customLegendItems.length&&(m.target.classList.contains("apexcharts-legend-series")||m.target.classList.contains("apexcharts-legend-text")||m.target.classList.contains("apexcharts-legend-marker"))){var N=parseInt(m.target.getAttribute("rel"),10)-1,A=m.target.getAttribute("data:collapsed")==="true",k=this.w.config.chart.events.legendClick;typeof k=="function"&&k(this.ctx,N,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,N,this.w]);var P=this.w.config.legend.markers.onClick;typeof P=="function"&&m.target.classList.contains("apexcharts-legend-marker")&&(P(this.ctx,N,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,N,this.w])),p.config.chart.type!=="treemap"&&p.config.chart.type!=="heatmap"&&!this.isBarsDistributed&&p.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(N,A)}}}]),Ce}(),Jt=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.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(Ce,[{key:"createToolbar",value:function(){var m=this,p=this.w,N=function(){return document.createElement("div")},A=N();if(A.setAttribute("class","apexcharts-toolbar"),A.style.top=p.config.chart.toolbar.offsetY+"px",A.style.right=3-p.config.chart.toolbar.offsetX+"px",p.globals.dom.elWrap.appendChild(A),this.elZoom=N(),this.elZoomIn=N(),this.elZoomOut=N(),this.elPan=N(),this.elSelection=N(),this.elZoomReset=N(),this.elMenuIcon=N(),this.elMenu=N(),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(N());var P=[],D=function(ue,me,Ne){var Ie=ue.toLowerCase();m.t[Ie]&&p.config.chart.zoom.enabled&&P.push({el:me,icon:typeof m.t[Ie]=="string"?m.t[Ie]:Ne,title:m.localeValues[ue],class:"apexcharts-".concat(Ie,"-icon")})};D("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>
`),D("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 V=function(ue){m.t[ue]&&p.config.chart[ue].enabled&&P.push({el:ue==="zoom"?m.elZoom:m.elSelection,icon:typeof m.t[ue]=="string"?m.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:m.localeValues[ue==="zoom"?"selectionZoom":"selection"],class:p.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-".concat(ue,"-icon")})};V("zoom"),V("selection"),this.t.pan&&p.config.chart.zoom.enabled&&P.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"}),D("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&&P.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 Z=0;Z<this.elCustomIcons.length;Z++)P.push({el:this.elCustomIcons[Z],icon:this.t.customIcons[Z].icon,title:this.t.customIcons[Z].title,index:this.t.customIcons[Z].index,class:"apexcharts-toolbar-custom-icon "+this.t.customIcons[Z].class});P.forEach(function(ue,me){ue.index&&F.moveIndexInArray(P,me,ue.index)});for(var ce=0;ce<P.length;ce++)U.setAttrs(P[ce].el,{class:P[ce].class,title:P[ce].title}),P[ce].el.innerHTML=P[ce].icon,A.appendChild(P[ce].el);this._createHamburgerMenu(A),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(m){this.elMenuItems=[],m.appendChild(this.elMenu),U.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}],N=0;N<p.length;N++)this.elMenuItems.push(document.createElement("div")),this.elMenuItems[N].innerHTML=p[N].title,U.setAttrs(this.elMenuItems[N],{class:"apexcharts-menu-item ".concat(p[N].name),title:p[N].title}),this.elMenu.appendChild(this.elMenuItems[N])}},{key:"addToolbarEventListeners",value:function(){var m=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(N){N.classList.contains("exportSVG")?N.addEventListener("click",m.handleDownload.bind(m,"svg")):N.classList.contains("exportPNG")?N.addEventListener("click",m.handleDownload.bind(m,"png")):N.classList.contains("exportCSV")&&N.addEventListener("click",m.handleDownload.bind(m,"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(m){this.ctx.getSyncedCharts().forEach(function(p){p.ctx.toolbar.toggleOtherControls();var N=m==="selection"?p.ctx.toolbar.elSelection:p.ctx.toolbar.elZoom,A=m==="selection"?"selectionEnabled":"zoomEnabled";p.w.globals[A]=!p.w.globals[A],N.classList.contains(p.ctx.toolbar.selectedClass)?N.classList.remove(p.ctx.toolbar.selectedClass):N.classList.add(p.ctx.toolbar.selectedClass)})}},{key:"getToolbarIconsReference",value:function(){var m=this.w;this.elZoom||(this.elZoom=m.globals.dom.baseEl.querySelector(".apexcharts-zoom-icon")),this.elPan||(this.elPan=m.globals.dom.baseEl.querySelector(".apexcharts-pan-icon")),this.elSelection||(this.elSelection=m.globals.dom.baseEl.querySelector(".apexcharts-selection-icon"))}},{key:"enableZoomPanFromToolbar",value:function(m){this.toggleOtherControls(),m==="pan"?this.w.globals.panEnabled=!0:this.w.globals.zoomEnabled=!0;var p=m==="pan"?this.elPan:this.elZoom,N=m==="pan"?this.elZoom:this.elPan;p&&p.classList.add(this.selectedClass),N&&N.classList.remove(this.selectedClass)}},{key:"togglePanning",value:function(){this.ctx.getSyncedCharts().forEach(function(m){m.ctx.toolbar.toggleOtherControls(),m.w.globals.panEnabled=!m.w.globals.panEnabled,m.ctx.toolbar.elPan.classList.contains(m.ctx.toolbar.selectedClass)?m.ctx.toolbar.elPan.classList.remove(m.ctx.toolbar.selectedClass):m.ctx.toolbar.elPan.classList.add(m.ctx.toolbar.selectedClass)})}},{key:"toggleOtherControls",value:function(){var m=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(N){N&&N.classList.remove(m.selectedClass)})}},{key:"handleZoomIn",value:function(){var m=this.w;m.globals.isRangeBar&&(this.minX=m.globals.minY,this.maxX=m.globals.maxY);var p=(this.minX+this.maxX)/2,N=(this.minX+p)/2,A=(this.maxX+p)/2,k=this._getNewMinXMaxX(N,A);m.globals.disableZoomIn||this.zoomUpdateOptions(k.minX,k.maxX)}},{key:"handleZoomOut",value:function(){var m=this.w;if(m.globals.isRangeBar&&(this.minX=m.globals.minY,this.maxX=m.globals.maxY),!(m.config.xaxis.type==="datetime"&&new Date(this.minX).getUTCFullYear()<1e3)){var p=(this.minX+this.maxX)/2,N=this.minX-(p-this.minX),A=this.maxX-(p-this.maxX),k=this._getNewMinXMaxX(N,A);m.globals.disableZoomOut||this.zoomUpdateOptions(k.minX,k.maxX)}}},{key:"_getNewMinXMaxX",value:function(m,p){var N=this.w.config.xaxis.convertedCatToNumeric;return{minX:N?Math.floor(m):m,maxX:N?Math.floor(p):p}}},{key:"zoomUpdateOptions",value:function(m,p){var N=this.w;if(m!==void 0||p!==void 0){if(!(N.config.xaxis.convertedCatToNumeric&&(m<1&&(m=1,p=N.globals.dataPoints),p-m<2))){var A={min:m,max:p},k=this.getBeforeZoomRange(A);k&&(A=k.xaxis);var P={xaxis:A},D=F.clone(N.globals.initialConfig.yaxis);N.config.chart.group||(P.yaxis=D),this.w.globals.zoomed=!0,this.ctx.updateHelpers._updateOptions(P,!1,this.w.config.chart.animations.dynamicAnimation.enabled),this.zoomCallback(A,D)}}else this.handleZoomReset()}},{key:"zoomCallback",value:function(m,p){typeof this.ev.zoomed=="function"&&this.ev.zoomed(this.ctx,{xaxis:m,yaxis:p})}},{key:"getBeforeZoomRange",value:function(m,p){var N=null;return typeof this.ev.beforeZoom=="function"&&(N=this.ev.beforeZoom(this,{xaxis:m,yaxis:p})),N}},{key:"toggleMenu",value:function(){var m=this;window.setTimeout(function(){m.elMenu.classList.contains("apexcharts-menu-open")?m.elMenu.classList.remove("apexcharts-menu-open"):m.elMenu.classList.add("apexcharts-menu-open")},0)}},{key:"handleDownload",value:function(m){var p=this.w,N=new Ye(this.ctx);switch(m){case"svg":N.exportToSVG(this.ctx);break;case"png":N.exportToPng(this.ctx);break;case"csv":N.exportToCSV({series:p.config.series,columnDelimiter:p.config.chart.toolbar.export.csv.columnDelimiter})}}},{key:"handleZoomReset",value:function(m){this.ctx.getSyncedCharts().forEach(function(p){var N=p.w;if(N.globals.lastXAxis.min=N.globals.initialConfig.xaxis.min,N.globals.lastXAxis.max=N.globals.initialConfig.xaxis.max,p.updateHelpers.revertDefaultAxisMinMax(),typeof N.config.chart.events.beforeResetZoom=="function"){var A=N.config.chart.events.beforeResetZoom(p,N);A&&p.updateHelpers.revertDefaultAxisMinMax(A)}typeof N.config.chart.events.zoomed=="function"&&p.ctx.toolbar.zoomCallback({min:N.config.xaxis.min,max:N.config.xaxis.max}),N.globals.zoomed=!1;var k=p.ctx.series.emptyCollapsedSeries(F.clone(N.globals.initialSeries));p.updateHelpers._updateSeries(k,N.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}}]),Ce}(),Vt=function(Ce){f(p,Jt);var m=c(p);function p(N){var A;return s(this,p),(A=m.call(this,N)).ctx=N,A.w=N.w,A.dragged=!1,A.graphics=new U(A.ctx),A.eventList=["mousedown","mouseleave","mousemove","touchstart","touchmove","mouseup","touchend","wheel"],A.clientX=0,A.clientY=0,A.startX=0,A.endX=0,A.dragX=0,A.startY=0,A.endY=0,A.dragY=0,A.moveDirection="none",A.debounceTimer=null,A.debounceDelay=100,A.wheelDelay=400,A}return o(p,[{key:"init",value:function(N){var A=this,k=N.xyRatios,P=this.w,D=this;this.xyRatios=k,this.zoomRect=this.graphics.drawRect(0,0,0,0),this.selectionRect=this.graphics.drawRect(0,0,0,0),this.gridRect=P.globals.dom.baseEl.querySelector(".apexcharts-grid"),this.zoomRect.node.classList.add("apexcharts-zoom-rect"),this.selectionRect.node.classList.add("apexcharts-selection-rect"),P.globals.dom.elGraphical.add(this.zoomRect),P.globals.dom.elGraphical.add(this.selectionRect),P.config.chart.selection.type==="x"?this.slDraggableRect=this.selectionRect.draggable({minX:0,minY:0,maxX:P.globals.gridWidth,maxY:P.globals.gridHeight}).on("dragmove",this.selectionDragging.bind(this,"dragging")):P.config.chart.selection.type==="y"?this.slDraggableRect=this.selectionRect.draggable({minX:0,maxX:P.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=P.globals.dom.baseEl.querySelector("".concat(P.globals.chartClass," .apexcharts-svg")),this.hoverArea.classList.add("apexcharts-zoomable"),this.eventList.forEach(function(V){A.hoverArea.addEventListener(V,D.svgMouseEvents.bind(D,k),{capture:!1,passive:!0})}),P.config.chart.zoom.allowMouseWheelZoom&&this.hoverArea.addEventListener("wheel",D.mouseWheelEvent.bind(D),{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(N,A){var k=this.w,P=this,D=this.ctx.toolbar,V=k.globals.zoomEnabled?k.config.chart.zoom.type:k.config.chart.selection.type,Z=k.config.chart.toolbar.autoSelected;if(A.shiftKey?(this.shiftWasPressed=!0,D.enableZoomPanFromToolbar(Z==="pan"?"zoom":"pan")):this.shiftWasPressed&&(D.enableZoomPanFromToolbar(Z),this.shiftWasPressed=!1),A.target){var ce,ue=A.target.classList;if(A.target.parentNode&&A.target.parentNode!==null&&(ce=A.target.parentNode.classList),!(ue.contains("apexcharts-selection-rect")||ue.contains("apexcharts-legend-marker")||ue.contains("apexcharts-legend-text")||ce&&ce.contains("apexcharts-toolbar"))){if(P.clientX=A.type==="touchmove"||A.type==="touchstart"?A.touches[0].clientX:A.type==="touchend"?A.changedTouches[0].clientX:A.clientX,P.clientY=A.type==="touchmove"||A.type==="touchstart"?A.touches[0].clientY:A.type==="touchend"?A.changedTouches[0].clientY:A.clientY,A.type==="mousedown"&&A.which===1){var me=P.gridRect.getBoundingClientRect();P.startX=P.clientX-me.left,P.startY=P.clientY-me.top,P.dragged=!1,P.w.globals.mousedown=!0}if((A.type==="mousemove"&&A.which===1||A.type==="touchmove")&&(P.dragged=!0,k.globals.panEnabled?(k.globals.selection=null,P.w.globals.mousedown&&P.panDragging({context:P,zoomtype:V,xyRatios:N})):(P.w.globals.mousedown&&k.globals.zoomEnabled||P.w.globals.mousedown&&k.globals.selectionEnabled)&&(P.selection=P.selectionDrawing({context:P,zoomtype:V}))),A.type==="mouseup"||A.type==="touchend"||A.type==="mouseleave"){var Ne,Ie=(Ne=P.gridRect)===null||Ne===void 0?void 0:Ne.getBoundingClientRect();Ie&&P.w.globals.mousedown&&(P.endX=P.clientX-Ie.left,P.endY=P.clientY-Ie.top,P.dragX=Math.abs(P.endX-P.startX),P.dragY=Math.abs(P.endY-P.startY),(k.globals.zoomEnabled||k.globals.selectionEnabled)&&P.selectionDrawn({context:P,zoomtype:V}),k.globals.panEnabled&&k.config.xaxis.convertedCatToNumeric&&P.delayedPanScrolled()),k.globals.zoomEnabled&&P.hideSelectionRect(this.selectionRect),P.dragged=!1,P.w.globals.mousedown=!1}this.makeSelectionRectDraggable()}}}},{key:"mouseWheelEvent",value:function(N){var A=this,k=this.w;N.preventDefault();var P=Date.now();P-k.globals.lastWheelExecution>this.wheelDelay&&(this.executeMouseWheelZoom(N),k.globals.lastWheelExecution=P),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(function(){P-k.globals.lastWheelExecution>A.wheelDelay&&(A.executeMouseWheelZoom(N),k.globals.lastWheelExecution=P)},this.debounceDelay)}},{key:"executeMouseWheelZoom",value:function(N){var A,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 P=(A=this.gridRect)===null||A===void 0?void 0:A.getBoundingClientRect();if(P){var D,V,Z,ce=(N.clientX-P.left)/P.width,ue=this.minX,me=this.maxX,Ne=me-ue;if(N.deltaY<0){var Ie=ue+ce*Ne;V=Ie-(D=.5*Ne)/2,Z=Ie+D/2}else V=ue-(D=1.5*Ne)/2,Z=me+D/2;if(!k.globals.isRangeBar){V=Math.max(V,k.globals.initialMinX),Z=Math.min(Z,k.globals.initialMaxX);var Le=.01*(k.globals.initialMaxX-k.globals.initialMinX);if(Z-V<Le){var Xe=(V+Z)/2;V=Xe-Le/2,Z=Xe+Le/2}}var Oe=this._getNewMinXMaxX(V,Z);isNaN(Oe.minX)||isNaN(Oe.maxX)||this.zoomUpdateOptions(Oe.minX,Oe.maxX)}}},{key:"makeSelectionRectDraggable",value:function(){var N=this.w;if(this.selectionRect){var A=this.selectionRect.node.getBoundingClientRect();A.width>0&&A.height>0&&this.slDraggableRect.selectize({points:"l, r",pointSize:8,pointType:"rect"}).resize({constraint:{minX:0,minY:0,maxX:N.globals.gridWidth,maxY:N.globals.gridHeight}}).on("resizing",this.selectionDragging.bind(this,"resizing"))}}},{key:"preselectedSelection",value:function(){var N=this.w,A=this.xyRatios;if(!N.globals.zoomEnabled){if(N.globals.selection!==void 0&&N.globals.selection!==null)this.drawSelectionRect(N.globals.selection);else if(N.config.chart.selection.xaxis.min!==void 0&&N.config.chart.selection.xaxis.max!==void 0){var k=(N.config.chart.selection.xaxis.min-N.globals.minX)/A.xRatio,P=N.globals.gridWidth-(N.globals.maxX-N.config.chart.selection.xaxis.max)/A.xRatio-k;N.globals.isRangeBar&&(k=(N.config.chart.selection.xaxis.min-N.globals.yAxisScale[0].niceMin)/A.invertedYRatio,P=(N.config.chart.selection.xaxis.max-N.config.chart.selection.xaxis.min)/A.invertedYRatio);var D={x:k,y:0,width:P,height:N.globals.gridHeight,translateX:0,translateY:0,selectionEnabled:!0};this.drawSelectionRect(D),this.makeSelectionRectDraggable(),typeof N.config.chart.events.selection=="function"&&N.config.chart.events.selection(this.ctx,{xaxis:{min:N.config.chart.selection.xaxis.min,max:N.config.chart.selection.xaxis.max},yaxis:{}})}}}},{key:"drawSelectionRect",value:function(N){var A=N.x,k=N.y,P=N.width,D=N.height,V=N.translateX,Z=V===void 0?0:V,ce=N.translateY,ue=ce===void 0?0:ce,me=this.w,Ne=this.zoomRect,Ie=this.selectionRect;if(this.dragged||me.globals.selection!==null){var Le={transform:"translate("+Z+", "+ue+")"};me.globals.zoomEnabled&&this.dragged&&(P<0&&(P=1),Ne.attr({x:A,y:k,width:P,height:D,fill:me.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":me.config.chart.zoom.zoomedArea.fill.opacity,stroke:me.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":me.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":me.config.chart.zoom.zoomedArea.stroke.opacity}),U.setAttrs(Ne.node,Le)),me.globals.selectionEnabled&&(Ie.attr({x:A,y:k,width:P>0?P:0,height:D>0?D:0,fill:me.config.chart.selection.fill.color,"fill-opacity":me.config.chart.selection.fill.opacity,stroke:me.config.chart.selection.stroke.color,"stroke-width":me.config.chart.selection.stroke.width,"stroke-dasharray":me.config.chart.selection.stroke.dashArray,"stroke-opacity":me.config.chart.selection.stroke.opacity}),U.setAttrs(Ie.node,Le))}}},{key:"hideSelectionRect",value:function(N){N&&N.attr({x:0,y:0,width:0,height:0})}},{key:"selectionDrawing",value:function(N){var A=N.context,k=N.zoomtype,P=this.w,D=A,V=this.gridRect.getBoundingClientRect(),Z=D.startX-1,ce=D.startY,ue=!1,me=!1,Ne=D.clientX-V.left-Z,Ie=D.clientY-V.top-ce,Le={};return Math.abs(Ne+Z)>P.globals.gridWidth?Ne=P.globals.gridWidth-Z:D.clientX-V.left<0&&(Ne=Z),Z>D.clientX-V.left&&(ue=!0,Ne=Math.abs(Ne)),ce>D.clientY-V.top&&(me=!0,Ie=Math.abs(Ie)),Le=k==="x"?{x:ue?Z-Ne:Z,y:0,width:Ne,height:P.globals.gridHeight}:k==="y"?{x:0,y:me?ce-Ie:ce,width:P.globals.gridWidth,height:Ie}:{x:ue?Z-Ne:Z,y:me?ce-Ie:ce,width:Ne,height:Ie},D.drawSelectionRect(Le),D.selectionDragging("resizing"),Le}},{key:"selectionDragging",value:function(N,A){var k=this,P=this.w,D=this.xyRatios,V=this.selectionRect,Z=0;N==="resizing"&&(Z=30);var ce=function(me){return parseFloat(V.node.getAttribute(me))},ue={x:ce("x"),y:ce("y"),width:ce("width"),height:ce("height")};P.globals.selection=ue,typeof P.config.chart.events.selection=="function"&&P.globals.selectionEnabled&&(clearTimeout(this.w.globals.selectionResizeTimer),this.w.globals.selectionResizeTimer=window.setTimeout(function(){var me,Ne,Ie,Le,Xe=k.gridRect.getBoundingClientRect(),Oe=V.node.getBoundingClientRect();P.globals.isRangeBar?(me=P.globals.yAxisScale[0].niceMin+(Oe.left-Xe.left)*D.invertedYRatio,Ne=P.globals.yAxisScale[0].niceMin+(Oe.right-Xe.left)*D.invertedYRatio,Ie=0,Le=1):(me=P.globals.xAxisScale.niceMin+(Oe.left-Xe.left)*D.xRatio,Ne=P.globals.xAxisScale.niceMin+(Oe.right-Xe.left)*D.xRatio,Ie=P.globals.yAxisScale[0].niceMin+(Xe.bottom-Oe.bottom)*D.yRatio[0],Le=P.globals.yAxisScale[0].niceMax-(Oe.top-Xe.top)*D.yRatio[0]);var $e={xaxis:{min:me,max:Ne},yaxis:{min:Ie,max:Le}};P.config.chart.events.selection(k.ctx,$e),P.config.chart.brush.enabled&&P.config.chart.events.brushScrolled!==void 0&&P.config.chart.events.brushScrolled(k.ctx,$e)},Z))}},{key:"selectionDrawn",value:function(N){var A=N.context,k=N.zoomtype,P=this.w,D=A,V=this.xyRatios,Z=this.ctx.toolbar;if(D.startX>D.endX){var ce=D.startX;D.startX=D.endX,D.endX=ce}if(D.startY>D.endY){var ue=D.startY;D.startY=D.endY,D.endY=ue}var me=void 0,Ne=void 0;P.globals.isRangeBar?(me=P.globals.yAxisScale[0].niceMin+D.startX*V.invertedYRatio,Ne=P.globals.yAxisScale[0].niceMin+D.endX*V.invertedYRatio):(me=P.globals.xAxisScale.niceMin+D.startX*V.xRatio,Ne=P.globals.xAxisScale.niceMin+D.endX*V.xRatio);var Ie=[],Le=[];if(P.config.yaxis.forEach(function(Ve,Te){var Ze=P.globals.seriesYAxisMap[Te][0];Ie.push(P.globals.yAxisScale[Te].niceMax-V.yRatio[Ze]*D.startY),Le.push(P.globals.yAxisScale[Te].niceMax-V.yRatio[Ze]*D.endY)}),D.dragged&&(D.dragX>10||D.dragY>10)&&me!==Ne){if(P.globals.zoomEnabled){var Xe=F.clone(P.globals.initialConfig.yaxis),Oe=F.clone(P.globals.initialConfig.xaxis);if(P.globals.zoomed=!0,P.config.xaxis.convertedCatToNumeric&&(me=Math.floor(me),Ne=Math.floor(Ne),me<1&&(me=1,Ne=P.globals.dataPoints),Ne-me<2&&(Ne=me+1)),k!=="xy"&&k!=="x"||(Oe={min:me,max:Ne}),k!=="xy"&&k!=="y"||Xe.forEach(function(Ve,Te){Xe[Te].min=Le[Te],Xe[Te].max=Ie[Te]}),Z){var $e=Z.getBeforeZoomRange(Oe,Xe);$e&&(Oe=$e.xaxis?$e.xaxis:Oe,Xe=$e.yaxis?$e.yaxis:Xe)}var ae={xaxis:Oe};P.config.chart.group||(ae.yaxis=Xe),D.ctx.updateHelpers._updateOptions(ae,!1,D.w.config.chart.animations.dynamicAnimation.enabled),typeof P.config.chart.events.zoomed=="function"&&Z.zoomCallback(Oe,Xe)}else if(P.globals.selectionEnabled){var he,Pe=null;he={min:me,max:Ne},k!=="xy"&&k!=="y"||(Pe=F.clone(P.config.yaxis)).forEach(function(Ve,Te){Pe[Te].min=Le[Te],Pe[Te].max=Ie[Te]}),P.globals.selection=D.selection,typeof P.config.chart.events.selection=="function"&&P.config.chart.events.selection(D.ctx,{xaxis:he,yaxis:Pe})}}}},{key:"panDragging",value:function(N){var A=N.context,k=this.w,P=A;if(k.globals.lastClientPosition.x!==void 0){var D=k.globals.lastClientPosition.x-P.clientX,V=k.globals.lastClientPosition.y-P.clientY;Math.abs(D)>Math.abs(V)&&D>0?this.moveDirection="left":Math.abs(D)>Math.abs(V)&&D<0?this.moveDirection="right":Math.abs(V)>Math.abs(D)&&V>0?this.moveDirection="up":Math.abs(V)>Math.abs(D)&&V<0&&(this.moveDirection="down")}k.globals.lastClientPosition={x:P.clientX,y:P.clientY};var Z=k.globals.isRangeBar?k.globals.minY:k.globals.minX,ce=k.globals.isRangeBar?k.globals.maxY:k.globals.maxX;k.config.xaxis.convertedCatToNumeric||P.panScrolled(Z,ce)}},{key:"delayedPanScrolled",value:function(){var N=this.w,A=N.globals.minX,k=N.globals.maxX,P=(N.globals.maxX-N.globals.minX)/2;this.moveDirection==="left"?(A=N.globals.minX+P,k=N.globals.maxX+P):this.moveDirection==="right"&&(A=N.globals.minX-P,k=N.globals.maxX-P),A=Math.floor(A),k=Math.floor(k),this.updateScrolledChart({xaxis:{min:A,max:k}},A,k)}},{key:"panScrolled",value:function(N,A){var k=this.w,P=this.xyRatios,D=F.clone(k.globals.initialConfig.yaxis),V=P.xRatio,Z=k.globals.minX,ce=k.globals.maxX;k.globals.isRangeBar&&(V=P.invertedYRatio,Z=k.globals.minY,ce=k.globals.maxY),this.moveDirection==="left"?(N=Z+k.globals.gridWidth/15*V,A=ce+k.globals.gridWidth/15*V):this.moveDirection==="right"&&(N=Z-k.globals.gridWidth/15*V,A=ce-k.globals.gridWidth/15*V),k.globals.isRangeBar||(N<k.globals.initialMinX||A>k.globals.initialMaxX)&&(N=Z,A=ce);var ue={xaxis:{min:N,max:A}};k.config.chart.group||(ue.yaxis=D),this.updateScrolledChart(ue,N,A)}},{key:"updateScrolledChart",value:function(N,A,k){var P=this.w;this.ctx.updateHelpers._updateOptions(N,!1,!1),typeof P.config.chart.events.scrolled=="function"&&P.config.chart.events.scrolled(this.ctx,{xaxis:{min:A,max:k}})}}]),p}(),xt=function(){function Ce(m){s(this,Ce),this.w=m.w,this.ttCtx=m,this.ctx=m.ctx}return o(Ce,[{key:"getNearestValues",value:function(m){var p=m.hoverArea,N=m.elGrid,A=m.clientX,k=m.clientY,P=this.w,D=N.getBoundingClientRect(),V=D.width,Z=D.height,ce=V/(P.globals.dataPoints-1),ue=Z/P.globals.dataPoints,me=this.hasBars();!P.globals.comboCharts&&!me||P.config.xaxis.convertedCatToNumeric||(ce=V/P.globals.dataPoints);var Ne=A-D.left-P.globals.barPadForNumericAxis,Ie=k-D.top;Ne<0||Ie<0||Ne>V||Ie>Z?(p.classList.remove("hovering-zoom"),p.classList.remove("hovering-pan")):P.globals.zoomEnabled?(p.classList.remove("hovering-pan"),p.classList.add("hovering-zoom")):P.globals.panEnabled&&(p.classList.remove("hovering-zoom"),p.classList.add("hovering-pan"));var Le=Math.round(Ne/ce),Xe=Math.floor(Ie/ue);me&&!P.config.xaxis.convertedCatToNumeric&&(Le=Math.ceil(Ne/ce),Le-=1);var Oe=null,$e=null,ae=P.globals.seriesXvalues.map(function(Ze){return Ze.filter(function(it){return F.isNumber(it)})}),he=P.globals.seriesYvalues.map(function(Ze){return Ze.filter(function(it){return F.isNumber(it)})});if(P.globals.isXNumeric){var Pe=this.ttCtx.getElGrid().getBoundingClientRect(),Ve=Ne*(Pe.width/V),Te=Ie*(Pe.height/Z);Oe=($e=this.closestInMultiArray(Ve,Te,ae,he)).index,Le=$e.j,Oe!==null&&(ae=P.globals.seriesXvalues[Oe],Le=($e=this.closestInArray(Ve,ae)).index)}return P.globals.capturedSeriesIndex=Oe===null?-1:Oe,(!Le||Le<1)&&(Le=0),P.globals.isBarHorizontal?P.globals.capturedDataPointIndex=Xe:P.globals.capturedDataPointIndex=Le,{capturedSeries:Oe,j:P.globals.isBarHorizontal?Xe:Le,hoverX:Ne,hoverY:Ie}}},{key:"closestInMultiArray",value:function(m,p,N,A){var k=this.w,P=0,D=null,V=-1;k.globals.series.length>1?P=this.getFirstActiveXArray(N):D=0;var Z=N[P][0],ce=Math.abs(m-Z);if(N.forEach(function(Ne){Ne.forEach(function(Ie,Le){var Xe=Math.abs(m-Ie);Xe<=ce&&(ce=Xe,V=Le)})}),V!==-1){var ue=A[P][V],me=Math.abs(p-ue);D=P,A.forEach(function(Ne,Ie){var Le=Math.abs(p-Ne[V]);Le<=me&&(me=Le,D=Ie)})}return{index:D,j:V}}},{key:"getFirstActiveXArray",value:function(m){for(var p=this.w,N=0,A=m.map(function(P,D){return P.length>0?D:-1}),k=0;k<A.length;k++)if(A[k]!==-1&&p.globals.collapsedSeriesIndices.indexOf(k)===-1&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(k)===-1){N=A[k];break}return N}},{key:"closestInArray",value:function(m,p){for(var N=p[0],A=null,k=Math.abs(m-N),P=0;P<p.length;P++){var D=Math.abs(m-p[P]);D<k&&(k=D,A=P)}return{index:A}}},{key:"isXoverlap",value:function(m){var p=[],N=this.w.globals.seriesX.filter(function(k){return k[0]!==void 0});if(N.length>0)for(var A=0;A<N.length-1;A++)N[A][m]!==void 0&&N[A+1][m]!==void 0&&N[A][m]!==N[A+1][m]&&p.push("unEqual");return p.length===0}},{key:"isInitialSeriesSameLen",value:function(){for(var m=!0,p=this.w.globals.initialSeries,N=0;N<p.length-1;N++)if(p[N].data.length!==p[N+1].data.length){m=!1;break}return m}},{key:"getBarsHeight",value:function(m){return S(m).reduce(function(p,N){return p+N.getBBox().height},0)}},{key:"getElMarkers",value:function(m){return typeof m=="number"?this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series[data\\:realIndex='".concat(m,"'] .apexcharts-series-markers-wrap > *")):this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap > *")}},{key:"getAllMarkers",value:function(){var m=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap");(m=S(m)).sort(function(N,A){var k=Number(N.getAttribute("data:realIndex")),P=Number(A.getAttribute("data:realIndex"));return P<k?1:P>k?-1:0});var p=[];return m.forEach(function(N){p.push(N.querySelector(".apexcharts-marker"))}),p}},{key:"hasMarkers",value:function(m){return this.getElMarkers(m).length>0}},{key:"getPathFromPoint",value:function(m,p){var N=Number(m.getAttribute("cx")),A=Number(m.getAttribute("cy")),k=m.getAttribute("shape");return new U(this.ctx).getMarkerPath(N,A,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(m){var p=this.w,N=p.config.markers.hover.size;return N===void 0&&(N=p.globals.markers.size[m]+p.config.markers.hover.sizeOffset),N}},{key:"toggleAllTooltipSeriesGroups",value:function(m){var p=this.w,N=this.ttCtx;N.allTooltipSeriesGroups.length===0&&(N.allTooltipSeriesGroups=p.globals.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group"));for(var A=N.allTooltipSeriesGroups,k=0;k<A.length;k++)m==="enable"?(A[k].classList.add("apexcharts-active"),A[k].style.display=p.config.tooltip.items.display):(A[k].classList.remove("apexcharts-active"),A[k].style.display="none")}}]),Ce}(),We=function(){function Ce(m){s(this,Ce),this.w=m.w,this.ctx=m.ctx,this.ttCtx=m,this.tooltipUtil=new xt(m)}return o(Ce,[{key:"drawSeriesTexts",value:function(m){var p=m.shared,N=p===void 0||p,A=m.ttItems,k=m.i,P=k===void 0?0:k,D=m.j,V=D===void 0?null:D,Z=m.y1,ce=m.y2,ue=m.e,me=this.w;me.config.tooltip.custom!==void 0?this.handleCustomTooltip({i:P,j:V,y1:Z,y2:ce,w:me}):this.toggleActiveInactiveSeries(N,P);var Ne=this.getValuesToPrint({i:P,j:V});this.printLabels({i:P,j:V,values:Ne,ttItems:A,shared:N,e:ue});var Ie=this.ttCtx.getElTooltip();this.ttCtx.tooltipRect.ttWidth=Ie.getBoundingClientRect().width,this.ttCtx.tooltipRect.ttHeight=Ie.getBoundingClientRect().height}},{key:"printLabels",value:function(m){var p,N=this,A=m.i,k=m.j,P=m.values,D=m.ttItems,V=m.shared,Z=m.e,ce=this.w,ue=[],me=function(Pe){return ce.globals.seriesGoals[Pe]&&ce.globals.seriesGoals[Pe][k]&&Array.isArray(ce.globals.seriesGoals[Pe][k])},Ne=P.xVal,Ie=P.zVal,Le=P.xAxisTTVal,Xe="",Oe=ce.globals.colors[A];k!==null&&ce.config.plotOptions.bar.distributed&&(Oe=ce.globals.colors[k]);for(var $e=function(Pe,Ve){var Te=N.getFormatters(A);Xe=N.getSeriesName({fn:Te.yLbTitleFormatter,index:A,seriesIndex:A,j:k}),ce.config.chart.type==="treemap"&&(Xe=Te.yLbTitleFormatter(String(ce.config.series[A].data[k].x),{series:ce.globals.series,seriesIndex:A,dataPointIndex:k,w:ce}));var Ze=ce.config.tooltip.inverseOrder?Ve:Pe;if(ce.globals.axisCharts){var it=function(Qt){var xn,pn,An,or;return ce.globals.isRangeData?Te.yLbFormatter((xn=ce.globals.seriesRangeStart)===null||xn===void 0||(pn=xn[Qt])===null||pn===void 0?void 0:pn[k],{series:ce.globals.seriesRangeStart,seriesIndex:Qt,dataPointIndex:k,w:ce})+" - "+Te.yLbFormatter((An=ce.globals.seriesRangeEnd)===null||An===void 0||(or=An[Qt])===null||or===void 0?void 0:or[k],{series:ce.globals.seriesRangeEnd,seriesIndex:Qt,dataPointIndex:k,w:ce}):Te.yLbFormatter(ce.globals.series[Qt][k],{series:ce.globals.series,seriesIndex:Qt,dataPointIndex:k,w:ce})};if(V)Te=N.getFormatters(Ze),Xe=N.getSeriesName({fn:Te.yLbTitleFormatter,index:Ze,seriesIndex:A,j:k}),Oe=ce.globals.colors[Ze],p=it(Ze),me(Ze)&&(ue=ce.globals.seriesGoals[Ze][k].map(function(Qt){return{attrs:Qt,val:Te.yLbFormatter(Qt.value,{seriesIndex:Ze,dataPointIndex:k,w:ce})}}));else{var wt,Dt=Z==null||(wt=Z.target)===null||wt===void 0?void 0:wt.getAttribute("fill");Dt&&(Dt.indexOf("url")!==-1?Dt.indexOf("Pattern")!==-1&&(Oe=ce.globals.dom.baseEl.querySelector(Dt.substr(4).slice(0,-1)).childNodes[0].getAttribute("stroke")):Oe=Dt),p=it(A),me(A)&&Array.isArray(ce.globals.seriesGoals[A][k])&&(ue=ce.globals.seriesGoals[A][k].map(function(Qt){return{attrs:Qt,val:Te.yLbFormatter(Qt.value,{seriesIndex:A,dataPointIndex:k,w:ce})}}))}}k===null&&(p=Te.yLbFormatter(ce.globals.series[A],y(y({},ce),{},{seriesIndex:A,dataPointIndex:A}))),N.DOMHandling({i:A,t:Ze,j:k,ttItems:D,values:{val:p,goalVals:ue,xVal:Ne,xAxisTTVal:Le,zVal:Ie},seriesName:Xe,shared:V,pColor:Oe})},ae=0,he=ce.globals.series.length-1;ae<ce.globals.series.length;ae++,he--)$e(ae,he)}},{key:"getFormatters",value:function(m){var p,N=this.w,A=N.globals.yLabelFormatters[m];return N.globals.ttVal!==void 0?Array.isArray(N.globals.ttVal)?(A=N.globals.ttVal[m]&&N.globals.ttVal[m].formatter,p=N.globals.ttVal[m]&&N.globals.ttVal[m].title&&N.globals.ttVal[m].title.formatter):(A=N.globals.ttVal.formatter,typeof N.globals.ttVal.title.formatter=="function"&&(p=N.globals.ttVal.title.formatter)):p=N.config.tooltip.y.title.formatter,typeof A!="function"&&(A=N.globals.yLabelFormatters[0]?N.globals.yLabelFormatters[0]:function(k){return k}),typeof p!="function"&&(p=function(k){return k}),{yLbFormatter:A,yLbTitleFormatter:p}}},{key:"getSeriesName",value:function(m){var p=m.fn,N=m.index,A=m.seriesIndex,k=m.j,P=this.w;return p(String(P.globals.seriesNames[N]),{series:P.globals.series,seriesIndex:A,dataPointIndex:k,w:P})}},{key:"DOMHandling",value:function(m){m.i;var p=m.t,N=m.j,A=m.ttItems,k=m.values,P=m.seriesName,D=m.shared,V=m.pColor,Z=this.w,ce=this.ttCtx,ue=k.val,me=k.goalVals,Ne=k.xVal,Ie=k.xAxisTTVal,Le=k.zVal,Xe=null;Xe=A[p].children,Z.config.tooltip.fillSeriesColor&&(A[p].style.backgroundColor=V,Xe[0].style.display="none"),ce.showTooltipTitle&&(ce.tooltipTitle===null&&(ce.tooltipTitle=Z.globals.dom.baseEl.querySelector(".apexcharts-tooltip-title")),ce.tooltipTitle.innerHTML=Ne),ce.isXAxisTooltipEnabled&&(ce.xaxisTooltipText.innerHTML=Ie!==""?Ie:Ne);var Oe=A[p].querySelector(".apexcharts-tooltip-text-y-label");Oe&&(Oe.innerHTML=P||"");var $e=A[p].querySelector(".apexcharts-tooltip-text-y-value");$e&&($e.innerHTML=ue!==void 0?ue:""),Xe[0]&&Xe[0].classList.contains("apexcharts-tooltip-marker")&&(Z.config.tooltip.marker.fillColors&&Array.isArray(Z.config.tooltip.marker.fillColors)&&(V=Z.config.tooltip.marker.fillColors[p]),Xe[0].style.backgroundColor=V),Z.config.tooltip.marker.show||(Xe[0].style.display="none");var ae=A[p].querySelector(".apexcharts-tooltip-text-goals-label"),he=A[p].querySelector(".apexcharts-tooltip-text-goals-value");if(me.length&&Z.globals.seriesGoals[p]){var Pe=function(){var Ze="<div >",it="<div>";me.forEach(function(wt,Dt){Ze+=' <div style="display: flex"><span class="apexcharts-tooltip-marker" style="background-color: '.concat(wt.attrs.strokeColor,'; height: 3px; border-radius: 0; top: 5px;"></span> ').concat(wt.attrs.name,"</div>"),it+="<div>".concat(wt.val,"</div>")}),ae.innerHTML=Ze+"</div>",he.innerHTML=it+"</div>"};D?Z.globals.seriesGoals[p][N]&&Array.isArray(Z.globals.seriesGoals[p][N])?Pe():(ae.innerHTML="",he.innerHTML=""):Pe()}else ae.innerHTML="",he.innerHTML="";if(Le!==null&&(A[p].querySelector(".apexcharts-tooltip-text-z-label").innerHTML=Z.config.tooltip.z.title,A[p].querySelector(".apexcharts-tooltip-text-z-value").innerHTML=Le!==void 0?Le:""),D&&Xe[0]){if(Z.config.tooltip.hideEmptySeries){var Ve=A[p].querySelector(".apexcharts-tooltip-marker"),Te=A[p].querySelector(".apexcharts-tooltip-text");parseFloat(ue)==0?(Ve.style.display="none",Te.style.display="none"):(Ve.style.display="block",Te.style.display="block")}ue==null||Z.globals.ancillaryCollapsedSeriesIndices.indexOf(p)>-1||Z.globals.collapsedSeriesIndices.indexOf(p)>-1||Array.isArray(ce.tConfig.enabledOnSeries)&&ce.tConfig.enabledOnSeries.indexOf(p)===-1?Xe[0].parentNode.style.display="none":Xe[0].parentNode.style.display=Z.config.tooltip.items.display}else Array.isArray(ce.tConfig.enabledOnSeries)&&ce.tConfig.enabledOnSeries.indexOf(p)===-1&&(Xe[0].parentNode.style.display="none")}},{key:"toggleActiveInactiveSeries",value:function(m,p){var N=this.w;if(m)this.tooltipUtil.toggleAllTooltipSeriesGroups("enable");else{this.tooltipUtil.toggleAllTooltipSeriesGroups("disable");var A=N.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group-".concat(p));A&&(A.classList.add("apexcharts-active"),A.style.display=N.config.tooltip.items.display)}}},{key:"getValuesToPrint",value:function(m){var p=m.i,N=m.j,A=this.w,k=this.ctx.series.filteredSeriesX(),P="",D="",V=null,Z=null,ce={series:A.globals.series,seriesIndex:p,dataPointIndex:N,w:A},ue=A.globals.ttZFormatter;N===null?Z=A.globals.series[p]:A.globals.isXNumeric&&A.config.chart.type!=="treemap"?(P=k[p][N],k[p].length===0&&(P=k[this.tooltipUtil.getFirstActiveXArray(k)][N])):P=new Qe(this.ctx).isFormatXY()?A.config.series[p].data[N]!==void 0?A.config.series[p].data[N].x:"":A.globals.labels[N]!==void 0?A.globals.labels[N]:"";var me=P;return A.globals.isXNumeric&&A.config.xaxis.type==="datetime"?P=new te(this.ctx).xLabelFormat(A.globals.ttKeyFormatter,me,me,{i:void 0,dateFormatter:new q(this.ctx).formatDate,w:this.w}):P=A.globals.isBarHorizontal?A.globals.yLabelFormatters[0](me,ce):A.globals.xLabelFormatter(me,ce),A.config.tooltip.x.formatter!==void 0&&(P=A.globals.ttKeyFormatter(me,ce)),A.globals.seriesZ.length>0&&A.globals.seriesZ[p].length>0&&(V=ue(A.globals.seriesZ[p][N],A)),D=typeof A.config.xaxis.tooltip.formatter=="function"?A.globals.xaxisTooltipFormatter(me,ce):P,{val:Array.isArray(Z)?Z.join(" "):Z,xVal:Array.isArray(P)?P.join(" "):P,xAxisTTVal:Array.isArray(D)?D.join(" "):D,zVal:V}}},{key:"handleCustomTooltip",value:function(m){var p=m.i,N=m.j,A=m.y1,k=m.y2,P=m.w,D=this.ttCtx.getElTooltip(),V=P.config.tooltip.custom;Array.isArray(V)&&V[p]&&(V=V[p]),D.innerHTML=V({ctx:this.ctx,series:P.globals.series,seriesIndex:p,dataPointIndex:N,y1:A,y2:k,w:P})}}]),Ce}(),Pt=function(){function Ce(m){s(this,Ce),this.ttCtx=m,this.ctx=m.ctx,this.w=m.w}return o(Ce,[{key:"moveXCrosshairs",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,N=this.ttCtx,A=this.w,k=N.getElXCrosshairs(),P=m-N.xcrosshairsWidth/2,D=A.globals.labels.slice().length;if(p!==null&&(P=A.globals.gridWidth/D*p),k===null||A.globals.isBarHorizontal||(k.setAttribute("x",P),k.setAttribute("x1",P),k.setAttribute("x2",P),k.setAttribute("y2",A.globals.gridHeight),k.classList.add("apexcharts-active")),P<0&&(P=0),P>A.globals.gridWidth&&(P=A.globals.gridWidth),N.isXAxisTooltipEnabled){var V=P;A.config.xaxis.crosshairs.width!=="tickWidth"&&A.config.xaxis.crosshairs.width!=="barWidth"||(V=P+N.xcrosshairsWidth/2),this.moveXAxisTooltip(V)}}},{key:"moveYCrosshairs",value:function(m){var p=this.ttCtx;p.ycrosshairs!==null&&U.setAttrs(p.ycrosshairs,{y1:m,y2:m}),p.ycrosshairsHidden!==null&&U.setAttrs(p.ycrosshairsHidden,{y1:m,y2:m})}},{key:"moveXAxisTooltip",value:function(m){var p=this.w,N=this.ttCtx;if(N.xaxisTooltip!==null&&N.xcrosshairsWidth!==0){N.xaxisTooltip.classList.add("apexcharts-active");var A=N.xaxisOffY+p.config.xaxis.tooltip.offsetY+p.globals.translateY+1+p.config.xaxis.offsetY;if(m-=N.xaxisTooltip.getBoundingClientRect().width/2,!isNaN(m)){m+=p.globals.translateX;var k;k=new U(this.ctx).getTextRects(N.xaxisTooltipText.innerHTML),N.xaxisTooltipText.style.minWidth=k.width+"px",N.xaxisTooltip.style.left=m+"px",N.xaxisTooltip.style.top=A+"px"}}}},{key:"moveYAxisTooltip",value:function(m){var p=this.w,N=this.ttCtx;N.yaxisTTEls===null&&(N.yaxisTTEls=p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));var A=parseInt(N.ycrosshairsHidden.getAttribute("y1"),10),k=p.globals.translateY+A,P=N.yaxisTTEls[m].getBoundingClientRect().height,D=p.globals.translateYAxisX[m]-2;p.config.yaxis[m].opposite&&(D-=26),k-=P/2,p.globals.ignoreYAxisIndexes.indexOf(m)===-1?(N.yaxisTTEls[m].classList.add("apexcharts-active"),N.yaxisTTEls[m].style.top=k+"px",N.yaxisTTEls[m].style.left=D+p.config.yaxis[m].tooltip.offsetX+"px"):N.yaxisTTEls[m].classList.remove("apexcharts-active")}},{key:"moveTooltip",value:function(m,p){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,A=this.w,k=this.ttCtx,P=k.getElTooltip(),D=k.tooltipRect,V=N!==null?parseFloat(N):1,Z=parseFloat(m)+V+5,ce=parseFloat(p)+V/2;if(Z>A.globals.gridWidth/2&&(Z=Z-D.ttWidth-V-10),Z>A.globals.gridWidth-D.ttWidth-10&&(Z=A.globals.gridWidth-D.ttWidth),Z<-20&&(Z=-20),A.config.tooltip.followCursor){var ue=k.getElGrid().getBoundingClientRect();(Z=k.e.clientX-ue.left)>A.globals.gridWidth/2&&(Z-=k.tooltipRect.ttWidth),(ce=k.e.clientY+A.globals.translateY-ue.top)>A.globals.gridHeight/2&&(ce-=k.tooltipRect.ttHeight)}else A.globals.isBarHorizontal||D.ttHeight/2+ce>A.globals.gridHeight&&(ce=A.globals.gridHeight-D.ttHeight+A.globals.translateY);isNaN(Z)||(Z+=A.globals.translateX,P.style.left=Z+"px",P.style.top=ce+"px")}},{key:"moveMarkers",value:function(m,p){var N=this.w,A=this.ttCtx;if(N.globals.markers.size[m]>0)for(var k=N.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(m,"'] .apexcharts-marker")),P=0;P<k.length;P++)parseInt(k[P].getAttribute("rel"),10)===p&&(A.marker.resetPointsSize(),A.marker.enlargeCurrentPoint(p,k[P]));else A.marker.resetPointsSize(),this.moveDynamicPointOnHover(p,m)}},{key:"moveDynamicPointOnHover",value:function(m,p){var N,A,k,P,D=this.w,V=this.ttCtx,Z=new U(this.ctx),ce=D.globals.pointsArray,ue=V.tooltipUtil.getHoverMarkerSize(p),me=D.config.series[p].type;if(!me||me!=="column"&&me!=="candlestick"&&me!=="boxPlot"){k=(N=ce[p][m])===null||N===void 0?void 0:N[0],P=((A=ce[p][m])===null||A===void 0?void 0:A[1])||0;var Ne=D.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(p,"'] .apexcharts-series-markers path"));if(Ne&&P<D.globals.gridHeight&&P>0){var Ie=Ne.getAttribute("shape"),Le=Z.getMarkerPath(k,P,Ie,1.5*ue);Ne.setAttribute("d",Le)}this.moveXCrosshairs(k),V.fixedTooltip||this.moveTooltip(k,P,ue)}}},{key:"moveDynamicPointsOnHover",value:function(m){var p,N=this.ttCtx,A=N.w,k=0,P=0,D=A.globals.pointsArray,V=new Re(this.ctx),Z=new U(this.ctx);p=V.getActiveConfigSeriesIndex("asc",["line","area","scatter","bubble"]);var ce=N.tooltipUtil.getHoverMarkerSize(p);D[p]&&(k=D[p][m][0],P=D[p][m][1]);var ue=N.tooltipUtil.getAllMarkers();if(ue!==null)for(var me=0;me<A.globals.series.length;me++){var Ne=D[me];if(A.globals.comboCharts&&Ne===void 0&&ue.splice(me,0,null),Ne&&Ne.length){var Ie=D[me][m][1],Le=void 0;ue[me].setAttribute("cx",k);var Xe=ue[me].getAttribute("shape");if(A.config.chart.type==="rangeArea"&&!A.globals.comboCharts){var Oe=m+A.globals.series[me].length;Le=D[me][Oe][1],Ie-=Math.abs(Ie-Le)/2}if(Ie!==null&&!isNaN(Ie)&&Ie<A.globals.gridHeight+ce&&Ie+ce>0){var $e=Z.getMarkerPath(k,Ie,Xe,ce);ue[me].setAttribute("d",$e)}else ue[me].setAttribute("d","")}}this.moveXCrosshairs(k),N.fixedTooltip||this.moveTooltip(k,P||A.globals.gridHeight,ce)}},{key:"moveStickyTooltipOverBars",value:function(m,p){var N=this.w,A=this.ttCtx,k=N.globals.columnSeries?N.globals.columnSeries.length:N.globals.series.length,P=k>=2&&k%2==0?Math.floor(k/2):Math.floor(k/2)+1;N.globals.isBarHorizontal&&(P=new Re(this.ctx).getActiveConfigSeriesIndex("desc")+1);var D=N.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(P,"'] path[j='").concat(m,"'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(P,"'] path[j='").concat(m,"'], .apexcharts-boxPlot-series .apexcharts-series[rel='").concat(P,"'] path[j='").concat(m,"'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(P,"'] path[j='").concat(m,"']"));D||typeof p!="number"||(D=N.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[data\\:realIndex='".concat(p,"'] path[j='").concat(m,`'],
.apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='`).concat(p,"'] path[j='").concat(m,`'],
.apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='`).concat(p,"'] path[j='").concat(m,`'],
.apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='`).concat(p,"'] path[j='").concat(m,"']")));var V=D?parseFloat(D.getAttribute("cx")):0,Z=D?parseFloat(D.getAttribute("cy")):0,ce=D?parseFloat(D.getAttribute("barWidth")):0,ue=A.getElGrid().getBoundingClientRect(),me=D&&(D.classList.contains("apexcharts-candlestick-area")||D.classList.contains("apexcharts-boxPlot-area"));N.globals.isXNumeric?(D&&!me&&(V-=k%2!=0?ce/2:0),D&&me&&N.globals.comboCharts&&(V-=ce/2)):N.globals.isBarHorizontal||(V=A.xAxisTicksPositions[m-1]+A.dataPointsDividedWidth/2,isNaN(V)&&(V=A.xAxisTicksPositions[m]-A.dataPointsDividedWidth/2)),N.globals.isBarHorizontal?Z-=A.tooltipRect.ttHeight:N.config.tooltip.followCursor?Z=A.e.clientY-ue.top-A.tooltipRect.ttHeight/2:Z+A.tooltipRect.ttHeight+15>N.globals.gridHeight&&(Z=N.globals.gridHeight),N.globals.isBarHorizontal||this.moveXCrosshairs(V),A.fixedTooltip||this.moveTooltip(V,Z||N.globals.gridHeight)}}]),Ce}(),Ke=function(){function Ce(m){s(this,Ce),this.w=m.w,this.ttCtx=m,this.ctx=m.ctx,this.tooltipPosition=new Pt(m)}return o(Ce,[{key:"drawDynamicPoints",value:function(){var m=this.w,p=new U(this.ctx),N=new we(this.ctx),A=m.globals.dom.baseEl.querySelectorAll(".apexcharts-series");A=S(A),m.config.chart.stacked&&A.sort(function(ue,me){return parseFloat(ue.getAttribute("data:realIndex"))-parseFloat(me.getAttribute("data:realIndex"))});for(var k=0;k<A.length;k++){var P=A[k].querySelector(".apexcharts-series-markers-wrap");if(P!==null){var D=void 0,V="apexcharts-marker w".concat((Math.random()+1).toString(36).substring(4));m.config.chart.type!=="line"&&m.config.chart.type!=="area"||m.globals.comboCharts||m.config.tooltip.intersect||(V+=" no-pointer-events");var Z=N.getMarkerConfig({cssClass:V,seriesIndex:Number(P.getAttribute("data:realIndex"))});(D=p.drawMarker(0,0,Z)).node.setAttribute("default-marker-size",0);var ce=document.createElementNS(m.globals.SVGNS,"g");ce.classList.add("apexcharts-series-markers"),ce.appendChild(D.node),P.appendChild(ce)}}}},{key:"enlargeCurrentPoint",value:function(m,p){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,k=this.w;k.config.chart.type!=="bubble"&&this.newPointSize(m,p);var P=p.getAttribute("cx"),D=p.getAttribute("cy");if(N!==null&&A!==null&&(P=N,D=A),this.tooltipPosition.moveXCrosshairs(P),!this.fixedTooltip){if(k.config.chart.type==="radar"){var V=this.ttCtx.getElGrid().getBoundingClientRect();P=this.ttCtx.e.clientX-V.left}this.tooltipPosition.moveTooltip(P,D,k.config.markers.hover.size)}}},{key:"enlargePoints",value:function(m){for(var p=this.w,N=this,A=this.ttCtx,k=m,P=p.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),D=p.config.markers.hover.size,V=0;V<P.length;V++){var Z=P[V].getAttribute("rel"),ce=P[V].getAttribute("index");if(D===void 0&&(D=p.globals.markers.size[ce]+p.config.markers.hover.sizeOffset),k===parseInt(Z,10)){N.newPointSize(k,P[V]);var ue=P[V].getAttribute("cx"),me=P[V].getAttribute("cy");N.tooltipPosition.moveXCrosshairs(ue),A.fixedTooltip||N.tooltipPosition.moveTooltip(ue,me,D)}else N.oldPointSize(P[V])}}},{key:"newPointSize",value:function(m,p){var N=this.w,A=N.config.markers.hover.size,k=m===0?p.parentNode.firstChild:p.parentNode.lastChild;if(k.getAttribute("default-marker-size")!=="0"){var P=parseInt(k.getAttribute("index"),10);A===void 0&&(A=N.globals.markers.size[P]+N.config.markers.hover.sizeOffset),A<0&&(A=0);var D=this.ttCtx.tooltipUtil.getPathFromPoint(p,A);p.setAttribute("d",D)}}},{key:"oldPointSize",value:function(m){var p=parseFloat(m.getAttribute("default-marker-size")),N=this.ttCtx.tooltipUtil.getPathFromPoint(m,p);m.setAttribute("d",N)}},{key:"resetPointsSize",value:function(){for(var m=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),p=0;p<m.length;p++){var N=parseFloat(m[p].getAttribute("default-marker-size"));if(F.isNumber(N)&&N>=0){var A=this.ttCtx.tooltipUtil.getPathFromPoint(m[p],N);m[p].setAttribute("d",A)}else m[p].setAttribute("d","M0,0")}}}]),Ce}(),ct=function(){function Ce(m){s(this,Ce),this.w=m.w;var p=this.w;this.ttCtx=m,this.isVerticalGroupedRangeBar=!p.globals.isBarHorizontal&&p.config.chart.type==="rangeBar"&&p.config.plotOptions.bar.rangeBarGroupRows}return o(Ce,[{key:"getAttr",value:function(m,p){return parseFloat(m.target.getAttribute(p))}},{key:"handleHeatTreeTooltip",value:function(m){var p=m.e,N=m.opt,A=m.x,k=m.y,P=m.type,D=this.ttCtx,V=this.w;if(p.target.classList.contains("apexcharts-".concat(P,"-rect"))){var Z=this.getAttr(p,"i"),ce=this.getAttr(p,"j"),ue=this.getAttr(p,"cx"),me=this.getAttr(p,"cy"),Ne=this.getAttr(p,"width"),Ie=this.getAttr(p,"height");if(D.tooltipLabels.drawSeriesTexts({ttItems:N.ttItems,i:Z,j:ce,shared:!1,e:p}),V.globals.capturedSeriesIndex=Z,V.globals.capturedDataPointIndex=ce,A=ue+D.tooltipRect.ttWidth/2+Ne,k=me+D.tooltipRect.ttHeight/2-Ie/2,D.tooltipPosition.moveXCrosshairs(ue+Ne/2),A>V.globals.gridWidth/2&&(A=ue-D.tooltipRect.ttWidth/2+Ne),D.w.config.tooltip.followCursor){var Le=V.globals.dom.elWrap.getBoundingClientRect();A=V.globals.clientX-Le.left-(A>V.globals.gridWidth/2?D.tooltipRect.ttWidth:0),k=V.globals.clientY-Le.top-(k>V.globals.gridHeight/2?D.tooltipRect.ttHeight:0)}}return{x:A,y:k}}},{key:"handleMarkerTooltip",value:function(m){var p,N,A=m.e,k=m.opt,P=m.x,D=m.y,V=this.w,Z=this.ttCtx;if(A.target.classList.contains("apexcharts-marker")){var ce=parseInt(k.paths.getAttribute("cx"),10),ue=parseInt(k.paths.getAttribute("cy"),10),me=parseFloat(k.paths.getAttribute("val"));if(N=parseInt(k.paths.getAttribute("rel"),10),p=parseInt(k.paths.parentNode.parentNode.parentNode.getAttribute("rel"),10)-1,Z.intersect){var Ne=F.findAncestor(k.paths,"apexcharts-series");Ne&&(p=parseInt(Ne.getAttribute("data:realIndex"),10))}if(Z.tooltipLabels.drawSeriesTexts({ttItems:k.ttItems,i:p,j:N,shared:!Z.showOnIntersect&&V.config.tooltip.shared,e:A}),A.type==="mouseup"&&Z.markerClick(A,p,N),V.globals.capturedSeriesIndex=p,V.globals.capturedDataPointIndex=N,P=ce,D=ue+V.globals.translateY-1.4*Z.tooltipRect.ttHeight,Z.w.config.tooltip.followCursor){var Ie=Z.getElGrid().getBoundingClientRect();D=Z.e.clientY+V.globals.translateY-Ie.top}me<0&&(D=ue),Z.marker.enlargeCurrentPoint(N,k.paths,P,D)}return{x:P,y:D}}},{key:"handleBarTooltip",value:function(m){var p,N,A=m.e,k=m.opt,P=this.w,D=this.ttCtx,V=D.getElTooltip(),Z=0,ce=0,ue=0,me=this.getBarTooltipXY({e:A,opt:k});p=me.i;var Ne=me.j;P.globals.capturedSeriesIndex=p,P.globals.capturedDataPointIndex=Ne,P.globals.isBarHorizontal&&D.tooltipUtil.hasBars()||!P.config.tooltip.shared?(ce=me.x,ue=me.y,N=Array.isArray(P.config.stroke.width)?P.config.stroke.width[p]:P.config.stroke.width,Z=ce):P.globals.comboCharts||P.config.tooltip.shared||(Z/=2),isNaN(ue)&&(ue=P.globals.svgHeight-D.tooltipRect.ttHeight);var Ie=parseInt(k.paths.parentNode.getAttribute("data:realIndex"),10);if(P.globals.isMultipleYAxis?P.config.yaxis[Ie]&&P.config.yaxis[Ie].reversed:P.config.yaxis[0].reversed,ce+D.tooltipRect.ttWidth>P.globals.gridWidth?ce-=D.tooltipRect.ttWidth:ce<0&&(ce=0),D.w.config.tooltip.followCursor){var Le=D.getElGrid().getBoundingClientRect();ue=D.e.clientY-Le.top}D.tooltip===null&&(D.tooltip=P.globals.dom.baseEl.querySelector(".apexcharts-tooltip")),P.config.tooltip.shared||(P.globals.comboBarCount>0?D.tooltipPosition.moveXCrosshairs(Z+N/2):D.tooltipPosition.moveXCrosshairs(Z)),!D.fixedTooltip&&(!P.config.tooltip.shared||P.globals.isBarHorizontal&&D.tooltipUtil.hasBars())&&(ue=ue+P.globals.translateY-D.tooltipRect.ttHeight/2,V.style.left=ce+P.globals.translateX+"px",V.style.top=ue+"px")}},{key:"getBarTooltipXY",value:function(m){var p=this,N=m.e,A=m.opt,k=this.w,P=null,D=this.ttCtx,V=0,Z=0,ce=0,ue=0,me=0,Ne=N.target.classList;if(Ne.contains("apexcharts-bar-area")||Ne.contains("apexcharts-candlestick-area")||Ne.contains("apexcharts-boxPlot-area")||Ne.contains("apexcharts-rangebar-area")){var Ie=N.target,Le=Ie.getBoundingClientRect(),Xe=A.elGrid.getBoundingClientRect(),Oe=Le.height;me=Le.height;var $e=Le.width,ae=parseInt(Ie.getAttribute("cx"),10),he=parseInt(Ie.getAttribute("cy"),10);ue=parseFloat(Ie.getAttribute("barWidth"));var Pe=N.type==="touchmove"?N.touches[0].clientX:N.clientX;P=parseInt(Ie.getAttribute("j"),10),V=parseInt(Ie.parentNode.getAttribute("rel"),10)-1;var Ve=Ie.getAttribute("data-range-y1"),Te=Ie.getAttribute("data-range-y2");k.globals.comboCharts&&(V=parseInt(Ie.parentNode.getAttribute("data:realIndex"),10));var Ze=function(wt){return k.globals.isXNumeric?ae-$e/2:p.isVerticalGroupedRangeBar?ae+$e/2:ae-D.dataPointsDividedWidth+$e/2},it=function(){return he-D.dataPointsDividedHeight+Oe/2-D.tooltipRect.ttHeight/2};D.tooltipLabels.drawSeriesTexts({ttItems:A.ttItems,i:V,j:P,y1:Ve?parseInt(Ve,10):null,y2:Te?parseInt(Te,10):null,shared:!D.showOnIntersect&&k.config.tooltip.shared,e:N}),k.config.tooltip.followCursor?k.globals.isBarHorizontal?(Z=Pe-Xe.left+15,ce=it()):(Z=Ze(),ce=N.clientY-Xe.top-D.tooltipRect.ttHeight/2-15):k.globals.isBarHorizontal?((Z=ae)<D.xyRatios.baseLineInvertedY&&(Z=ae-D.tooltipRect.ttWidth),ce=it()):(Z=Ze(),ce=he)}return{x:Z,y:ce,barHeight:me,barWidth:ue,i:V,j:P}}}]),Ce}(),Nt=function(){function Ce(m){s(this,Ce),this.w=m.w,this.ttCtx=m}return o(Ce,[{key:"drawXaxisTooltip",value:function(){var m=this.w,p=this.ttCtx,N=m.config.xaxis.position==="bottom";p.xaxisOffY=N?m.globals.gridHeight+1:-m.globals.xAxisHeight-m.config.xaxis.axisTicks.height+3;var A=N?"apexcharts-xaxistooltip apexcharts-xaxistooltip-bottom":"apexcharts-xaxistooltip apexcharts-xaxistooltip-top",k=m.globals.dom.elWrap;p.isXAxisTooltipEnabled&&m.globals.dom.baseEl.querySelector(".apexcharts-xaxistooltip")===null&&(p.xaxisTooltip=document.createElement("div"),p.xaxisTooltip.setAttribute("class",A+" apexcharts-theme-"+m.config.tooltip.theme),k.appendChild(p.xaxisTooltip),p.xaxisTooltipText=document.createElement("div"),p.xaxisTooltipText.classList.add("apexcharts-xaxistooltip-text"),p.xaxisTooltipText.style.fontFamily=m.config.xaxis.tooltip.style.fontFamily||m.config.chart.fontFamily,p.xaxisTooltipText.style.fontSize=m.config.xaxis.tooltip.style.fontSize,p.xaxisTooltip.appendChild(p.xaxisTooltipText))}},{key:"drawYaxisTooltip",value:function(){for(var m=this.w,p=this.ttCtx,N=0;N<m.config.yaxis.length;N++){var A=m.config.yaxis[N].opposite||m.config.yaxis[N].crosshairs.opposite;p.yaxisOffX=A?m.globals.gridWidth+1:1;var k="apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(N,A?" apexcharts-yaxistooltip-right":" apexcharts-yaxistooltip-left"),P=m.globals.dom.elWrap;m.globals.dom.baseEl.querySelector(".apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(N))===null&&(p.yaxisTooltip=document.createElement("div"),p.yaxisTooltip.setAttribute("class",k+" apexcharts-theme-"+m.config.tooltip.theme),P.appendChild(p.yaxisTooltip),N===0&&(p.yaxisTooltipText=[]),p.yaxisTooltipText[N]=document.createElement("div"),p.yaxisTooltipText[N].classList.add("apexcharts-yaxistooltip-text"),p.yaxisTooltip.appendChild(p.yaxisTooltipText[N]))}}},{key:"setXCrosshairWidth",value:function(){var m=this.w,p=this.ttCtx,N=p.getElXCrosshairs();if(p.xcrosshairsWidth=parseInt(m.config.xaxis.crosshairs.width,10),m.globals.comboCharts){var A=m.globals.dom.baseEl.querySelector(".apexcharts-bar-area");if(A!==null&&m.config.xaxis.crosshairs.width==="barWidth"){var k=parseFloat(A.getAttribute("barWidth"));p.xcrosshairsWidth=k}else if(m.config.xaxis.crosshairs.width==="tickWidth"){var P=m.globals.labels.length;p.xcrosshairsWidth=m.globals.gridWidth/P}}else if(m.config.xaxis.crosshairs.width==="tickWidth"){var D=m.globals.labels.length;p.xcrosshairsWidth=m.globals.gridWidth/D}else if(m.config.xaxis.crosshairs.width==="barWidth"){var V=m.globals.dom.baseEl.querySelector(".apexcharts-bar-area");if(V!==null){var Z=parseFloat(V.getAttribute("barWidth"));p.xcrosshairsWidth=Z}else p.xcrosshairsWidth=1}m.globals.isBarHorizontal&&(p.xcrosshairsWidth=0),N!==null&&p.xcrosshairsWidth>0&&N.setAttribute("width",p.xcrosshairsWidth)}},{key:"handleYCrosshair",value:function(){var m=this.w,p=this.ttCtx;p.ycrosshairs=m.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs"),p.ycrosshairsHidden=m.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs-hidden")}},{key:"drawYaxisTooltipText",value:function(m,p,N){var A=this.ttCtx,k=this.w,P=k.globals,D=P.seriesYAxisMap[m];if(A.yaxisTooltips[m]&&D.length>0){var V=P.yLabelFormatters[m],Z=A.getElGrid().getBoundingClientRect(),ce=D[0],ue=0;N.yRatio.length>1&&(ue=ce);var me=(p-Z.top)*N.yRatio[ue],Ne=P.maxYArr[ce]-P.minYArr[ce],Ie=P.minYArr[ce]+(Ne-me);k.config.yaxis[m].reversed&&(Ie=P.maxYArr[ce]-(Ne-me)),A.tooltipPosition.moveYCrosshairs(p-Z.top),A.yaxisTooltipText[m].innerHTML=V(Ie),A.tooltipPosition.moveYAxisTooltip(m)}}}]),Ce}(),Ht=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w;var p=this.w;this.tConfig=p.config.tooltip,this.tooltipUtil=new xt(this),this.tooltipLabels=new We(this),this.tooltipPosition=new Pt(this),this.marker=new Ke(this),this.intersect=new ct(this),this.axesTooltip=new Nt(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(Ce,[{key:"getElTooltip",value:function(m){return m||(m=this),m.w.globals.dom.baseEl?m.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(m){var p=this.w;this.xyRatios=m,this.isXAxisTooltipEnabled=p.config.xaxis.tooltip.enabled&&p.globals.axisCharts,this.yaxisTooltips=p.config.yaxis.map(function(P,D){return!!(P.show&&P.tooltip.enabled&&p.globals.axisCharts)}),this.allTooltipSeriesGroups=[],p.globals.axisCharts||(this.showTooltipTitle=!1);var N=document.createElement("div");if(N.classList.add("apexcharts-tooltip"),p.config.tooltip.cssClass&&N.classList.add(p.config.tooltip.cssClass),N.classList.add("apexcharts-theme-".concat(this.tConfig.theme)),p.globals.dom.elWrap.appendChild(N),p.globals.axisCharts){this.axesTooltip.drawXaxisTooltip(),this.axesTooltip.drawYaxisTooltip(),this.axesTooltip.setXCrosshairWidth(),this.axesTooltip.handleYCrosshair();var A=new dt(this.ctx);this.xAxisTicksPositions=A.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,N.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(m){for(var p=this,N=this.w,A=[],k=this.getElTooltip(),P=function(V){var Z=document.createElement("div");Z.classList.add("apexcharts-tooltip-series-group","apexcharts-tooltip-series-group-".concat(V)),Z.style.order=N.config.tooltip.inverseOrder?m-V:V+1;var ce=document.createElement("span");ce.classList.add("apexcharts-tooltip-marker"),ce.style.backgroundColor=N.globals.colors[V],Z.appendChild(ce);var ue=document.createElement("div");ue.classList.add("apexcharts-tooltip-text"),ue.style.fontFamily=p.tConfig.style.fontFamily||N.config.chart.fontFamily,ue.style.fontSize=p.tConfig.style.fontSize,["y","goals","z"].forEach(function(me){var Ne=document.createElement("div");Ne.classList.add("apexcharts-tooltip-".concat(me,"-group"));var Ie=document.createElement("span");Ie.classList.add("apexcharts-tooltip-text-".concat(me,"-label")),Ne.appendChild(Ie);var Le=document.createElement("span");Le.classList.add("apexcharts-tooltip-text-".concat(me,"-value")),Ne.appendChild(Le),ue.appendChild(Ne)}),Z.appendChild(ue),k.appendChild(Z),A.push(Z)},D=0;D<m;D++)P(D);return A}},{key:"addSVGEvents",value:function(){var m=this.w,p=m.config.chart.type,N=this.getElTooltip(),A=!(p!=="bar"&&p!=="candlestick"&&p!=="boxPlot"&&p!=="rangeBar"),k=p==="area"||p==="line"||p==="scatter"||p==="bubble"||p==="radar",P=m.globals.dom.Paper.node,D=this.getElGrid();D&&(this.seriesBound=D.getBoundingClientRect());var V,Z=[],ce=[],ue={hoverArea:P,elGrid:D,tooltipEl:N,tooltipY:Z,tooltipX:ce,ttItems:this.ttItems};if(m.globals.axisCharts&&(k?V=m.globals.dom.baseEl.querySelectorAll(".apexcharts-series[data\\:longestSeries='true'] .apexcharts-marker"):A?V=m.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"||(V=m.globals.dom.baseEl.querySelectorAll(".apexcharts-series .apexcharts-heatmap, .apexcharts-series .apexcharts-treemap")),V&&V.length))for(var me=0;me<V.length;me++)Z.push(V[me].getAttribute("cy")),ce.push(V[me].getAttribute("cx"));if(m.globals.xyCharts&&!this.showOnIntersect||m.globals.comboCharts&&!this.showOnIntersect||A&&this.tooltipUtil.hasBars()&&this.tConfig.shared)this.addPathsEventListeners([P],ue);else if(A&&!m.globals.comboCharts||k&&this.showOnIntersect)this.addDatapointEventsListeners(ue);else if(!m.globals.axisCharts||p==="heatmap"||p==="treemap"){var Ne=m.globals.dom.baseEl.querySelectorAll(".apexcharts-series");this.addPathsEventListeners(Ne,ue)}if(this.showOnIntersect){var Ie=m.globals.dom.baseEl.querySelectorAll(".apexcharts-line-series .apexcharts-marker, .apexcharts-area-series .apexcharts-marker");Ie.length>0&&this.addPathsEventListeners(Ie,ue),this.tooltipUtil.hasBars()&&!this.tConfig.shared&&this.addDatapointEventsListeners(ue)}}},{key:"drawFixedTooltipRect",value:function(){var m=this.w,p=this.getElTooltip(),N=p.getBoundingClientRect(),A=N.width+10,k=N.height+10,P=this.tConfig.fixed.offsetX,D=this.tConfig.fixed.offsetY,V=this.tConfig.fixed.position.toLowerCase();return V.indexOf("right")>-1&&(P=P+m.globals.svgWidth-A+10),V.indexOf("bottom")>-1&&(D=D+m.globals.svgHeight-k-10),p.style.left=P+"px",p.style.top=D+"px",{x:P,y:D,ttWidth:A,ttHeight:k}}},{key:"addDatapointEventsListeners",value:function(m){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,m)}},{key:"addPathsEventListeners",value:function(m,p){for(var N=this,A=function(P){var D={paths:m[P],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(V){return m[P].addEventListener(V,N.onSeriesHover.bind(N,D),{capture:!1,passive:!0})})},k=0;k<m.length;k++)A(k)}},{key:"onSeriesHover",value:function(m,p){var N=this,A=Date.now()-this.lastHoverTime;A>=100?this.seriesHover(m,p):(clearTimeout(this.seriesHoverTimeout),this.seriesHoverTimeout=setTimeout(function(){N.seriesHover(m,p)},100-A))}},{key:"seriesHover",value:function(m,p){var N=this;this.lastHoverTime=Date.now();var A=[],k=this.w;k.config.chart.group&&(A=this.ctx.getGroupedCharts()),k.globals.axisCharts&&(k.globals.minX===-1/0&&k.globals.maxX===1/0||k.globals.dataPoints===0)||(A.length?A.forEach(function(P){var D=N.getElTooltip(P),V={paths:m.paths,tooltipEl:D,tooltipY:m.tooltipY,tooltipX:m.tooltipX,elGrid:m.elGrid,hoverArea:m.hoverArea,ttItems:P.w.globals.tooltip.ttItems};P.w.globals.minX===N.w.globals.minX&&P.w.globals.maxX===N.w.globals.maxX&&P.w.globals.tooltip.seriesHoverByContext({chartCtx:P,ttCtx:P.w.globals.tooltip,opt:V,e:p})}):this.seriesHoverByContext({chartCtx:this.ctx,ttCtx:this.w.globals.tooltip,opt:m,e:p}))}},{key:"seriesHoverByContext",value:function(m){var p=m.chartCtx,N=m.ttCtx,A=m.opt,k=m.e,P=p.w,D=this.getElTooltip(p);D&&(N.tooltipRect={x:0,y:0,ttWidth:D.getBoundingClientRect().width,ttHeight:D.getBoundingClientRect().height},N.e=k,N.tooltipUtil.hasBars()&&!P.globals.comboCharts&&!N.isBarShared&&this.tConfig.onDatasetHover.highlightDataSeries&&new Re(p).toggleSeriesOnHover(k,k.target.parentNode),N.fixedTooltip&&N.drawFixedTooltipRect(),P.globals.axisCharts?N.axisChartsTooltips({e:k,opt:A,tooltipRect:N.tooltipRect}):N.nonAxisChartsTooltips({e:k,opt:A,tooltipRect:N.tooltipRect}))}},{key:"axisChartsTooltips",value:function(m){var p,N,A=m.e,k=m.opt,P=this.w,D=k.elGrid.getBoundingClientRect(),V=A.type==="touchmove"?A.touches[0].clientX:A.clientX,Z=A.type==="touchmove"?A.touches[0].clientY:A.clientY;if(this.clientY=Z,this.clientX=V,P.globals.capturedSeriesIndex=-1,P.globals.capturedDataPointIndex=-1,Z<D.top||Z>D.top+D.height)this.handleMouseOut(k);else{if(Array.isArray(this.tConfig.enabledOnSeries)&&!P.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(),me=this.getElXCrosshairs(),Ne=[];P.config.chart.group&&(Ne=this.ctx.getSyncedCharts());var Ie=P.globals.xyCharts||P.config.chart.type==="bar"&&!P.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&this.tConfig.shared||P.globals.comboCharts&&this.tooltipUtil.hasBars();if(A.type==="mousemove"||A.type==="touchmove"||A.type==="mouseup"){if(P.globals.collapsedSeries.length+P.globals.ancillaryCollapsedSeries.length===P.globals.series.length)return;me!==null&&me.classList.add("apexcharts-active");var Le=this.yaxisTooltips.filter(function($e){return $e===!0});if(this.ycrosshairs!==null&&Le.length&&this.ycrosshairs.classList.add("apexcharts-active"),Ie&&!this.showOnIntersect||Ne.length>1)this.handleStickyTooltip(A,V,Z,k);else if(P.config.chart.type==="heatmap"||P.config.chart.type==="treemap"){var Xe=this.intersect.handleHeatTreeTooltip({e:A,opt:k,x:p,y:N,type:P.config.chart.type});p=Xe.x,N=Xe.y,ue.style.left=p+"px",ue.style.top=N+"px"}else this.tooltipUtil.hasBars()&&this.intersect.handleBarTooltip({e:A,opt:k}),this.tooltipUtil.hasMarkers()&&this.intersect.handleMarkerTooltip({e:A,opt:k,x:p,y:N});if(this.yaxisTooltips.length)for(var Oe=0;Oe<P.config.yaxis.length;Oe++)this.axesTooltip.drawYaxisTooltipText(Oe,Z,this.xyRatios);P.globals.dom.baseEl.classList.add("apexcharts-tooltip-active"),k.tooltipEl.classList.add("apexcharts-active")}else A.type!=="mouseout"&&A.type!=="touchend"||this.handleMouseOut(k)}}},{key:"nonAxisChartsTooltips",value:function(m){var p=m.e,N=m.opt,A=m.tooltipRect,k=this.w,P=N.paths.getAttribute("rel"),D=this.getElTooltip(),V=k.globals.dom.elWrap.getBoundingClientRect();if(p.type==="mousemove"||p.type==="touchmove"){k.globals.dom.baseEl.classList.add("apexcharts-tooltip-active"),D.classList.add("apexcharts-active"),this.tooltipLabels.drawSeriesTexts({ttItems:N.ttItems,i:parseInt(P,10)-1,shared:!1});var Z=k.globals.clientX-V.left-A.ttWidth/2,ce=k.globals.clientY-V.top-A.ttHeight-10;if(D.style.left=Z+"px",D.style.top=ce+"px",k.config.legend.tooltipHoverFormatter){var ue=P-1,me=(0,k.config.legend.tooltipHoverFormatter)(this.legendLabels[ue].getAttribute("data:default-text"),{seriesIndex:ue,dataPointIndex:ue,w:k});this.legendLabels[ue].innerHTML=me}}else p.type!=="mouseout"&&p.type!=="touchend"||(D.classList.remove("apexcharts-active"),k.globals.dom.baseEl.classList.remove("apexcharts-tooltip-active"),k.config.legend.tooltipHoverFormatter&&this.legendLabels.forEach(function(Ne){var Ie=Ne.getAttribute("data:default-text");Ne.innerHTML=decodeURIComponent(Ie)}))}},{key:"handleStickyTooltip",value:function(m,p,N,A){var k=this.w,P=this.tooltipUtil.getNearestValues({context:this,hoverArea:A.hoverArea,elGrid:A.elGrid,clientX:p,clientY:N}),D=P.j,V=P.capturedSeries;k.globals.collapsedSeriesIndices.includes(V)&&(V=null);var Z=A.elGrid.getBoundingClientRect();if(P.hoverX<0||P.hoverX>Z.width)this.handleMouseOut(A);else if(V!==null)this.handleStickyCapturedSeries(m,V,A,D);else if(this.tooltipUtil.isXoverlap(D)||k.globals.isBarHorizontal){var ce=k.globals.series.findIndex(function(ue,me){return!k.globals.collapsedSeriesIndices.includes(me)});this.create(m,this,ce,D,A.ttItems)}}},{key:"handleStickyCapturedSeries",value:function(m,p,N,A){var k=this.w;if(!this.tConfig.shared&&k.globals.series[p][A]===null)return void this.handleMouseOut(N);if(k.globals.series[p][A]!==void 0)this.tConfig.shared&&this.tooltipUtil.isXoverlap(A)&&this.tooltipUtil.isInitialSeriesSameLen()?this.create(m,this,p,A,N.ttItems):this.create(m,this,p,A,N.ttItems,!1);else if(this.tooltipUtil.isXoverlap(A)){var P=k.globals.series.findIndex(function(D,V){return!k.globals.collapsedSeriesIndices.includes(V)});this.create(m,this,P,A,N.ttItems)}}},{key:"deactivateHoverFilter",value:function(){for(var m=this.w,p=new U(this.ctx),N=m.globals.dom.Paper.select(".apexcharts-bar-area"),A=0;A<N.length;A++)p.pathMouseLeave(N[A])}},{key:"handleMouseOut",value:function(m){var p=this.w,N=this.getElXCrosshairs();if(p.globals.dom.baseEl.classList.remove("apexcharts-tooltip-active"),m.tooltipEl.classList.remove("apexcharts-active"),this.deactivateHoverFilter(),p.config.chart.type!=="bubble"&&this.marker.resetPointsSize(),N!==null&&N.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 A=0;A<this.yaxisTTEls.length;A++)this.yaxisTTEls[A].classList.remove("apexcharts-active")}p.config.legend.tooltipHoverFormatter&&this.legendLabels.forEach(function(k){var P=k.getAttribute("data:default-text");k.innerHTML=decodeURIComponent(P)})}},{key:"markerClick",value:function(m,p,N){var A=this.w;typeof A.config.chart.events.markerClick=="function"&&A.config.chart.events.markerClick(m,this.ctx,{seriesIndex:p,dataPointIndex:N,w:A}),this.ctx.events.fireEvent("markerClick",[m,this.ctx,{seriesIndex:p,dataPointIndex:N,w:A}])}},{key:"create",value:function(m,p,N,A,k){var P,D,V,Z,ce,ue,me,Ne,Ie,Le,Xe,Oe,$e,ae,he,Pe,Ve=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,Te=this.w,Ze=p;m.type==="mouseup"&&this.markerClick(m,N,A),Ve===null&&(Ve=this.tConfig.shared);var it=this.tooltipUtil.hasMarkers(N),wt=this.tooltipUtil.getElBars();if(Te.config.legend.tooltipHoverFormatter){var Dt=Te.config.legend.tooltipHoverFormatter,Qt=Array.from(this.legendLabels);Qt.forEach(function(br){var Br=br.getAttribute("data:default-text");br.innerHTML=decodeURIComponent(Br)});for(var xn=0;xn<Qt.length;xn++){var pn=Qt[xn],An=parseInt(pn.getAttribute("i"),10),or=decodeURIComponent(pn.getAttribute("data:default-text")),$t=Dt(or,{seriesIndex:Ve?An:N,dataPointIndex:A,w:Te});if(Ve)pn.innerHTML=Te.globals.collapsedSeriesIndices.indexOf(An)<0?$t:or;else if(pn.innerHTML=An===N?$t:or,N===An)break}}var bt=y(y({ttItems:k,i:N,j:A},((P=Te.globals.seriesRange)===null||P===void 0||(D=P[N])===null||D===void 0||(V=D[A])===null||V===void 0||(Z=V.y[0])===null||Z===void 0?void 0:Z.y1)!==void 0&&{y1:(ce=Te.globals.seriesRange)===null||ce===void 0||(ue=ce[N])===null||ue===void 0||(me=ue[A])===null||me===void 0||(Ne=me.y[0])===null||Ne===void 0?void 0:Ne.y1}),((Ie=Te.globals.seriesRange)===null||Ie===void 0||(Le=Ie[N])===null||Le===void 0||(Xe=Le[A])===null||Xe===void 0||(Oe=Xe.y[0])===null||Oe===void 0?void 0:Oe.y2)!==void 0&&{y2:($e=Te.globals.seriesRange)===null||$e===void 0||(ae=$e[N])===null||ae===void 0||(he=ae[A])===null||he===void 0||(Pe=he.y[0])===null||Pe===void 0?void 0:Pe.y2});if(Ve){if(Ze.tooltipLabels.drawSeriesTexts(y(y({},bt),{},{shared:!this.showOnIntersect&&this.tConfig.shared})),it)Te.globals.markers.largestSize>0?Ze.marker.enlargePoints(A):Ze.tooltipPosition.moveDynamicPointsOnHover(A);else if(this.tooltipUtil.hasBars()&&(this.barSeriesHeight=this.tooltipUtil.getBarsHeight(wt),this.barSeriesHeight>0)){var rn=new U(this.ctx),ur=Te.globals.dom.Paper.select(".apexcharts-bar-area[j='".concat(A,"']"));this.deactivateHoverFilter(),this.tooltipPosition.moveStickyTooltipOverBars(A,N);for(var gr=0;gr<ur.length;gr++)rn.pathMouseEnter(ur[gr])}}else Ze.tooltipLabels.drawSeriesTexts(y({shared:!1},bt)),this.tooltipUtil.hasBars()&&Ze.tooltipPosition.moveStickyTooltipOverBars(A,N),it&&Ze.tooltipPosition.moveMarkers(N,A)}}]),Ce}(),Rt=function(){function Ce(m){s(this,Ce),this.w=m.w,this.barCtx=m,this.totalFormatter=this.w.config.plotOptions.bar.dataLabels.total.formatter,this.totalFormatter||(this.totalFormatter=this.w.config.dataLabels.formatter)}return o(Ce,[{key:"handleBarDataLabels",value:function(m){var p,N,A=m.x,k=m.y,P=m.y1,D=m.y2,V=m.i,Z=m.j,ce=m.realIndex,ue=m.columnGroupIndex,me=m.series,Ne=m.barHeight,Ie=m.barWidth,Le=m.barXPosition,Xe=m.barYPosition,Oe=m.visibleSeries,$e=m.renderedPath,ae=this.w,he=new U(this.barCtx.ctx),Pe=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[ce]:this.barCtx.strokeWidth;ae.globals.isXNumeric&&!ae.globals.isBarHorizontal?(p=A+parseFloat(Ie*(Oe+1)),N=k+parseFloat(Ne*(Oe+1))-Pe):(p=A+parseFloat(Ie*Oe),N=k+parseFloat(Ne*Oe));var Ve,Te=null,Ze=A,it=k,wt={},Dt=ae.config.dataLabels,Qt=this.barCtx.barOptions.dataLabels,xn=this.barCtx.barOptions.dataLabels.total;Xe!==void 0&&this.barCtx.isRangeBar&&(N=Xe,it=Xe),Le!==void 0&&this.barCtx.isVerticalGroupedRangeBar&&(p=Le,Ze=Le);var pn=Dt.offsetX,An=Dt.offsetY,or={width:0,height:0};if(ae.config.dataLabels.enabled){var $t=ae.globals.series[V][Z];or=he.getTextRects(ae.config.dataLabels.formatter?ae.config.dataLabels.formatter($t,y(y({},ae),{},{seriesIndex:V,dataPointIndex:Z,w:ae})):ae.globals.yLabelFormatters[0]($t),parseFloat(Dt.style.fontSize))}var bt={x:A,y:k,i:V,j:Z,realIndex:ce,columnGroupIndex:ue,renderedPath:$e,bcx:p,bcy:N,barHeight:Ne,barWidth:Ie,textRects:or,strokeWidth:Pe,dataLabelsX:Ze,dataLabelsY:it,dataLabelsConfig:Dt,barDataLabelsConfig:Qt,barTotalDataLabelsConfig:xn,offX:pn,offY:An};return wt=this.barCtx.isHorizontal?this.calculateBarsDataLabelsPosition(bt):this.calculateColumnsDataLabelsPosition(bt),$e.attr({cy:wt.bcy,cx:wt.bcx,j:Z,val:ae.globals.series[V][Z],barHeight:Ne,barWidth:Ie}),Ve=this.drawCalculatedDataLabels({x:wt.dataLabelsX,y:wt.dataLabelsY,val:this.barCtx.isRangeBar?[P,D]:ae.config.chart.stackType==="100%"?me[ce][Z]:ae.globals.series[ce][Z],i:ce,j:Z,barWidth:Ie,barHeight:Ne,textRects:or,dataLabelsConfig:Dt}),ae.config.chart.stacked&&xn.enabled&&(Te=this.drawTotalDataLabels({x:wt.totalDataLabelsX,y:wt.totalDataLabelsY,barWidth:Ie,barHeight:Ne,realIndex:ce,textAnchor:wt.totalDataLabelsAnchor,val:this.getStackedTotalDataLabel({realIndex:ce,j:Z}),dataLabelsConfig:Dt,barTotalDataLabelsConfig:xn})),{dataLabels:Ve,totalDataLabels:Te}}},{key:"getStackedTotalDataLabel",value:function(m){var p=m.realIndex,N=m.j,A=this.w,k=this.barCtx.stackedSeriesTotals[N];return this.totalFormatter&&(k=this.totalFormatter(k,y(y({},A),{},{seriesIndex:p,dataPointIndex:N,w:A}))),k}},{key:"calculateColumnsDataLabelsPosition",value:function(m){var p=this.w,N=m.i,A=m.j,k=m.realIndex;m.columnGroupIndex;var P,D,V=m.y,Z=m.bcx,ce=m.barWidth,ue=m.barHeight,me=m.textRects,Ne=m.dataLabelsX,Ie=m.dataLabelsY,Le=m.dataLabelsConfig,Xe=m.barDataLabelsConfig,Oe=m.barTotalDataLabelsConfig,$e=m.strokeWidth,ae=m.offX,he=m.offY,Pe=Z;ue=Math.abs(ue);var Ve=p.config.plotOptions.bar.dataLabels.orientation==="vertical",Te=this.barCtx.barHelpers.getZeroValueEncounters({i:N,j:A}).zeroEncounters;Z-=$e/2;var Ze=p.globals.gridWidth/p.globals.dataPoints;this.barCtx.isVerticalGroupedRangeBar?Ne+=ce/2:(Ne=p.globals.isXNumeric?Z-ce/2+ae:Z-Ze+ce/2+ae,Te>0&&p.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(Ne-=ce*Te)),Ve&&(Ne=Ne+me.height/2-$e/2-2);var it=p.globals.series[N][A]<0,wt=V;switch(this.barCtx.isReversed&&(wt=V+(it?ue:-ue)),Xe.position){case"center":Ie=Ve?it?wt-ue/2+he:wt+ue/2-he:it?wt-ue/2+me.height/2+he:wt+ue/2+me.height/2-he;break;case"bottom":Ie=Ve?it?wt-ue+he:wt+ue-he:it?wt-ue+me.height+$e+he:wt+ue-me.height/2+$e-he;break;case"top":Ie=Ve?it?wt+he:wt-he:it?wt-me.height/2-he:wt+me.height+he}if(this.barCtx.lastActiveBarSerieIndex===k&&Oe.enabled){var Dt=new U(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:k,j:A}),Le.fontSize);P=it?wt-Dt.height/2-he-Oe.offsetY+18:wt+Dt.height+he+Oe.offsetY-18;var Qt=Ze;D=Pe+(p.globals.isXNumeric?-ce*p.globals.barGroups.length/2:p.globals.barGroups.length*ce/2-(p.globals.barGroups.length-1)*ce-Qt)+Oe.offsetX}return p.config.chart.stacked||(Ie<0?Ie=0+$e:Ie+me.height/3>p.globals.gridHeight&&(Ie=p.globals.gridHeight-$e)),{bcx:Z,bcy:V,dataLabelsX:Ne,dataLabelsY:Ie,totalDataLabelsX:D,totalDataLabelsY:P,totalDataLabelsAnchor:"middle"}}},{key:"calculateBarsDataLabelsPosition",value:function(m){var p=this.w,N=m.x,A=m.i,k=m.j,P=m.realIndex,D=m.bcy,V=m.barHeight,Z=m.barWidth,ce=m.textRects,ue=m.dataLabelsX,me=m.strokeWidth,Ne=m.dataLabelsConfig,Ie=m.barDataLabelsConfig,Le=m.barTotalDataLabelsConfig,Xe=m.offX,Oe=m.offY,$e=p.globals.gridHeight/p.globals.dataPoints;Z=Math.abs(Z);var ae,he,Pe=D-(this.barCtx.isRangeBar?0:$e)+V/2+ce.height/2+Oe-3,Ve="start",Te=p.globals.series[A][k]<0,Ze=N;switch(this.barCtx.isReversed&&(Ze=N+(Te?-Z:Z),Ve=Te?"start":"end"),Ie.position){case"center":ue=Te?Ze+Z/2-Xe:Math.max(ce.width/2,Ze-Z/2)+Xe;break;case"bottom":ue=Te?Ze+Z-me-Xe:Ze-Z+me+Xe;break;case"top":ue=Te?Ze-me-Xe:Ze-me+Xe}if(this.barCtx.lastActiveBarSerieIndex===P&&Le.enabled){var it=new U(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:P,j:k}),Ne.fontSize);Te?(ae=Ze-me-Xe-Le.offsetX,Ve="end"):ae=Ze+Xe+Le.offsetX+(this.barCtx.isReversed?-(Z+me):me),he=Pe-ce.height/2+it.height/2+Le.offsetY+me}return p.config.chart.stacked||(Ne.textAnchor==="start"?ue-ce.width<0?ue=Te?ce.width+me:me:ue+ce.width>p.globals.gridWidth&&(ue=Te?p.globals.gridWidth-me:p.globals.gridWidth-ce.width-me):Ne.textAnchor==="middle"?ue-ce.width/2<0?ue=ce.width/2+me:ue+ce.width/2>p.globals.gridWidth&&(ue=p.globals.gridWidth-ce.width/2-me):Ne.textAnchor==="end"&&(ue<1?ue=ce.width+me:ue+1>p.globals.gridWidth&&(ue=p.globals.gridWidth-ce.width-me))),{bcx:N,bcy:D,dataLabelsX:ue,dataLabelsY:Pe,totalDataLabelsX:ae,totalDataLabelsY:he,totalDataLabelsAnchor:Ve}}},{key:"drawCalculatedDataLabels",value:function(m){var p=m.x,N=m.y,A=m.val,k=m.i,P=m.j,D=m.textRects,V=m.barHeight,Z=m.barWidth,ce=m.dataLabelsConfig,ue=this.w,me="rotate(0)";ue.config.plotOptions.bar.dataLabels.orientation==="vertical"&&(me="rotate(-90, ".concat(p,", ").concat(N,")"));var Ne=new Fe(this.barCtx.ctx),Ie=new U(this.barCtx.ctx),Le=ce.formatter,Xe=null,Oe=ue.globals.collapsedSeriesIndices.indexOf(k)>-1;if(ce.enabled&&!Oe){Xe=Ie.group({class:"apexcharts-data-labels",transform:me});var $e="";A!==void 0&&($e=Le(A,y(y({},ue),{},{seriesIndex:k,dataPointIndex:P,w:ue}))),!A&&ue.config.plotOptions.bar.hideZeroBarsWhenGrouped&&($e="");var ae=ue.globals.series[k][P]<0,he=ue.config.plotOptions.bar.dataLabels.position;ue.config.plotOptions.bar.dataLabels.orientation==="vertical"&&(he==="top"&&(ce.textAnchor=ae?"end":"start"),he==="center"&&(ce.textAnchor="middle"),he==="bottom"&&(ce.textAnchor=ae?"end":"start")),this.barCtx.isRangeBar&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels&&Z<Ie.getTextRects($e,parseFloat(ce.style.fontSize)).width&&($e=""),ue.config.chart.stacked&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels&&(this.barCtx.isHorizontal?D.width/1.6>Math.abs(Z)&&($e=""):D.height/1.6>Math.abs(V)&&($e=""));var Pe=y({},ce);this.barCtx.isHorizontal&&A<0&&(ce.textAnchor==="start"?Pe.textAnchor="end":ce.textAnchor==="end"&&(Pe.textAnchor="start")),Ne.plotDataLabelsText({x:p,y:N,text:$e,i:k,j:P,parent:Xe,dataLabelsConfig:Pe,alwaysDrawDataLabel:!0,offsetCorrection:!0})}return Xe}},{key:"drawTotalDataLabels",value:function(m){var p=m.x,N=m.y,A=m.val,k=m.realIndex,P=m.textAnchor,D=m.barTotalDataLabelsConfig;this.w;var V,Z=new U(this.barCtx.ctx);return D.enabled&&p!==void 0&&N!==void 0&&this.barCtx.lastActiveBarSerieIndex===k&&(V=Z.drawText({x:p,y:N,foreColor:D.style.color,text:A,textAnchor:P,fontFamily:D.style.fontFamily,fontSize:D.style.fontSize,fontWeight:D.style.fontWeight})),V}}]),Ce}(),hn=function(){function Ce(m){s(this,Ce),this.w=m.w,this.barCtx=m}return o(Ce,[{key:"initVariables",value:function(m){var p=this.w;this.barCtx.series=m,this.barCtx.totalItems=0,this.barCtx.seriesLen=0,this.barCtx.visibleI=-1,this.barCtx.visibleItems=1;for(var N=0;N<m.length;N++)if(m[N].length>0&&(this.barCtx.seriesLen=this.barCtx.seriesLen+1,this.barCtx.totalItems+=m[N].length),p.globals.isXNumeric)for(var A=0;A<m[N].length;A++)p.globals.seriesX[N][A]>p.globals.minX&&p.globals.seriesX[N][A]<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:m})}},{key:"initialPositions",value:function(){var m,p,N,A,k,P,D,V,Z=this.w,ce=Z.globals.dataPoints;this.barCtx.isRangeBar&&(ce=Z.globals.labels.length);var ue=this.barCtx.seriesLen;if(Z.config.plotOptions.bar.rangeBarGroupRows&&(ue=1),this.barCtx.isHorizontal)k=(N=Z.globals.gridHeight/ce)/ue,Z.globals.isXNumeric&&(k=(N=Z.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)),V=this.barCtx.baseLineInvertedY+Z.globals.padHorizontal+(this.barCtx.isReversed?Z.globals.gridWidth:0)-(this.barCtx.isReversed?2*this.barCtx.baseLineInvertedY:0),this.barCtx.isFunnel&&(V=Z.globals.gridWidth/2),p=(N-k*this.barCtx.seriesLen)/2;else{if(A=Z.globals.gridWidth/this.barCtx.visibleItems,Z.config.xaxis.convertedCatToNumeric&&(A=Z.globals.gridWidth/Z.globals.dataPoints),P=A/ue*parseInt(this.barCtx.barOptions.columnWidth,10)/100,Z.globals.isXNumeric){var me=this.barCtx.xRatio;Z.globals.minXDiff&&Z.globals.minXDiff!==.5&&Z.globals.minXDiff/me>0&&(A=Z.globals.minXDiff/me),(P=A/ue*parseInt(this.barCtx.barOptions.columnWidth,10)/100)<1&&(P=1)}String(this.barCtx.barOptions.columnWidth).indexOf("%")===-1&&(P=parseInt(this.barCtx.barOptions.columnWidth,10)),D=Z.globals.gridHeight-this.barCtx.baseLineY[this.barCtx.translationsIndex]-(this.barCtx.isReversed?Z.globals.gridHeight:0)+(this.barCtx.isReversed?2*this.barCtx.baseLineY[this.barCtx.translationsIndex]:0),m=Z.globals.padHorizontal+(A-P*this.barCtx.seriesLen)/2}return Z.globals.barHeight=k,Z.globals.barWidth=P,{x:m,y:p,yDivision:N,xDivision:A,barHeight:k,barWidth:P,zeroH:D,zeroW:V}}},{key:"initializeStackedPrevVars",value:function(m){m.w.globals.seriesGroups.forEach(function(p){m[p]||(m[p]={}),m[p].prevY=[],m[p].prevX=[],m[p].prevYF=[],m[p].prevXF=[],m[p].prevYVal=[],m[p].prevXVal=[]})}},{key:"initializeStackedXYVars",value:function(m){m.w.globals.seriesGroups.forEach(function(p){m[p]||(m[p]={}),m[p].xArrj=[],m[p].xArrjF=[],m[p].xArrjVal=[],m[p].yArrj=[],m[p].yArrjF=[],m[p].yArrjVal=[]})}},{key:"getPathFillColor",value:function(m,p,N,A){var k,P,D,V,Z,ce=this.w,ue=this.barCtx.ctx.fill,me=null,Ne=this.barCtx.barOptions.distributed?N:p;return this.barCtx.barOptions.colors.ranges.length>0&&this.barCtx.barOptions.colors.ranges.map(function(Ie){m[p][N]>=Ie.from&&m[p][N]<=Ie.to&&(me=Ie.color)}),(k=ce.config.series[p].data[N])!==null&&k!==void 0&&k.fillColor&&(me=ce.config.series[p].data[N].fillColor),ue.fillPath({seriesNumber:this.barCtx.barOptions.distributed?Ne:A,dataPointIndex:N,color:me,value:m[p][N],fillConfig:(P=ce.config.series[p].data[N])===null||P===void 0?void 0:P.fill,fillType:(D=ce.config.series[p].data[N])!==null&&D!==void 0&&(V=D.fill)!==null&&V!==void 0&&V.type?(Z=ce.config.series[p].data[N])===null||Z===void 0?void 0:Z.fill.type:Array.isArray(ce.config.fill.type)?ce.config.fill.type[A]:ce.config.fill.type})}},{key:"getStrokeWidth",value:function(m,p,N){var A=0,k=this.w;return this.barCtx.series[m][p]?this.barCtx.isNullValue=!1:this.barCtx.isNullValue=!0,k.config.stroke.show&&(this.barCtx.isNullValue||(A=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[N]:this.barCtx.strokeWidth)),A}},{key:"createBorderRadiusArr",value:function(m){var p=this.w,N=!this.w.config.chart.stacked||p.config.plotOptions.bar.borderRadiusWhenStacked!=="last"||p.config.plotOptions.bar.borderRadius<=0,A=m.length,k=m[0].length,P=Array.from({length:A},function(){return Array(k).fill(N?"top":"none")});if(N)return P;for(var D=0;D<k;D++){for(var V=[],Z=[],ce=0,ue=0;ue<A;ue++){var me=m[ue][D];me>0?(V.push(ue),ce++):me<0&&(Z.push(ue),ce++)}if(V.length>0&&Z.length===0)if(V.length===1)P[V[0]][D]="both";else{var Ne,Ie=V[0],Le=V[V.length-1],Xe=l(V);try{for(Xe.s();!(Ne=Xe.n()).done;){var Oe=Ne.value;P[Oe][D]=Oe===Ie?"bottom":Oe===Le?"top":"none"}}catch(An){Xe.e(An)}finally{Xe.f()}}else if(Z.length>0&&V.length===0)if(Z.length===1)P[Z[0]][D]="both";else{var $e,ae=Z[0],he=Z[Z.length-1],Pe=l(Z);try{for(Pe.s();!($e=Pe.n()).done;){var Ve=$e.value;P[Ve][D]=Ve===ae?"bottom":Ve===he?"top":"none"}}catch(An){Pe.e(An)}finally{Pe.f()}}else if(V.length>0&&Z.length>0){var Te,Ze=V[V.length-1],it=l(V);try{for(it.s();!(Te=it.n()).done;){var wt=Te.value;P[wt][D]=wt===Ze?"top":"none"}}catch(An){it.e(An)}finally{it.f()}var Dt,Qt=Z[Z.length-1],xn=l(Z);try{for(xn.s();!(Dt=xn.n()).done;){var pn=Dt.value;P[pn][D]=pn===Qt?"bottom":"none"}}catch(An){xn.e(An)}finally{xn.f()}}else ce===1&&(P[V[0]||Z[0]][D]="both")}return P}},{key:"barBackground",value:function(m){var p=m.j,N=m.i,A=m.x1,k=m.x2,P=m.y1,D=m.y2,V=m.elSeries,Z=this.w,ce=new U(this.barCtx.ctx),ue=new Re(this.barCtx.ctx).getActiveConfigSeriesIndex();if(this.barCtx.barOptions.colors.backgroundBarColors.length>0&&ue===N){p>=this.barCtx.barOptions.colors.backgroundBarColors.length&&(p%=this.barCtx.barOptions.colors.backgroundBarColors.length);var me=this.barCtx.barOptions.colors.backgroundBarColors[p],Ne=ce.drawRect(A!==void 0?A:0,P!==void 0?P:0,k!==void 0?k:Z.globals.gridWidth,D!==void 0?D:Z.globals.gridHeight,this.barCtx.barOptions.colors.backgroundBarRadius,me,this.barCtx.barOptions.colors.backgroundBarOpacity);V.add(Ne),Ne.node.classList.add("apexcharts-backgroundBar")}}},{key:"getColumnPaths",value:function(m){var p,N=m.barWidth,A=m.barXPosition,k=m.y1,P=m.y2,D=m.strokeWidth,V=m.isReversed,Z=m.series,ce=m.seriesGroup,ue=m.realIndex,me=m.i,Ne=m.j,Ie=m.w,Le=new U(this.barCtx.ctx);(D=Array.isArray(D)?D[ue]:D)||(D=0);var Xe=N,Oe=A;(p=Ie.config.series[ue].data[Ne])!==null&&p!==void 0&&p.columnWidthOffset&&(Oe=A-Ie.config.series[ue].data[Ne].columnWidthOffset/2,Xe=N+Ie.config.series[ue].data[Ne].columnWidthOffset);var $e=D/2,ae=Oe+$e,he=Oe+Xe-$e,Pe=(Z[me][Ne]>=0?1:-1)*(V?-1:1);k+=.001-$e*Pe,P+=.001+$e*Pe;var Ve=Le.move(ae,k),Te=Le.move(ae,k),Ze=Le.line(he,k);if(Ie.globals.previousPaths.length>0&&(Te=this.barCtx.getPreviousPath(ue,Ne,!1)),Ve=Ve+Le.line(ae,P)+Le.line(he,P)+Ze+(Ie.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ue][Ne]==="both"?" Z":" z"),Te=Te+Le.line(ae,k)+Ze+Ze+Ze+Ze+Ze+Le.line(ae,k)+(Ie.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ue][Ne]==="both"?" Z":" z"),this.arrBorderRadius[ue][Ne]!=="none"&&(Ve=Le.roundPathCorners(Ve,Ie.config.plotOptions.bar.borderRadius)),Ie.config.chart.stacked){var it=this.barCtx;(it=this.barCtx[ce]).yArrj.push(P-$e*Pe),it.yArrjF.push(Math.abs(k-P+D*Pe)),it.yArrjVal.push(this.barCtx.series[me][Ne])}return{pathTo:Ve,pathFrom:Te}}},{key:"getBarpaths",value:function(m){var p,N=m.barYPosition,A=m.barHeight,k=m.x1,P=m.x2,D=m.strokeWidth,V=m.isReversed,Z=m.series,ce=m.seriesGroup,ue=m.realIndex,me=m.i,Ne=m.j,Ie=m.w,Le=new U(this.barCtx.ctx);(D=Array.isArray(D)?D[ue]:D)||(D=0);var Xe=N,Oe=A;(p=Ie.config.series[ue].data[Ne])!==null&&p!==void 0&&p.barHeightOffset&&(Xe=N-Ie.config.series[ue].data[Ne].barHeightOffset/2,Oe=A+Ie.config.series[ue].data[Ne].barHeightOffset);var $e=D/2,ae=Xe+$e,he=Xe+Oe-$e,Pe=(Z[me][Ne]>=0?1:-1)*(V?-1:1);k+=.001+$e*Pe,P+=.001-$e*Pe;var Ve=Le.move(k,ae),Te=Le.move(k,ae);Ie.globals.previousPaths.length>0&&(Te=this.barCtx.getPreviousPath(ue,Ne,!1));var Ze=Le.line(k,he);if(Ve=Ve+Le.line(P,ae)+Le.line(P,he)+Ze+(Ie.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ue][Ne]==="both"?" Z":" z"),Te=Te+Le.line(k,ae)+Ze+Ze+Ze+Ze+Ze+Le.line(k,ae)+(Ie.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ue][Ne]==="both"?" Z":" z"),this.arrBorderRadius[ue][Ne]!=="none"&&(Ve=Le.roundPathCorners(Ve,Ie.config.plotOptions.bar.borderRadius)),Ie.config.chart.stacked){var it=this.barCtx;(it=this.barCtx[ce]).xArrj.push(P+$e*Pe),it.xArrjF.push(Math.abs(k-P-D*Pe)),it.xArrjVal.push(this.barCtx.series[me][Ne])}return{pathTo:Ve,pathFrom:Te}}},{key:"checkZeroSeries",value:function(m){for(var p=m.series,N=this.w,A=0;A<p.length;A++){for(var k=0,P=0;P<p[N.globals.maxValsInArrayIndex].length;P++)k+=p[A][P];k===0&&this.barCtx.zeroSerieses.push(A)}}},{key:"getXForValue",value:function(m,p){var N=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2]?p:null;return m!=null&&(N=p+m/this.barCtx.invertedYRatio-2*(this.barCtx.isReversed?m/this.barCtx.invertedYRatio:0)),N}},{key:"getYForValue",value:function(m,p,N){var A=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3]?p:null;return m!=null&&(A=p-m/this.barCtx.yRatio[N]+2*(this.barCtx.isReversed?m/this.barCtx.yRatio[N]:0)),A}},{key:"getGoalValues",value:function(m,p,N,A,k,P){var D=this,V=this.w,Z=[],ce=function(Ne,Ie){var Le;Z.push((u(Le={},m,m==="x"?D.getXForValue(Ne,p,!1):D.getYForValue(Ne,N,P,!1)),u(Le,"attrs",Ie),Le))};if(V.globals.seriesGoals[A]&&V.globals.seriesGoals[A][k]&&Array.isArray(V.globals.seriesGoals[A][k])&&V.globals.seriesGoals[A][k].forEach(function(Ne){ce(Ne.value,Ne)}),this.barCtx.barOptions.isDumbbell&&V.globals.seriesRange.length){var ue=this.barCtx.barOptions.dumbbellColors?this.barCtx.barOptions.dumbbellColors:V.globals.colors,me={strokeHeight:m==="x"?0:V.globals.markers.size[A],strokeWidth:m==="x"?V.globals.markers.size[A]:0,strokeDashArray:0,strokeLineCap:"round",strokeColor:Array.isArray(ue[A])?ue[A][0]:ue[A]};ce(V.globals.seriesRangeStart[A][k],me),ce(V.globals.seriesRangeEnd[A][k],y(y({},me),{},{strokeColor:Array.isArray(ue[A])?ue[A][1]:ue[A]}))}return Z}},{key:"drawGoalLine",value:function(m){var p=m.barXPosition,N=m.barYPosition,A=m.goalX,k=m.goalY,P=m.barWidth,D=m.barHeight,V=new U(this.barCtx.ctx),Z=V.group({className:"apexcharts-bar-goals-groups"});Z.node.classList.add("apexcharts-element-hidden"),this.barCtx.w.globals.delayedElements.push({el:Z.node}),Z.attr("clip-path","url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid,")"));var ce=null;return this.barCtx.isHorizontal?Array.isArray(A)&&A.forEach(function(ue){if(ue.x>=-1&&ue.x<=V.w.globals.gridWidth+1){var me=ue.attrs.strokeHeight!==void 0?ue.attrs.strokeHeight:D/2,Ne=N+me+D/2;ce=V.drawLine(ue.x,Ne-2*me,ue.x,Ne,ue.attrs.strokeColor?ue.attrs.strokeColor:void 0,ue.attrs.strokeDashArray,ue.attrs.strokeWidth?ue.attrs.strokeWidth:2,ue.attrs.strokeLineCap),Z.add(ce)}}):Array.isArray(k)&&k.forEach(function(ue){if(ue.y>=-1&&ue.y<=V.w.globals.gridHeight+1){var me=ue.attrs.strokeWidth!==void 0?ue.attrs.strokeWidth:P/2,Ne=p+me+P/2;ce=V.drawLine(Ne-2*me,ue.y,Ne,ue.y,ue.attrs.strokeColor?ue.attrs.strokeColor:void 0,ue.attrs.strokeDashArray,ue.attrs.strokeHeight?ue.attrs.strokeHeight:2,ue.attrs.strokeLineCap),Z.add(ce)}}),Z}},{key:"drawBarShadow",value:function(m){var p=m.prevPaths,N=m.currPaths,A=m.color,k=this.w,P=p.x,D=p.x1,V=p.barYPosition,Z=N.x,ce=N.x1,ue=N.barYPosition,me=V+N.barHeight,Ne=new U(this.barCtx.ctx),Ie=new F,Le=Ne.move(D,me)+Ne.line(P,me)+Ne.line(Z,ue)+Ne.line(ce,ue)+Ne.line(D,me)+(k.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[realIndex][j]==="both"?" Z":" z");return Ne.drawPath({d:Le,fill:Ie.shadeColor(.5,F.rgb2hex(A)),stroke:"none",strokeWidth:0,fillOpacity:1,classes:"apexcharts-bar-shadows"})}},{key:"getZeroValueEncounters",value:function(m){var p,N=m.i,A=m.j,k=this.w,P=0,D=0;return(k.config.plotOptions.bar.horizontal?k.globals.series.map(function(V,Z){return Z}):((p=k.globals.columnSeries)===null||p===void 0?void 0:p.i.map(function(V){return V}))||[]).forEach(function(V){var Z=k.globals.seriesPercent[V][A];Z&&P++,V<N&&Z===0&&D++}),{nonZeroColumns:P,zeroEncounters:D}}},{key:"getGroupIndex",value:function(m){var p=this.w,N=p.globals.seriesGroups.findIndex(function(P){return P.indexOf(p.globals.seriesNames[m])>-1}),A=this.barCtx.columnGroupIndices,k=A.indexOf(N);return k<0&&(A.push(N),k=A.length-1),{groupIndex:N,columnGroupIndex:k}}}]),Ce}(),yn=function(){function Ce(m,p){s(this,Ce),this.ctx=m,this.w=m.w;var N=this.w;this.barOptions=N.config.plotOptions.bar,this.isHorizontal=this.barOptions.horizontal,this.strokeWidth=N.config.stroke.width,this.isNullValue=!1,this.isRangeBar=N.globals.seriesRange.length&&this.isHorizontal,this.isVerticalGroupedRangeBar=!N.globals.isBarHorizontal&&N.globals.seriesRange.length&&N.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 A=new Re(this.ctx);this.lastActiveBarSerieIndex=A.getActiveConfigSeriesIndex("desc",["bar","column"]),this.columnGroupIndices=[];var k=A.getBarSeriesIndices(),P=new Y(this.ctx);this.stackedSeriesTotals=P.getStackedSeriesTotals(this.w.config.series.map(function(D,V){return k.indexOf(V)===-1?V:-1}).filter(function(D){return D!==-1})),this.barHelpers=new hn(this)}return o(Ce,[{key:"draw",value:function(m,p){var N=this.w,A=new U(this.ctx),k=new Y(this.ctx,N);m=k.getLogSeries(m),this.series=m,this.yRatio=k.getLogYRatios(this.yRatio),this.barHelpers.initVariables(m);var P=A.group({class:"apexcharts-bar-series apexcharts-plot-series"});N.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 D=0,V=0;D<m.length;D++,V++){var Z,ce,ue,me,Ne=void 0,Ie=void 0,Le=[],Xe=[],Oe=N.globals.comboCharts?p[D]:D,$e=this.barHelpers.getGroupIndex(Oe).columnGroupIndex,ae=A.group({class:"apexcharts-series",rel:D+1,seriesName:F.escapeString(N.globals.seriesNames[Oe]),"data:realIndex":Oe});this.ctx.series.addCollapsedClassToSeries(ae,Oe),m[D].length>0&&(this.visibleI=this.visibleI+1);var he=0,Pe=0;this.yRatio.length>1&&(this.yaxisIndex=N.globals.seriesYAxisReverseMap[Oe],this.translationsIndex=Oe);var Ve=this.translationsIndex;this.isReversed=N.config.yaxis[this.yaxisIndex]&&N.config.yaxis[this.yaxisIndex].reversed;var Te=this.barHelpers.initialPositions();Ie=Te.y,he=Te.barHeight,ce=Te.yDivision,me=Te.zeroW,Ne=Te.x,Pe=Te.barWidth,Z=Te.xDivision,ue=Te.zeroH,this.horizontal||Xe.push(Ne+Pe/2);var Ze=A.group({class:"apexcharts-datalabels","data:realIndex":Oe});N.globals.delayedElements.push({el:Ze.node}),Ze.node.classList.add("apexcharts-element-hidden");var it=A.group({class:"apexcharts-bar-goals-markers"}),wt=A.group({class:"apexcharts-bar-shadows"});N.globals.delayedElements.push({el:wt.node}),wt.node.classList.add("apexcharts-element-hidden");for(var Dt=0;Dt<m[D].length;Dt++){var Qt=this.barHelpers.getStrokeWidth(D,Dt,Oe),xn=null,pn={indexes:{i:D,j:Dt,realIndex:Oe,translationsIndex:Ve,bc:V},x:Ne,y:Ie,strokeWidth:Qt,elSeries:ae};this.isHorizontal?(xn=this.drawBarPaths(y(y({},pn),{},{barHeight:he,zeroW:me,yDivision:ce})),Pe=this.series[D][Dt]/this.invertedYRatio):(xn=this.drawColumnPaths(y(y({},pn),{},{xDivision:Z,barWidth:Pe,zeroH:ue})),he=this.series[D][Dt]/this.yRatio[Ve]);var An=this.barHelpers.getPathFillColor(m,D,Dt,Oe);if(this.isFunnel&&this.barOptions.isFunnel3d&&this.pathArr.length&&Dt>0){var or=this.barHelpers.drawBarShadow({color:typeof An=="string"&&(An==null?void 0:An.indexOf("url"))===-1?An:F.hexToRgba(N.globals.colors[D]),prevPaths:this.pathArr[this.pathArr.length-1],currPaths:xn});or&&wt.add(or)}this.pathArr.push(xn);var $t=this.barHelpers.drawGoalLine({barXPosition:xn.barXPosition,barYPosition:xn.barYPosition,goalX:xn.goalX,goalY:xn.goalY,barHeight:he,barWidth:Pe});$t&&it.add($t),Ie=xn.y,Ne=xn.x,Dt>0&&Xe.push(Ne+Pe/2),Le.push(Ie),this.renderSeries({realIndex:Oe,pathFill:An,j:Dt,i:D,columnGroupIndex:$e,pathFrom:xn.pathFrom,pathTo:xn.pathTo,strokeWidth:Qt,elSeries:ae,x:Ne,y:Ie,series:m,barHeight:Math.abs(xn.barHeight?xn.barHeight:he),barWidth:Math.abs(xn.barWidth?xn.barWidth:Pe),elDataLabelsWrap:Ze,elGoalsMarkers:it,elBarShadows:wt,visibleSeries:this.visibleI,type:"bar"})}N.globals.seriesXvalues[Oe]=Xe,N.globals.seriesYvalues[Oe]=Le,P.add(ae)}return P}},{key:"renderSeries",value:function(m){var p=m.realIndex,N=m.pathFill,A=m.lineFill,k=m.j,P=m.i,D=m.columnGroupIndex,V=m.pathFrom,Z=m.pathTo,ce=m.strokeWidth,ue=m.elSeries,me=m.x,Ne=m.y,Ie=m.y1,Le=m.y2,Xe=m.series,Oe=m.barHeight,$e=m.barWidth,ae=m.barXPosition,he=m.barYPosition,Pe=m.elDataLabelsWrap,Ve=m.elGoalsMarkers,Te=m.elBarShadows,Ze=m.visibleSeries,it=m.type,wt=m.classes,Dt=this.w,Qt=new U(this.ctx);if(!A){var xn=typeof Dt.globals.stroke.colors[p]=="function"?function(bt){var rn,ur=Dt.config.stroke.colors;return Array.isArray(ur)&&ur.length>0&&((rn=ur[bt])||(rn=""),typeof rn=="function")?rn({value:Dt.globals.series[bt][k],dataPointIndex:k,w:Dt}):rn}(p):Dt.globals.stroke.colors[p];A=this.barOptions.distributed?Dt.globals.stroke.colors[k]:xn}Dt.config.series[P].data[k]&&Dt.config.series[P].data[k].strokeColor&&(A=Dt.config.series[P].data[k].strokeColor),this.isNullValue&&(N="none");var pn=k/Dt.config.chart.animations.animateGradually.delay*(Dt.config.chart.animations.speed/Dt.globals.dataPoints)/2.4,An=Qt.renderPaths({i:P,j:k,realIndex:p,pathFrom:V,pathTo:Z,stroke:A,strokeWidth:ce,strokeLineCap:Dt.config.stroke.lineCap,fill:N,animationDelay:pn,initialSpeed:Dt.config.chart.animations.speed,dataChangeSpeed:Dt.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(it,"-area ").concat(wt),chartType:it});An.attr("clip-path","url(#gridRectBarMask".concat(Dt.globals.cuid,")"));var or=Dt.config.forecastDataPoints;or.count>0&&k>=Dt.globals.dataPoints-or.count&&(An.node.setAttribute("stroke-dasharray",or.dashArray),An.node.setAttribute("stroke-width",or.strokeWidth),An.node.setAttribute("fill-opacity",or.fillOpacity)),Ie!==void 0&&Le!==void 0&&(An.attr("data-range-y1",Ie),An.attr("data-range-y2",Le)),new O(this.ctx).setSelectionFilter(An,p,k),ue.add(An);var $t=new Rt(this).handleBarDataLabels({x:me,y:Ne,y1:Ie,y2:Le,i:P,j:k,series:Xe,realIndex:p,columnGroupIndex:D,barHeight:Oe,barWidth:$e,barXPosition:ae,barYPosition:he,renderedPath:An,visibleSeries:Ze});return $t.dataLabels!==null&&Pe.add($t.dataLabels),$t.totalDataLabels&&Pe.add($t.totalDataLabels),ue.add(Pe),Ve&&ue.add(Ve),Te&&ue.add(Te),ue}},{key:"drawBarPaths",value:function(m){var p,N=m.indexes,A=m.barHeight,k=m.strokeWidth,P=m.zeroW,D=m.x,V=m.y,Z=m.yDivision,ce=m.elSeries,ue=this.w,me=N.i,Ne=N.j;if(ue.globals.isXNumeric)p=(V=(ue.globals.seriesX[me][Ne]-ue.globals.minX)/this.invertedXRatio-A)+A*this.visibleI;else if(ue.config.plotOptions.bar.hideZeroBarsWhenGrouped){var Ie=0,Le=0;ue.globals.seriesPercent.forEach(function(Oe,$e){Oe[Ne]&&Ie++,$e<me&&Oe[Ne]===0&&Le++}),Ie>0&&(A=this.seriesLen*A/Ie),p=V+A*this.visibleI,p-=A*Le}else p=V+A*this.visibleI;this.isFunnel&&(P-=(this.barHelpers.getXForValue(this.series[me][Ne],P)-P)/2),D=this.barHelpers.getXForValue(this.series[me][Ne],P);var Xe=this.barHelpers.getBarpaths({barYPosition:p,barHeight:A,x1:P,x2:D,strokeWidth:k,isReversed:this.isReversed,series:this.series,realIndex:N.realIndex,i:me,j:Ne,w:ue});return ue.globals.isXNumeric||(V+=Z),this.barHelpers.barBackground({j:Ne,i:me,y1:p-A*this.visibleI,y2:A*this.seriesLen,elSeries:ce}),{pathTo:Xe.pathTo,pathFrom:Xe.pathFrom,x1:P,x:D,y:V,goalX:this.barHelpers.getGoalValues("x",P,null,me,Ne),barYPosition:p,barHeight:A}}},{key:"drawColumnPaths",value:function(m){var p,N=m.indexes,A=m.x,k=m.y,P=m.xDivision,D=m.barWidth,V=m.zeroH,Z=m.strokeWidth,ce=m.elSeries,ue=this.w,me=N.realIndex,Ne=N.translationsIndex,Ie=N.i,Le=N.j,Xe=N.bc;if(ue.globals.isXNumeric){var Oe=this.getBarXForNumericXAxis({x:A,j:Le,realIndex:me,barWidth:D});A=Oe.x,p=Oe.barXPosition}else if(ue.config.plotOptions.bar.hideZeroBarsWhenGrouped){var $e=this.barHelpers.getZeroValueEncounters({i:Ie,j:Le}),ae=$e.nonZeroColumns,he=$e.zeroEncounters;ae>0&&(D=this.seriesLen*D/ae),p=A+D*this.visibleI,p-=D*he}else p=A+D*this.visibleI;k=this.barHelpers.getYForValue(this.series[Ie][Le],V,Ne);var Pe=this.barHelpers.getColumnPaths({barXPosition:p,barWidth:D,y1:V,y2:k,strokeWidth:Z,isReversed:this.isReversed,series:this.series,realIndex:me,i:Ie,j:Le,w:ue});return ue.globals.isXNumeric||(A+=P),this.barHelpers.barBackground({bc:Xe,j:Le,i:Ie,x1:p-Z/2-D*this.visibleI,x2:D*this.seriesLen+Z/2,elSeries:ce}),{pathTo:Pe.pathTo,pathFrom:Pe.pathFrom,x:A,y:k,goalY:this.barHelpers.getGoalValues("y",null,V,Ie,Le,Ne),barXPosition:p,barWidth:D}}},{key:"getBarXForNumericXAxis",value:function(m){var p=m.x,N=m.barWidth,A=m.realIndex,k=m.j,P=this.w,D=A;return P.globals.seriesX[A].length||(D=P.globals.maxValsInArrayIndex),P.globals.seriesX[D][k]&&(p=(P.globals.seriesX[D][k]-P.globals.minX)/this.xRatio-N*this.seriesLen/2),{barXPosition:p+N*this.visibleI,x:p}}},{key:"getPreviousPath",value:function(m,p){for(var N,A=this.w,k=0;k<A.globals.previousPaths.length;k++){var P=A.globals.previousPaths[k];P.paths&&P.paths.length>0&&parseInt(P.realIndex,10)===parseInt(m,10)&&A.globals.previousPaths[k].paths[p]!==void 0&&(N=A.globals.previousPaths[k].paths[p].d)}return N}}]),Ce}(),Cn=function(Ce){f(p,yn);var m=c(p);function p(){return s(this,p),m.apply(this,arguments)}return o(p,[{key:"draw",value:function(N,A){var k=this,P=this.w;this.graphics=new U(this.ctx),this.bar=new yn(this.ctx,this.xyRatios);var D=new Y(this.ctx,P);N=D.getLogSeries(N),this.yRatio=D.getLogYRatios(this.yRatio),this.barHelpers.initVariables(N),P.config.chart.stackType==="100%"&&(N=P.globals.comboCharts?A.map(function(Ie){return P.globals.seriesPercent[Ie]}):P.globals.seriesPercent.slice()),this.series=N,this.barHelpers.initializeStackedPrevVars(this);for(var V=this.graphics.group({class:"apexcharts-bar-series apexcharts-plot-series"}),Z=0,ce=0,ue=function(Ie,Le){var Xe=void 0,Oe=void 0,$e=void 0,ae=void 0,he=P.globals.comboCharts?A[Ie]:Ie,Pe=k.barHelpers.getGroupIndex(he),Ve=Pe.groupIndex,Te=Pe.columnGroupIndex;k.groupCtx=k[P.globals.seriesGroups[Ve]];var Ze=[],it=[],wt=0;k.yRatio.length>1&&(k.yaxisIndex=P.globals.seriesYAxisReverseMap[he][0],wt=he),k.isReversed=P.config.yaxis[k.yaxisIndex]&&P.config.yaxis[k.yaxisIndex].reversed;var Dt=k.graphics.group({class:"apexcharts-series",seriesName:F.escapeString(P.globals.seriesNames[he]),rel:Ie+1,"data:realIndex":he});k.ctx.series.addCollapsedClassToSeries(Dt,he);var Qt=k.graphics.group({class:"apexcharts-datalabels","data:realIndex":he}),xn=k.graphics.group({class:"apexcharts-bar-goals-markers"}),pn=0,An=0,or=k.initialPositions(Z,ce,Xe,Oe,$e,ae,wt);ce=or.y,pn=or.barHeight,Oe=or.yDivision,ae=or.zeroW,Z=or.x,An=or.barWidth,Xe=or.xDivision,$e=or.zeroH,P.globals.barHeight=pn,P.globals.barWidth=An,k.barHelpers.initializeStackedXYVars(k),k.groupCtx.prevY.length===1&&k.groupCtx.prevY[0].every(function(Gr){return isNaN(Gr)})&&(k.groupCtx.prevY[0]=k.groupCtx.prevY[0].map(function(){return $e}),k.groupCtx.prevYF[0]=k.groupCtx.prevYF[0].map(function(){return 0}));for(var $t=0;$t<P.globals.dataPoints;$t++){var bt=k.barHelpers.getStrokeWidth(Ie,$t,he),rn={indexes:{i:Ie,j:$t,realIndex:he,translationsIndex:wt,bc:Le},strokeWidth:bt,x:Z,y:ce,elSeries:Dt,columnGroupIndex:Te,seriesGroup:P.globals.seriesGroups[Ve]},ur=null;k.isHorizontal?(ur=k.drawStackedBarPaths(y(y({},rn),{},{zeroW:ae,barHeight:pn,yDivision:Oe})),An=k.series[Ie][$t]/k.invertedYRatio):(ur=k.drawStackedColumnPaths(y(y({},rn),{},{xDivision:Xe,barWidth:An,zeroH:$e})),pn=k.series[Ie][$t]/k.yRatio[wt]);var gr=k.barHelpers.drawGoalLine({barXPosition:ur.barXPosition,barYPosition:ur.barYPosition,goalX:ur.goalX,goalY:ur.goalY,barHeight:pn,barWidth:An});gr&&xn.add(gr),ce=ur.y,Z=ur.x,Ze.push(Z),it.push(ce);var br=k.barHelpers.getPathFillColor(N,Ie,$t,he),Br="";P.globals.isBarHorizontal?k.barHelpers.arrBorderRadius[he][$t]==="bottom"&&P.globals.series[he][$t]>0&&(Br="apexcharts-flip-x"):k.barHelpers.arrBorderRadius[he][$t]==="bottom"&&P.globals.series[he][$t]>0&&(Br="apexcharts-flip-y"),Dt=k.renderSeries({realIndex:he,pathFill:br,j:$t,i:Ie,columnGroupIndex:Te,pathFrom:ur.pathFrom,pathTo:ur.pathTo,strokeWidth:bt,elSeries:Dt,x:Z,y:ce,series:N,barHeight:pn,barWidth:An,elDataLabelsWrap:Qt,elGoalsMarkers:xn,type:"bar",visibleSeries:Te,classes:Br})}P.globals.seriesXvalues[he]=Ze,P.globals.seriesYvalues[he]=it,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),V.add(Dt)},me=0,Ne=0;me<N.length;me++,Ne++)ue(me,Ne);return V}},{key:"initialPositions",value:function(N,A,k,P,D,V,Z){var ce,ue,me=this.w;if(this.isHorizontal){P=me.globals.gridHeight/me.globals.dataPoints;var Ne=me.config.plotOptions.bar.barHeight;ce=String(Ne).indexOf("%")===-1?parseInt(Ne,10):P*parseInt(Ne,10)/100,V=me.globals.padHorizontal+(this.isReversed?me.globals.gridWidth-this.baseLineInvertedY:this.baseLineInvertedY),A=(P-ce)/2}else{ue=k=me.globals.gridWidth/me.globals.dataPoints;var Ie=me.config.plotOptions.bar.columnWidth;me.globals.isXNumeric&&me.globals.dataPoints>1?ue=(k=me.globals.minXDiff/this.xRatio)*parseInt(this.barOptions.columnWidth,10)/100:String(Ie).indexOf("%")===-1?ue=parseInt(Ie,10):ue*=parseInt(Ie,10)/100,D=this.isReversed?this.baseLineY[Z]:me.globals.gridHeight-this.baseLineY[Z],N=me.globals.padHorizontal+(k-ue)/2}var Le=me.globals.barGroups.length||1;return{x:N,y:A,yDivision:P,xDivision:k,barHeight:ce/Le,barWidth:ue/Le,zeroH:D,zeroW:V}}},{key:"drawStackedBarPaths",value:function(N){for(var A,k=N.indexes,P=N.barHeight,D=N.strokeWidth,V=N.zeroW,Z=N.x,ce=N.y,ue=N.columnGroupIndex,me=N.seriesGroup,Ne=N.yDivision,Ie=N.elSeries,Le=this.w,Xe=ce+ue*P,Oe=k.i,$e=k.j,ae=k.realIndex,he=k.translationsIndex,Pe=0,Ve=0;Ve<this.groupCtx.prevXF.length;Ve++)Pe+=this.groupCtx.prevXF[Ve][$e];var Te;if((Te=me.indexOf(Le.config.series[ae].name))>0){var Ze=V;this.groupCtx.prevXVal[Te-1][$e]<0?Ze=this.series[Oe][$e]>=0?this.groupCtx.prevX[Te-1][$e]+Pe-2*(this.isReversed?Pe:0):this.groupCtx.prevX[Te-1][$e]:this.groupCtx.prevXVal[Te-1][$e]>=0&&(Ze=this.series[Oe][$e]>=0?this.groupCtx.prevX[Te-1][$e]:this.groupCtx.prevX[Te-1][$e]-Pe+2*(this.isReversed?Pe:0)),A=Ze}else A=V;Z=this.series[Oe][$e]===null?A:A+this.series[Oe][$e]/this.invertedYRatio-2*(this.isReversed?this.series[Oe][$e]/this.invertedYRatio:0);var it=this.barHelpers.getBarpaths({barYPosition:Xe,barHeight:P,x1:A,x2:Z,strokeWidth:D,isReversed:this.isReversed,series:this.series,realIndex:k.realIndex,seriesGroup:me,i:Oe,j:$e,w:Le});return this.barHelpers.barBackground({j:$e,i:Oe,y1:Xe,y2:P,elSeries:Ie}),ce+=Ne,{pathTo:it.pathTo,pathFrom:it.pathFrom,goalX:this.barHelpers.getGoalValues("x",V,null,Oe,$e,he),barXPosition:A,barYPosition:Xe,x:Z,y:ce}}},{key:"drawStackedColumnPaths",value:function(N){var A=N.indexes,k=N.x,P=N.y,D=N.xDivision,V=N.barWidth,Z=N.zeroH,ce=N.columnGroupIndex,ue=N.seriesGroup,me=N.elSeries,Ne=this.w,Ie=A.i,Le=A.j,Xe=A.bc,Oe=A.realIndex,$e=A.translationsIndex;if(Ne.globals.isXNumeric){var ae=Ne.globals.seriesX[Oe][Le];ae||(ae=0),k=(ae-Ne.globals.minX)/this.xRatio-V/2*Ne.globals.barGroups.length}for(var he,Pe=k+ce*V,Ve=0,Te=0;Te<this.groupCtx.prevYF.length;Te++)Ve+=isNaN(this.groupCtx.prevYF[Te][Le])?0:this.groupCtx.prevYF[Te][Le];var Ze=Ie;if(ue&&(Ze=ue.indexOf(Ne.globals.seriesNames[Oe])),Ze>0&&!Ne.globals.isXNumeric||Ze>0&&Ne.globals.isXNumeric&&Ne.globals.seriesX[Oe-1][Le]===Ne.globals.seriesX[Oe][Le]){var it,wt,Dt,Qt=Math.min(this.yRatio.length+1,Oe+1);if(this.groupCtx.prevY[Ze-1]!==void 0&&this.groupCtx.prevY[Ze-1].length)for(var xn=1;xn<Qt;xn++){var pn;if(!isNaN((pn=this.groupCtx.prevY[Ze-xn])===null||pn===void 0?void 0:pn[Le])){Dt=this.groupCtx.prevY[Ze-xn][Le];break}}for(var An=1;An<Qt;An++){var or,$t;if(((or=this.groupCtx.prevYVal[Ze-An])===null||or===void 0?void 0:or[Le])<0){wt=this.series[Ie][Le]>=0?Dt-Ve+2*(this.isReversed?Ve:0):Dt;break}if((($t=this.groupCtx.prevYVal[Ze-An])===null||$t===void 0?void 0:$t[Le])>=0){wt=this.series[Ie][Le]>=0?Dt:Dt+Ve-2*(this.isReversed?Ve:0);break}}wt===void 0&&(wt=Ne.globals.gridHeight),he=(it=this.groupCtx.prevYF[0])!==null&&it!==void 0&&it.every(function(rn){return rn===0})&&this.groupCtx.prevYF.slice(1,Ze).every(function(rn){return rn.every(function(ur){return isNaN(ur)})})?Z:wt}else he=Z;P=this.series[Ie][Le]?he-this.series[Ie][Le]/this.yRatio[$e]+2*(this.isReversed?this.series[Ie][Le]/this.yRatio[$e]:0):he;var bt=this.barHelpers.getColumnPaths({barXPosition:Pe,barWidth:V,y1:he,y2:P,yRatio:this.yRatio[$e],strokeWidth:this.strokeWidth,isReversed:this.isReversed,series:this.series,seriesGroup:ue,realIndex:A.realIndex,i:Ie,j:Le,w:Ne});return this.barHelpers.barBackground({bc:Xe,j:Le,i:Ie,x1:Pe,x2:V,elSeries:me}),{pathTo:bt.pathTo,pathFrom:bt.pathFrom,goalY:this.barHelpers.getGoalValues("y",null,Z,Ie,Le),barXPosition:Pe,x:Ne.globals.isXNumeric?k:k+D,y:P}}}]),p}(),En=function(Ce){f(p,yn);var m=c(p);function p(){return s(this,p),m.apply(this,arguments)}return o(p,[{key:"draw",value:function(N,A,k){var P=this,D=this.w,V=new U(this.ctx),Z=D.globals.comboCharts?A:D.config.chart.type,ce=new be(this.ctx);this.candlestickOptions=this.w.config.plotOptions.candlestick,this.boxOptions=this.w.config.plotOptions.boxPlot,this.isHorizontal=D.config.plotOptions.bar.horizontal;var ue=new Y(this.ctx,D);N=ue.getLogSeries(N),this.series=N,this.yRatio=ue.getLogYRatios(this.yRatio),this.barHelpers.initVariables(N);for(var me=V.group({class:"apexcharts-".concat(Z,"-series apexcharts-plot-series")}),Ne=function(Le){P.isBoxPlot=D.config.chart.type==="boxPlot"||D.config.series[Le].type==="boxPlot";var Xe,Oe,$e,ae,he=void 0,Pe=void 0,Ve=[],Te=[],Ze=D.globals.comboCharts?k[Le]:Le,it=P.barHelpers.getGroupIndex(Ze).columnGroupIndex,wt=V.group({class:"apexcharts-series",seriesName:F.escapeString(D.globals.seriesNames[Ze]),rel:Le+1,"data:realIndex":Ze});P.ctx.series.addCollapsedClassToSeries(wt,Ze),N[Le].length>0&&(P.visibleI=P.visibleI+1);var Dt,Qt,xn=0;P.yRatio.length>1&&(P.yaxisIndex=D.globals.seriesYAxisReverseMap[Ze][0],xn=Ze);var pn=P.barHelpers.initialPositions();Pe=pn.y,Dt=pn.barHeight,Oe=pn.yDivision,ae=pn.zeroW,he=pn.x,Qt=pn.barWidth,Xe=pn.xDivision,$e=pn.zeroH,Te.push(he+Qt/2);for(var An=V.group({class:"apexcharts-datalabels","data:realIndex":Ze}),or=function(bt){var rn=P.barHelpers.getStrokeWidth(Le,bt,Ze),ur=null,gr={indexes:{i:Le,j:bt,realIndex:Ze,translationsIndex:xn},x:he,y:Pe,strokeWidth:rn,elSeries:wt};ur=P.isHorizontal?P.drawHorizontalBoxPaths(y(y({},gr),{},{yDivision:Oe,barHeight:Dt,zeroW:ae})):P.drawVerticalBoxPaths(y(y({},gr),{},{xDivision:Xe,barWidth:Qt,zeroH:$e})),Pe=ur.y,he=ur.x,bt>0&&Te.push(he+Qt/2),Ve.push(Pe),ur.pathTo.forEach(function(br,Br){var Gr=!P.isBoxPlot&&P.candlestickOptions.wick.useFillColor?ur.color[Br]:D.globals.stroke.colors[Le],Or=ce.fillPath({seriesNumber:Ze,dataPointIndex:bt,color:ur.color[Br],value:N[Le][bt]});P.renderSeries({realIndex:Ze,pathFill:Or,lineFill:Gr,j:bt,i:Le,pathFrom:ur.pathFrom,pathTo:br,strokeWidth:rn,elSeries:wt,x:he,y:Pe,series:N,columnGroupIndex:it,barHeight:Dt,barWidth:Qt,elDataLabelsWrap:An,visibleSeries:P.visibleI,type:D.config.chart.type})})},$t=0;$t<D.globals.dataPoints;$t++)or($t);D.globals.seriesXvalues[Ze]=Te,D.globals.seriesYvalues[Ze]=Ve,me.add(wt)},Ie=0;Ie<N.length;Ie++)Ne(Ie);return me}},{key:"drawVerticalBoxPaths",value:function(N){var A=N.indexes,k=N.x;N.y;var P=N.xDivision,D=N.barWidth,V=N.zeroH,Z=N.strokeWidth,ce=this.w,ue=new U(this.ctx),me=A.i,Ne=A.j,Ie=!0,Le=ce.config.plotOptions.candlestick.colors.upward,Xe=ce.config.plotOptions.candlestick.colors.downward,Oe="";this.isBoxPlot&&(Oe=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var $e=this.yRatio[A.translationsIndex],ae=A.realIndex,he=this.getOHLCValue(ae,Ne),Pe=V,Ve=V;he.o>he.c&&(Ie=!1);var Te=Math.min(he.o,he.c),Ze=Math.max(he.o,he.c),it=he.m;ce.globals.isXNumeric&&(k=(ce.globals.seriesX[ae][Ne]-ce.globals.minX)/this.xRatio-D/2);var wt=k+D*this.visibleI;this.series[me][Ne]===void 0||this.series[me][Ne]===null?(Te=V,Ze=V):(Te=V-Te/$e,Ze=V-Ze/$e,Pe=V-he.h/$e,Ve=V-he.l/$e,it=V-he.m/$e);var Dt=ue.move(wt,V),Qt=ue.move(wt+D/2,Te);return ce.globals.previousPaths.length>0&&(Qt=this.getPreviousPath(ae,Ne,!0)),Dt=this.isBoxPlot?[ue.move(wt,Te)+ue.line(wt+D/2,Te)+ue.line(wt+D/2,Pe)+ue.line(wt+D/4,Pe)+ue.line(wt+D-D/4,Pe)+ue.line(wt+D/2,Pe)+ue.line(wt+D/2,Te)+ue.line(wt+D,Te)+ue.line(wt+D,it)+ue.line(wt,it)+ue.line(wt,Te+Z/2),ue.move(wt,it)+ue.line(wt+D,it)+ue.line(wt+D,Ze)+ue.line(wt+D/2,Ze)+ue.line(wt+D/2,Ve)+ue.line(wt+D-D/4,Ve)+ue.line(wt+D/4,Ve)+ue.line(wt+D/2,Ve)+ue.line(wt+D/2,Ze)+ue.line(wt,Ze)+ue.line(wt,it)+"z"]:[ue.move(wt,Ze)+ue.line(wt+D/2,Ze)+ue.line(wt+D/2,Pe)+ue.line(wt+D/2,Ze)+ue.line(wt+D,Ze)+ue.line(wt+D,Te)+ue.line(wt+D/2,Te)+ue.line(wt+D/2,Ve)+ue.line(wt+D/2,Te)+ue.line(wt,Te)+ue.line(wt,Ze-Z/2)],Qt+=ue.move(wt,Te),ce.globals.isXNumeric||(k+=P),{pathTo:Dt,pathFrom:Qt,x:k,y:Ze,barXPosition:wt,color:this.isBoxPlot?Oe:Ie?[Le]:[Xe]}}},{key:"drawHorizontalBoxPaths",value:function(N){var A=N.indexes;N.x;var k=N.y,P=N.yDivision,D=N.barHeight,V=N.zeroW,Z=N.strokeWidth,ce=this.w,ue=new U(this.ctx),me=A.i,Ne=A.j,Ie=this.boxOptions.colors.lower;this.isBoxPlot&&(Ie=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var Le=this.invertedYRatio,Xe=A.realIndex,Oe=this.getOHLCValue(Xe,Ne),$e=V,ae=V,he=Math.min(Oe.o,Oe.c),Pe=Math.max(Oe.o,Oe.c),Ve=Oe.m;ce.globals.isXNumeric&&(k=(ce.globals.seriesX[Xe][Ne]-ce.globals.minX)/this.invertedXRatio-D/2);var Te=k+D*this.visibleI;this.series[me][Ne]===void 0||this.series[me][Ne]===null?(he=V,Pe=V):(he=V+he/Le,Pe=V+Pe/Le,$e=V+Oe.h/Le,ae=V+Oe.l/Le,Ve=V+Oe.m/Le);var Ze=ue.move(V,Te),it=ue.move(he,Te+D/2);return ce.globals.previousPaths.length>0&&(it=this.getPreviousPath(Xe,Ne,!0)),Ze=[ue.move(he,Te)+ue.line(he,Te+D/2)+ue.line($e,Te+D/2)+ue.line($e,Te+D/2-D/4)+ue.line($e,Te+D/2+D/4)+ue.line($e,Te+D/2)+ue.line(he,Te+D/2)+ue.line(he,Te+D)+ue.line(Ve,Te+D)+ue.line(Ve,Te)+ue.line(he+Z/2,Te),ue.move(Ve,Te)+ue.line(Ve,Te+D)+ue.line(Pe,Te+D)+ue.line(Pe,Te+D/2)+ue.line(ae,Te+D/2)+ue.line(ae,Te+D-D/4)+ue.line(ae,Te+D/4)+ue.line(ae,Te+D/2)+ue.line(Pe,Te+D/2)+ue.line(Pe,Te)+ue.line(Ve,Te)+"z"],it+=ue.move(he,Te),ce.globals.isXNumeric||(k+=P),{pathTo:Ze,pathFrom:it,x:Pe,y:k,barYPosition:Te,color:Ie}}},{key:"getOHLCValue",value:function(N,A){var k=this.w;return{o:this.isBoxPlot?k.globals.seriesCandleH[N][A]:k.globals.seriesCandleO[N][A],h:this.isBoxPlot?k.globals.seriesCandleO[N][A]:k.globals.seriesCandleH[N][A],m:k.globals.seriesCandleM[N][A],l:this.isBoxPlot?k.globals.seriesCandleC[N][A]:k.globals.seriesCandleL[N][A],c:this.isBoxPlot?k.globals.seriesCandleL[N][A]:k.globals.seriesCandleC[N][A]}}}]),p}(),Rn=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"checkColorRange",value:function(){var m=this.w,p=!1,N=m.config.plotOptions[m.config.chart.type];return N.colorScale.ranges.length>0&&N.colorScale.ranges.map(function(A,k){A.from<=0&&(p=!0)}),p}},{key:"getShadeColor",value:function(m,p,N,A){var k=this.w,P=1,D=k.config.plotOptions[m].shadeIntensity,V=this.determineColor(m,p,N);k.globals.hasNegs||A?P=k.config.plotOptions[m].reverseNegativeShade?V.percent<0?V.percent/100*(1.25*D):(1-V.percent/100)*(1.25*D):V.percent<=0?1-(1+V.percent/100)*D:(1-V.percent/100)*D:(P=1-V.percent/100,m==="treemap"&&(P=(1-V.percent/100)*(1.25*D)));var Z=V.color,ce=new F;if(k.config.plotOptions[m].enableShades)if(this.w.config.theme.mode==="dark"){var ue=ce.shadeColor(-1*P,V.color);Z=F.hexToRgba(F.isColorHex(ue)?ue:F.rgb2hex(ue),k.config.fill.opacity)}else{var me=ce.shadeColor(P,V.color);Z=F.hexToRgba(F.isColorHex(me)?me:F.rgb2hex(me),k.config.fill.opacity)}return{color:Z,colorProps:V}}},{key:"determineColor",value:function(m,p,N){var A=this.w,k=A.globals.series[p][N],P=A.config.plotOptions[m],D=P.colorScale.inverse?N:p;P.distributed&&A.config.chart.type==="treemap"&&(D=N);var V=A.globals.colors[D],Z=null,ce=Math.min.apply(Math,S(A.globals.series[p])),ue=Math.max.apply(Math,S(A.globals.series[p]));P.distributed||m!=="heatmap"||(ce=A.globals.minY,ue=A.globals.maxY),P.colorScale.min!==void 0&&(ce=P.colorScale.min<A.globals.minY?P.colorScale.min:A.globals.minY,ue=P.colorScale.max>A.globals.maxY?P.colorScale.max:A.globals.maxY);var me=Math.abs(ue)+Math.abs(ce),Ne=100*k/(me===0?me-1e-6:me);return P.colorScale.ranges.length>0&&P.colorScale.ranges.map(function(Ie,Le){if(k>=Ie.from&&k<=Ie.to){V=Ie.color,Z=Ie.foreColor?Ie.foreColor:null,ce=Ie.from,ue=Ie.to;var Xe=Math.abs(ue)+Math.abs(ce);Ne=100*k/(Xe===0?Xe-1e-6:Xe)}}),{color:V,foreColor:Z,percent:Ne}}},{key:"calculateDataLabels",value:function(m){var p=m.text,N=m.x,A=m.y,k=m.i,P=m.j,D=m.colorProps,V=m.fontSize,Z=this.w.config.dataLabels,ce=new U(this.ctx),ue=new Fe(this.ctx),me=null;if(Z.enabled){me=ce.group({class:"apexcharts-data-labels"});var Ne=Z.offsetX,Ie=Z.offsetY,Le=N+Ne,Xe=A+parseFloat(Z.style.fontSize)/3+Ie;ue.plotDataLabelsText({x:Le,y:Xe,text:p,i:k,j:P,color:D.foreColor,parent:me,fontSize:V,dataLabelsConfig:Z})}return me}},{key:"addListeners",value:function(m){var p=new U(this.ctx);m.node.addEventListener("mouseenter",p.pathMouseEnter.bind(this,m)),m.node.addEventListener("mouseleave",p.pathMouseLeave.bind(this,m)),m.node.addEventListener("mousedown",p.pathMouseDown.bind(this,m))}}]),Ce}(),Mn=function(){function Ce(m,p){s(this,Ce),this.ctx=m,this.w=m.w,this.xRatio=p.xRatio,this.yRatio=p.yRatio,this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.helpers=new Rn(m),this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}return o(Ce,[{key:"draw",value:function(m){var p=this.w,N=new U(this.ctx),A=N.group({class:"apexcharts-heatmap"});A.attr("clip-path","url(#gridRectMask".concat(p.globals.cuid,")"));var k=p.globals.gridWidth/p.globals.dataPoints,P=p.globals.gridHeight/p.globals.series.length,D=0,V=!1;this.negRange=this.helpers.checkColorRange();var Z=m.slice();p.config.yaxis[0].reversed&&(V=!0,Z.reverse());for(var ce=V?0:Z.length-1;V?ce<Z.length:ce>=0;V?ce++:ce--){var ue=N.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 me=p.config.chart.dropShadow;new O(this.ctx).dropShadow(ue,me,ce)}for(var Ne=0,Ie=p.config.plotOptions.heatmap.shadeIntensity,Le=0;Le<Z[ce].length;Le++){var Xe=this.helpers.getShadeColor(p.config.chart.type,ce,Le,this.negRange),Oe=Xe.color,$e=Xe.colorProps;p.config.fill.type==="image"&&(Oe=new be(this.ctx).fillPath({seriesNumber:ce,dataPointIndex:Le,opacity:p.globals.hasNegs?$e.percent<0?1-(1+$e.percent/100):Ie+$e.percent/100:$e.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:P}));var ae=this.rectRadius,he=N.drawRect(Ne,D,k,P,ae);if(he.attr({cx:Ne,cy:D}),he.node.classList.add("apexcharts-heatmap-rect"),ue.add(he),he.attr({fill:Oe,i:ce,index:ce,j:Le,val:m[ce][Le],"stroke-width":this.strokeWidth,stroke:p.config.plotOptions.heatmap.useFillColorAsStroke?Oe:p.globals.stroke.colors[0],color:Oe}),this.helpers.addListeners(he),p.config.chart.animations.enabled&&!p.globals.dataChanged){var Pe=1;p.globals.resized||(Pe=p.config.chart.animations.speed),this.animateHeatMap(he,Ne,D,k,P,Pe)}if(p.globals.dataChanged){var Ve=1;if(this.dynamicAnim.enabled&&p.globals.shouldAnimate){Ve=this.dynamicAnim.speed;var Te=p.globals.previousPaths[ce]&&p.globals.previousPaths[ce][Le]&&p.globals.previousPaths[ce][Le].color;Te||(Te="rgba(255, 255, 255, 0)"),this.animateHeatColor(he,F.isColorHex(Te)?Te:F.rgb2hex(Te),F.isColorHex(Oe)?Oe:F.rgb2hex(Oe),Ve)}}var Ze=(0,p.config.dataLabels.formatter)(p.globals.series[ce][Le],{value:p.globals.series[ce][Le],seriesIndex:ce,dataPointIndex:Le,w:p}),it=this.helpers.calculateDataLabels({text:Ze,x:Ne+k/2,y:D+P/2,i:ce,j:Le,colorProps:$e,series:Z});it!==null&&ue.add(it),Ne+=k}D+=P,A.add(ue)}var wt=p.globals.yAxisScale[0].result.slice();return p.config.yaxis[0].reversed?wt.unshift(""):wt.push(""),p.globals.yAxisScale[0].result=wt,A}},{key:"animateHeatMap",value:function(m,p,N,A,k,P){var D=new $(this.ctx);D.animateRect(m,{x:p+A/2,y:N+k/2,width:0,height:0},{x:p,y:N,width:A,height:k},P,function(){D.animationCompleted(m)})}},{key:"animateHeatColor",value:function(m,p,N,A){m.attr({fill:p}).animate(A).attr({fill:N})}}]),Ce}(),Yn=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"drawYAxisTexts",value:function(m,p,N,A){var k=this.w,P=k.config.yaxis[0],D=k.globals.yLabelFormatters[0];return new U(this.ctx).drawText({x:m+P.labels.offsetX,y:p+P.labels.offsetY,text:D(A,N),textAnchor:"middle",fontSize:P.labels.style.fontSize,fontFamily:P.labels.style.fontFamily,foreColor:Array.isArray(P.labels.style.colors)?P.labels.style.colors[N]:P.labels.style.colors})}}]),Ce}(),Zn=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.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 N=p.config.plotOptions.pie.customScale,A=p.globals.gridWidth/2,k=p.globals.gridHeight/2;this.translateX=A-A*N,this.translateY=k-k*N,this.dataLabelsGroup=new U(this.ctx).group({class:"apexcharts-datalabels-group",transform:"translate(".concat(this.translateX,", ").concat(this.translateY,") scale(").concat(N,")")}),this.maxY=0,this.sliceLabels=[],this.sliceSizes=[],this.prevSectorAngleArr=[]}return o(Ce,[{key:"draw",value:function(m){var p=this,N=this.w,A=new U(this.ctx),k=A.group({class:"apexcharts-pie"});if(N.globals.noData)return k;for(var P=0,D=0;D<m.length;D++)P+=F.negToZero(m[D]);var V=[],Z=A.group();P===0&&(P=1e-5),m.forEach(function(ae){p.maxY=Math.max(p.maxY,ae)}),N.config.yaxis[0].max&&(this.maxY=N.config.yaxis[0].max),N.config.grid.position==="back"&&this.chartType==="polarArea"&&this.drawPolarElements(k);for(var ce=0;ce<m.length;ce++){var ue=this.fullAngle*F.negToZero(m[ce])/P;V.push(ue),this.chartType==="polarArea"?(V[ce]=this.fullAngle/m.length,this.sliceSizes.push(N.globals.radialSize*m[ce]/this.maxY)):this.sliceSizes.push(N.globals.radialSize)}if(N.globals.dataChanged){for(var me,Ne=0,Ie=0;Ie<N.globals.previousPaths.length;Ie++)Ne+=F.negToZero(N.globals.previousPaths[Ie]);for(var Le=0;Le<N.globals.previousPaths.length;Le++)me=this.fullAngle*F.negToZero(N.globals.previousPaths[Le])/Ne,this.prevSectorAngleArr.push(me)}if(this.donutSize<0&&(this.donutSize=0),this.chartType==="donut"){var Xe=A.drawCircle(this.donutSize);Xe.attr({cx:this.centerX,cy:this.centerY,fill:N.config.plotOptions.pie.donut.background?N.config.plotOptions.pie.donut.background:"transparent"}),Z.add(Xe)}var Oe=this.drawArcs(V,m);if(this.sliceLabels.forEach(function(ae){Oe.add(ae)}),Z.attr({transform:"translate(".concat(this.translateX,", ").concat(this.translateY,") scale(").concat(N.config.plotOptions.pie.customScale,")")}),Z.add(Oe),k.add(Z),this.donutDataLabels.show){var $e=this.renderInnerDataLabels(this.dataLabelsGroup,this.donutDataLabels,{hollowSize:this.donutSize,centerX:this.centerX,centerY:this.centerY,opacity:this.donutDataLabels.show});k.add($e)}return N.config.grid.position==="front"&&this.chartType==="polarArea"&&this.drawPolarElements(k),k}},{key:"drawArcs",value:function(m,p){var N=this.w,A=new O(this.ctx),k=new U(this.ctx),P=new be(this.ctx),D=k.group({class:"apexcharts-slices"}),V=this.initialAngle,Z=this.initialAngle,ce=this.initialAngle,ue=this.initialAngle;this.strokeWidth=N.config.stroke.show?N.config.stroke.width:0;for(var me=0;me<m.length;me++){var Ne=k.group({class:"apexcharts-series apexcharts-pie-series",seriesName:F.escapeString(N.globals.seriesNames[me]),rel:me+1,"data:realIndex":me});D.add(Ne),Z=ue,ce=(V=ce)+m[me],ue=Z+this.prevSectorAngleArr[me];var Ie=ce<V?this.fullAngle+ce-V:ce-V,Le=P.fillPath({seriesNumber:me,size:this.sliceSizes[me],value:p[me]}),Xe=this.getChangedPath(Z,ue),Oe=k.drawPath({d:Xe,stroke:Array.isArray(this.lineColorArr)?this.lineColorArr[me]:this.lineColorArr,strokeWidth:0,fill:Le,fillOpacity:N.config.fill.opacity,classes:"apexcharts-pie-area apexcharts-".concat(this.chartType.toLowerCase(),"-slice-").concat(me)});if(Oe.attr({index:0,j:me}),A.setSelectionFilter(Oe,0,me),N.config.chart.dropShadow.enabled){var $e=N.config.chart.dropShadow;A.dropShadow(Oe,$e,me)}this.addListeners(Oe,this.donutDataLabels),U.setAttrs(Oe.node,{"data:angle":Ie,"data:startAngle":V,"data:strokeWidth":this.strokeWidth,"data:value":p[me]});var ae={x:0,y:0};this.chartType==="pie"||this.chartType==="polarArea"?ae=F.polarToCartesian(this.centerX,this.centerY,N.globals.radialSize/1.25+N.config.plotOptions.pie.dataLabels.offset,(V+Ie/2)%this.fullAngle):this.chartType==="donut"&&(ae=F.polarToCartesian(this.centerX,this.centerY,(N.globals.radialSize+this.donutSize)/2+N.config.plotOptions.pie.dataLabels.offset,(V+Ie/2)%this.fullAngle)),Ne.add(Oe);var he=0;if(!this.initialAnim||N.globals.resized||N.globals.dataChanged?this.animBeginArr.push(0):((he=Ie/this.fullAngle*N.config.chart.animations.speed)===0&&(he=1),this.animDur=he+this.animDur,this.animBeginArr.push(this.animDur)),this.dynamicAnim&&N.globals.dataChanged?this.animatePaths(Oe,{size:this.sliceSizes[me],endAngle:ce,startAngle:V,prevStartAngle:Z,prevEndAngle:ue,animateStartingPos:!0,i:me,animBeginArr:this.animBeginArr,shouldSetPrevPaths:!0,dur:N.config.chart.animations.dynamicAnimation.speed}):this.animatePaths(Oe,{size:this.sliceSizes[me],endAngle:ce,startAngle:V,i:me,totalItems:m.length-1,animBeginArr:this.animBeginArr,dur:he}),N.config.plotOptions.pie.expandOnClick&&this.chartType!=="polarArea"&&Oe.node.addEventListener("mouseup",this.pieClicked.bind(this,me)),N.globals.selectedDataPoints[0]!==void 0&&N.globals.selectedDataPoints[0].indexOf(me)>-1&&this.pieClicked(me),N.config.dataLabels.enabled){var Pe=ae.x,Ve=ae.y,Te=100*Ie/this.fullAngle+"%";if(Ie!==0&&N.config.plotOptions.pie.dataLabels.minAngleToShowLabel<m[me]){var Ze=N.config.dataLabels.formatter;Ze!==void 0&&(Te=Ze(N.globals.seriesPercent[me][0],{seriesIndex:me,w:N}));var it=N.globals.dataLabels.style.colors[me],wt=k.group({class:"apexcharts-datalabels"}),Dt=k.drawText({x:Pe,y:Ve,text:Te,textAnchor:"middle",fontSize:N.config.dataLabels.style.fontSize,fontFamily:N.config.dataLabels.style.fontFamily,fontWeight:N.config.dataLabels.style.fontWeight,foreColor:it});if(wt.add(Dt),N.config.dataLabels.dropShadow.enabled){var Qt=N.config.dataLabels.dropShadow;A.dropShadow(Dt,Qt)}Dt.node.classList.add("apexcharts-pie-label"),N.config.chart.animations.animate&&N.globals.resized===!1&&(Dt.node.classList.add("apexcharts-pie-label-delay"),Dt.node.style.animationDelay=N.config.chart.animations.speed/940+"s"),this.sliceLabels.push(wt)}}}return D}},{key:"addListeners",value:function(m,p){var N=new U(this.ctx);m.node.addEventListener("mouseenter",N.pathMouseEnter.bind(this,m)),m.node.addEventListener("mouseleave",N.pathMouseLeave.bind(this,m)),m.node.addEventListener("mouseleave",this.revertDataLabelsInner.bind(this,m.node,p)),m.node.addEventListener("mousedown",N.pathMouseDown.bind(this,m)),this.donutDataLabels.total.showAlways||(m.node.addEventListener("mouseenter",this.printDataLabelsInner.bind(this,m.node,p)),m.node.addEventListener("mousedown",this.printDataLabelsInner.bind(this,m.node,p)))}},{key:"animatePaths",value:function(m,p){var N=this.w,A=p.endAngle<p.startAngle?this.fullAngle+p.endAngle-p.startAngle:p.endAngle-p.startAngle,k=A,P=p.startAngle,D=p.startAngle;p.prevStartAngle!==void 0&&p.prevEndAngle!==void 0&&(P=p.prevEndAngle,k=p.prevEndAngle<p.prevStartAngle?this.fullAngle+p.prevEndAngle-p.prevStartAngle:p.prevEndAngle-p.prevStartAngle),p.i===N.config.series.length-1&&(A+D>this.fullAngle?p.endAngle=p.endAngle-(A+D):A+D<this.fullAngle&&(p.endAngle=p.endAngle+(this.fullAngle-(A+D)))),A===this.fullAngle&&(A=this.fullAngle-.01),this.animateArc(m,P,D,A,k,p)}},{key:"animateArc",value:function(m,p,N,A,k,P){var D,V=this,Z=this.w,ce=new $(this.ctx),ue=P.size;(isNaN(p)||isNaN(k))&&(p=N,k=A,P.dur=0);var me=A,Ne=N,Ie=p<N?this.fullAngle+p-N:p-N;Z.globals.dataChanged&&P.shouldSetPrevPaths&&P.prevEndAngle&&(D=V.getPiePath({me:V,startAngle:P.prevStartAngle,angle:P.prevEndAngle<P.prevStartAngle?this.fullAngle+P.prevEndAngle-P.prevStartAngle:P.prevEndAngle-P.prevStartAngle,size:ue}),m.attr({d:D})),P.dur!==0?m.animate(P.dur,Z.globals.easing,P.animBeginArr[P.i]).afterAll(function(){V.chartType!=="pie"&&V.chartType!=="donut"&&V.chartType!=="polarArea"||this.animate(Z.config.chart.animations.dynamicAnimation.speed).attr({"stroke-width":V.strokeWidth}),P.i===Z.config.series.length-1&&ce.animationCompleted(m)}).during(function(Le){me=Ie+(A-Ie)*Le,P.animateStartingPos&&(me=k+(A-k)*Le,Ne=p-k+(N-(p-k))*Le),D=V.getPiePath({me:V,startAngle:Ne,angle:me,size:ue}),m.node.setAttribute("data:pathOrig",D),m.attr({d:D})}):(D=V.getPiePath({me:V,startAngle:Ne,angle:A,size:ue}),P.isTrack||(Z.globals.animationEnded=!0),m.node.setAttribute("data:pathOrig",D),m.attr({d:D,"stroke-width":V.strokeWidth}))}},{key:"pieClicked",value:function(m){var p,N=this.w,A=this,k=A.sliceSizes[m]+(N.config.plotOptions.pie.expandOnClick?4:0),P=N.globals.dom.Paper.select(".apexcharts-".concat(A.chartType.toLowerCase(),"-slice-").concat(m)).members[0];if(P.attr("data:pieClicked")!=="true"){var D=N.globals.dom.baseEl.getElementsByClassName("apexcharts-pie-area");Array.prototype.forEach.call(D,function(ue){ue.setAttribute("data:pieClicked","false");var me=ue.getAttribute("data:pathOrig");me&&ue.setAttribute("d",me)}),N.globals.capturedDataPointIndex=m,P.attr("data:pieClicked","true");var V=parseInt(P.attr("data:startAngle"),10),Z=parseInt(P.attr("data:angle"),10);p=A.getPiePath({me:A,startAngle:V,angle:Z,size:k}),Z!==360&&P.plot(p)}else{P.attr({"data:pieClicked":"false"}),this.revertDataLabelsInner(P.node,this.donutDataLabels);var ce=P.attr("data:pathOrig");P.attr({d:ce})}}},{key:"getChangedPath",value:function(m,p){var N="";return this.dynamicAnim&&this.w.globals.dataChanged&&(N=this.getPiePath({me:this,startAngle:m,angle:p-m,size:this.size})),N}},{key:"getPiePath",value:function(m){var p,N=m.me,A=m.startAngle,k=m.angle,P=m.size,D=new U(this.ctx),V=A,Z=Math.PI*(V-90)/180,ce=k+A;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,me=N.centerX+P*Math.cos(Z),Ne=N.centerY+P*Math.sin(Z),Ie=N.centerX+P*Math.cos(ue),Le=N.centerY+P*Math.sin(ue),Xe=F.polarToCartesian(N.centerX,N.centerY,N.donutSize,ce),Oe=F.polarToCartesian(N.centerX,N.centerY,N.donutSize,V),$e=k>180?1:0,ae=["M",me,Ne,"A",P,P,0,$e,1,Ie,Le];return p=N.chartType==="donut"?[].concat(ae,["L",Xe.x,Xe.y,"A",N.donutSize,N.donutSize,0,$e,0,Oe.x,Oe.y,"L",me,Ne,"z"]).join(" "):N.chartType==="pie"||N.chartType==="polarArea"?[].concat(ae,["L",N.centerX,N.centerY,"L",me,Ne]).join(" "):[].concat(ae).join(" "),D.roundPathCorners(p,2*this.strokeWidth)}},{key:"drawPolarElements",value:function(m){var p=this.w,N=new at(this.ctx),A=new U(this.ctx),k=new Yn(this.ctx),P=A.group(),D=A.group(),V=N.niceScale(0,Math.ceil(this.maxY),0),Z=V.result.reverse(),ce=V.result.length;this.maxY=V.niceMax;for(var ue=p.globals.radialSize,me=ue/(ce-1),Ne=0;Ne<ce-1;Ne++){var Ie=A.drawCircle(ue);if(Ie.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 Le=k.drawYAxisTexts(this.centerX,this.centerY-ue+parseInt(p.config.yaxis[0].labels.style.fontSize,10)/2,Ne,Z[Ne]);D.add(Le)}P.add(Ie),ue-=me}this.drawSpokes(m),m.add(P),m.add(D)}},{key:"renderInnerDataLabels",value:function(m,p,N){var A=this.w,k=new U(this.ctx),P=p.total.show;m.node.innerHTML="",m.node.style.opacity=N.opacity;var D,V,Z=N.centerX,ce=this.donutDataLabels.total.label?N.centerY:N.centerY-N.centerY/6;D=p.name.color===void 0?A.globals.colors[0]:p.name.color;var ue=p.name.fontSize,me=p.name.fontFamily,Ne=p.name.fontWeight;V=p.value.color===void 0?A.config.chart.foreColor:p.value.color;var Ie=p.value.formatter,Le="",Xe="";if(P?(D=p.total.color,ue=p.total.fontSize,me=p.total.fontFamily,Ne=p.total.fontWeight,Xe=this.donutDataLabels.total.label?p.total.label:"",Le=p.total.formatter(A)):A.globals.series.length===1&&(Le=Ie(A.globals.series[0],A),Xe=A.globals.seriesNames[0]),Xe&&(Xe=p.name.formatter(Xe,p.total.show,A)),p.name.show){var Oe=k.drawText({x:Z,y:ce+parseFloat(p.name.offsetY),text:Xe,textAnchor:"middle",foreColor:D,fontSize:ue,fontWeight:Ne,fontFamily:me});Oe.node.classList.add("apexcharts-datalabel-label"),m.add(Oe)}if(p.value.show){var $e=p.name.show?parseFloat(p.value.offsetY)+16:p.value.offsetY,ae=k.drawText({x:Z,y:ce+$e,text:Le,textAnchor:"middle",foreColor:V,fontWeight:p.value.fontWeight,fontSize:p.value.fontSize,fontFamily:p.value.fontFamily});ae.node.classList.add("apexcharts-datalabel-value"),m.add(ae)}return m}},{key:"printInnerLabels",value:function(m,p,N,A){var k,P=this.w;A?k=m.name.color===void 0?P.globals.colors[parseInt(A.parentNode.getAttribute("rel"),10)-1]:m.name.color:P.globals.series.length>1&&m.total.show&&(k=m.total.color);var D=P.globals.dom.baseEl.querySelector(".apexcharts-datalabel-label"),V=P.globals.dom.baseEl.querySelector(".apexcharts-datalabel-value");N=(0,m.value.formatter)(N,P),A||typeof m.total.formatter!="function"||(N=m.total.formatter(P));var Z=p===m.total.label;p=this.donutDataLabels.total.label?m.name.formatter(p,Z,P):"",D!==null&&(D.textContent=p),V!==null&&(V.textContent=N),D!==null&&(D.style.fill=k)}},{key:"printDataLabelsInner",value:function(m,p){var N=this.w,A=m.getAttribute("data:value"),k=N.globals.seriesNames[parseInt(m.parentNode.getAttribute("rel"),10)-1];N.globals.series.length>1&&this.printInnerLabels(p,k,A,m);var P=N.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group");P!==null&&(P.style.opacity=1)}},{key:"drawSpokes",value:function(m){var p=this,N=this.w,A=new U(this.ctx),k=N.config.plotOptions.polarArea.spokes;if(k.strokeWidth!==0){for(var P=[],D=360/N.globals.series.length,V=0;V<N.globals.series.length;V++)P.push(F.polarToCartesian(this.centerX,this.centerY,N.globals.radialSize,N.config.plotOptions.pie.startAngle+D*V));P.forEach(function(Z,ce){var ue=A.drawLine(Z.x,Z.y,p.centerX,p.centerY,Array.isArray(k.connectorColors)?k.connectorColors[ce]:k.connectorColors);m.add(ue)})}}},{key:"revertDataLabelsInner",value:function(){var m=this.w;if(this.donutDataLabels.show){var p=m.globals.dom.Paper.select(".apexcharts-datalabels-group").members[0],N=this.renderInnerDataLabels(p,this.donutDataLabels,{hollowSize:this.donutSize,centerX:this.centerX,centerY:this.centerY,opacity:this.donutDataLabels.show});m.globals.dom.Paper.select(".apexcharts-radialbar, .apexcharts-pie").members[0].add(N)}}}]),Ce}(),Vn=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.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 U(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 Y(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(Ce,[{key:"draw",value:function(m){var p=this,N=this.w,A=new be(this.ctx),k=[],P=new Fe(this.ctx);m.length&&(this.dataPointsLen=m[N.globals.maxValsInArrayIndex].length),this.disAngle=2*Math.PI/this.dataPointsLen;var D=N.globals.gridWidth/2,V=N.globals.gridHeight/2,Z=D+N.config.plotOptions.radar.offsetX,ce=V+N.config.plotOptions.radar.offsetY,ue=this.graphics.group({class:"apexcharts-radar-series apexcharts-plot-series",transform:"translate(".concat(Z||0,", ").concat(ce||0,")")}),me=[],Ne=null,Ie=null;if(this.yaxisLabels=this.graphics.group({class:"apexcharts-yaxis"}),m.forEach(function(Xe,Oe){var $e=Xe.length===N.globals.dataPoints,ae=p.graphics.group().attr({class:"apexcharts-series","data:longestSeries":$e,seriesName:F.escapeString(N.globals.seriesNames[Oe]),rel:Oe+1,"data:realIndex":Oe});p.dataRadiusOfPercent[Oe]=[],p.dataRadius[Oe]=[],p.angleArr[Oe]=[],Xe.forEach(function(xn,pn){var An=Math.abs(p.maxValue-p.minValue);xn-=p.minValue,p.isLog&&(xn=p.coreUtils.getLogVal(p.logBase,xn,0)),p.dataRadiusOfPercent[Oe][pn]=xn/An,p.dataRadius[Oe][pn]=p.dataRadiusOfPercent[Oe][pn]*p.size,p.angleArr[Oe][pn]=pn*p.disAngle}),me=p.getDataPointsPos(p.dataRadius[Oe],p.angleArr[Oe]);var he=p.createPaths(me,{x:0,y:0});Ne=p.graphics.group({class:"apexcharts-series-markers-wrap apexcharts-element-hidden"}),Ie=p.graphics.group({class:"apexcharts-datalabels","data:realIndex":Oe}),N.globals.delayedElements.push({el:Ne.node,index:Oe});var Pe={i:Oe,realIndex:Oe,animationDelay:Oe,initialSpeed:N.config.chart.animations.speed,dataChangeSpeed:N.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-radar",shouldClipToGrid:!1,bindEventsOnPaths:!1,stroke:N.globals.stroke.colors[Oe],strokeLineCap:N.config.stroke.lineCap},Ve=null;N.globals.previousPaths.length>0&&(Ve=p.getPreviousPath(Oe));for(var Te=0;Te<he.linePathsTo.length;Te++){var Ze=p.graphics.renderPaths(y(y({},Pe),{},{pathFrom:Ve===null?he.linePathsFrom[Te]:Ve,pathTo:he.linePathsTo[Te],strokeWidth:Array.isArray(p.strokeWidth)?p.strokeWidth[Oe]:p.strokeWidth,fill:"none",drawShadow:!1}));ae.add(Ze);var it=A.fillPath({seriesNumber:Oe}),wt=p.graphics.renderPaths(y(y({},Pe),{},{pathFrom:Ve===null?he.areaPathsFrom[Te]:Ve,pathTo:he.areaPathsTo[Te],strokeWidth:0,fill:it,drawShadow:!1}));if(N.config.chart.dropShadow.enabled){var Dt=new O(p.ctx),Qt=N.config.chart.dropShadow;Dt.dropShadow(wt,Object.assign({},Qt,{noUserSpaceOnUse:!0}),Oe)}ae.add(wt)}Xe.forEach(function(xn,pn){var An=new we(p.ctx).getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:Oe,dataPointIndex:pn}),or=p.graphics.drawMarker(me[pn].x,me[pn].y,An);or.attr("rel",pn),or.attr("j",pn),or.attr("index",Oe),or.node.setAttribute("default-marker-size",An.pSize);var $t=p.graphics.group({class:"apexcharts-series-markers"});$t&&$t.add(or),Ne.add($t),ae.add(Ne);var bt=N.config.dataLabels;if(bt.enabled){var rn=bt.formatter(N.globals.series[Oe][pn],{seriesIndex:Oe,dataPointIndex:pn,w:N});P.plotDataLabelsText({x:me[pn].x,y:me[pn].y,text:rn,textAnchor:"middle",i:Oe,j:Oe,parent:Ie,offsetCorrection:!1,dataLabelsConfig:y({},bt)})}ae.add(Ie)}),k.push(ae)}),this.drawPolygons({parent:ue}),N.config.xaxis.labels.show){var Le=this.drawXAxisTexts();ue.add(Le)}return k.forEach(function(Xe){ue.add(Xe)}),ue.add(this.yaxisLabels),ue}},{key:"drawPolygons",value:function(m){for(var p=this,N=this.w,A=m.parent,k=new Yn(this.ctx),P=N.globals.yAxisScale[0].result.reverse(),D=P.length,V=[],Z=this.size/(D-1),ce=0;ce<D;ce++)V[ce]=Z*ce;V.reverse();var ue=[],me=[];V.forEach(function(Ne,Ie){var Le=F.getPolygonPos(Ne,p.dataPointsLen),Xe="";Le.forEach(function(Oe,$e){if(Ie===0){var ae=p.graphics.drawLine(Oe.x,Oe.y,0,0,Array.isArray(p.polygons.connectorColors)?p.polygons.connectorColors[$e]:p.polygons.connectorColors);me.push(ae)}$e===0&&p.yaxisLabelsTextsPos.push({x:Oe.x,y:Oe.y}),Xe+=Oe.x+","+Oe.y+" "}),ue.push(Xe)}),ue.forEach(function(Ne,Ie){var Le=p.polygons.strokeColors,Xe=p.polygons.strokeWidth,Oe=p.graphics.drawPolygon(Ne,Array.isArray(Le)?Le[Ie]:Le,Array.isArray(Xe)?Xe[Ie]:Xe,N.globals.radarPolygons.fill.colors[Ie]);A.add(Oe)}),me.forEach(function(Ne){A.add(Ne)}),N.config.yaxis[0].show&&this.yaxisLabelsTextsPos.forEach(function(Ne,Ie){var Le=k.drawYAxisTexts(Ne.x,Ne.y,Ie,P[Ie]);p.yaxisLabels.add(Le)})}},{key:"drawXAxisTexts",value:function(){var m=this,p=this.w,N=p.config.xaxis.labels,A=this.graphics.group({class:"apexcharts-xaxis"}),k=F.getPolygonPos(this.size,this.dataPointsLen);return p.globals.labels.forEach(function(P,D){var V=p.config.xaxis.labels.formatter,Z=new Fe(m.ctx);if(k[D]){var ce=m.getTextPos(k[D],m.size),ue=V(P,{seriesIndex:-1,dataPointIndex:D,w:p});Z.plotDataLabelsText({x:ce.newX,y:ce.newY,text:ue,textAnchor:ce.textAnchor,i:D,j:D,parent:A,className:"apexcharts-xaxis-label",color:Array.isArray(N.style.colors)&&N.style.colors[D]?N.style.colors[D]:"#a8a8a8",dataLabelsConfig:y({textAnchor:ce.textAnchor,dropShadow:{enabled:!1}},N),offsetCorrection:!1}).on("click",function(me){if(typeof p.config.chart.events.xAxisLabelClick=="function"){var Ne=Object.assign({},p,{labelIndex:D});p.config.chart.events.xAxisLabelClick(me,m.ctx,Ne)}})}}),A}},{key:"createPaths",value:function(m,p){var N=this,A=[],k=[],P=[],D=[];if(m.length){k=[this.graphics.move(p.x,p.y)],D=[this.graphics.move(p.x,p.y)];var V=this.graphics.move(m[0].x,m[0].y),Z=this.graphics.move(m[0].x,m[0].y);m.forEach(function(ce,ue){V+=N.graphics.line(ce.x,ce.y),Z+=N.graphics.line(ce.x,ce.y),ue===m.length-1&&(V+="Z",Z+="Z")}),A.push(V),P.push(Z)}return{linePathsFrom:k,linePathsTo:A,areaPathsFrom:D,areaPathsTo:P}}},{key:"getTextPos",value:function(m,p){var N="middle",A=m.x,k=m.y;return Math.abs(m.x)>=10?m.x>0?(N="start",A+=10):m.x<0&&(N="end",A-=10):N="middle",Math.abs(m.y)>=p-10&&(m.y<0?k-=10:m.y>0&&(k+=10)),{textAnchor:N,newX:A,newY:k}}},{key:"getPreviousPath",value:function(m){for(var p=this.w,N=null,A=0;A<p.globals.previousPaths.length;A++){var k=p.globals.previousPaths[A];k.paths.length>0&&parseInt(k.realIndex,10)===parseInt(m,10)&&p.globals.previousPaths[A].paths[0]!==void 0&&(N=p.globals.previousPaths[A].paths[0].d)}return N}},{key:"getDataPointsPos",value:function(m,p){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.dataPointsLen;m=m||[],p=p||[];for(var A=[],k=0;k<N;k++){var P={};P.x=m[k]*Math.sin(p[k]),P.y=-m[k]*Math.cos(p[k]),A.push(P)}return A}}]),Ce}(),tr=function(Ce){f(p,Zn);var m=c(p);function p(N){var A;s(this,p),(A=m.call(this,N)).ctx=N,A.w=N.w,A.animBeginArr=[0],A.animDur=0;var k=A.w;return A.startAngle=k.config.plotOptions.radialBar.startAngle,A.endAngle=k.config.plotOptions.radialBar.endAngle,A.totalAngle=Math.abs(k.config.plotOptions.radialBar.endAngle-k.config.plotOptions.radialBar.startAngle),A.trackStartAngle=k.config.plotOptions.radialBar.track.startAngle,A.trackEndAngle=k.config.plotOptions.radialBar.track.endAngle,A.barLabels=A.w.config.plotOptions.radialBar.barLabels,A.donutDataLabels=A.w.config.plotOptions.radialBar.dataLabels,A.radialDataLabels=A.donutDataLabels,A.trackStartAngle||(A.trackStartAngle=A.startAngle),A.trackEndAngle||(A.trackEndAngle=A.endAngle),A.endAngle===360&&(A.endAngle=359.99),A.margin=parseInt(k.config.plotOptions.radialBar.track.margin,10),A.onBarLabelClick=A.onBarLabelClick.bind(r(A)),A}return o(p,[{key:"draw",value:function(N){var A=this.w,k=new U(this.ctx),P=k.group({class:"apexcharts-radialbar"});if(A.globals.noData)return P;var D=k.group(),V=this.defaultSize/2,Z=A.globals.gridWidth/2,ce=this.defaultSize/2.05;A.config.chart.sparkline.enabled||(ce=ce-A.config.stroke.width-A.config.chart.dropShadow.blur);var ue=A.globals.fill.colors;if(A.config.plotOptions.radialBar.track.show){var me=this.drawTracks({size:ce,centerX:Z,centerY:V,colorArr:ue,series:N});D.add(me)}var Ne=this.drawArcs({size:ce,centerX:Z,centerY:V,colorArr:ue,series:N}),Ie=360;A.config.plotOptions.radialBar.startAngle<0&&(Ie=this.totalAngle);var Le=(360-Ie)/360;if(A.globals.radialSize=ce-ce*Le,this.radialDataLabels.value.show){var Xe=Math.max(this.radialDataLabels.value.offsetY,this.radialDataLabels.name.offsetY);A.globals.radialSize+=Xe*Le}return D.add(Ne.g),A.config.plotOptions.radialBar.hollow.position==="front"&&(Ne.g.add(Ne.elHollow),Ne.dataLabels&&Ne.g.add(Ne.dataLabels)),P.add(D),P}},{key:"drawTracks",value:function(N){var A=this.w,k=new U(this.ctx),P=k.group({class:"apexcharts-tracks"}),D=new O(this.ctx),V=new be(this.ctx),Z=this.getStrokeWidth(N);N.size=N.size-Z/2;for(var ce=0;ce<N.series.length;ce++){var ue=k.group({class:"apexcharts-radialbar-track apexcharts-track"});P.add(ue),ue.attr({rel:ce+1}),N.size=N.size-Z-this.margin;var me=A.config.plotOptions.radialBar.track,Ne=V.fillPath({seriesNumber:0,size:N.size,fillColors:Array.isArray(me.background)?me.background[ce]:me.background,solid:!0}),Ie=this.trackStartAngle,Le=this.trackEndAngle;Math.abs(Le)+Math.abs(Ie)>=360&&(Le=360-Math.abs(this.startAngle)-.1);var Xe=k.drawPath({d:"",stroke:Ne,strokeWidth:Z*parseInt(me.strokeWidth,10)/100,fill:"none",strokeOpacity:me.opacity,classes:"apexcharts-radialbar-area"});if(me.dropShadow.enabled){var Oe=me.dropShadow;D.dropShadow(Xe,Oe)}ue.add(Xe),Xe.attr("id","apexcharts-radialbarTrack-"+ce),this.animatePaths(Xe,{centerX:N.centerX,centerY:N.centerY,endAngle:Le,startAngle:Ie,size:N.size,i:ce,totalItems:2,animBeginArr:0,dur:0,isTrack:!0,easing:A.globals.easing})}return P}},{key:"drawArcs",value:function(N){var A=this.w,k=new U(this.ctx),P=new be(this.ctx),D=new O(this.ctx),V=k.group(),Z=this.getStrokeWidth(N);N.size=N.size-Z/2;var ce=A.config.plotOptions.radialBar.hollow.background,ue=N.size-Z*N.series.length-this.margin*N.series.length-Z*parseInt(A.config.plotOptions.radialBar.track.strokeWidth,10)/100/2,me=ue-A.config.plotOptions.radialBar.hollow.margin;A.config.plotOptions.radialBar.hollow.image!==void 0&&(ce=this.drawHollowImage(N,V,ue,ce));var Ne=this.drawHollow({size:me,centerX:N.centerX,centerY:N.centerY,fill:ce||"transparent"});if(A.config.plotOptions.radialBar.hollow.dropShadow.enabled){var Ie=A.config.plotOptions.radialBar.hollow.dropShadow;D.dropShadow(Ne,Ie)}var Le=1;!this.radialDataLabels.total.show&&A.globals.series.length>1&&(Le=0);var Xe=null;if(this.radialDataLabels.show){var Oe=A.globals.dom.Paper.select(".apexcharts-datalabels-group").members[0];Xe=this.renderInnerDataLabels(Oe,this.radialDataLabels,{hollowSize:ue,centerX:N.centerX,centerY:N.centerY,opacity:Le})}A.config.plotOptions.radialBar.hollow.position==="back"&&(V.add(Ne),Xe&&V.add(Xe));var $e=!1;A.config.plotOptions.radialBar.inverseOrder&&($e=!0);for(var ae=$e?N.series.length-1:0;$e?ae>=0:ae<N.series.length;$e?ae--:ae++){var he=k.group({class:"apexcharts-series apexcharts-radial-series",seriesName:F.escapeString(A.globals.seriesNames[ae])});V.add(he),he.attr({rel:ae+1,"data:realIndex":ae}),this.ctx.series.addCollapsedClassToSeries(he,ae),N.size=N.size-Z-this.margin;var Pe=P.fillPath({seriesNumber:ae,size:N.size,value:N.series[ae]}),Ve=this.startAngle,Te=void 0,Ze=F.negToZero(N.series[ae]>100?100:N.series[ae])/100,it=Math.round(this.totalAngle*Ze)+this.startAngle,wt=void 0;A.globals.dataChanged&&(Te=this.startAngle,wt=Math.round(this.totalAngle*F.negToZero(A.globals.previousPaths[ae])/100)+Te),Math.abs(it)+Math.abs(Ve)>360&&(it-=.01),Math.abs(wt)+Math.abs(Te)>360&&(wt-=.01);var Dt=it-Ve,Qt=Array.isArray(A.config.stroke.dashArray)?A.config.stroke.dashArray[ae]:A.config.stroke.dashArray,xn=k.drawPath({d:"",stroke:Pe,strokeWidth:Z,fill:"none",fillOpacity:A.config.fill.opacity,classes:"apexcharts-radialbar-area apexcharts-radialbar-slice-"+ae,strokeDashArray:Qt});if(U.setAttrs(xn.node,{"data:angle":Dt,"data:value":N.series[ae]}),A.config.chart.dropShadow.enabled){var pn=A.config.chart.dropShadow;D.dropShadow(xn,pn,ae)}if(D.setSelectionFilter(xn,0,ae),this.addListeners(xn,this.radialDataLabels),he.add(xn),xn.attr({index:0,j:ae}),this.barLabels.enabled){var An=F.polarToCartesian(N.centerX,N.centerY,N.size,Ve),or=this.barLabels.formatter(A.globals.seriesNames[ae],{seriesIndex:ae,w:A}),$t=["apexcharts-radialbar-label"];this.barLabels.onClick||$t.push("apexcharts-no-click");var bt=this.barLabels.useSeriesColors?A.globals.colors[ae]:A.config.chart.foreColor;bt||(bt=A.config.chart.foreColor);var rn=An.x+this.barLabels.offsetX,ur=An.y+this.barLabels.offsetY,gr=k.drawText({x:rn,y:ur,text:or,textAnchor:"end",dominantBaseline:"middle",fontFamily:this.barLabels.fontFamily,fontWeight:this.barLabels.fontWeight,fontSize:this.barLabels.fontSize,foreColor:bt,cssClass:$t.join(" ")});gr.on("click",this.onBarLabelClick),gr.attr({rel:ae+1}),Ve!==0&&gr.attr({"transform-origin":"".concat(rn," ").concat(ur),transform:"rotate(".concat(Ve," 0 0)")}),he.add(gr)}var br=0;!this.initialAnim||A.globals.resized||A.globals.dataChanged||(br=A.config.chart.animations.speed),A.globals.dataChanged&&(br=A.config.chart.animations.dynamicAnimation.speed),this.animDur=br/(1.2*N.series.length)+this.animDur,this.animBeginArr.push(this.animDur),this.animatePaths(xn,{centerX:N.centerX,centerY:N.centerY,endAngle:it,startAngle:Ve,prevEndAngle:wt,prevStartAngle:Te,size:N.size,i:ae,totalItems:2,animBeginArr:this.animBeginArr,dur:br,shouldSetPrevPaths:!0,easing:A.globals.easing})}return{g:V,elHollow:Ne,dataLabels:Xe}}},{key:"drawHollow",value:function(N){var A=new U(this.ctx).drawCircle(2*N.size);return A.attr({class:"apexcharts-radialbar-hollow",cx:N.centerX,cy:N.centerY,r:N.size,fill:N.fill}),A}},{key:"drawHollowImage",value:function(N,A,k,P){var D=this.w,V=new be(this.ctx),Z=F.randomId(),ce=D.config.plotOptions.radialBar.hollow.image;if(D.config.plotOptions.radialBar.hollow.imageClipped)V.clippedImgArea({width:k,height:k,image:ce,patternID:"pattern".concat(D.globals.cuid).concat(Z)}),P="url(#pattern".concat(D.globals.cuid).concat(Z,")");else{var ue=D.config.plotOptions.radialBar.hollow.imageWidth,me=D.config.plotOptions.radialBar.hollow.imageHeight;if(ue===void 0&&me===void 0){var Ne=D.globals.dom.Paper.image(ce).loaded(function(Le){this.move(N.centerX-Le.width/2+D.config.plotOptions.radialBar.hollow.imageOffsetX,N.centerY-Le.height/2+D.config.plotOptions.radialBar.hollow.imageOffsetY)});A.add(Ne)}else{var Ie=D.globals.dom.Paper.image(ce).loaded(function(Le){this.move(N.centerX-ue/2+D.config.plotOptions.radialBar.hollow.imageOffsetX,N.centerY-me/2+D.config.plotOptions.radialBar.hollow.imageOffsetY),this.size(ue,me)});A.add(Ie)}}return P}},{key:"getStrokeWidth",value:function(N){var A=this.w;return N.size*(100-parseInt(A.config.plotOptions.radialBar.hollow.size,10))/100/(N.series.length+1)-this.margin}},{key:"onBarLabelClick",value:function(N){var A=parseInt(N.target.getAttribute("rel"),10)-1,k=this.barLabels.onClick,P=this.w;k&&k(P.globals.seriesNames[A],{w:P,seriesIndex:A})}}]),p}(),Sn=function(Ce){f(p,yn);var m=c(p);function p(){return s(this,p),m.apply(this,arguments)}return o(p,[{key:"draw",value:function(N,A){var k=this.w,P=new U(this.ctx);this.rangeBarOptions=this.w.config.plotOptions.rangeBar,this.series=N,this.seriesRangeStart=k.globals.seriesRangeStart,this.seriesRangeEnd=k.globals.seriesRangeEnd,this.barHelpers.initVariables(N);for(var D=P.group({class:"apexcharts-rangebar-series apexcharts-plot-series"}),V=0;V<N.length;V++){var Z,ce,ue,me,Ne=void 0,Ie=void 0,Le=k.globals.comboCharts?A[V]:V,Xe=this.barHelpers.getGroupIndex(Le).columnGroupIndex,Oe=P.group({class:"apexcharts-series",seriesName:F.escapeString(k.globals.seriesNames[Le]),rel:V+1,"data:realIndex":Le});this.ctx.series.addCollapsedClassToSeries(Oe,Le),N[V].length>0&&(this.visibleI=this.visibleI+1);var $e=0,ae=0,he=0;this.yRatio.length>1&&(this.yaxisIndex=k.globals.seriesYAxisReverseMap[Le][0],he=Le);var Pe=this.barHelpers.initialPositions();Ie=Pe.y,me=Pe.zeroW,Ne=Pe.x,ae=Pe.barWidth,$e=Pe.barHeight,Z=Pe.xDivision,ce=Pe.yDivision,ue=Pe.zeroH;for(var Ve=P.group({class:"apexcharts-datalabels","data:realIndex":Le}),Te=P.group({class:"apexcharts-rangebar-goals-markers"}),Ze=0;Ze<k.globals.dataPoints;Ze++){var it=this.barHelpers.getStrokeWidth(V,Ze,Le),wt=this.seriesRangeStart[V][Ze],Dt=this.seriesRangeEnd[V][Ze],Qt=null,xn=null,pn=null,An={x:Ne,y:Ie,strokeWidth:it,elSeries:Oe},or=this.seriesLen;if(k.config.plotOptions.bar.rangeBarGroupRows&&(or=1),k.config.series[V].data[Ze]===void 0)break;if(this.isHorizontal){pn=Ie+$e*this.visibleI;var $t=(ce-$e*or)/2;if(k.config.series[V].data[Ze].x){var bt=this.detectOverlappingBars({i:V,j:Ze,barYPosition:pn,srty:$t,barHeight:$e,yDivision:ce,initPositions:Pe});$e=bt.barHeight,pn=bt.barYPosition}ae=(Qt=this.drawRangeBarPaths(y({indexes:{i:V,j:Ze,realIndex:Le},barHeight:$e,barYPosition:pn,zeroW:me,yDivision:ce,y1:wt,y2:Dt},An))).barWidth}else{k.globals.isXNumeric&&(Ne=(k.globals.seriesX[V][Ze]-k.globals.minX)/this.xRatio-ae/2),xn=Ne+ae*this.visibleI;var rn=(Z-ae*or)/2;if(k.config.series[V].data[Ze].x){var ur=this.detectOverlappingBars({i:V,j:Ze,barXPosition:xn,srtx:rn,barWidth:ae,xDivision:Z,initPositions:Pe});ae=ur.barWidth,xn=ur.barXPosition}$e=(Qt=this.drawRangeColumnPaths(y({indexes:{i:V,j:Ze,realIndex:Le,translationsIndex:he},barWidth:ae,barXPosition:xn,zeroH:ue,xDivision:Z},An))).barHeight}var gr=this.barHelpers.drawGoalLine({barXPosition:Qt.barXPosition,barYPosition:pn,goalX:Qt.goalX,goalY:Qt.goalY,barHeight:$e,barWidth:ae});gr&&Te.add(gr),Ie=Qt.y,Ne=Qt.x;var br=this.barHelpers.getPathFillColor(N,V,Ze,Le),Br=k.globals.stroke.colors[Le];this.renderSeries({realIndex:Le,pathFill:br,lineFill:Br,j:Ze,i:V,x:Ne,y:Ie,y1:wt,y2:Dt,pathFrom:Qt.pathFrom,pathTo:Qt.pathTo,strokeWidth:it,elSeries:Oe,series:N,barHeight:$e,barWidth:ae,barXPosition:xn,barYPosition:pn,columnGroupIndex:Xe,elDataLabelsWrap:Ve,elGoalsMarkers:Te,visibleSeries:this.visibleI,type:"rangebar"})}D.add(Oe)}return D}},{key:"detectOverlappingBars",value:function(N){var A=N.i,k=N.j,P=N.barYPosition,D=N.barXPosition,V=N.srty,Z=N.srtx,ce=N.barHeight,ue=N.barWidth,me=N.yDivision,Ne=N.xDivision,Ie=N.initPositions,Le=this.w,Xe=[],Oe=Le.config.series[A].data[k].rangeName,$e=Le.config.series[A].data[k].x,ae=Array.isArray($e)?$e.join(" "):$e,he=Le.globals.labels.map(function(Ve){return Array.isArray(Ve)?Ve.join(" "):Ve}).indexOf(ae),Pe=Le.globals.seriesRange[A].findIndex(function(Ve){return Ve.x===ae&&Ve.overlaps.length>0});return this.isHorizontal?(P=Le.config.plotOptions.bar.rangeBarGroupRows?V+me*he:V+ce*this.visibleI+me*he,Pe>-1&&!Le.config.plotOptions.bar.rangeBarOverlap&&(Xe=Le.globals.seriesRange[A][Pe].overlaps).indexOf(Oe)>-1&&(P=(ce=Ie.barHeight/Xe.length)*this.visibleI+me*(100-parseInt(this.barOptions.barHeight,10))/100/2+ce*(this.visibleI+Xe.indexOf(Oe))+me*he)):(he>-1&&!Le.globals.timescaleLabels.length&&(D=Le.config.plotOptions.bar.rangeBarGroupRows?Z+Ne*he:Z+ue*this.visibleI+Ne*he),Pe>-1&&!Le.config.plotOptions.bar.rangeBarOverlap&&(Xe=Le.globals.seriesRange[A][Pe].overlaps).indexOf(Oe)>-1&&(D=(ue=Ie.barWidth/Xe.length)*this.visibleI+Ne*(100-parseInt(this.barOptions.barWidth,10))/100/2+ue*(this.visibleI+Xe.indexOf(Oe))+Ne*he)),{barYPosition:P,barXPosition:D,barHeight:ce,barWidth:ue}}},{key:"drawRangeColumnPaths",value:function(N){var A=N.indexes,k=N.x,P=N.xDivision,D=N.barWidth,V=N.barXPosition,Z=N.zeroH,ce=this.w,ue=A.i,me=A.j,Ne=A.realIndex,Ie=A.translationsIndex,Le=this.yRatio[Ie],Xe=this.getRangeValue(Ne,me),Oe=Math.min(Xe.start,Xe.end),$e=Math.max(Xe.start,Xe.end);this.series[ue][me]===void 0||this.series[ue][me]===null?Oe=Z:(Oe=Z-Oe/Le,$e=Z-$e/Le);var ae=Math.abs($e-Oe),he=this.barHelpers.getColumnPaths({barXPosition:V,barWidth:D,y1:Oe,y2:$e,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,realIndex:Ne,i:Ne,j:me,w:ce});if(ce.globals.isXNumeric){var Pe=this.getBarXForNumericXAxis({x:k,j:me,realIndex:Ne,barWidth:D});k=Pe.x,V=Pe.barXPosition}else k+=P;return{pathTo:he.pathTo,pathFrom:he.pathFrom,barHeight:ae,x:k,y:Xe.start<0&&Xe.end<0?Oe:$e,goalY:this.barHelpers.getGoalValues("y",null,Z,ue,me,Ie),barXPosition:V}}},{key:"preventBarOverflow",value:function(N){var A=this.w;return N<0&&(N=0),N>A.globals.gridWidth&&(N=A.globals.gridWidth),N}},{key:"drawRangeBarPaths",value:function(N){var A=N.indexes,k=N.y,P=N.y1,D=N.y2,V=N.yDivision,Z=N.barHeight,ce=N.barYPosition,ue=N.zeroW,me=this.w,Ne=A.realIndex,Ie=A.j,Le=this.preventBarOverflow(ue+P/this.invertedYRatio),Xe=this.preventBarOverflow(ue+D/this.invertedYRatio),Oe=this.getRangeValue(Ne,Ie),$e=Math.abs(Xe-Le),ae=this.barHelpers.getBarpaths({barYPosition:ce,barHeight:Z,x1:Le,x2:Xe,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:Ne,realIndex:Ne,j:Ie,w:me});return me.globals.isXNumeric||(k+=V),{pathTo:ae.pathTo,pathFrom:ae.pathFrom,barWidth:$e,x:Oe.start<0&&Oe.end<0?Le:Xe,goalX:this.barHelpers.getGoalValues("x",ue,null,Ne,Ie),y:k}}},{key:"getRangeValue",value:function(N,A){var k=this.w;return{start:k.globals.seriesRangeStart[N][A],end:k.globals.seriesRangeEnd[N][A]}}}]),p}(),ze=function(){function Ce(m){s(this,Ce),this.w=m.w,this.lineCtx=m}return o(Ce,[{key:"sameValueSeriesFix",value:function(m,p){var N=this.w;if((N.config.fill.type==="gradient"||N.config.fill.type[m]==="gradient")&&new Y(this.lineCtx.ctx,N).seriesHaveSameValues(m)){var A=p[m].slice();A[A.length-1]=A[A.length-1]+1e-6,p[m]=A}return p}},{key:"calculatePoints",value:function(m){var p=m.series,N=m.realIndex,A=m.x,k=m.y,P=m.i,D=m.j,V=m.prevY,Z=this.w,ce=[],ue=[];if(D===0){var me=this.lineCtx.categoryAxisCorrection+Z.config.markers.offsetX;Z.globals.isXNumeric&&(me=(Z.globals.seriesX[N][0]-Z.globals.minX)/this.lineCtx.xRatio+Z.config.markers.offsetX),ce.push(me),ue.push(F.isNumber(p[P][0])?V+Z.config.markers.offsetY:null),ce.push(A+Z.config.markers.offsetX),ue.push(F.isNumber(p[P][D+1])?k+Z.config.markers.offsetY:null)}else ce.push(A+Z.config.markers.offsetX),ue.push(F.isNumber(p[P][D+1])?k+Z.config.markers.offsetY:null);return{x:ce,y:ue}}},{key:"checkPreviousPaths",value:function(m){for(var p=m.pathFromLine,N=m.pathFromArea,A=m.realIndex,k=this.w,P=0;P<k.globals.previousPaths.length;P++){var D=k.globals.previousPaths[P];(D.type==="line"||D.type==="area")&&D.paths.length>0&&parseInt(D.realIndex,10)===parseInt(A,10)&&(D.type==="line"?(this.lineCtx.appendPathFrom=!1,p=k.globals.previousPaths[P].paths[0].d):D.type==="area"&&(this.lineCtx.appendPathFrom=!1,N=k.globals.previousPaths[P].paths[0].d,k.config.stroke.show&&k.globals.previousPaths[P].paths[1]&&(p=k.globals.previousPaths[P].paths[1].d)))}return{pathFromLine:p,pathFromArea:N}}},{key:"determineFirstPrevY",value:function(m){var p,N,A,k=m.i,P=m.realIndex,D=m.series,V=m.prevY,Z=m.lineYPosition,ce=m.translationsIndex,ue=this.w,me=ue.config.chart.stacked&&!ue.globals.comboCharts||ue.config.chart.stacked&&ue.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||((p=this.w.config.series[P])===null||p===void 0?void 0:p.type)==="bar"||((N=this.w.config.series[P])===null||N===void 0?void 0:N.type)==="column");if(((A=D[k])===null||A===void 0?void 0:A[0])!==void 0)V=(Z=me&&k>0?this.lineCtx.prevSeriesY[k-1][0]:this.lineCtx.zeroY)-D[k][0]/this.lineCtx.yRatio[ce]+2*(this.lineCtx.isReversed?D[k][0]/this.lineCtx.yRatio[ce]:0);else if(me&&k>0&&D[k][0]===void 0){for(var Ne=k-1;Ne>=0;Ne--)if(D[Ne][0]!==null&&D[Ne][0]!==void 0){V=Z=this.lineCtx.prevSeriesY[Ne][0];break}}return{prevY:V,lineYPosition:Z}}}]),Ce}(),xe=function(Ce){for(var m,p,N,A,k=function(ce){for(var ue=[],me=ce[0],Ne=ce[1],Ie=ue[0]=Be(me,Ne),Le=1,Xe=ce.length-1;Le<Xe;Le++)me=Ne,Ne=ce[Le+1],ue[Le]=.5*(Ie+(Ie=Be(me,Ne)));return ue[Le]=Ie,ue}(Ce),P=Ce.length-1,D=[],V=0;V<P;V++)N=Be(Ce[V],Ce[V+1]),Math.abs(N)<1e-6?k[V]=k[V+1]=0:(A=(m=k[V]/N)*m+(p=k[V+1]/N)*p)>9&&(A=3*N/Math.sqrt(A),k[V]=A*m,k[V+1]=A*p);for(var Z=0;Z<=P;Z++)A=(Ce[Math.min(P,Z+1)][0]-Ce[Math.max(0,Z-1)][0])/(6*(1+k[Z]*k[Z])),D.push([A||0,k[Z]*A||0]);return D},Ge=function(Ce){var m=xe(Ce),p=Ce[1],N=Ce[0],A=[],k=m[1],P=m[0];A.push(N,[N[0]+P[0],N[1]+P[1],p[0]-k[0],p[1]-k[1],p[0],p[1]]);for(var D=2,V=m.length;D<V;D++){var Z=Ce[D],ce=m[D];A.push([Z[0]-ce[0],Z[1]-ce[1],Z[0],Z[1]])}return A},_e=function(Ce,m,p){var N=Ce.slice(m,p);if(m){if(p-m>1&&N[1].length<6){var A=N[0].length;N[1]=[2*N[0][A-2]-N[0][A-4],2*N[0][A-1]-N[0][A-3]].concat(N[1])}N[0]=N[0].slice(-2)}return N};function Be(Ce,m){return(m[1]-Ce[1])/(m[0]-Ce[0])}var qt=function(){function Ce(m,p,N){s(this,Ce),this.ctx=m,this.w=m.w,this.xyRatios=p,this.pointsChart=!(this.w.config.chart.type!=="bubble"&&this.w.config.chart.type!=="scatter")||N,this.scatter=new je(this.ctx),this.noNegatives=this.w.globals.minX===Number.MAX_VALUE,this.lineHelpers=new ze(this),this.markers=new we(this.ctx),this.prevSeriesY=[],this.categoryAxisCorrection=0,this.yaxisIndex=0}return o(Ce,[{key:"draw",value:function(m,p,N,A){var k,P=this.w,D=new U(this.ctx),V=P.globals.comboCharts?p:P.config.chart.type,Z=D.group({class:"apexcharts-".concat(V,"-series apexcharts-plot-series")}),ce=new Y(this.ctx,P);this.yRatio=this.xyRatios.yRatio,this.zRatio=this.xyRatios.zRatio,this.xRatio=this.xyRatios.xRatio,this.baseLineY=this.xyRatios.baseLineY,m=ce.getLogSeries(m),this.yRatio=ce.getLogYRatios(this.yRatio),this.prevSeriesY=[];for(var ue=[],me=0;me<m.length;me++){m=this.lineHelpers.sameValueSeriesFix(me,m);var Ne=P.globals.comboCharts?N[me]:me,Ie=this.yRatio.length>1?Ne:0;this._initSerieVariables(m,me,Ne);var Le=[],Xe=[],Oe=[],$e=P.globals.padHorizontal+this.categoryAxisCorrection;this.ctx.series.addCollapsedClassToSeries(this.elSeries,Ne),P.globals.isXNumeric&&P.globals.seriesX.length>0&&($e=(P.globals.seriesX[Ne][0]-P.globals.minX)/this.xRatio),Oe.push($e);var ae,he=$e,Pe=void 0,Ve=he,Te=this.zeroY,Ze=this.zeroY;Te=this.lineHelpers.determineFirstPrevY({i:me,realIndex:Ne,series:m,prevY:Te,lineYPosition:0,translationsIndex:Ie}).prevY,P.config.stroke.curve==="monotoneCubic"&&m[me][0]===null?Le.push(null):Le.push(Te),ae=Te,V==="rangeArea"&&(Pe=Ze=this.lineHelpers.determineFirstPrevY({i:me,realIndex:Ne,series:A,prevY:Ze,lineYPosition:0,translationsIndex:Ie}).prevY,Xe.push(Le[0]!==null?Ze:null));var it=this._calculatePathsFrom({type:V,series:m,i:me,realIndex:Ne,translationsIndex:Ie,prevX:Ve,prevY:Te,prevY2:Ze}),wt=[Le[0]],Dt=[Xe[0]],Qt={type:V,series:m,realIndex:Ne,translationsIndex:Ie,i:me,x:$e,y:1,pX:he,pY:ae,pathsFrom:it,linePaths:[],areaPaths:[],seriesIndex:N,lineYPosition:0,xArrj:Oe,yArrj:Le,y2Arrj:Xe,seriesRangeEnd:A},xn=this._iterateOverDataPoints(y(y({},Qt),{},{iterations:V==="rangeArea"?m[me].length-1:void 0,isRangeStart:!0}));if(V==="rangeArea"){for(var pn=this._calculatePathsFrom({series:A,i:me,realIndex:Ne,prevX:Ve,prevY:Ze}),An=this._iterateOverDataPoints(y(y({},Qt),{},{series:A,xArrj:[$e],yArrj:wt,y2Arrj:Dt,pY:Pe,areaPaths:xn.areaPaths,pathsFrom:pn,iterations:A[me].length-1,isRangeStart:!1})),or=xn.linePaths.length/2,$t=0;$t<or;$t++)xn.linePaths[$t]=An.linePaths[$t+or]+xn.linePaths[$t];xn.linePaths.splice(or),xn.pathFromLine=An.pathFromLine+xn.pathFromLine}else xn.pathFromArea+="z";this._handlePaths({type:V,realIndex:Ne,i:me,paths:xn}),this.elSeries.add(this.elPointsMain),this.elSeries.add(this.elDataLabelsWrap),ue.push(this.elSeries)}if(((k=P.config.series[0])===null||k===void 0?void 0:k.zIndex)!==void 0&&ue.sort(function(ur,gr){return Number(ur.node.getAttribute("zIndex"))-Number(gr.node.getAttribute("zIndex"))}),P.config.chart.stacked)for(var bt=ue.length-1;bt>=0;bt--)Z.add(ue[bt]);else for(var rn=0;rn<ue.length;rn++)Z.add(ue[rn]);return Z}},{key:"_initSerieVariables",value:function(m,p,N){var A=this.w,k=new U(this.ctx);this.xDivision=A.globals.gridWidth/(A.globals.dataPoints-(A.config.xaxis.tickPlacement==="on"?1:0)),this.strokeWidth=Array.isArray(A.config.stroke.width)?A.config.stroke.width[N]:A.config.stroke.width;var P=0;this.yRatio.length>1&&(this.yaxisIndex=A.globals.seriesYAxisReverseMap[N],P=N),this.isReversed=A.config.yaxis[this.yaxisIndex]&&A.config.yaxis[this.yaxisIndex].reversed,this.zeroY=A.globals.gridHeight-this.baseLineY[P]-(this.isReversed?A.globals.gridHeight:0)+(this.isReversed?2*this.baseLineY[P]:0),this.areaBottomY=this.zeroY,(this.zeroY>A.globals.gridHeight||A.config.plotOptions.area.fillTo==="end")&&(this.areaBottomY=A.globals.gridHeight),this.categoryAxisCorrection=this.xDivision/2,this.elSeries=k.group({class:"apexcharts-series",zIndex:A.config.series[N].zIndex!==void 0?A.config.series[N].zIndex:N,seriesName:F.escapeString(A.globals.seriesNames[N])}),this.elPointsMain=k.group({class:"apexcharts-series-markers-wrap","data:realIndex":N}),this.elDataLabelsWrap=k.group({class:"apexcharts-datalabels","data:realIndex":N});var D=m[p].length===A.globals.dataPoints;this.elSeries.attr({"data:longestSeries":D,rel:p+1,"data:realIndex":N}),this.appendPathFrom=!0}},{key:"_calculatePathsFrom",value:function(m){var p,N,A,k,P=m.type,D=m.series,V=m.i,Z=m.realIndex,ce=m.translationsIndex,ue=m.prevX,me=m.prevY,Ne=m.prevY2,Ie=this.w,Le=new U(this.ctx);if(D[V][0]===null){for(var Xe=0;Xe<D[V].length;Xe++)if(D[V][Xe]!==null){ue=this.xDivision*Xe,me=this.zeroY-D[V][Xe]/this.yRatio[ce],p=Le.move(ue,me),N=Le.move(ue,this.areaBottomY);break}}else p=Le.move(ue,me),P==="rangeArea"&&(p=Le.move(ue,Ne)+Le.line(ue,me)),N=Le.move(ue,this.areaBottomY)+Le.line(ue,me);if(A=Le.move(0,this.zeroY)+Le.line(0,this.zeroY),k=Le.move(0,this.zeroY)+Le.line(0,this.zeroY),Ie.globals.previousPaths.length>0){var Oe=this.lineHelpers.checkPreviousPaths({pathFromLine:A,pathFromArea:k,realIndex:Z});A=Oe.pathFromLine,k=Oe.pathFromArea}return{prevX:ue,prevY:me,linePath:p,areaPath:N,pathFromLine:A,pathFromArea:k}}},{key:"_handlePaths",value:function(m){var p=m.type,N=m.realIndex,A=m.i,k=m.paths,P=this.w,D=new U(this.ctx),V=new be(this.ctx);this.prevSeriesY.push(k.yArrj),P.globals.seriesXvalues[N]=k.xArrj,P.globals.seriesYvalues[N]=k.yArrj;var Z=P.config.forecastDataPoints;if(Z.count>0&&p!=="rangeArea"){var ce=P.globals.seriesXvalues[N][P.globals.seriesXvalues[N].length-Z.count-1],ue=D.drawRect(ce,0,P.globals.gridWidth,P.globals.gridHeight,0);P.globals.dom.elForecastMask.appendChild(ue.node);var me=D.drawRect(0,0,ce,P.globals.gridHeight,0);P.globals.dom.elNonForecastMask.appendChild(me.node)}this.pointsChart||P.globals.delayedElements.push({el:this.elPointsMain.node,index:N});var Ne={i:A,realIndex:N,animationDelay:A,initialSpeed:P.config.chart.animations.speed,dataChangeSpeed:P.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(p)};if(p==="area")for(var Ie=V.fillPath({seriesNumber:N}),Le=0;Le<k.areaPaths.length;Le++){var Xe=D.renderPaths(y(y({},Ne),{},{pathFrom:k.pathFromArea,pathTo:k.areaPaths[Le],stroke:"none",strokeWidth:0,strokeLineCap:null,fill:Ie}));this.elSeries.add(Xe)}if(P.config.stroke.show&&!this.pointsChart){var Oe=null;if(p==="line")Oe=V.fillPath({seriesNumber:N,i:A});else if(P.config.stroke.fill.type==="solid")Oe=P.globals.stroke.colors[N];else{var $e=P.config.fill;P.config.fill=P.config.stroke.fill,Oe=V.fillPath({seriesNumber:N,i:A}),P.config.fill=$e}for(var ae=0;ae<k.linePaths.length;ae++){var he=Oe;p==="rangeArea"&&(he=V.fillPath({seriesNumber:N}));var Pe=y(y({},Ne),{},{pathFrom:k.pathFromLine,pathTo:k.linePaths[ae],stroke:Oe,strokeWidth:this.strokeWidth,strokeLineCap:P.config.stroke.lineCap,fill:p==="rangeArea"?he:"none"}),Ve=D.renderPaths(Pe);if(this.elSeries.add(Ve),Ve.attr("fill-rule","evenodd"),Z.count>0&&p!=="rangeArea"){var Te=D.renderPaths(Pe);Te.node.setAttribute("stroke-dasharray",Z.dashArray),Z.strokeWidth&&Te.node.setAttribute("stroke-width",Z.strokeWidth),this.elSeries.add(Te),Te.attr("clip-path","url(#forecastMask".concat(P.globals.cuid,")")),Ve.attr("clip-path","url(#nonForecastMask".concat(P.globals.cuid,")"))}}}}},{key:"_iterateOverDataPoints",value:function(m){var p,N,A=this,k=m.type,P=m.series,D=m.iterations,V=m.realIndex,Z=m.translationsIndex,ce=m.i,ue=m.x,me=m.y,Ne=m.pX,Ie=m.pY,Le=m.pathsFrom,Xe=m.linePaths,Oe=m.areaPaths,$e=m.seriesIndex,ae=m.lineYPosition,he=m.xArrj,Pe=m.yArrj,Ve=m.y2Arrj,Te=m.isRangeStart,Ze=m.seriesRangeEnd,it=this.w,wt=new U(this.ctx),Dt=this.yRatio,Qt=Le.prevY,xn=Le.linePath,pn=Le.areaPath,An=Le.pathFromLine,or=Le.pathFromArea,$t=F.isNumber(it.globals.minYArr[V])?it.globals.minYArr[V]:it.globals.minY;D||(D=it.globals.dataPoints>1?it.globals.dataPoints-1:it.globals.dataPoints);var bt=function(en,Fn){return Fn-en/Dt[Z]+2*(A.isReversed?en/Dt[Z]:0)},rn=me,ur=it.config.chart.stacked&&!it.globals.comboCharts||it.config.chart.stacked&&it.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||((p=this.w.config.series[V])===null||p===void 0?void 0:p.type)==="bar"||((N=this.w.config.series[V])===null||N===void 0?void 0:N.type)==="column"),gr=it.config.stroke.curve;Array.isArray(gr)&&(gr=Array.isArray($e)?gr[$e[ce]]:gr[ce]);for(var br,Br=0,Gr=0;Gr<D;Gr++){var Or=P[ce][Gr+1]===void 0||P[ce][Gr+1]===null;if(it.globals.isXNumeric){var Lt=it.globals.seriesX[V][Gr+1];it.globals.seriesX[V][Gr+1]===void 0&&(Lt=it.globals.seriesX[V][D-1]),ue=(Lt-it.globals.minX)/this.xRatio}else ue+=this.xDivision;ur?ce>0&&it.globals.collapsedSeries.length<it.config.series.length-1?ae=this.prevSeriesY[function(en){for(var Fn=en;Fn>0;Fn--){if(!(it.globals.collapsedSeriesIndices.indexOf(($e==null?void 0:$e[Fn])||Fn)>-1))return Fn;Fn--}return 0}(ce-1)][Gr+1]:ae=this.zeroY:ae=this.zeroY,Or?me=bt($t,ae):(me=bt(P[ce][Gr+1],ae),k==="rangeArea"&&(rn=bt(Ze[ce][Gr+1],ae))),he.push(ue),!Or||it.config.stroke.curve!=="smooth"&&it.config.stroke.curve!=="monotoneCubic"?(Pe.push(me),Ve.push(rn)):(Pe.push(null),Ve.push(null));var nn=this.lineHelpers.calculatePoints({series:P,x:ue,y:me,realIndex:V,i:ce,j:Gr,prevY:Qt}),Ot=this._createPaths({type:k,series:P,i:ce,realIndex:V,j:Gr,x:ue,y:me,y2:rn,xArrj:he,yArrj:Pe,y2Arrj:Ve,pX:Ne,pY:Ie,pathState:Br,segmentStartX:br,linePath:xn,areaPath:pn,linePaths:Xe,areaPaths:Oe,curve:gr,isRangeStart:Te});Oe=Ot.areaPaths,Xe=Ot.linePaths,Ne=Ot.pX,Ie=Ot.pY,Br=Ot.pathState,br=Ot.segmentStartX,pn=Ot.areaPath,xn=Ot.linePath,!this.appendPathFrom||gr==="monotoneCubic"&&k==="rangeArea"||(An+=wt.line(ue,this.zeroY),or+=wt.line(ue,this.zeroY)),this.handleNullDataPoints(P,nn,ce,Gr,V),this._handleMarkersAndLabels({type:k,pointsPos:nn,i:ce,j:Gr,realIndex:V,isRangeStart:Te})}return{yArrj:Pe,xArrj:he,pathFromArea:or,areaPaths:Oe,pathFromLine:An,linePaths:Xe,linePath:xn,areaPath:pn}}},{key:"_handleMarkersAndLabels",value:function(m){var p=m.type,N=m.pointsPos,A=m.isRangeStart,k=m.i,P=m.j,D=m.realIndex,V=this.w,Z=new Fe(this.ctx);if(this.pointsChart)this.scatter.draw(this.elSeries,P,{realIndex:D,pointsPos:N,zRatio:this.zRatio,elParent:this.elPointsMain});else{V.globals.series[k].length>1&&this.elPointsMain.node.classList.add("apexcharts-element-hidden");var ce=this.markers.plotChartMarkers(N,D,P+1);ce!==null&&this.elPointsMain.add(ce)}var ue=Z.drawDataLabel({type:p,isRangeStart:A,pos:N,i:D,j:P+1});ue!==null&&this.elDataLabelsWrap.add(ue)}},{key:"_createPaths",value:function(m){var p=m.type,N=m.series,A=m.i;m.realIndex;var k,P=m.j,D=m.x,V=m.y,Z=m.xArrj,ce=m.yArrj,ue=m.y2,me=m.y2Arrj,Ne=m.pX,Ie=m.pY,Le=m.pathState,Xe=m.segmentStartX,Oe=m.linePath,$e=m.areaPath,ae=m.linePaths,he=m.areaPaths,Pe=m.curve,Ve=m.isRangeStart,Te=new U(this.ctx),Ze=this.areaBottomY,it=p==="rangeArea",wt=p==="rangeArea"&&Ve;switch(Pe){case"monotoneCubic":var Dt=Ve?ce:me;switch(Le){case 0:if(Dt[P+1]===null)break;Le=1;case 1:if(!(it?Z.length===N[A].length:P===N[A].length-2))break;case 2:var Qt=Ve?Z:Z.slice().reverse(),xn=Ve?Dt:Dt.slice().reverse(),pn=(k=xn,Qt.map(function(Lt,nn){return[Lt,k[nn]]}).filter(function(Lt){return Lt[1]!==null})),An=pn.length>1?Ge(pn):pn,or=[];it&&(wt?he=pn:or=he.reverse());var $t=0,bt=0;if(function(Lt,nn){for(var Ot=function(hr){var lt=[],Ct=0;return hr.forEach(function(On){On!==null?Ct++:Ct>0&&(lt.push(Ct),Ct=0)}),Ct>0&<.push(Ct),lt}(Lt),en=[],Fn=0,yr=0;Fn<Ot.length;yr+=Ot[Fn++])en[Fn]=_e(nn,yr,yr+Ot[Fn]);return en}(xn,An).forEach(function(Lt){$t++;var nn=function(Fn){for(var yr="",hr=0;hr<Fn.length;hr++){var lt=Fn[hr],Ct=lt.length;Ct>4?(yr+="C".concat(lt[0],", ").concat(lt[1]),yr+=", ".concat(lt[2],", ").concat(lt[3]),yr+=", ".concat(lt[4],", ").concat(lt[5])):Ct>2&&(yr+="S".concat(lt[0],", ").concat(lt[1]),yr+=", ".concat(lt[2],", ").concat(lt[3]))}return yr}(Lt),Ot=bt,en=(bt+=Lt.length)-1;wt?Oe=Te.move(pn[Ot][0],pn[Ot][1])+nn:it?Oe=Te.move(or[Ot][0],or[Ot][1])+Te.line(pn[Ot][0],pn[Ot][1])+nn+Te.line(or[en][0],or[en][1]):(Oe=Te.move(pn[Ot][0],pn[Ot][1])+nn,$e=Oe+Te.line(pn[en][0],Ze)+Te.line(pn[Ot][0],Ze)+"z",he.push($e)),ae.push(Oe)}),it&&$t>1&&!wt){var rn=ae.slice($t).reverse();ae.splice($t),rn.forEach(function(Lt){return ae.push(Lt)})}Le=0}break;case"smooth":var ur=.35*(D-Ne);if(N[A][P]===null)Le=0;else switch(Le){case 0:if(Xe=Ne,Oe=wt?Te.move(Ne,me[P])+Te.line(Ne,Ie):Te.move(Ne,Ie),$e=Te.move(Ne,Ie),N[A][P+1]===null){ae.push(Oe),he.push($e);break}if(Le=1,P<N[A].length-2){var gr=Te.curve(Ne+ur,Ie,D-ur,V,D,V);Oe+=gr,$e+=gr;break}case 1:if(N[A][P+1]===null)Oe+=wt?Te.line(Ne,ue):Te.move(Ne,Ie),$e+=Te.line(Ne,Ze)+Te.line(Xe,Ze)+"z",ae.push(Oe),he.push($e),Le=-1;else{var br=Te.curve(Ne+ur,Ie,D-ur,V,D,V);Oe+=br,$e+=br,P>=N[A].length-2&&(wt&&(Oe+=Te.curve(D,V,D,V,D,ue)+Te.move(D,ue)),$e+=Te.curve(D,V,D,V,D,Ze)+Te.line(Xe,Ze)+"z",ae.push(Oe),he.push($e),Le=-1)}}Ne=D,Ie=V;break;default:var Br=function(Lt,nn,Ot){var en=[];switch(Lt){case"stepline":en=Te.line(nn,null,"H")+Te.line(null,Ot,"V");break;case"linestep":en=Te.line(null,Ot,"V")+Te.line(nn,null,"H");break;case"straight":en=Te.line(nn,Ot)}return en};if(N[A][P]===null)Le=0;else switch(Le){case 0:if(Xe=Ne,Oe=wt?Te.move(Ne,me[P])+Te.line(Ne,Ie):Te.move(Ne,Ie),$e=Te.move(Ne,Ie),N[A][P+1]===null){ae.push(Oe),he.push($e);break}if(Le=1,P<N[A].length-2){var Gr=Br(Pe,D,V);Oe+=Gr,$e+=Gr;break}case 1:if(N[A][P+1]===null)Oe+=wt?Te.line(Ne,ue):Te.move(Ne,Ie),$e+=Te.line(Ne,Ze)+Te.line(Xe,Ze)+"z",ae.push(Oe),he.push($e),Le=-1;else{var Or=Br(Pe,D,V);Oe+=Or,$e+=Or,P>=N[A].length-2&&(wt&&(Oe+=Te.line(D,ue)),$e+=Te.line(D,Ze)+Te.line(Xe,Ze)+"z",ae.push(Oe),he.push($e),Le=-1)}}Ne=D,Ie=V}return{linePaths:ae,areaPaths:he,pX:Ne,pY:Ie,pathState:Le,segmentStartX:Xe,linePath:Oe,areaPath:$e}}},{key:"handleNullDataPoints",value:function(m,p,N,A,k){var P=this.w;if(m[N][A]===null&&P.config.markers.showNullDataPoints||m[N].length===1){var D=this.strokeWidth-P.config.markers.strokeWidth/2;D>0||(D=0);var V=this.markers.plotChartMarkers(p,k,A+1,D,!0);V!==null&&this.elPointsMain.add(V)}}}]),Ce}();window.TreemapSquared={},window.TreemapSquared.generate=function(){function Ce(D,V,Z,ce){this.xoffset=D,this.yoffset=V,this.height=ce,this.width=Z,this.shortestEdge=function(){return Math.min(this.height,this.width)},this.getCoordinates=function(ue){var me,Ne=[],Ie=this.xoffset,Le=this.yoffset,Xe=k(ue)/this.height,Oe=k(ue)/this.width;if(this.width>=this.height)for(me=0;me<ue.length;me++)Ne.push([Ie,Le,Ie+Xe,Le+ue[me]/Xe]),Le+=ue[me]/Xe;else for(me=0;me<ue.length;me++)Ne.push([Ie,Le,Ie+ue[me]/Oe,Le+Oe]),Ie+=ue[me]/Oe;return Ne},this.cutArea=function(ue){var me;if(this.width>=this.height){var Ne=ue/this.height,Ie=this.width-Ne;me=new Ce(this.xoffset+Ne,this.yoffset,Ie,this.height)}else{var Le=ue/this.width,Xe=this.height-Le;me=new Ce(this.xoffset,this.yoffset+Le,this.width,Xe)}return me}}function m(D,V,Z,ce,ue){ce=ce===void 0?0:ce,ue=ue===void 0?0:ue;var me=p(function(Ne,Ie){var Le,Xe=[],Oe=Ie/k(Ne);for(Le=0;Le<Ne.length;Le++)Xe[Le]=Ne[Le]*Oe;return Xe}(D,V*Z),[],new Ce(ce,ue,V,Z),[]);return function(Ne){var Ie,Le,Xe=[];for(Ie=0;Ie<Ne.length;Ie++)for(Le=0;Le<Ne[Ie].length;Le++)Xe.push(Ne[Ie][Le]);return Xe}(me)}function p(D,V,Z,ce){var ue,me,Ne;if(D.length!==0)return ue=Z.shortestEdge(),function(Ie,Le,Xe){var Oe;if(Ie.length===0)return!0;(Oe=Ie.slice()).push(Le);var $e=N(Ie,Xe),ae=N(Oe,Xe);return $e>=ae}(V,me=D[0],ue)?(V.push(me),p(D.slice(1),V,Z,ce)):(Ne=Z.cutArea(k(V),ce),ce.push(Z.getCoordinates(V)),p(D,[],Ne,ce)),ce;ce.push(Z.getCoordinates(V))}function N(D,V){var Z=Math.min.apply(Math,D),ce=Math.max.apply(Math,D),ue=k(D);return Math.max(Math.pow(V,2)*ce/Math.pow(ue,2),Math.pow(ue,2)/(Math.pow(V,2)*Z))}function A(D){return D&&D.constructor===Array}function k(D){var V,Z=0;for(V=0;V<D.length;V++)Z+=D[V];return Z}function P(D){var V,Z=0;if(A(D[0]))for(V=0;V<D.length;V++)Z+=P(D[V]);else Z=k(D);return Z}return function D(V,Z,ce,ue,me){ue=ue===void 0?0:ue,me=me===void 0?0:me;var Ne,Ie,Le=[],Xe=[];if(A(V[0])){for(Ie=0;Ie<V.length;Ie++)Le[Ie]=P(V[Ie]);for(Ne=m(Le,Z,ce,ue,me),Ie=0;Ie<V.length;Ie++)Xe.push(D(V[Ie],Ne[Ie][2]-Ne[Ie][0],Ne[Ie][3]-Ne[Ie][1],Ne[Ie][0],Ne[Ie][1]))}else Xe=m(V,Z,ce,ue,me);return Xe}}();var It,mt,Ft=function(){function Ce(m,p){s(this,Ce),this.ctx=m,this.w=m.w,this.strokeWidth=this.w.config.stroke.width,this.helpers=new Rn(m),this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.labels=[]}return o(Ce,[{key:"draw",value:function(m){var p=this,N=this.w,A=new U(this.ctx),k=new be(this.ctx),P=A.group({class:"apexcharts-treemap"});if(N.globals.noData)return P;var D=[];return m.forEach(function(V){var Z=V.map(function(ce){return Math.abs(ce)});D.push(Z)}),this.negRange=this.helpers.checkColorRange(),N.config.series.forEach(function(V,Z){V.data.forEach(function(ce){Array.isArray(p.labels[Z])||(p.labels[Z]=[]),p.labels[Z].push(ce.x)})}),window.TreemapSquared.generate(D,N.globals.gridWidth,N.globals.gridHeight).forEach(function(V,Z){var ce=A.group({class:"apexcharts-series apexcharts-treemap-series",seriesName:F.escapeString(N.globals.seriesNames[Z]),rel:Z+1,"data:realIndex":Z});if(N.config.chart.dropShadow.enabled){var ue=N.config.chart.dropShadow;new O(p.ctx).dropShadow(P,ue,Z)}var me=A.group({class:"apexcharts-data-labels"});V.forEach(function(Ne,Ie){var Le=Ne[0],Xe=Ne[1],Oe=Ne[2],$e=Ne[3],ae=A.drawRect(Le,Xe,Oe-Le,$e-Xe,N.config.plotOptions.treemap.borderRadius,"#fff",1,p.strokeWidth,N.config.plotOptions.treemap.useFillColorAsStroke?Pe:N.globals.stroke.colors[Z]);ae.attr({cx:Le,cy:Xe,index:Z,i:Z,j:Ie,width:Oe-Le,height:$e-Xe});var he=p.helpers.getShadeColor(N.config.chart.type,Z,Ie,p.negRange),Pe=he.color;N.config.series[Z].data[Ie]!==void 0&&N.config.series[Z].data[Ie].fillColor&&(Pe=N.config.series[Z].data[Ie].fillColor);var Ve=k.fillPath({color:Pe,seriesNumber:Z,dataPointIndex:Ie});ae.node.classList.add("apexcharts-treemap-rect"),ae.attr({fill:Ve}),p.helpers.addListeners(ae);var Te={x:Le+(Oe-Le)/2,y:Xe+($e-Xe)/2,width:0,height:0},Ze={x:Le,y:Xe,width:Oe-Le,height:$e-Xe};if(N.config.chart.animations.enabled&&!N.globals.dataChanged){var it=1;N.globals.resized||(it=N.config.chart.animations.speed),p.animateTreemap(ae,Te,Ze,it)}if(N.globals.dataChanged){var wt=1;p.dynamicAnim.enabled&&N.globals.shouldAnimate&&(wt=p.dynamicAnim.speed,N.globals.previousPaths[Z]&&N.globals.previousPaths[Z][Ie]&&N.globals.previousPaths[Z][Ie].rect&&(Te=N.globals.previousPaths[Z][Ie].rect),p.animateTreemap(ae,Te,Ze,wt))}var Dt=p.getFontSize(Ne),Qt=N.config.dataLabels.formatter(p.labels[Z][Ie],{value:N.globals.series[Z][Ie],seriesIndex:Z,dataPointIndex:Ie,w:N});N.config.plotOptions.treemap.dataLabels.format==="truncate"&&(Dt=parseInt(N.config.dataLabels.style.fontSize,10),Qt=p.truncateLabels(Qt,Dt,Le,Xe,Oe,$e));var xn=null;N.globals.series[Z][Ie]&&(xn=p.helpers.calculateDataLabels({text:Qt,x:(Le+Oe)/2,y:(Xe+$e)/2+p.strokeWidth/2+Dt/3,i:Z,j:Ie,colorProps:he,fontSize:Dt,series:m})),N.config.dataLabels.enabled&&xn&&p.rotateToFitLabel(xn,Dt,Qt,Le,Xe,Oe,$e),ce.add(ae),xn!==null&&ce.add(xn)}),ce.add(me),P.add(ce)}),P}},{key:"getFontSize",value:function(m){var p=this.w,N,A,k,P,D=function V(Z){var ce,ue=0;if(Array.isArray(Z[0]))for(ce=0;ce<Z.length;ce++)ue+=V(Z[ce]);else for(ce=0;ce<Z.length;ce++)ue+=Z[ce].length;return ue}(this.labels)/function V(Z){var ce,ue=0;if(Array.isArray(Z[0]))for(ce=0;ce<Z.length;ce++)ue+=V(Z[ce]);else for(ce=0;ce<Z.length;ce++)ue+=1;return ue}(this.labels);return N=m[2]-m[0],A=m[3]-m[1],k=N*A,P=Math.pow(k,.5),Math.min(P/D,parseInt(p.config.dataLabels.style.fontSize,10))}},{key:"rotateToFitLabel",value:function(m,p,N,A,k,P,D){var V=new U(this.ctx),Z=V.getTextRects(N,p);if(Z.width+this.w.config.stroke.width+5>P-A&&Z.width<=D-k){var ce=V.rotateAroundCenter(m.node);m.node.setAttribute("transform","rotate(-90 ".concat(ce.x," ").concat(ce.y,") translate(").concat(Z.height/3,")"))}}},{key:"truncateLabels",value:function(m,p,N,A,k,P){var D=new U(this.ctx),V=D.getTextRects(m,p).width+this.w.config.stroke.width+5>k-N&&P-A>k-N?P-A:k-N,Z=D.getTextBasedOnMaxWidth({text:m,maxWidth:V,fontSize:p});return m.length!==Z.length&&V/p<5?"":Z}},{key:"animateTreemap",value:function(m,p,N,A){var k=new $(this.ctx);k.animateRect(m,{x:p.x,y:p.y,width:p.width,height:p.height},{x:N.x,y:N.y,width:N.width,height:N.height},A,function(){k.animationCompleted(m)})}}]),Ce}(),Tn=86400,kn=10/Tn,Gt=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w,this.timeScaleArray=[],this.utc=this.w.config.xaxis.labels.datetimeUTC}return o(Ce,[{key:"calculateTimeScaleTicks",value:function(m,p){var N=this,A=this.w;if(A.globals.allSeriesCollapsed)return A.globals.labels=[],A.globals.timescaleLabels=[],[];var k=new q(this.ctx),P=(p-m)/864e5;this.determineInterval(P),A.globals.disableZoomIn=!1,A.globals.disableZoomOut=!1,P<kn?A.globals.disableZoomIn=!0:P>5e4&&(A.globals.disableZoomOut=!0);var D=k.getTimeUnitsfromTimestamp(m,p,this.utc),V=A.globals.gridWidth/P,Z=V/24,ce=Z/60,ue=ce/60,me=Math.floor(24*P),Ne=Math.floor(1440*P),Ie=Math.floor(P*Tn),Le=Math.floor(P),Xe=Math.floor(P/30),Oe=Math.floor(P/365),$e={minMillisecond:D.minMillisecond,minSecond:D.minSecond,minMinute:D.minMinute,minHour:D.minHour,minDate:D.minDate,minMonth:D.minMonth,minYear:D.minYear},ae={firstVal:$e,currentMillisecond:$e.minMillisecond,currentSecond:$e.minSecond,currentMinute:$e.minMinute,currentHour:$e.minHour,currentMonthDate:$e.minDate,currentDate:$e.minDate,currentMonth:$e.minMonth,currentYear:$e.minYear,daysWidthOnXAxis:V,hoursWidthOnXAxis:Z,minutesWidthOnXAxis:ce,secondsWidthOnXAxis:ue,numberOfSeconds:Ie,numberOfMinutes:Ne,numberOfHours:me,numberOfDays:Le,numberOfMonths:Xe,numberOfYears:Oe};switch(this.tickInterval){case"years":this.generateYearScale(ae);break;case"months":case"half_year":this.generateMonthScale(ae);break;case"months_days":case"months_fortnight":case"days":case"week_days":this.generateDayScale(ae);break;case"hours":this.generateHourScale(ae);break;case"minutes_fives":case"minutes":this.generateMinuteScale(ae);break;case"seconds_tens":case"seconds_fives":case"seconds":this.generateSecondScale(ae)}var he=this.timeScaleArray.map(function(Pe){var Ve={position:Pe.position,unit:Pe.unit,year:Pe.year,day:Pe.day?Pe.day:1,hour:Pe.hour?Pe.hour:0,month:Pe.month+1};return Pe.unit==="month"?y(y({},Ve),{},{day:1,value:Pe.value+1}):Pe.unit==="day"||Pe.unit==="hour"?y(y({},Ve),{},{value:Pe.value}):Pe.unit==="minute"?y(y({},Ve),{},{value:Pe.value,minute:Pe.value}):Pe.unit==="second"?y(y({},Ve),{},{value:Pe.value,minute:Pe.minute,second:Pe.second}):Pe});return he.filter(function(Pe){var Ve=1,Te=Math.ceil(A.globals.gridWidth/120),Ze=Pe.value;A.config.xaxis.tickAmount!==void 0&&(Te=A.config.xaxis.tickAmount),he.length>Te&&(Ve=Math.floor(he.length/Te));var it=!1,wt=!1;switch(N.tickInterval){case"years":Pe.unit==="year"&&(it=!0);break;case"half_year":Ve=7,Pe.unit==="year"&&(it=!0);break;case"months":Ve=1,Pe.unit==="year"&&(it=!0);break;case"months_fortnight":Ve=15,Pe.unit!=="year"&&Pe.unit!=="month"||(it=!0),Ze===30&&(wt=!0);break;case"months_days":Ve=10,Pe.unit==="month"&&(it=!0),Ze===30&&(wt=!0);break;case"week_days":Ve=8,Pe.unit==="month"&&(it=!0);break;case"days":Ve=1,Pe.unit==="month"&&(it=!0);break;case"hours":Pe.unit==="day"&&(it=!0);break;case"minutes_fives":case"seconds_fives":Ze%5!=0&&(wt=!0);break;case"seconds_tens":Ze%10!=0&&(wt=!0)}if(N.tickInterval==="hours"||N.tickInterval==="minutes_fives"||N.tickInterval==="seconds_tens"||N.tickInterval==="seconds_fives"){if(!wt)return!0}else if((Ze%Ve==0||it)&&!wt)return!0})}},{key:"recalcDimensionsBasedOnFormat",value:function(m,p){var N=this.w,A=this.formatDates(m),k=this.removeOverlappingTS(A);N.globals.timescaleLabels=k.slice(),new nt(this.ctx).plotCoords()}},{key:"determineInterval",value:function(m){var p=24*m,N=60*p;switch(!0){case m/365>5:this.tickInterval="years";break;case m>800:this.tickInterval="half_year";break;case m>180:this.tickInterval="months";break;case m>90:this.tickInterval="months_fortnight";break;case m>60:this.tickInterval="months_days";break;case m>30:this.tickInterval="week_days";break;case m>2:this.tickInterval="days";break;case p>2.4:this.tickInterval="hours";break;case N>15:this.tickInterval="minutes_fives";break;case N>5:this.tickInterval="minutes";break;case N>1:this.tickInterval="seconds_tens";break;case 60*N>20:this.tickInterval="seconds_fives";break;default:this.tickInterval="seconds"}}},{key:"generateYearScale",value:function(m){var p=m.firstVal,N=m.currentMonth,A=m.currentYear,k=m.daysWidthOnXAxis,P=m.numberOfYears,D=p.minYear,V=0,Z=new q(this.ctx),ce="year";if(p.minDate>1||p.minMonth>0){var ue=Z.determineRemainingDaysOfYear(p.minYear,p.minMonth,p.minDate);V=(Z.determineDaysOfYear(p.minYear)-ue+1)*k,D=p.minYear+1,this.timeScaleArray.push({position:V,value:D,unit:ce,year:D,month:F.monthMod(N+1)})}else p.minDate===1&&p.minMonth===0&&this.timeScaleArray.push({position:V,value:D,unit:ce,year:A,month:F.monthMod(N+1)});for(var me=D,Ne=V,Ie=0;Ie<P;Ie++)me++,Ne=Z.determineDaysOfYear(me-1)*k+Ne,this.timeScaleArray.push({position:Ne,value:me,unit:ce,year:me,month:1})}},{key:"generateMonthScale",value:function(m){var p=m.firstVal,N=m.currentMonthDate,A=m.currentMonth,k=m.currentYear,P=m.daysWidthOnXAxis,D=m.numberOfMonths,V=A,Z=0,ce=new q(this.ctx),ue="month",me=0;if(p.minDate>1){Z=(ce.determineDaysOfMonths(A+1,p.minYear)-N+1)*P,V=F.monthMod(A+1);var Ne=k+me,Ie=F.monthMod(V),Le=V;V===0&&(ue="year",Le=Ne,Ie=1,Ne+=me+=1),this.timeScaleArray.push({position:Z,value:Le,unit:ue,year:Ne,month:Ie})}else this.timeScaleArray.push({position:Z,value:V,unit:ue,year:k,month:F.monthMod(A)});for(var Xe=V+1,Oe=Z,$e=0,ae=1;$e<D;$e++,ae++){(Xe=F.monthMod(Xe))===0?(ue="year",me+=1):ue="month";var he=this._getYear(k,Xe,me);Oe=ce.determineDaysOfMonths(Xe,he)*P+Oe;var Pe=Xe===0?he:Xe;this.timeScaleArray.push({position:Oe,value:Pe,unit:ue,year:he,month:Xe===0?1:Xe}),Xe++}}},{key:"generateDayScale",value:function(m){var p=m.firstVal,N=m.currentMonth,A=m.currentYear,k=m.hoursWidthOnXAxis,P=m.numberOfDays,D=new q(this.ctx),V="day",Z=p.minDate+1,ce=Z,ue=function(ae,he,Pe){return ae>D.determineDaysOfMonths(he+1,Pe)&&(ce=1,V="month",Ne=he+=1),he},me=(24-p.minHour)*k,Ne=Z,Ie=ue(ce,N,A);p.minHour===0&&p.minDate===1?(me=0,Ne=F.monthMod(p.minMonth),V="month",ce=p.minDate):p.minDate!==1&&p.minHour===0&&p.minMinute===0&&(me=0,Z=p.minDate,Ne=Z,Ie=ue(ce=Z,N,A)),this.timeScaleArray.push({position:me,value:Ne,unit:V,year:this._getYear(A,Ie,0),month:F.monthMod(Ie),day:ce});for(var Le=me,Xe=0;Xe<P;Xe++){V="day",Ie=ue(ce+=1,Ie,this._getYear(A,Ie,0));var Oe=this._getYear(A,Ie,0);Le=24*k+Le;var $e=ce===1?F.monthMod(Ie):ce;this.timeScaleArray.push({position:Le,value:$e,unit:V,year:Oe,month:F.monthMod(Ie),day:$e})}}},{key:"generateHourScale",value:function(m){var p=m.firstVal,N=m.currentDate,A=m.currentMonth,k=m.currentYear,P=m.minutesWidthOnXAxis,D=m.numberOfHours,V=new q(this.ctx),Z="hour",ce=function(Ve,Te){return Ve>V.determineDaysOfMonths(Te+1,k)&&(Xe=1,Te+=1),{month:Te,date:Xe}},ue=function(Ve,Te){return Ve>V.determineDaysOfMonths(Te+1,k)?Te+=1:Te},me=60-(p.minMinute+p.minSecond/60),Ne=me*P,Ie=p.minHour+1,Le=Ie;me===60&&(Ne=0,Le=Ie=p.minHour);var Xe=N;Le>=24&&(Le=0,Xe+=1,Z="day");var Oe=ce(Xe,A).month;Oe=ue(Xe,Oe),this.timeScaleArray.push({position:Ne,value:Ie,unit:Z,day:Xe,hour:Le,year:k,month:F.monthMod(Oe)}),Le++;for(var $e=Ne,ae=0;ae<D;ae++){Z="hour",Le>=24&&(Le=0,Z="day",Oe=ce(Xe+=1,Oe).month,Oe=ue(Xe,Oe));var he=this._getYear(k,Oe,0);$e=60*P+$e;var Pe=Le===0?Xe:Le;this.timeScaleArray.push({position:$e,value:Pe,unit:Z,hour:Le,day:Xe,year:he,month:F.monthMod(Oe)}),Le++}}},{key:"generateMinuteScale",value:function(m){for(var p=m.currentMillisecond,N=m.currentSecond,A=m.currentMinute,k=m.currentHour,P=m.currentDate,D=m.currentMonth,V=m.currentYear,Z=m.minutesWidthOnXAxis,ce=m.secondsWidthOnXAxis,ue=m.numberOfMinutes,me=A+1,Ne=P,Ie=D,Le=V,Xe=k,Oe=(60-N-p/1e3)*ce,$e=0;$e<ue;$e++)me>=60&&(me=0,(Xe+=1)===24&&(Xe=0)),this.timeScaleArray.push({position:Oe,value:me,unit:"minute",hour:Xe,minute:me,day:Ne,year:this._getYear(Le,Ie,0),month:F.monthMod(Ie)}),Oe+=Z,me++}},{key:"generateSecondScale",value:function(m){for(var p=m.currentMillisecond,N=m.currentSecond,A=m.currentMinute,k=m.currentHour,P=m.currentDate,D=m.currentMonth,V=m.currentYear,Z=m.secondsWidthOnXAxis,ce=m.numberOfSeconds,ue=N+1,me=A,Ne=P,Ie=D,Le=V,Xe=k,Oe=(1e3-p)/1e3*Z,$e=0;$e<ce;$e++)ue>=60&&(ue=0,++me>=60&&(me=0,++Xe===24&&(Xe=0))),this.timeScaleArray.push({position:Oe,value:ue,unit:"second",hour:Xe,minute:me,second:ue,day:Ne,year:this._getYear(Le,Ie,0),month:F.monthMod(Ie)}),Oe+=Z,ue++}},{key:"createRawDateString",value:function(m,p){var N=m.year;return m.month===0&&(m.month=1),N+="-"+("0"+m.month.toString()).slice(-2),m.unit==="day"?N+=m.unit==="day"?"-"+("0"+p).slice(-2):"-01":N+="-"+("0"+(m.day?m.day:"1")).slice(-2),m.unit==="hour"?N+=m.unit==="hour"?"T"+("0"+p).slice(-2):"T00":N+="T"+("0"+(m.hour?m.hour:"0")).slice(-2),m.unit==="minute"?N+=":"+("0"+p).slice(-2):N+=":"+(m.minute?("0"+m.minute).slice(-2):"00"),m.unit==="second"?N+=":"+("0"+p).slice(-2):N+=":00",this.utc&&(N+=".000Z"),N}},{key:"formatDates",value:function(m){var p=this,N=this.w;return m.map(function(A){var k=A.value.toString(),P=new q(p.ctx),D=p.createRawDateString(A,k),V=P.getDate(P.parseDate(D));if(p.utc||(V=P.getDate(P.parseDateWithTimezone(D))),N.config.xaxis.labels.format===void 0){var Z="dd MMM",ce=N.config.xaxis.labels.datetimeFormatter;A.unit==="year"&&(Z=ce.year),A.unit==="month"&&(Z=ce.month),A.unit==="day"&&(Z=ce.day),A.unit==="hour"&&(Z=ce.hour),A.unit==="minute"&&(Z=ce.minute),A.unit==="second"&&(Z=ce.second),k=P.formatDate(V,Z)}else k=P.formatDate(V,N.config.xaxis.labels.format);return{dateString:D,position:A.position,value:k,unit:A.unit,year:A.year,month:A.month}})}},{key:"removeOverlappingTS",value:function(m){var p,N=this,A=new U(this.ctx),k=!1;m.length>0&&m[0].value&&m.every(function(V){return V.value.length===m[0].value.length})&&(k=!0,p=A.getTextRects(m[0].value).width);var P=0,D=m.map(function(V,Z){if(Z>0&&N.w.config.xaxis.labels.hideOverlappingLabels){var ce=k?p:A.getTextRects(m[P].value).width,ue=m[P].position;return V.position>ue+ce+10?(P=Z,V):null}return V});return D=D.filter(function(V){return V!==null})}},{key:"_getYear",value:function(m,p,N){return m+Math.floor(p/12)+N}}]),Ce}(),mn=function(){function Ce(m,p){s(this,Ce),this.ctx=p,this.w=p.w,this.el=m}return o(Ce,[{key:"setupElements",value:function(){var m=this.w,p=m.globals,N=m.config,A=N.chart.type;p.axisCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble","radar","heatmap","treemap"].includes(A),p.xyCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble"].includes(A),p.isBarHorizontal=["bar","rangeBar","boxPlot"].includes(A)&&N.plotOptions.bar.horizontal,p.chartClass=".apexcharts".concat(p.chartID),p.dom.baseEl=this.el,p.dom.elWrap=document.createElement("div"),U.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(N.chart.offsetX,", ").concat(N.chart.offsetY,")")}),p.dom.Paper.node.style.background=N.theme.mode!=="dark"||N.chart.background?N.theme.mode!=="light"||N.chart.background?N.chart.background:"#fff":"#424242",this.setSVGDimensions(),p.dom.elLegendForeign=document.createElementNS(p.SVGNS,"foreignObject"),U.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(m,p){var N=this.w,A=this.ctx,k=N.config,P=N.globals,D={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:[]}},V=k.chart.type||"line",Z=null,ce=0;P.series.forEach(function(Ve,Te){var Ze=m[Te].type||V;D[Ze]?(Ze==="rangeArea"?(D[Ze].series.push(P.seriesRangeStart[Te]),D[Ze].seriesRangeEnd.push(P.seriesRangeEnd[Te])):D[Ze].series.push(Ve),D[Ze].i.push(Te),Ze!=="column"&&Ze!=="bar"||(N.globals.columnSeries=D.column)):["heatmap","treemap","pie","donut","polarArea","radialBar","radar"].includes(Ze)?Z=Ze:Ze==="bar"?(D.column.series.push(Ve),D.column.i.push(Te)):console.warn("You have specified an unrecognized series type (".concat(Ze,").")),V!==Ze&&Ze!=="scatter"&&ce++}),ce>0&&(Z&&console.warn("Chart or series type ".concat(Z," cannot appear with other chart or series types.")),D.column.series.length>0&&k.plotOptions.bar.horizontal&&(ce-=D.column.series.length,D.column={series:[],i:[]},N.globals.columnSeries={series:[],i:[]},console.warn("Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`"))),P.comboCharts||(P.comboCharts=ce>0);var ue=new qt(A,p),me=new En(A,p);A.pie=new Zn(A);var Ne=new tr(A);A.rangeBar=new Sn(A,p);var Ie=new Vn(A),Le=[];if(P.comboCharts){var Xe,Oe,$e=new Y(A);if(D.area.series.length>0&&(Xe=Le).push.apply(Xe,S($e.drawSeriesByGroup(D.area,P.areaGroups,"area",ue))),D.column.series.length>0)if(k.chart.stacked){var ae=new Cn(A,p);Le.push(ae.draw(D.column.series,D.column.i))}else A.bar=new yn(A,p),Le.push(A.bar.draw(D.column.series,D.column.i));if(D.rangeArea.series.length>0&&Le.push(ue.draw(D.rangeArea.series,"rangeArea",D.rangeArea.i,D.rangeArea.seriesRangeEnd)),D.line.series.length>0&&(Oe=Le).push.apply(Oe,S($e.drawSeriesByGroup(D.line,P.lineGroups,"line",ue))),D.candlestick.series.length>0&&Le.push(me.draw(D.candlestick.series,"candlestick",D.candlestick.i)),D.boxPlot.series.length>0&&Le.push(me.draw(D.boxPlot.series,"boxPlot",D.boxPlot.i)),D.rangeBar.series.length>0&&Le.push(A.rangeBar.draw(D.rangeBar.series,D.rangeBar.i)),D.scatter.series.length>0){var he=new qt(A,p,!0);Le.push(he.draw(D.scatter.series,"scatter",D.scatter.i))}if(D.bubble.series.length>0){var Pe=new qt(A,p,!0);Le.push(Pe.draw(D.bubble.series,"bubble",D.bubble.i))}}else switch(k.chart.type){case"line":Le=ue.draw(P.series,"line");break;case"area":Le=ue.draw(P.series,"area");break;case"bar":k.chart.stacked?Le=new Cn(A,p).draw(P.series):(A.bar=new yn(A,p),Le=A.bar.draw(P.series));break;case"candlestick":Le=new En(A,p).draw(P.series,"candlestick");break;case"boxPlot":Le=new En(A,p).draw(P.series,k.chart.type);break;case"rangeBar":Le=A.rangeBar.draw(P.series);break;case"rangeArea":Le=ue.draw(P.seriesRangeStart,"rangeArea",void 0,P.seriesRangeEnd);break;case"heatmap":Le=new Mn(A,p).draw(P.series);break;case"treemap":Le=new Ft(A,p).draw(P.series);break;case"pie":case"donut":case"polarArea":Le=A.pie.draw(P.series);break;case"radialBar":Le=Ne.draw(P.series);break;case"radar":Le=Ie.draw(P.series);break;default:Le=ue.draw(P.series)}return Le}},{key:"setSVGDimensions",value:function(){var m=this.w,p=m.globals,N=m.config;N.chart.width=N.chart.width||"100%",N.chart.height=N.chart.height||"auto",p.svgWidth=N.chart.width,p.svgHeight=N.chart.height;var A=F.getDimensions(this.el),k=N.chart.width.toString().split(/[0-9]+/g).pop();k==="%"?F.isNumber(A[0])&&(A[0].width===0&&(A=F.getDimensions(this.el.parentNode)),p.svgWidth=A[0]*parseInt(N.chart.width,10)/100):k!=="px"&&k!==""||(p.svgWidth=parseInt(N.chart.width,10));var P=String(N.chart.height).toString().split(/[0-9]+/g).pop();if(p.svgHeight!=="auto"&&p.svgHeight!=="")if(P==="%"){var D=F.getDimensions(this.el.parentNode);p.svgHeight=D[1]*parseInt(N.chart.height,10)/100}else p.svgHeight=parseInt(N.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),U.setAttrs(p.dom.Paper.node,{width:p.svgWidth,height:p.svgHeight}),P!=="%"){var V=N.chart.sparkline.enabled?0:p.axisCharts?N.chart.parentHeightOffset:0;p.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(p.svgHeight+V,"px")}p.dom.elWrap.style.width="".concat(p.svgWidth,"px"),p.dom.elWrap.style.height="".concat(p.svgHeight,"px")}},{key:"shiftGraphPosition",value:function(){var m=this.w.globals,p=m.translateY,N=m.translateX;U.setAttrs(m.dom.elGraphical.node,{transform:"translate(".concat(N,", ").concat(p,")")})}},{key:"resizeNonAxisCharts",value:function(){var m=this.w,p=m.globals,N=0,A=m.config.chart.sparkline.enabled?1:15;A+=m.config.grid.padding.bottom,["top","bottom"].includes(m.config.legend.position)&&m.config.legend.show&&!m.config.legend.floating&&(N=new wn(this.ctx).legendHelpers.getLegendDimensions().clwh+7);var k=m.globals.dom.baseEl.querySelector(".apexcharts-radialbar, .apexcharts-pie"),P=2.05*m.globals.radialSize;if(k&&!m.config.chart.sparkline.enabled&&m.config.plotOptions.radialBar.startAngle!==0){var D=F.getBoundingClientRect(k);P=D.bottom;var V=D.bottom-D.top;P=Math.max(2.05*m.globals.radialSize,V)}var Z=Math.ceil(P+p.translateY+N+A);p.dom.elLegendForeign&&p.dom.elLegendForeign.setAttribute("height",Z),m.config.chart.height&&String(m.config.chart.height).includes("%")||(p.dom.elWrap.style.height="".concat(Z,"px"),U.setAttrs(p.dom.Paper.node,{height:Z}),p.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(Z,"px"))}},{key:"coreCalculations",value:function(){new He(this.ctx).init()}},{key:"resetGlobals",value:function(){var m=this,p=function(){return m.w.config.series.map(function(){return[]})},N=new ge,A=this.w.globals;N.initGlobalVars(A),A.seriesXvalues=p(),A.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 m=this.w,p=null;if(m.globals.axisCharts){if(m.config.xaxis.crosshairs.position==="back"&&new jt(this.ctx).drawXCrosshairs(),m.config.yaxis[0].crosshairs.position==="back"&&new jt(this.ctx).drawYCrosshairs(),m.config.xaxis.type==="datetime"&&m.config.xaxis.labels.formatter===void 0){this.ctx.timeScale=new Gt(this.ctx);var N=[];isFinite(m.globals.minX)&&isFinite(m.globals.maxX)&&!m.globals.isBarHorizontal?N=this.ctx.timeScale.calculateTimeScaleTicks(m.globals.minX,m.globals.maxX):m.globals.isBarHorizontal&&(N=this.ctx.timeScale.calculateTimeScaleTicks(m.globals.minY,m.globals.maxY)),this.ctx.timeScale.recalcDimensionsBasedOnFormat(N)}p=new Y(this.ctx).getCalculatedRatios()}return p}},{key:"updateSourceChart",value:function(m){this.ctx.w.globals.selection=void 0,this.ctx.updateHelpers._updateOptions({chart:{selection:{xaxis:{min:m.w.globals.minX,max:m.w.globals.maxX}}}},!1,!1)}},{key:"setupBrushHandler",value:function(){var m=this,p=this.w;if(p.config.chart.brush.enabled&&typeof p.config.chart.events.selection!="function"){var N=Array.isArray(p.config.chart.brush.targets)?p.config.chart.brush.targets:[p.config.chart.brush.target];N.forEach(function(A){var k=ApexCharts.getChartByID(A);k.w.globals.brushSource=m.ctx,typeof k.w.config.chart.events.zoomed!="function"&&(k.w.config.chart.events.zoomed=function(){return m.updateSourceChart(k)}),typeof k.w.config.chart.events.scrolled!="function"&&(k.w.config.chart.events.scrolled=function(){return m.updateSourceChart(k)})}),p.config.chart.events.selection=function(A,k){N.forEach(function(P){ApexCharts.getChartByID(P).ctx.updateHelpers._updateOptions({xaxis:{min:k.xaxis.min,max:k.xaxis.max}},!1,!1,!1,!1)})}}}}]),Ce}(),gt=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"_updateOptions",value:function(m){var p=this,N=arguments.length>1&&arguments[1]!==void 0&&arguments[1],A=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],k=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],P=arguments.length>4&&arguments[4]!==void 0&&arguments[4];return new Promise(function(D){var V=[p.ctx];k&&(V=p.ctx.getSyncedCharts()),p.ctx.w.globals.isExecCalled&&(V=[p.ctx],p.ctx.w.globals.isExecCalled=!1),V.forEach(function(Z,ce){var ue=Z.w;if(ue.globals.shouldAnimate=A,N||(ue.globals.resized=!0,ue.globals.dataChanged=!0,A&&Z.series.getPreviousPaths()),m&&I(m)==="object"&&(Z.config=new Se(m),m=Y.extendArrayProps(Z.config,m,ue),Z.w.globals.chartID!==p.ctx.w.globals.chartID&&delete m.series,ue.config=F.extend(ue.config,m),P&&(ue.globals.lastXAxis=m.xaxis?F.clone(m.xaxis):[],ue.globals.lastYAxis=m.yaxis?F.clone(m.yaxis):[],ue.globals.initialConfig=F.extend({},ue.config),ue.globals.initialSeries=F.clone(ue.config.series),m.series))){for(var me=0;me<ue.globals.collapsedSeriesIndices.length;me++){var Ne=ue.config.series[ue.globals.collapsedSeriesIndices[me]];ue.globals.collapsedSeries[me].data=ue.globals.axisCharts?Ne.data.slice():Ne}for(var Ie=0;Ie<ue.globals.ancillaryCollapsedSeriesIndices.length;Ie++){var Le=ue.config.series[ue.globals.ancillaryCollapsedSeriesIndices[Ie]];ue.globals.ancillaryCollapsedSeries[Ie].data=ue.globals.axisCharts?Le.data.slice():Le}Z.series.emptyCollapsedSeries(ue.config.series)}return Z.update(m).then(function(){ce===V.length-1&&D(Z)})})})}},{key:"_updateSeries",value:function(m,p){var N=this,A=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return new Promise(function(k){var P,D=N.w;return D.globals.shouldAnimate=p,D.globals.dataChanged=!0,p&&N.ctx.series.getPreviousPaths(),D.globals.axisCharts?((P=m.map(function(V,Z){return N._extendSeries(V,Z)})).length===0&&(P=[{data:[]}]),D.config.series=P):D.config.series=m.slice(),A&&(D.globals.initialConfig.series=F.clone(D.config.series),D.globals.initialSeries=F.clone(D.config.series)),N.ctx.update().then(function(){k(N.ctx)})})}},{key:"_extendSeries",value:function(m,p){var N=this.w,A=N.config.series[p];return y(y({},N.config.series[p]),{},{name:m.name?m.name:A==null?void 0:A.name,color:m.color?m.color:A==null?void 0:A.color,type:m.type?m.type:A==null?void 0:A.type,group:m.group?m.group:A==null?void 0:A.group,hidden:m.hidden!==void 0?m.hidden:A==null?void 0:A.hidden,data:m.data?m.data:A==null?void 0:A.data,zIndex:m.zIndex!==void 0?m.zIndex:p})}},{key:"toggleDataPointSelection",value:function(m,p){var N=this.w,A=null,k=".apexcharts-series[data\\:realIndex='".concat(m,"']");return N.globals.axisCharts?A=N.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&&(A=N.globals.dom.Paper.select("".concat(k," path[j='").concat(m,"']")).members[0],N.config.chart.type!=="pie"&&N.config.chart.type!=="polarArea"&&N.config.chart.type!=="donut"||this.ctx.pie.pieClicked(m)),A?(new U(this.ctx).pathMouseDown(A,null),A.node?A.node:null):(console.warn("toggleDataPointSelection: Element not found"),null)}},{key:"forceXAxisUpdate",value:function(m){var p=this.w;if(["min","max"].forEach(function(A){m.xaxis[A]!==void 0&&(p.config.xaxis[A]=m.xaxis[A],p.globals.lastXAxis[A]=m.xaxis[A])}),m.xaxis.categories&&m.xaxis.categories.length&&(p.config.xaxis.categories=m.xaxis.categories),p.config.xaxis.convertedCatToNumeric){var N=new pe(m);m=N.convertCatToNumericXaxis(m,this.ctx)}return m}},{key:"forceYAxisUpdate",value:function(m){return m.chart&&m.chart.stacked&&m.chart.stackType==="100%"&&(Array.isArray(m.yaxis)?m.yaxis.forEach(function(p,N){m.yaxis[N].min=0,m.yaxis[N].max=100}):(m.yaxis.min=0,m.yaxis.max=100)),m}},{key:"revertDefaultAxisMinMax",value:function(m){var p=this,N=this.w,A=N.globals.lastXAxis,k=N.globals.lastYAxis;m&&m.xaxis&&(A=m.xaxis),m&&m.yaxis&&(k=m.yaxis),N.config.xaxis.min=A.min,N.config.xaxis.max=A.max;var P=function(D){k[D]!==void 0&&(N.config.yaxis[D].min=k[D].min,N.config.yaxis[D].max=k[D].max)};N.config.yaxis.map(function(D,V){N.globals.zoomed||k[V]!==void 0?P(V):p.ctx.opts.yaxis[V]!==void 0&&(D.min=p.ctx.opts.yaxis[V].min,D.max=p.ctx.opts.yaxis[V].max)})}}]),Ce}();It=typeof window<"u"?window:void 0,mt=function(Ce,m){var p=(this!==void 0?this:Ce).SVG=function(ae){if(p.supported)return ae=new p.Doc(ae),p.parser.draw||p.prepare(),ae};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(ae){return"Svgjs"+ce(ae)+p.did++},p.create=function(ae){var he=m.createElementNS(this.ns,ae);return he.setAttribute("id",this.eid(ae)),he},p.extend=function(){var ae,he;he=(ae=[].slice.call(arguments)).pop();for(var Pe=ae.length-1;Pe>=0;Pe--)if(ae[Pe])for(var Ve in he)ae[Pe].prototype[Ve]=he[Ve];p.Set&&p.Set.inherit&&p.Set.inherit()},p.invent=function(ae){var he=typeof ae.create=="function"?ae.create:function(){this.constructor.call(this,p.create(ae.create))};return ae.inherit&&(he.prototype=new ae.inherit),ae.extend&&p.extend(he,ae.extend),ae.construct&&p.extend(ae.parent||p.Container,ae.construct),he},p.adopt=function(ae){return ae?ae.instance?ae.instance:((he=ae.nodeName=="svg"?ae.parentNode instanceof Ce.SVGElement?new p.Nested:new p.Doc:ae.nodeName=="linearGradient"?new p.Gradient("linear"):ae.nodeName=="radialGradient"?new p.Gradient("radial"):p[ce(ae.nodeName)]?new p[ce(ae.nodeName)]:new p.Element(ae)).type=ae.nodeName,he.node=ae,ae.instance=he,he instanceof p.Doc&&he.namespace().defs(),he.setData(JSON.parse(ae.getAttribute("svgjs:data"))||{}),he):null;var he},p.prepare=function(){var ae=m.getElementsByTagName("body")[0],he=(ae?new p.Doc(ae):p.adopt(m.documentElement).nested()).size(2,0);p.parser={body:ae||m.documentElement,draw:he.style("opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden").node,poly:he.polyline().node,path:he.path().node,native:p.create("svg")}},p.parser={native:p.create("svg")},m.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(ae,he){for(var Pe=ae.length,Ve=[],Te=0;Te<Pe;Te++)Ve.push(he(ae[Te]));return Ve},filter:function(ae,he){for(var Pe=ae.length,Ve=[],Te=0;Te<Pe;Te++)he(ae[Te])&&Ve.push(ae[Te]);return Ve},filterSVGElements:function(ae){return this.filter(ae,function(he){return he instanceof Ce.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(ae){var he,Pe;this.r=0,this.g=0,this.b=0,ae&&(typeof ae=="string"?p.regex.isRgb.test(ae)?(he=p.regex.rgb.exec(ae.replace(p.regex.whitespace,"")),this.r=parseInt(he[1]),this.g=parseInt(he[2]),this.b=parseInt(he[3])):p.regex.isHex.test(ae)&&(he=p.regex.hex.exec((Pe=ae).length==4?["#",Pe.substring(1,2),Pe.substring(1,2),Pe.substring(2,3),Pe.substring(2,3),Pe.substring(3,4),Pe.substring(3,4)].join(""):Pe),this.r=parseInt(he[1],16),this.g=parseInt(he[2],16),this.b=parseInt(he[3],16)):I(ae)==="object"&&(this.r=ae.r,this.g=ae.g,this.b=ae.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(ae){return this.destination=new p.Color(ae),this},at:function(ae){return this.destination?(ae=ae<0?0:ae>1?1:ae,new p.Color({r:~~(this.r+(this.destination.r-this.r)*ae),g:~~(this.g+(this.destination.g-this.g)*ae),b:~~(this.b+(this.destination.b-this.b)*ae)})):this}}),p.Color.test=function(ae){return ae+="",p.regex.isHex.test(ae)||p.regex.isRgb.test(ae)},p.Color.isRgb=function(ae){return ae&&typeof ae.r=="number"&&typeof ae.g=="number"&&typeof ae.b=="number"},p.Color.isColor=function(ae){return p.Color.isRgb(ae)||p.Color.test(ae)},p.Array=function(ae,he){(ae=(ae||[]).valueOf()).length==0&&he&&(ae=he.valueOf()),this.value=this.parse(ae)},p.extend(p.Array,{toString:function(){return this.value.join(" ")},valueOf:function(){return this.value},parse:function(ae){return ae=ae.valueOf(),Array.isArray(ae)?ae:this.split(ae)}}),p.PointArray=function(ae,he){p.Array.call(this,ae,he||[[0,0]])},p.PointArray.prototype=new p.Array,p.PointArray.prototype.constructor=p.PointArray;for(var N={M:function(ae,he,Pe){return he.x=Pe.x=ae[0],he.y=Pe.y=ae[1],["M",he.x,he.y]},L:function(ae,he){return he.x=ae[0],he.y=ae[1],["L",ae[0],ae[1]]},H:function(ae,he){return he.x=ae[0],["H",ae[0]]},V:function(ae,he){return he.y=ae[0],["V",ae[0]]},C:function(ae,he){return he.x=ae[4],he.y=ae[5],["C",ae[0],ae[1],ae[2],ae[3],ae[4],ae[5]]},Q:function(ae,he){return he.x=ae[2],he.y=ae[3],["Q",ae[0],ae[1],ae[2],ae[3]]},S:function(ae,he){return he.x=ae[2],he.y=ae[3],["S",ae[0],ae[1],ae[2],ae[3]]},Z:function(ae,he,Pe){return he.x=Pe.x,he.y=Pe.y,["Z"]}},A="mlhvqtcsaz".split(""),k=0,P=A.length;k<P;++k)N[A[k]]=function(ae){return function(he,Pe,Ve){if(ae=="H")he[0]=he[0]+Pe.x;else if(ae=="V")he[0]=he[0]+Pe.y;else if(ae=="A")he[5]=he[5]+Pe.x,he[6]=he[6]+Pe.y;else for(var Te=0,Ze=he.length;Te<Ze;++Te)he[Te]=he[Te]+(Te%2?Pe.y:Pe.x);if(N&&typeof N[ae]=="function")return N[ae](he,Pe,Ve)}}(A[k].toUpperCase());p.PathArray=function(ae,he){p.Array.call(this,ae,he||[["M",0,0]])},p.PathArray.prototype=new p.Array,p.PathArray.prototype.constructor=p.PathArray,p.extend(p.PathArray,{toString:function(){return function(ae){for(var he=0,Pe=ae.length,Ve="";he<Pe;he++)Ve+=ae[he][0],ae[he][1]!=null&&(Ve+=ae[he][1],ae[he][2]!=null&&(Ve+=" ",Ve+=ae[he][2],ae[he][3]!=null&&(Ve+=" ",Ve+=ae[he][3],Ve+=" ",Ve+=ae[he][4],ae[he][5]!=null&&(Ve+=" ",Ve+=ae[he][5],Ve+=" ",Ve+=ae[he][6],ae[he][7]!=null&&(Ve+=" ",Ve+=ae[he][7])))));return Ve+" "}(this.value)},move:function(ae,he){var Pe=this.bbox();return Pe.x,Pe.y,this},at:function(ae){if(!this.destination)return this;for(var he=this.value,Pe=this.destination.value,Ve=[],Te=new p.PathArray,Ze=0,it=he.length;Ze<it;Ze++){Ve[Ze]=[he[Ze][0]];for(var wt=1,Dt=he[Ze].length;wt<Dt;wt++)Ve[Ze][wt]=he[Ze][wt]+(Pe[Ze][wt]-he[Ze][wt])*ae;Ve[Ze][0]==="A"&&(Ve[Ze][4]=+(Ve[Ze][4]!=0),Ve[Ze][5]=+(Ve[Ze][5]!=0))}return Te.value=Ve,Te},parse:function(ae){if(ae instanceof p.PathArray)return ae.valueOf();var he,Pe={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};ae=typeof ae=="string"?ae.replace(p.regex.numbersWithDots,V).replace(p.regex.pathLetters," $& ").replace(p.regex.hyphen,"$1 -").trim().split(p.regex.delimiter):ae.reduce(function(Dt,Qt){return[].concat.call(Dt,Qt)},[]);var Ve=[],Te=new p.Point,Ze=new p.Point,it=0,wt=ae.length;do p.regex.isPathLetter.test(ae[it])?(he=ae[it],++it):he=="M"?he="L":he=="m"&&(he="l"),Ve.push(N[he].call(null,ae.slice(it,it+=Pe[he.toUpperCase()]).map(parseFloat),Te,Ze));while(wt>it);return Ve},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(ae,he){this.value=0,this.unit=he||"",typeof ae=="number"?this.value=isNaN(ae)?0:isFinite(ae)?ae:ae<0?-34e37:34e37:typeof ae=="string"?(he=ae.match(p.regex.numberAndUnit))&&(this.value=parseFloat(he[1]),he[5]=="%"?this.value/=100:he[5]=="s"&&(this.value*=1e3),this.unit=he[5]):ae instanceof p.Number&&(this.value=ae.valueOf(),this.unit=ae.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(ae){return ae=new p.Number(ae),new p.Number(this+ae,this.unit||ae.unit)},minus:function(ae){return ae=new p.Number(ae),new p.Number(this-ae,this.unit||ae.unit)},times:function(ae){return ae=new p.Number(ae),new p.Number(this*ae,this.unit||ae.unit)},divide:function(ae){return ae=new p.Number(ae),new p.Number(this/ae,this.unit||ae.unit)},to:function(ae){var he=new p.Number(this);return typeof ae=="string"&&(he.unit=ae),he},morph:function(ae){return this.destination=new p.Number(ae),ae.relative&&(this.destination.value+=this.value),this},at:function(ae){return this.destination?new p.Number(this.destination).minus(this).times(ae).plus(this):this}}}),p.Element=p.invent({create:function(ae){this._stroke=p.defaults.attrs.stroke,this._event=null,this.dom={},(this.node=ae)&&(this.type=ae.nodeName,this.node.instance=this,this._stroke=ae.getAttribute("stroke")||this._stroke)},extend:{x:function(ae){return this.attr("x",ae)},y:function(ae){return this.attr("y",ae)},cx:function(ae){return ae==null?this.x()+this.width()/2:this.x(ae-this.width()/2)},cy:function(ae){return ae==null?this.y()+this.height()/2:this.y(ae-this.height()/2)},move:function(ae,he){return this.x(ae).y(he)},center:function(ae,he){return this.cx(ae).cy(he)},width:function(ae){return this.attr("width",ae)},height:function(ae){return this.attr("height",ae)},size:function(ae,he){var Pe=me(this,ae,he);return this.width(new p.Number(Pe.width)).height(new p.Number(Pe.height))},clone:function(ae){this.writeDataToDom();var he=Le(this.node.cloneNode(!0));return ae?ae.add(he):this.after(he),he},remove:function(){return this.parent()&&this.parent().removeElement(this),this},replace:function(ae){return this.after(ae).remove(),ae},addTo:function(ae){return ae.put(this)},putIn:function(ae){return ae.add(this)},id:function(ae){return this.attr("id",ae)},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 ae=this.attr("class");return ae==null?[]:ae.trim().split(p.regex.delimiter)},hasClass:function(ae){return this.classes().indexOf(ae)!=-1},addClass:function(ae){if(!this.hasClass(ae)){var he=this.classes();he.push(ae),this.attr("class",he.join(" "))}return this},removeClass:function(ae){return this.hasClass(ae)&&this.attr("class",this.classes().filter(function(he){return he!=ae}).join(" ")),this},toggleClass:function(ae){return this.hasClass(ae)?this.removeClass(ae):this.addClass(ae)},reference:function(ae){return p.get(this.attr(ae))},parent:function(ae){var he=this;if(!he.node.parentNode)return null;if(he=p.adopt(he.node.parentNode),!ae)return he;for(;he&&he.node instanceof Ce.SVGElement;){if(typeof ae=="string"?he.matches(ae):he instanceof ae)return he;if(!he.node.parentNode||he.node.parentNode.nodeName=="#document")return null;he=p.adopt(he.node.parentNode)}},doc:function(){return this instanceof p.Doc?this:this.parent(p.Doc)},parents:function(ae){var he=[],Pe=this;do{if(!(Pe=Pe.parent(ae))||!Pe.node)break;he.push(Pe)}while(Pe.parent);return he},matches:function(ae){return function(he,Pe){return(he.matches||he.matchesSelector||he.msMatchesSelector||he.mozMatchesSelector||he.webkitMatchesSelector||he.oMatchesSelector).call(he,Pe)}(this.node,ae)},native:function(){return this.node},svg:function(ae){var he=m.createElementNS("http://www.w3.org/2000/svg","svg");if(!(ae&&this instanceof p.Parent))return he.appendChild(ae=m.createElementNS("http://www.w3.org/2000/svg","svg")),this.writeDataToDom(),ae.appendChild(this.node.cloneNode(!0)),he.innerHTML.replace(/^<svg>/,"").replace(/<\/svg>$/,"");he.innerHTML="<svg>"+ae.replace(/\n/,"").replace(/<([\w:-]+)([^<]+?)\/>/g,"<$1$2></$1>")+"</svg>";for(var Pe=0,Ve=he.firstChild.childNodes.length;Pe<Ve;Pe++)this.node.appendChild(he.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(ae){return this.dom=ae,this},is:function(ae){return function(he,Pe){return he instanceof Pe}(this,ae)}}}),p.easing={"-":function(ae){return ae},"<>":function(ae){return-Math.cos(ae*Math.PI)/2+.5},">":function(ae){return Math.sin(ae*Math.PI/2)},"<":function(ae){return 1-Math.cos(ae*Math.PI/2)}},p.morph=function(ae){return function(he,Pe){return new p.MorphObj(he,Pe).at(ae)}},p.Situation=p.invent({create:function(ae){this.init=!1,this.reversed=!1,this.reversing=!1,this.duration=new p.Number(ae.duration).valueOf(),this.delay=new p.Number(ae.delay).valueOf(),this.start=+new Date+this.delay,this.finish=this.start+this.duration,this.ease=ae.ease,this.loop=0,this.loops=!1,this.animations={},this.attrs={},this.styles={},this.transforms=[],this.once={}}}),p.FX=p.invent({create:function(ae){this._target=ae,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(ae,he,Pe){I(ae)==="object"&&(he=ae.ease,Pe=ae.delay,ae=ae.duration);var Ve=new p.Situation({duration:ae||1e3,delay:Pe||0,ease:p.easing[he||"-"]||he});return this.queue(Ve),this},target:function(ae){return ae&&ae instanceof p.Element?(this._target=ae,this):this._target},timeToAbsPos:function(ae){return(ae-this.situation.start)/(this.situation.duration/this._speed)},absPosToTime:function(ae){return this.situation.duration/this._speed*ae+this.situation.start},startAnimFrame:function(){this.stopAnimFrame(),this.animationFrame=Ce.requestAnimationFrame((function(){this.step()}).bind(this))},stopAnimFrame:function(){Ce.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(ae){return(typeof ae=="function"||ae instanceof p.Situation)&&this.situations.push(ae),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 ae,he=this.situation;if(he.init)return this;for(var Pe in he.animations){ae=this.target()[Pe](),Array.isArray(ae)||(ae=[ae]),Array.isArray(he.animations[Pe])||(he.animations[Pe]=[he.animations[Pe]]);for(var Ve=ae.length;Ve--;)he.animations[Pe][Ve]instanceof p.Number&&(ae[Ve]=new p.Number(ae[Ve])),he.animations[Pe][Ve]=ae[Ve].morph(he.animations[Pe][Ve])}for(var Pe in he.attrs)he.attrs[Pe]=new p.MorphObj(this.target().attr(Pe),he.attrs[Pe]);for(var Pe in he.styles)he.styles[Pe]=new p.MorphObj(this.target().style(Pe),he.styles[Pe]);return he.initialTransformation=this.target().matrixify(),he.init=!0,this},clearQueue:function(){return this.situations=[],this},clearCurrent:function(){return this.situation=null,this},stop:function(ae,he){var Pe=this.active;return this.active=!1,he&&this.clearQueue(),ae&&this.situation&&(!Pe&&this.startCurrent(),this.atEnd()),this.stopAnimFrame(),this.clearCurrent()},after:function(ae){var he=this.last();return this.target().on("finished.fx",function Pe(Ve){Ve.detail.situation==he&&(ae.call(this,he),this.off("finished.fx",Pe))}),this._callStart()},during:function(ae){var he=this.last(),Pe=function(Ve){Ve.detail.situation==he&&ae.call(this,Ve.detail.pos,p.morph(Ve.detail.pos),Ve.detail.eased,he)};return this.target().off("during.fx",Pe).on("during.fx",Pe),this.after(function(){this.off("during.fx",Pe)}),this._callStart()},afterAll:function(ae){var he=function Pe(Ve){ae.call(this),this.off("allfinished.fx",Pe)};return this.target().off("allfinished.fx",he).on("allfinished.fx",he),this._callStart()},last:function(){return this.situations.length?this.situations[this.situations.length-1]:this.situation},add:function(ae,he,Pe){return this.last()[Pe||"animations"][ae]=he,this._callStart()},step:function(ae){var he,Pe,Ve;ae||(this.absPos=this.timeToAbsPos(+new Date)),this.situation.loops!==!1?(he=Math.max(this.absPos,0),Pe=Math.floor(he),this.situation.loops===!0||Pe<this.situation.loops?(this.pos=he-Pe,Ve=this.situation.loop,this.situation.loop=Pe):(this.absPos=this.situation.loops,this.pos=1,Ve=this.situation.loop-1,this.situation.loop=this.situation.loops),this.situation.reversing&&(this.situation.reversed=this.situation.reversed!=!!((this.situation.loop-Ve)%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 Te=this.situation.ease(this.pos);for(var Ze in this.situation.once)Ze>this.lastPos&&Ze<=Te&&(this.situation.once[Ze].call(this.target(),this.pos,Te),delete this.situation.once[Ze]);return this.active&&this.target().fire("during",{pos:this.pos,eased:Te,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=Te,this):this},eachAt:function(){var ae,he=this,Pe=this.target(),Ve=this.situation;for(var Te in Ve.animations)ae=[].concat(Ve.animations[Te]).map(function(wt){return typeof wt!="string"&&wt.at?wt.at(Ve.ease(he.pos),he.pos):wt}),Pe[Te].apply(Pe,ae);for(var Te in Ve.attrs)ae=[Te].concat(Ve.attrs[Te]).map(function(Dt){return typeof Dt!="string"&&Dt.at?Dt.at(Ve.ease(he.pos),he.pos):Dt}),Pe.attr.apply(Pe,ae);for(var Te in Ve.styles)ae=[Te].concat(Ve.styles[Te]).map(function(Dt){return typeof Dt!="string"&&Dt.at?Dt.at(Ve.ease(he.pos),he.pos):Dt}),Pe.style.apply(Pe,ae);if(Ve.transforms.length){ae=Ve.initialTransformation,Te=0;for(var Ze=Ve.transforms.length;Te<Ze;Te++){var it=Ve.transforms[Te];it instanceof p.Matrix?ae=it.relative?ae.multiply(new p.Matrix().morph(it).at(Ve.ease(this.pos))):ae.morph(it).at(Ve.ease(this.pos)):(it.relative||it.undo(ae.extract()),ae=ae.multiply(it.at(Ve.ease(this.pos))))}Pe.matrix(ae)}return this},once:function(ae,he,Pe){var Ve=this.last();return Pe||(ae=Ve.ease(ae)),Ve.once[ae]=he,this},_callStart:function(){return setTimeout((function(){this.start()}).bind(this),0),this}},parent:p.Element,construct:{animate:function(ae,he,Pe){return(this.fx||(this.fx=new p.FX(this))).animate(ae,he,Pe)},delay:function(ae){return(this.fx||(this.fx=new p.FX(this))).delay(ae)},stop:function(ae,he){return this.fx&&this.fx.stop(ae,he),this},finish:function(){return this.fx&&this.fx.finish(),this}}}),p.MorphObj=p.invent({create:function(ae,he){return p.Color.isColor(he)?new p.Color(ae).morph(he):p.regex.delimiter.test(ae)?p.regex.pathLetters.test(ae)?new p.PathArray(ae).morph(he):new p.Array(ae).morph(he):p.regex.numberAndUnit.test(he)?new p.Number(ae).morph(he):(this.value=ae,void(this.destination=he))},extend:{at:function(ae,he){return he<1?this.value:this.destination},valueOf:function(){return this.value}}}),p.extend(p.FX,{attr:function(ae,he,Pe){if(I(ae)==="object")for(var Ve in ae)this.attr(Ve,ae[Ve]);else this.add(ae,he,"attrs");return this},plot:function(ae,he,Pe,Ve){return arguments.length==4?this.plot([ae,he,Pe,Ve]):this.add("plot",new(this.target()).morphArray(ae))}}),p.Box=p.invent({create:function(ae,he,Pe,Ve){if(!(I(ae)!=="object"||ae instanceof p.Element))return p.Box.call(this,ae.left!=null?ae.left:ae.x,ae.top!=null?ae.top:ae.y,ae.width,ae.height);var Te;arguments.length==4&&(this.x=ae,this.y=he,this.width=Pe,this.height=Ve),(Te=this).x==null&&(Te.x=0,Te.y=0,Te.width=0,Te.height=0),Te.w=Te.width,Te.h=Te.height,Te.x2=Te.x+Te.width,Te.y2=Te.y+Te.height,Te.cx=Te.x+Te.width/2,Te.cy=Te.y+Te.height/2}}),p.BBox=p.invent({create:function(ae){if(p.Box.apply(this,[].slice.call(arguments)),ae instanceof p.Element){var he;try{if(!m.documentElement.contains){for(var Pe=ae.node;Pe.parentNode;)Pe=Pe.parentNode;if(Pe!=m)throw new Error("Element not in the dom")}he=ae.node.getBBox()}catch{if(ae instanceof p.Shape){p.parser.draw||p.prepare();var Ve=ae.clone(p.parser.draw.instance).show();Ve&&Ve.node&&typeof Ve.node.getBBox=="function"&&(he=Ve.node.getBBox()),Ve&&typeof Ve.remove=="function"&&Ve.remove()}else he={x:ae.node.clientLeft,y:ae.node.clientTop,width:ae.node.clientWidth,height:ae.node.clientHeight}}p.Box.call(this,he)}},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(ae){var he=Ie([1,0,0,1,0,0]);ae=ae===null?he:ae instanceof p.Element?ae.matrixify():typeof ae=="string"?Ie(ae.split(p.regex.delimiter).map(parseFloat)):arguments.length==6?Ie([].slice.call(arguments)):Array.isArray(ae)?Ie(ae):ae&&I(ae)==="object"?ae:he;for(var Pe=Oe.length-1;Pe>=0;--Pe)this[Oe[Pe]]=ae[Oe[Pe]]!=null?ae[Oe[Pe]]:he[Oe[Pe]]},extend:{extract:function(){var ae=Ne(this,0,1);Ne(this,1,0);var he=180/Math.PI*Math.atan2(ae.y,ae.x)-90;return{x:this.e,y:this.f,transformedX:(this.e*Math.cos(he*Math.PI/180)+this.f*Math.sin(he*Math.PI/180))/Math.sqrt(this.a*this.a+this.b*this.b),transformedY:(this.f*Math.cos(he*Math.PI/180)+this.e*Math.sin(-he*Math.PI/180))/Math.sqrt(this.c*this.c+this.d*this.d),rotation:he,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(ae){return this.destination=new p.Matrix(ae),this},multiply:function(ae){return new p.Matrix(this.native().multiply(function(he){return he instanceof p.Matrix||(he=new p.Matrix(he)),he}(ae).native()))},inverse:function(){return new p.Matrix(this.native().inverse())},translate:function(ae,he){return new p.Matrix(this.native().translate(ae||0,he||0))},native:function(){for(var ae=p.parser.native.createSVGMatrix(),he=Oe.length-1;he>=0;he--)ae[Oe[he]]=this[Oe[he]];return ae},toString:function(){return"matrix("+Xe(this.a)+","+Xe(this.b)+","+Xe(this.c)+","+Xe(this.d)+","+Xe(this.e)+","+Xe(this.f)+")"}},parent:p.Element,construct:{ctm:function(){return new p.Matrix(this.node.getCTM())},screenCTM:function(){if(this instanceof p.Nested){var ae=this.rect(1,1),he=ae.node.getScreenCTM();return ae.remove(),new p.Matrix(he)}return new p.Matrix(this.node.getScreenCTM())}}}),p.Point=p.invent({create:function(ae,he){var Pe;Pe=Array.isArray(ae)?{x:ae[0],y:ae[1]}:I(ae)==="object"?{x:ae.x,y:ae.y}:ae!=null?{x:ae,y:he??ae}:{x:0,y:0},this.x=Pe.x,this.y=Pe.y},extend:{clone:function(){return new p.Point(this)},morph:function(ae,he){return this.destination=new p.Point(ae,he),this}}}),p.extend(p.Element,{point:function(ae,he){return new p.Point(ae,he).transform(this.screenCTM().inverse())}}),p.extend(p.Element,{attr:function(ae,he,Pe){if(ae==null){for(ae={},Pe=(he=this.node.attributes).length-1;Pe>=0;Pe--)ae[he[Pe].nodeName]=p.regex.isNumber.test(he[Pe].nodeValue)?parseFloat(he[Pe].nodeValue):he[Pe].nodeValue;return ae}if(I(ae)==="object")for(var Ve in ae)this.attr(Ve,ae[Ve]);else if(he===null)this.node.removeAttribute(ae);else{if(he==null)return(he=this.node.getAttribute(ae))==null?p.defaults.attrs[ae]:p.regex.isNumber.test(he)?parseFloat(he):he;ae=="stroke-width"?this.attr("stroke",parseFloat(he)>0?this._stroke:null):ae=="stroke"&&(this._stroke=he),ae!="fill"&&ae!="stroke"||(p.regex.isImage.test(he)&&(he=this.doc().defs().image(he,0,0)),he instanceof p.Image&&(he=this.doc().defs().pattern(0,0,function(){this.add(he)}))),typeof he=="number"?he=new p.Number(he):p.Color.isColor(he)?he=new p.Color(he):Array.isArray(he)&&(he=new p.Array(he)),ae=="leading"?this.leading&&this.leading(he):typeof Pe=="string"?this.node.setAttributeNS(Pe,ae,he.toString()):this.node.setAttribute(ae,he.toString()),!this.rebuild||ae!="font-size"&&ae!="x"||this.rebuild(ae,he)}return this}}),p.extend(p.Element,{transform:function(ae,he){var Pe;return I(ae)!=="object"?(Pe=new p.Matrix(this).extract(),typeof ae=="string"?Pe[ae]:Pe):(Pe=new p.Matrix(this),he=!!he||!!ae.relative,ae.a!=null&&(Pe=he?Pe.multiply(new p.Matrix(ae)):new p.Matrix(ae)),this.attr("transform",Pe))}}),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(ae){var he=ae.trim().split("(");return[he[0],he[1].split(p.regex.delimiter).map(function(Pe){return parseFloat(Pe)})]}).reduce(function(ae,he){return he[0]=="matrix"?ae.multiply(Ie(he[1])):ae[he[0]].apply(ae,he[1])},new p.Matrix)},toParent:function(ae){if(this==ae)return this;var he=this.screenCTM(),Pe=ae.screenCTM().inverse();return this.addTo(ae).untransform().transform(Pe.multiply(he)),this},toDoc:function(){return this.toParent(this.doc())}}),p.Transformation=p.invent({create:function(ae,he){if(arguments.length>1&&typeof he!="boolean")return this.constructor.call(this,[].slice.call(arguments));if(Array.isArray(ae))for(var Pe=0,Ve=this.arguments.length;Pe<Ve;++Pe)this[this.arguments[Pe]]=ae[Pe];else if(ae&&I(ae)==="object")for(Pe=0,Ve=this.arguments.length;Pe<Ve;++Pe)this[this.arguments[Pe]]=ae[this.arguments[Pe]];this.inversed=!1,he===!0&&(this.inversed=!0)}}),p.Translate=p.invent({parent:p.Matrix,inherit:p.Transformation,create:function(ae,he){this.constructor.apply(this,[].slice.call(arguments))},extend:{arguments:["transformedX","transformedY"],method:"translate"}}),p.extend(p.Element,{style:function(ae,he){if(arguments.length==0)return this.node.style.cssText||"";if(arguments.length<2)if(I(ae)==="object")for(var Pe in ae)this.style(Pe,ae[Pe]);else{if(!p.regex.isCss.test(ae))return this.node.style[Z(ae)];for(ae=ae.split(/\s*;\s*/).filter(function(Ve){return!!Ve}).map(function(Ve){return Ve.split(/\s*:\s*/)});he=ae.pop();)this.style(he[0],he[1])}else this.node.style[Z(ae)]=he===null||p.regex.isBlank.test(he)?"":he;return this}}),p.Parent=p.invent({create:function(ae){this.constructor.call(this,ae)},inherit:p.Element,extend:{children:function(){return p.utils.map(p.utils.filterSVGElements(this.node.childNodes),function(ae){return p.adopt(ae)})},add:function(ae,he){return he==null?this.node.appendChild(ae.node):ae.node!=this.node.childNodes[he]&&this.node.insertBefore(ae.node,this.node.childNodes[he]),this},put:function(ae,he){return this.add(ae,he),ae},has:function(ae){return this.index(ae)>=0},index:function(ae){return[].slice.call(this.node.childNodes).indexOf(ae.node)},get:function(ae){return p.adopt(this.node.childNodes[ae])},first:function(){return this.get(0)},last:function(){return this.get(this.node.childNodes.length-1)},each:function(ae,he){for(var Pe=this.children(),Ve=0,Te=Pe.length;Ve<Te;Ve++)Pe[Ve]instanceof p.Element&&ae.apply(Pe[Ve],[Ve,Pe]),he&&Pe[Ve]instanceof p.Container&&Pe[Ve].each(ae,he);return this},removeElement:function(ae){return this.node.removeChild(ae.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(ae,he){return he===0||this instanceof p.Defs||this.node==p.parser.draw||(ae=ae||(this instanceof p.Doc?this:this.parent(p.Parent)),he=he||1/0,this.each(function(){return this instanceof p.Defs?this:this instanceof p.Parent?this.ungroup(ae,he-1):this.toParent(ae)}),this.node.firstChild||this.remove()),this},flatten:function(ae,he){return this.ungroup(ae,he)}}),p.Container=p.invent({create:function(ae){this.constructor.call(this,ae)},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(ae){p.Element.prototype[ae]=function(he){return p.on(this.node,ae,he),this}}),p.listeners=[],p.handlerMap=[],p.listenerId=0,p.on=function(ae,he,Pe,Ve,Te){var Ze=Pe.bind(Ve||ae.instance||ae),it=(p.handlerMap.indexOf(ae)+1||p.handlerMap.push(ae))-1,wt=he.split(".")[0],Dt=he.split(".")[1]||"*";p.listeners[it]=p.listeners[it]||{},p.listeners[it][wt]=p.listeners[it][wt]||{},p.listeners[it][wt][Dt]=p.listeners[it][wt][Dt]||{},Pe._svgjsListenerId||(Pe._svgjsListenerId=++p.listenerId),p.listeners[it][wt][Dt][Pe._svgjsListenerId]=Ze,ae.addEventListener(wt,Ze,Te||{passive:!1})},p.off=function(ae,he,Pe){var Ve=p.handlerMap.indexOf(ae),Te=he&&he.split(".")[0],Ze=he&&he.split(".")[1],it="";if(Ve!=-1)if(Pe){if(typeof Pe=="function"&&(Pe=Pe._svgjsListenerId),!Pe)return;p.listeners[Ve][Te]&&p.listeners[Ve][Te][Ze||"*"]&&(ae.removeEventListener(Te,p.listeners[Ve][Te][Ze||"*"][Pe],!1),delete p.listeners[Ve][Te][Ze||"*"][Pe])}else if(Ze&&Te){if(p.listeners[Ve][Te]&&p.listeners[Ve][Te][Ze]){for(var wt in p.listeners[Ve][Te][Ze])p.off(ae,[Te,Ze].join("."),wt);delete p.listeners[Ve][Te][Ze]}}else if(Ze)for(var Dt in p.listeners[Ve])for(var it in p.listeners[Ve][Dt])Ze===it&&p.off(ae,[Dt,Ze].join("."));else if(Te){if(p.listeners[Ve][Te]){for(var it in p.listeners[Ve][Te])p.off(ae,[Te,it].join("."));delete p.listeners[Ve][Te]}}else{for(var Dt in p.listeners[Ve])p.off(ae,Dt);delete p.listeners[Ve],delete p.handlerMap[Ve]}},p.extend(p.Element,{on:function(ae,he,Pe,Ve){return p.on(this.node,ae,he,Pe,Ve),this},off:function(ae,he){return p.off(this.node,ae,he),this},fire:function(ae,he){return ae instanceof Ce.Event?this.node.dispatchEvent(ae):this.node.dispatchEvent(ae=new p.CustomEvent(ae,{detail:he,cancelable:!0})),this._event=ae,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(ae){return ae==null?this.transform("x"):this.transform({x:ae-this.x()},!0)}},construct:{group:function(){return this.put(new p.G)}}}),p.Doc=p.invent({create:function(ae){ae&&((ae=typeof ae=="string"?m.getElementById(ae):ae).nodeName=="svg"?this.constructor.call(this,ae):(this.constructor.call(this,p.create("svg")),ae.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 ae;return this._defs||((ae=this.node.getElementsByTagName("defs")[0])?this._defs=p.adopt(ae):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(ae){this.writeDataToDom();var he=this.node,Pe=Le(he.cloneNode(!0));return ae?(ae.node||ae).appendChild(Pe.node):he.parentNode.insertBefore(Pe.node,he.nextSibling),Pe}}}),p.extend(p.Element,{}),p.Gradient=p.invent({create:function(ae){this.constructor.call(this,p.create(ae+"Gradient")),this.type=ae},inherit:p.Container,extend:{at:function(ae,he,Pe){return this.put(new p.Stop).update(ae,he,Pe)},update:function(ae){return this.clear(),typeof ae=="function"&&ae.call(this,this),this},fill:function(){return"url(#"+this.id()+")"},toString:function(){return this.fill()},attr:function(ae,he,Pe){return ae=="transform"&&(ae="gradientTransform"),p.Container.prototype.attr.call(this,ae,he,Pe)}},construct:{gradient:function(ae,he){return this.defs().gradient(ae,he)}}}),p.extend(p.Gradient,p.FX,{from:function(ae,he){return(this._target||this).type=="radial"?this.attr({fx:new p.Number(ae),fy:new p.Number(he)}):this.attr({x1:new p.Number(ae),y1:new p.Number(he)})},to:function(ae,he){return(this._target||this).type=="radial"?this.attr({cx:new p.Number(ae),cy:new p.Number(he)}):this.attr({x2:new p.Number(ae),y2:new p.Number(he)})}}),p.extend(p.Defs,{gradient:function(ae,he){return this.put(new p.Gradient(ae)).update(he)}}),p.Stop=p.invent({create:"stop",inherit:p.Element,extend:{update:function(ae){return(typeof ae=="number"||ae instanceof p.Number)&&(ae={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),ae.opacity!=null&&this.attr("stop-opacity",ae.opacity),ae.color!=null&&this.attr("stop-color",ae.color),ae.offset!=null&&this.attr("offset",new p.Number(ae.offset)),this}}}),p.Pattern=p.invent({create:"pattern",inherit:p.Container,extend:{fill:function(){return"url(#"+this.id()+")"},update:function(ae){return this.clear(),typeof ae=="function"&&ae.call(this,this),this},toString:function(){return this.fill()},attr:function(ae,he,Pe){return ae=="transform"&&(ae="patternTransform"),p.Container.prototype.attr.call(this,ae,he,Pe)}},construct:{pattern:function(ae,he,Pe){return this.defs().pattern(ae,he,Pe)}}}),p.extend(p.Defs,{pattern:function(ae,he,Pe){return this.put(new p.Pattern).update(Pe).attr({x:0,y:0,width:ae,height:he,patternUnits:"userSpaceOnUse"})}}),p.Shape=p.invent({create:function(ae){this.constructor.call(this,ae)},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(ae,he){return this.attr("href",(he||"")+"#"+ae,p.xlink)}},construct:{use:function(ae,he){return this.put(new p.Use).element(ae,he)}}}),p.Rect=p.invent({create:"rect",inherit:p.Shape,construct:{rect:function(ae,he){return this.put(new p.Rect).size(ae,he)}}}),p.Circle=p.invent({create:"circle",inherit:p.Shape,construct:{circle:function(ae){return this.put(new p.Circle).rx(new p.Number(ae).divide(2)).move(0,0)}}}),p.extend(p.Circle,p.FX,{rx:function(ae){return this.attr("r",ae)},ry:function(ae){return this.rx(ae)}}),p.Ellipse=p.invent({create:"ellipse",inherit:p.Shape,construct:{ellipse:function(ae,he){return this.put(new p.Ellipse).size(ae,he).move(0,0)}}}),p.extend(p.Ellipse,p.Rect,p.FX,{rx:function(ae){return this.attr("rx",ae)},ry:function(ae){return this.attr("ry",ae)}}),p.extend(p.Circle,p.Ellipse,{x:function(ae){return ae==null?this.cx()-this.rx():this.cx(ae+this.rx())},y:function(ae){return ae==null?this.cy()-this.ry():this.cy(ae+this.ry())},cx:function(ae){return ae==null?this.attr("cx"):this.attr("cx",ae)},cy:function(ae){return ae==null?this.attr("cy"):this.attr("cy",ae)},width:function(ae){return ae==null?2*this.rx():this.rx(new p.Number(ae).divide(2))},height:function(ae){return ae==null?2*this.ry():this.ry(new p.Number(ae).divide(2))},size:function(ae,he){var Pe=me(this,ae,he);return this.rx(new p.Number(Pe.width).divide(2)).ry(new p.Number(Pe.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(ae,he,Pe,Ve){return ae==null?this.array():(ae=he!==void 0?{x1:ae,y1:he,x2:Pe,y2:Ve}:new p.PointArray(ae).toLine(),this.attr(ae))},move:function(ae,he){return this.attr(this.array().move(ae,he).toLine())},size:function(ae,he){var Pe=me(this,ae,he);return this.attr(this.array().size(Pe.width,Pe.height).toLine())}},construct:{line:function(ae,he,Pe,Ve){return p.Line.prototype.plot.apply(this.put(new p.Line),ae!=null?[ae,he,Pe,Ve]:[0,0,0,0])}}}),p.Polyline=p.invent({create:"polyline",inherit:p.Shape,construct:{polyline:function(ae){return this.put(new p.Polyline).plot(ae||new p.PointArray)}}}),p.Polygon=p.invent({create:"polygon",inherit:p.Shape,construct:{polygon:function(ae){return this.put(new p.Polygon).plot(ae||new p.PointArray)}}}),p.extend(p.Polyline,p.Polygon,{array:function(){return this._array||(this._array=new p.PointArray(this.attr("points")))},plot:function(ae){return ae==null?this.array():this.clear().attr("points",typeof ae=="string"?ae:this._array=new p.PointArray(ae))},clear:function(){return delete this._array,this},move:function(ae,he){return this.attr("points",this.array().move(ae,he))},size:function(ae,he){var Pe=me(this,ae,he);return this.attr("points",this.array().size(Pe.width,Pe.height))}}),p.extend(p.Line,p.Polyline,p.Polygon,{morphArray:p.PointArray,x:function(ae){return ae==null?this.bbox().x:this.move(ae,this.bbox().y)},y:function(ae){return ae==null?this.bbox().y:this.move(this.bbox().x,ae)},width:function(ae){var he=this.bbox();return ae==null?he.width:this.size(ae,he.height)},height:function(ae){var he=this.bbox();return ae==null?he.height:this.size(he.width,ae)}}),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(ae){return ae==null?this.array():this.clear().attr("d",typeof ae=="string"?ae:this._array=new p.PathArray(ae))},clear:function(){return delete this._array,this}},construct:{path:function(ae){return this.put(new p.Path).plot(ae||new p.PathArray)}}}),p.Image=p.invent({create:"image",inherit:p.Shape,extend:{load:function(ae){if(!ae)return this;var he=this,Pe=new Ce.Image;return p.on(Pe,"load",function(){p.off(Pe);var Ve=he.parent(p.Pattern);Ve!==null&&(he.width()==0&&he.height()==0&&he.size(Pe.width,Pe.height),Ve&&Ve.width()==0&&Ve.height()==0&&Ve.size(he.width(),he.height()),typeof he._loaded=="function"&&he._loaded.call(he,{width:Pe.width,height:Pe.height,ratio:Pe.width/Pe.height,url:ae}))}),p.on(Pe,"error",function(Ve){p.off(Pe),typeof he._error=="function"&&he._error.call(he,Ve)}),this.attr("href",Pe.src=this.src=ae,p.xlink)},loaded:function(ae){return this._loaded=ae,this},error:function(ae){return this._error=ae,this}},construct:{image:function(ae,he,Pe){return this.put(new p.Image).load(ae).size(he||0,Pe||he||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(ae){return ae==null?this.attr("x"):this.attr("x",ae)},text:function(ae){if(ae===void 0){ae="";for(var he=this.node.childNodes,Pe=0,Ve=he.length;Pe<Ve;++Pe)Pe!=0&&he[Pe].nodeType!=3&&p.adopt(he[Pe]).dom.newLined==1&&(ae+=`
`),ae+=he[Pe].textContent;return ae}if(this.clear().build(!0),typeof ae=="function")ae.call(this,this);else{Pe=0;for(var Te=(ae=ae.split(`
`)).length;Pe<Te;Pe++)this.tspan(ae[Pe]).newLine()}return this.build(!1).rebuild()},size:function(ae){return this.attr("font-size",ae).rebuild()},leading:function(ae){return ae==null?this.dom.leading:(this.dom.leading=new p.Number(ae),this.rebuild())},lines:function(){var ae=(this.textPath&&this.textPath()||this).node,he=p.utils.map(p.utils.filterSVGElements(ae.childNodes),function(Pe){return p.adopt(Pe)});return new p.Set(he)},rebuild:function(ae){if(typeof ae=="boolean"&&(this._rebuild=ae),this._rebuild){var he=this,Pe=0,Ve=this.dom.leading*new p.Number(this.attr("font-size"));this.lines().each(function(){this.dom.newLined&&(he.textPath()||this.attr("x",he.attr("x")),this.text()==`
`?Pe+=Ve:(this.attr("dy",Ve+Pe),Pe=0))}),this.fire("rebuild")}return this},build:function(ae){return this._build=!!ae,this},setData:function(ae){return this.dom=ae,this.dom.leading=new p.Number(ae.leading||1.3),this}},construct:{text:function(ae){return this.put(new p.Text).text(ae)},plain:function(ae){return this.put(new p.Text).plain(ae)}}}),p.Tspan=p.invent({create:"tspan",inherit:p.Shape,extend:{text:function(ae){return ae==null?this.node.textContent+(this.dom.newLined?`
`:""):(typeof ae=="function"?ae.call(this,this):this.plain(ae),this)},dx:function(ae){return this.attr("dx",ae)},dy:function(ae){return this.attr("dy",ae)},newLine:function(){var ae=this.parent(p.Text);return this.dom.newLined=!0,this.dy(ae.dom.leading*ae.attr("font-size")).attr("x",ae.x())}}}),p.extend(p.Text,p.Tspan,{plain:function(ae){return this._build===!1&&this.clear(),this.node.appendChild(m.createTextNode(ae)),this},tspan:function(ae){var he=(this.textPath&&this.textPath()||this).node,Pe=new p.Tspan;return this._build===!1&&this.clear(),he.appendChild(Pe.node),Pe.text(ae)},clear:function(){for(var ae=(this.textPath&&this.textPath()||this).node;ae.hasChildNodes();)ae.removeChild(ae.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 ae=this.track();return ae?ae.array():null},plot:function(ae){var he=this.track(),Pe=null;return he&&(Pe=he.plot(ae)),ae==null?Pe:this},track:function(){var ae=this.textPath();if(ae)return ae.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 D={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(ae,he){return he=="color"?ae:ae+"-"+he}};function V(ae,he,Pe,Ve){return Pe+Ve.replace(p.regex.dots," .")}function Z(ae){return ae.toLowerCase().replace(/-(.)/g,function(he,Pe){return Pe.toUpperCase()})}function ce(ae){return ae.charAt(0).toUpperCase()+ae.slice(1)}function ue(ae){var he=ae.toString(16);return he.length==1?"0"+he:he}function me(ae,he,Pe){if(he==null||Pe==null){var Ve=ae.bbox();he==null?he=Ve.width/Ve.height*Pe:Pe==null&&(Pe=Ve.height/Ve.width*he)}return{width:he,height:Pe}}function Ne(ae,he,Pe){return{x:he*ae.a+Pe*ae.c+0,y:he*ae.b+Pe*ae.d+0}}function Ie(ae){return{a:ae[0],b:ae[1],c:ae[2],d:ae[3],e:ae[4],f:ae[5]}}function Le(ae){for(var he=ae.childNodes.length-1;he>=0;he--)ae.childNodes[he]instanceof Ce.SVGElement&&Le(ae.childNodes[he]);return p.adopt(ae).id(p.eid(ae.nodeName))}function Xe(ae){return Math.abs(ae)>1e-37?ae:0}["fill","stroke"].forEach(function(ae){var he={};he[ae]=function(Pe){if(Pe===void 0)return this;if(typeof Pe=="string"||p.Color.isRgb(Pe)||Pe&&typeof Pe.fill=="function")this.attr(ae,Pe);else for(var Ve=D[ae].length-1;Ve>=0;Ve--)Pe[D[ae][Ve]]!=null&&this.attr(D.prefix(ae,D[ae][Ve]),Pe[D[ae][Ve]]);return this},p.extend(p.Element,p.FX,he)}),p.extend(p.Element,p.FX,{translate:function(ae,he){return this.transform({x:ae,y:he})},matrix:function(ae){return this.attr("transform",new p.Matrix(arguments.length==6?[].slice.call(arguments):ae))},opacity:function(ae){return this.attr("opacity",ae)},dx:function(ae){return this.x(new p.Number(ae).plus(this instanceof p.FX?0:this.x()),!0)},dy:function(ae){return this.y(new p.Number(ae).plus(this instanceof p.FX?0:this.y()),!0)}}),p.extend(p.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(ae){return this.node.getPointAtLength(ae)}}),p.Set=p.invent({create:function(ae){Array.isArray(ae)?this.members=ae:this.clear()},extend:{add:function(){for(var ae=[].slice.call(arguments),he=0,Pe=ae.length;he<Pe;he++)this.members.push(ae[he]);return this},remove:function(ae){var he=this.index(ae);return he>-1&&this.members.splice(he,1),this},each:function(ae){for(var he=0,Pe=this.members.length;he<Pe;he++)ae.apply(this.members[he],[he,this.members]);return this},clear:function(){return this.members=[],this},length:function(){return this.members.length},has:function(ae){return this.index(ae)>=0},index:function(ae){return this.members.indexOf(ae)},get:function(ae){return this.members[ae]},first:function(){return this.get(0)},last:function(){return this.get(this.members.length-1)},valueOf:function(){return this.members}},construct:{set:function(ae){return new p.Set(ae)}}}),p.FX.Set=p.invent({create:function(ae){this.set=ae}}),p.Set.inherit=function(){var ae=[];for(var he in p.Shape.prototype)typeof p.Shape.prototype[he]=="function"&&typeof p.Set.prototype[he]!="function"&&ae.push(he);for(var he in ae.forEach(function(Ve){p.Set.prototype[Ve]=function(){for(var Te=0,Ze=this.members.length;Te<Ze;Te++)this.members[Te]&&typeof this.members[Te][Ve]=="function"&&this.members[Te][Ve].apply(this.members[Te],arguments);return Ve=="animate"?this.fx||(this.fx=new p.FX.Set(this)):this}}),ae=[],p.FX.prototype)typeof p.FX.prototype[he]=="function"&&typeof p.FX.Set.prototype[he]!="function"&&ae.push(he);ae.forEach(function(Pe){p.FX.Set.prototype[Pe]=function(){for(var Ve=0,Te=this.set.members.length;Ve<Te;Ve++)this.set.members[Ve].fx[Pe].apply(this.set.members[Ve].fx,arguments);return this}})},p.extend(p.Element,{}),p.extend(p.Element,{remember:function(ae,he){if(I(arguments[0])==="object")for(var Pe in ae)this.remember(Pe,ae[Pe]);else{if(arguments.length==1)return this.memory()[ae];this.memory()[ae]=he}return this},forget:function(){if(arguments.length==0)this._memory={};else for(var ae=arguments.length-1;ae>=0;ae--)delete this.memory()[arguments[ae]];return this},memory:function(){return this._memory||(this._memory={})}}),p.get=function(ae){var he=m.getElementById(function(Pe){var Ve=(Pe||"").toString().match(p.regex.reference);if(Ve)return Ve[1]}(ae)||ae);return p.adopt(he)},p.select=function(ae,he){return new p.Set(p.utils.map((he||m).querySelectorAll(ae),function(Pe){return p.adopt(Pe)}))},p.extend(p.Parent,{select:function(ae){return p.select(ae,this.node)}});var Oe="abcdef".split("");if(typeof Ce.CustomEvent!="function"){var $e=function(ae,he){he=he||{bubbles:!1,cancelable:!1,detail:void 0};var Pe=m.createEvent("CustomEvent");return Pe.initCustomEvent(ae,he.bubbles,he.cancelable,he.detail),Pe};$e.prototype=Ce.Event.prototype,p.CustomEvent=$e}else p.CustomEvent=Ce.CustomEvent;return p},I(e)==="object"?t.exports=It.document?mt(It,It.document):function(Ce){return mt(Ce,Ce.document)}:It.SVG=mt(It,It.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(P,D){return this.add(P,D),!P.attr("in")&&this.autoSetIn&&P.attr("in",this.source),P.attr("result")||P.attr("result",P),P},blend:function(P,D,V){return this.put(new SVG.BlendEffect(P,D,V))},colorMatrix:function(P,D){return this.put(new SVG.ColorMatrixEffect(P,D))},convolveMatrix:function(P){return this.put(new SVG.ConvolveMatrixEffect(P))},componentTransfer:function(P){return this.put(new SVG.ComponentTransferEffect(P))},composite:function(P,D,V){return this.put(new SVG.CompositeEffect(P,D,V))},flood:function(P,D){return this.put(new SVG.FloodEffect(P,D))},offset:function(P,D){return this.put(new SVG.OffsetEffect(P,D))},image:function(P){return this.put(new SVG.ImageEffect(P))},merge:function(){var P=[void 0];for(var D in arguments)P.push(arguments[D]);return this.put(new(SVG.MergeEffect.bind.apply(SVG.MergeEffect,P)))},gaussianBlur:function(P,D){return this.put(new SVG.GaussianBlurEffect(P,D))},morphology:function(P,D){return this.put(new SVG.MorphologyEffect(P,D))},diffuseLighting:function(P,D,V){return this.put(new SVG.DiffuseLightingEffect(P,D,V))},displacementMap:function(P,D,V,Z,ce){return this.put(new SVG.DisplacementMapEffect(P,D,V,Z,ce))},specularLighting:function(P,D,V,Z){return this.put(new SVG.SpecularLightingEffect(P,D,V,Z))},tile:function(){return this.put(new SVG.TileEffect)},turbulence:function(P,D,V,Z,ce){return this.put(new SVG.TurbulenceEffect(P,D,V,Z,ce))},toString:function(){return"url(#"+this.attr("id")+")"}}}),SVG.extend(SVG.Defs,{filter:function(P){var D=this.put(new SVG.Filter);return typeof P=="function"&&P.call(D,D),D}}),SVG.extend(SVG.Container,{filter:function(P){return this.defs().filter(P)}}),SVG.extend(SVG.Element,SVG.G,SVG.Nested,{filter:function(P){return this.filterer=P instanceof SVG.Element?P:this.doc().filter(P),this.doc()&&this.filterer.doc()!==this.doc()&&this.doc().defs().add(this.filterer),this.attr("filter",this.filterer),this.filterer},unfilter:function(P){return this.filterer&&P===!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(P){return P==null?this.parent()&&this.parent().select('[result="'+this.attr("in")+'"]').get(0)||this.attr("in"):this.attr("in",P)},result:function(P){return P==null?this.attr("result"):this.attr("result",P)},toString:function(){return this.result()}}}),SVG.ParentEffect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Parent,extend:{in:function(P){return P==null?this.parent()&&this.parent().select('[result="'+this.attr("in")+'"]').get(0)||this.attr("in"):this.attr("in",P)},result:function(P){return P==null?this.attr("result"):this.attr("result",P)},toString:function(){return this.result()}}});var Ce={blend:function(P,D){return this.parent()&&this.parent().blend(this,P,D)},colorMatrix:function(P,D){return this.parent()&&this.parent().colorMatrix(P,D).in(this)},convolveMatrix:function(P){return this.parent()&&this.parent().convolveMatrix(P).in(this)},componentTransfer:function(P){return this.parent()&&this.parent().componentTransfer(P).in(this)},composite:function(P,D){return this.parent()&&this.parent().composite(this,P,D)},flood:function(P,D){return this.parent()&&this.parent().flood(P,D)},offset:function(P,D){return this.parent()&&this.parent().offset(P,D).in(this)},image:function(P){return this.parent()&&this.parent().image(P)},merge:function(){return this.parent()&&this.parent().merge.apply(this.parent(),[this].concat(arguments))},gaussianBlur:function(P,D){return this.parent()&&this.parent().gaussianBlur(P,D).in(this)},morphology:function(P,D){return this.parent()&&this.parent().morphology(P,D).in(this)},diffuseLighting:function(P,D,V){return this.parent()&&this.parent().diffuseLighting(P,D,V).in(this)},displacementMap:function(P,D,V,Z){return this.parent()&&this.parent().displacementMap(this,P,D,V,Z)},specularLighting:function(P,D,V,Z){return this.parent()&&this.parent().specularLighting(P,D,V,Z).in(this)},tile:function(){return this.parent()&&this.parent().tile().in(this)},turbulence:function(P,D,V,Z,ce){return this.parent()&&this.parent().turbulence(P,D,V,Z,ce).in(this)}};SVG.extend(SVG.Effect,Ce),SVG.extend(SVG.ParentEffect,Ce),SVG.ChildEffect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Element,extend:{in:function(P){this.attr("in",P)}}});var m={blend:function(P,D,V){this.attr({in:P,in2:D,mode:V||"normal"})},colorMatrix:function(P,D){P=="matrix"&&(D=A(D)),this.attr({type:P,values:D===void 0?null:D})},convolveMatrix:function(P){P=A(P),this.attr({order:Math.sqrt(P.split(" ").length),kernelMatrix:P})},composite:function(P,D,V){this.attr({in:P,in2:D,operator:V})},flood:function(P,D){this.attr("flood-color",P),D!=null&&this.attr("flood-opacity",D)},offset:function(P,D){this.attr({dx:P,dy:D})},image:function(P){this.attr("href",P,SVG.xlink)},displacementMap:function(P,D,V,Z,ce){this.attr({in:P,in2:D,scale:V,xChannelSelector:Z,yChannelSelector:ce})},gaussianBlur:function(P,D){P!=null||D!=null?this.attr("stdDeviation",function(V){if(!Array.isArray(V))return V;for(var Z=0,ce=V.length,ue=[];Z<ce;Z++)ue.push(V[Z]);return ue.join(" ")}(Array.prototype.slice.call(arguments))):this.attr("stdDeviation","0 0")},morphology:function(P,D){this.attr({operator:P,radius:D})},tile:function(){},turbulence:function(P,D,V,Z,ce){this.attr({numOctaves:D,seed:V,stitchTiles:Z,baseFrequency:P,type:ce})}},p={merge:function(){var P;if(arguments[0]instanceof SVG.Set){var D=this;arguments[0].each(function(Z){this instanceof SVG.MergeNode?D.put(this):(this instanceof SVG.Effect||this instanceof SVG.ParentEffect)&&D.put(new SVG.MergeNode(this))})}else{P=Array.isArray(arguments[0])?arguments[0]:arguments;for(var V=0;V<P.length;V++)P[V]instanceof SVG.MergeNode?this.put(P[V]):this.put(new SVG.MergeNode(P[V]))}},componentTransfer:function(P){if(this.rgb=new SVG.Set,["r","g","b","a"].forEach((function(V){this[V]=new SVG["Func"+V.toUpperCase()]("identity"),this.rgb.add(this[V]),this.node.appendChild(this[V].node)}).bind(this)),P)for(var D in P.rgb&&(["r","g","b"].forEach((function(V){this[V].attr(P.rgb)}).bind(this)),delete P.rgb),P)this[D].attr(P[D])},diffuseLighting:function(P,D,V){this.attr({surfaceScale:P,diffuseConstant:D,kernelUnitLength:V})},specularLighting:function(P,D,V,Z){this.attr({surfaceScale:P,diffuseConstant:D,specularExponent:V,kernelUnitLength:Z})}},N={distantLight:function(P,D){this.attr({azimuth:P,elevation:D})},pointLight:function(P,D,V){this.attr({x:P,y:D,z:V})},spotLight:function(P,D,V,Z,ce,ue){this.attr({x:P,y:D,z:V,pointsAtX:Z,pointsAtY:ce,pointsAtZ:ue})},mergeNode:function(P){this.attr("in",P)}};function A(P){return Array.isArray(P)&&(P=new SVG.Array(P)),P.toString().replace(/^\s+/,"").replace(/\s+$/,"").replace(/\s+/g," ")}function k(){var P=function(){};for(var D in typeof arguments[arguments.length-1]=="function"&&(P=arguments[arguments.length-1],Array.prototype.splice.call(arguments,arguments.length-1,1)),arguments)for(var V in arguments[D])P(arguments[D][V],V,arguments[D])}["r","g","b","a"].forEach(function(P){N["Func"+P.toUpperCase()]=function(D){switch(this.attr("type",D),D){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(m,function(P,D){var V=D.charAt(0).toUpperCase()+D.slice(1);SVG[V+"Effect"]=SVG.invent({create:function(){this.constructor.call(this,SVG.create("fe"+V)),P.apply(this,arguments),this.result(this.attr("id")+"Out")},inherit:SVG.Effect,extend:{}})}),k(p,function(P,D){var V=D.charAt(0).toUpperCase()+D.slice(1);SVG[V+"Effect"]=SVG.invent({create:function(){this.constructor.call(this,SVG.create("fe"+V)),P.apply(this,arguments),this.result(this.attr("id")+"Out")},inherit:SVG.ParentEffect,extend:{}})}),k(N,function(P,D){var V=D.charAt(0).toUpperCase()+D.slice(1);SVG[V]=SVG.invent({create:function(){this.constructor.call(this,SVG.create("fe"+V)),P.apply(this,arguments)},inherit:SVG.ChildEffect,extend:{}})}),SVG.extend(SVG.MergeEffect,{in:function(P){return P instanceof SVG.MergeNode?this.add(P,0):this.add(new SVG.MergeNode(P),0),this}}),SVG.extend(SVG.CompositeEffect,SVG.BlendEffect,SVG.DisplacementMapEffect,{in2:function(P){return P==null?this.parent()&&this.parent().select('[result="'+this.attr("in2")+'"]').get(0)||this.attr("in2"):this.attr("in2",P)}}),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 Ce(k,P,D,V,Z,ce,ue){for(var me=k.slice(P,D||ue),Ne=V.slice(Z,ce||ue),Ie=0,Le={pos:[0,0],start:[0,0]},Xe={pos:[0,0],start:[0,0]};me[Ie]=m.call(Le,me[Ie]),Ne[Ie]=m.call(Xe,Ne[Ie]),me[Ie][0]!=Ne[Ie][0]||me[Ie][0]=="M"||me[Ie][0]=="A"&&(me[Ie][4]!=Ne[Ie][4]||me[Ie][5]!=Ne[Ie][5])?(Array.prototype.splice.apply(me,[Ie,1].concat(N.call(Le,me[Ie]))),Array.prototype.splice.apply(Ne,[Ie,1].concat(N.call(Xe,Ne[Ie])))):(me[Ie]=p.call(Le,me[Ie]),Ne[Ie]=p.call(Xe,Ne[Ie])),!(++Ie==me.length&&Ie==Ne.length);)Ie==me.length&&me.push(["C",Le.pos[0],Le.pos[1],Le.pos[0],Le.pos[1],Le.pos[0],Le.pos[1]]),Ie==Ne.length&&Ne.push(["C",Xe.pos[0],Xe.pos[1],Xe.pos[0],Xe.pos[1],Xe.pos[0],Xe.pos[1]]);return{start:me,dest:Ne}}function m(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 P=k.length;return this.pos=[k[P-2],k[P-1]],"SCQT".indexOf(k[0])!=-1&&(this.reflection=[2*this.pos[0]-k[P-4],2*this.pos[1]-k[P-3]]),k}function N(k){var P=[k];switch(k[0]){case"M":return this.pos=this.start=[k[1],k[2]],P;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":P=function(D,V){var Z,ce,ue,me,Ne,Ie,Le,Xe,Oe,$e,ae,he,Pe,Ve,Te,Ze,it,wt,Dt,Qt,xn,pn,An,or,$t,bt,rn=Math.abs(V[1]),ur=Math.abs(V[2]),gr=V[3]%360,br=V[4],Br=V[5],Gr=V[6],Or=V[7],Lt=new SVG.Point(D),nn=new SVG.Point(Gr,Or),Ot=[];if(rn===0||ur===0||Lt.x===nn.x&&Lt.y===nn.y)return[["C",Lt.x,Lt.y,nn.x,nn.y,nn.x,nn.y]];for(Z=new SVG.Point((Lt.x-nn.x)/2,(Lt.y-nn.y)/2).transform(new SVG.Matrix().rotate(gr)),(ce=Z.x*Z.x/(rn*rn)+Z.y*Z.y/(ur*ur))>1&&(rn*=ce=Math.sqrt(ce),ur*=ce),ue=new SVG.Matrix().rotate(gr).scale(1/rn,1/ur).rotate(-gr),Lt=Lt.transform(ue),nn=nn.transform(ue),me=[nn.x-Lt.x,nn.y-Lt.y],Ie=me[0]*me[0]+me[1]*me[1],Ne=Math.sqrt(Ie),me[0]/=Ne,me[1]/=Ne,Le=Ie<4?Math.sqrt(1-Ie/4):0,br===Br&&(Le*=-1),Xe=new SVG.Point((nn.x+Lt.x)/2+Le*-me[1],(nn.y+Lt.y)/2+Le*me[0]),Oe=new SVG.Point(Lt.x-Xe.x,Lt.y-Xe.y),$e=new SVG.Point(nn.x-Xe.x,nn.y-Xe.y),ae=Math.acos(Oe.x/Math.sqrt(Oe.x*Oe.x+Oe.y*Oe.y)),Oe.y<0&&(ae*=-1),he=Math.acos($e.x/Math.sqrt($e.x*$e.x+$e.y*$e.y)),$e.y<0&&(he*=-1),Br&&ae>he&&(he+=2*Math.PI),!Br&&ae<he&&(he-=2*Math.PI),Ve=Math.ceil(2*Math.abs(ae-he)/Math.PI),Ze=[],it=ae,Pe=(he-ae)/Ve,Te=4*Math.tan(Pe/4)/3,xn=0;xn<=Ve;xn++)Dt=Math.cos(it),wt=Math.sin(it),Qt=new SVG.Point(Xe.x+Dt,Xe.y+wt),Ze[xn]=[new SVG.Point(Qt.x+Te*wt,Qt.y-Te*Dt),Qt,new SVG.Point(Qt.x-Te*wt,Qt.y+Te*Dt)],it+=Pe;for(Ze[0][0]=Ze[0][1].clone(),Ze[Ze.length-1][2]=Ze[Ze.length-1][1].clone(),ue=new SVG.Matrix().rotate(gr).scale(rn,ur).rotate(-gr),xn=0,pn=Ze.length;xn<pn;xn++)Ze[xn][0]=Ze[xn][0].transform(ue),Ze[xn][1]=Ze[xn][1].transform(ue),Ze[xn][2]=Ze[xn][2].transform(ue);for(xn=1,pn=Ze.length;xn<pn;xn++)An=(Qt=Ze[xn-1][2]).x,or=Qt.y,$t=(Qt=Ze[xn][0]).x,bt=Qt.y,Gr=(Qt=Ze[xn][1]).x,Or=Qt.y,Ot.push(["C",An,or,$t,bt,Gr,Or]);return Ot}(this.pos,k),k=P[0]}return k[0]="C",this.pos=[k[5],k[6]],this.reflection=[2*k[5]-k[3],2*k[6]-k[4]],P}function A(k,P){if(P===!1)return!1;for(var D=P,V=k.length;D<V;++D)if(k[D][0]=="M")return D;return!1}SVG.extend(SVG.PathArray,{morph:function(k){for(var P=this.value,D=this.parse(k),V=0,Z=0,ce=!1,ue=!1;V!==!1||Z!==!1;){var me;ce=A(P,V!==!1&&V+1),ue=A(D,Z!==!1&&Z+1),V===!1&&(V=(me=new SVG.PathArray(Ne.start).bbox()).height==0||me.width==0?P.push(P[0])-1:P.push(["M",me.x+me.width/2,me.y+me.height/2])-1),Z===!1&&(Z=(me=new SVG.PathArray(Ne.dest).bbox()).height==0||me.width==0?D.push(D[0])-1:D.push(["M",me.x+me.width/2,me.y+me.height/2])-1);var Ne=Ce(P,V,ce,D,Z,ue);P=P.slice(0,V).concat(Ne.start,ce===!1?[]:P.slice(ce)),D=D.slice(0,Z).concat(Ne.dest,ue===!1?[]:D.slice(ue)),V=ce!==!1&&V+Ne.start.length,Z=ue!==!1&&Z+Ne.dest.length}return this.value=P,this.destination=new SVG.PathArray,this.destination.value=D,this}})}(),(function(){function Ce(m){m.remember("_draggable",this),this.el=m}Ce.prototype.init=function(m,p){var N=this;this.constraint=m,this.value=p,this.el.on("mousedown.drag",function(A){N.start(A)}),this.el.on("touchstart.drag",function(A){N.start(A)})},Ce.prototype.transformPoint=function(m,p){var N=(m=m||window.event).changedTouches&&m.changedTouches[0]||m;return this.p.x=N.clientX-(p||0),this.p.y=N.clientY,this.p.matrixTransform(this.m)},Ce.prototype.getBBox=function(){var m=this.el.bbox();return this.el instanceof SVG.Nested&&(m=this.el.rbox()),(this.el instanceof SVG.G||this.el instanceof SVG.Use||this.el instanceof SVG.Nested)&&(m.x=this.el.x(),m.y=this.el.y()),m},Ce.prototype.start=function(m){if(m.type!="click"&&m.type!="mousedown"&&m.type!="mousemove"||(m.which||m.buttons)==1){var p=this;if(this.el.fire("beforedrag",{event:m,handler:this}),!this.el.event().defaultPrevented){m.preventDefault(),m.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 N,A=this.getBBox();if(this.el instanceof SVG.Text)switch(N=this.el.node.getComputedTextLength(),this.el.attr("text-anchor")){case"middle":N/=2;break;case"start":N=0}this.startPoints={point:this.transformPoint(m,N),box:A,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:m,p:this.startPoints.point,m:this.m,handler:this})}}},Ce.prototype.drag=function(m){var p=this.getBBox(),N=this.transformPoint(m),A=this.startPoints.box.x+N.x-this.startPoints.point.x,k=this.startPoints.box.y+N.y-this.startPoints.point.y,P=this.constraint,D=N.x-this.startPoints.point.x,V=N.y-this.startPoints.point.y;if(this.el.fire("dragmove",{event:m,p:N,m:this.m,handler:this}),this.el.event().defaultPrevented)return N;if(typeof P=="function"){var Z=P.call(this.el,A,k,this.m);typeof Z=="boolean"&&(Z={x:Z,y:Z}),Z.x===!0?this.el.x(A):Z.x!==!1&&this.el.x(Z.x),Z.y===!0?this.el.y(k):Z.y!==!1&&this.el.y(Z.y)}else typeof P=="object"&&(P.minX!=null&&A<P.minX?D=(A=P.minX)-this.startPoints.box.x:P.maxX!=null&&A>P.maxX-p.width&&(D=(A=P.maxX-p.width)-this.startPoints.box.x),P.minY!=null&&k<P.minY?V=(k=P.minY)-this.startPoints.box.y:P.maxY!=null&&k>P.maxY-p.height&&(V=(k=P.maxY-p.height)-this.startPoints.box.y),P.snapToGrid!=null&&(A-=A%P.snapToGrid,k-=k%P.snapToGrid,D-=D%P.snapToGrid,V-=V%P.snapToGrid),this.el instanceof SVG.G?this.el.matrix(this.startPoints.transform).transform({x:D,y:V},!0):this.el.move(A,k));return N},Ce.prototype.end=function(m){var p=this.drag(m);this.el.fire("dragend",{event:m,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(m,p){typeof m!="function"&&typeof m!="object"||(p=m,m=!0);var N=this.remember("_draggable")||new Ce(this);return(m=m===void 0||m)?N.init(p||{},m):(this.off("mousedown.drag"),this.off("touchstart.drag")),this}})}).call(void 0),function(){function Ce(m){this.el=m,m.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,N,A){var k=typeof p!="string"?p:N[p];return A?k/2:k},this.pointCoords=function(p,N){var A=this.pointsList[p];return{x:this.pointCoord(A[0],N,p==="t"||p==="b"),y:this.pointCoord(A[1],N,p==="r"||p==="l")}}}Ce.prototype.init=function(m,p){var N=this.el.bbox();this.options={};var A=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 P=["points","pointsExclude"];for(var k in P){var D=this.options[P[k]];typeof D=="string"?D=D.length>0?D.split(/\s*,\s*/i):[]:typeof D=="boolean"&&P[k]==="points"&&(D=D?A:[]),this.options[P[k]]=D}this.options.points=[A,this.options.points].reduce(function(V,Z){return V.filter(function(ce){return Z.indexOf(ce)>-1})}),this.options.points=[this.options.points,this.options.pointsExclude].reduce(function(V,Z){return V.filter(function(ce){return Z.indexOf(ce)<0})}),this.parent=this.el.parent(),this.nested=this.nested||this.parent.group(),this.nested.matrix(new SVG.Matrix(this.el).translate(N.x,N.y)),this.options.deepSelect&&["line","polyline","polygon"].indexOf(this.el.type)!==-1?this.selectPoints(m):this.selectRect(m),this.observe(),this.cleanup()},Ce.prototype.selectPoints=function(m){return this.pointSelection.isSelected=m,this.pointSelection.set||(this.pointSelection.set=this.parent.set(),this.drawPoints()),this},Ce.prototype.getPointArray=function(){var m=this.el.bbox();return this.el.array().valueOf().map(function(p){return[p[0]-m.x,p[1]-m.y]})},Ce.prototype.drawPoints=function(){for(var m=this,p=this.getPointArray(),N=0,A=p.length;N<A;++N){var k=function(D){return function(V){(V=V||window.event).preventDefault?V.preventDefault():V.returnValue=!1,V.stopPropagation();var Z=V.pageX||V.touches[0].pageX,ce=V.pageY||V.touches[0].pageY;m.el.fire("point",{x:Z,y:ce,i:D,event:V})}}(N),P=this.drawPoint(p[N][0],p[N][1]).addClass(this.options.classPoints).addClass(this.options.classPoints+"_point").on("touchstart",k).on("mousedown",k);this.pointSelection.set.add(P)}},Ce.prototype.drawPoint=function(m,p){var N=this.options.pointType;switch(N){case"circle":return this.drawCircle(m,p);case"rect":return this.drawRect(m,p);default:if(typeof N=="function")return N.call(this,m,p);throw new Error("Unknown "+N+" point type!")}},Ce.prototype.drawCircle=function(m,p){return this.nested.circle(this.options.pointSize).center(m,p)},Ce.prototype.drawRect=function(m,p){return this.nested.rect(this.options.pointSize,this.options.pointSize).center(m,p)},Ce.prototype.updatePointSelection=function(){var m=this.getPointArray();this.pointSelection.set.each(function(p){this.cx()===m[p][0]&&this.cy()===m[p][1]||this.center(m[p][0],m[p][1])})},Ce.prototype.updateRectSelection=function(){var m=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(A,k){var P=m.pointCoords(A,p);m.rectSelection.set.get(k+1).center(P.x,P.y)}),this.options.rotationPoint){var N=this.rectSelection.set.length();this.rectSelection.set.get(N-1).center(p.width/2,20)}},Ce.prototype.selectRect=function(m){var p=this,N=this.el.bbox();function A(D){return function(V){(V=V||window.event).preventDefault?V.preventDefault():V.returnValue=!1,V.stopPropagation();var Z=V.pageX||V.touches[0].pageX,ce=V.pageY||V.touches[0].pageY;p.el.fire(D,{x:Z,y:ce,event:V})}}if(this.rectSelection.isSelected=m,this.rectSelection.set=this.rectSelection.set||this.parent.set(),this.rectSelection.set.get(0)||this.rectSelection.set.add(this.nested.rect(N.width,N.height).addClass(this.options.classRect)),this.options.points.length&&this.rectSelection.set.length()<2&&(this.options.points.map(function(D,V){var Z=p.pointCoords(D,N),ce=p.drawPoint(Z.x,Z.y).attr("class",p.options.classPoints+"_"+D).on("mousedown",A(D)).on("touchstart",A(D));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(D){(D=D||window.event).preventDefault?D.preventDefault():D.returnValue=!1,D.stopPropagation();var V=D.pageX||D.touches[0].pageX,Z=D.pageY||D.touches[0].pageY;p.el.fire("rot",{x:V,y:Z,event:D})},P=this.drawPoint(N.width/2,20).attr("class",this.options.classPoints+"_rot").on("touchstart",k).on("mousedown",k);this.rectSelection.set.add(P)}},Ce.prototype.handler=function(){var m=this.el.bbox();this.nested.matrix(new SVG.Matrix(this.el).translate(m.x,m.y)),this.rectSelection.isSelected&&this.updateRectSelection(),this.pointSelection.isSelected&&this.updatePointSelection()},Ce.prototype.observe=function(){var m=this;if(MutationObserver)if(this.rectSelection.isSelected||this.pointSelection.isSelected)this.observerInst=this.observerInst||new MutationObserver(function(){m.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(){m.handler()})},Ce.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(m,p){return typeof m=="object"&&(p=m,m=!0),(this.remember("_selectHandler")||new Ce(this)).init(m===void 0||m,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 Ce(m){m.remember("_resizeHandler",this),this.el=m,this.parameters={},this.lastUpdateCall=null,this.p=m.doc().node.createSVGPoint()}Ce.prototype.transformPoint=function(m,p,N){return this.p.x=m-(this.offset.x-window.pageXOffset),this.p.y=p-(this.offset.y-window.pageYOffset),this.p.matrixTransform(N||this.m)},Ce.prototype._extractPosition=function(m){return{x:m.clientX!=null?m.clientX:m.touches[0].clientX,y:m.clientY!=null?m.clientY:m.touches[0].clientY}},Ce.prototype.init=function(m){var p=this;if(this.stop(),m!=="stop"){for(var N in this.options={},this.el.resize.defaults)this.options[N]=this.el.resize.defaults[N],m[N]!==void 0&&(this.options[N]=m[N]);this.el.on("lt.resize",function(A){p.resize(A||window.event)}),this.el.on("rt.resize",function(A){p.resize(A||window.event)}),this.el.on("rb.resize",function(A){p.resize(A||window.event)}),this.el.on("lb.resize",function(A){p.resize(A||window.event)}),this.el.on("t.resize",function(A){p.resize(A||window.event)}),this.el.on("r.resize",function(A){p.resize(A||window.event)}),this.el.on("b.resize",function(A){p.resize(A||window.event)}),this.el.on("l.resize",function(A){p.resize(A||window.event)}),this.el.on("rot.resize",function(A){p.resize(A||window.event)}),this.el.on("point.resize",function(A){p.resize(A||window.event)}),this.update()}},Ce.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},Ce.prototype.resize=function(m){var p=this;this.m=this.el.node.getScreenCTM().inverse(),this.offset={x:window.pageXOffset,y:window.pageYOffset};var N=this._extractPosition(m.detail.event);if(this.parameters={type:this.el.type,p:this.transformPoint(N.x,N.y),x:m.detail.x,y:m.detail.y,box:this.el.bbox(),rotation:this.el.transform().rotation},this.el.type==="text"&&(this.parameters.fontSize=this.el.attr()["font-size"]),m.detail.i!==void 0){var A=this.el.array().valueOf();this.parameters.i=m.detail.i,this.parameters.pointCoords=[A[m.detail.i][0],A[m.detail.i][1]]}switch(m.type){case"lt":this.calc=function(k,P){var D=this.snapToGrid(k,P);if(this.parameters.box.width-D[0]>0&&this.parameters.box.height-D[1]>0){if(this.parameters.type==="text")return this.el.move(this.parameters.box.x+D[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize-D[0]);D=this.checkAspectRatio(D),this.el.move(this.parameters.box.x+D[0],this.parameters.box.y+D[1]).size(this.parameters.box.width-D[0],this.parameters.box.height-D[1])}};break;case"rt":this.calc=function(k,P){var D=this.snapToGrid(k,P,2);if(this.parameters.box.width+D[0]>0&&this.parameters.box.height-D[1]>0){if(this.parameters.type==="text")return this.el.move(this.parameters.box.x-D[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize+D[0]);D=this.checkAspectRatio(D,!0),this.el.move(this.parameters.box.x,this.parameters.box.y+D[1]).size(this.parameters.box.width+D[0],this.parameters.box.height-D[1])}};break;case"rb":this.calc=function(k,P){var D=this.snapToGrid(k,P,0);if(this.parameters.box.width+D[0]>0&&this.parameters.box.height+D[1]>0){if(this.parameters.type==="text")return this.el.move(this.parameters.box.x-D[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize+D[0]);D=this.checkAspectRatio(D),this.el.move(this.parameters.box.x,this.parameters.box.y).size(this.parameters.box.width+D[0],this.parameters.box.height+D[1])}};break;case"lb":this.calc=function(k,P){var D=this.snapToGrid(k,P,1);if(this.parameters.box.width-D[0]>0&&this.parameters.box.height+D[1]>0){if(this.parameters.type==="text")return this.el.move(this.parameters.box.x+D[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize-D[0]);D=this.checkAspectRatio(D,!0),this.el.move(this.parameters.box.x+D[0],this.parameters.box.y).size(this.parameters.box.width-D[0],this.parameters.box.height+D[1])}};break;case"t":this.calc=function(k,P){var D=this.snapToGrid(k,P,2);if(this.parameters.box.height-D[1]>0){if(this.parameters.type==="text")return;this.el.move(this.parameters.box.x,this.parameters.box.y+D[1]).height(this.parameters.box.height-D[1])}};break;case"r":this.calc=function(k,P){var D=this.snapToGrid(k,P,0);if(this.parameters.box.width+D[0]>0){if(this.parameters.type==="text")return;this.el.move(this.parameters.box.x,this.parameters.box.y).width(this.parameters.box.width+D[0])}};break;case"b":this.calc=function(k,P){var D=this.snapToGrid(k,P,0);if(this.parameters.box.height+D[1]>0){if(this.parameters.type==="text")return;this.el.move(this.parameters.box.x,this.parameters.box.y).height(this.parameters.box.height+D[1])}};break;case"l":this.calc=function(k,P){var D=this.snapToGrid(k,P,1);if(this.parameters.box.width-D[0]>0){if(this.parameters.type==="text")return;this.el.move(this.parameters.box.x+D[0],this.parameters.box.y).width(this.parameters.box.width-D[0])}};break;case"rot":this.calc=function(k,P){var D=k+this.parameters.p.x,V=P+this.parameters.p.y,Z=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(V-this.parameters.box.y-this.parameters.box.height/2,D-this.parameters.box.x-this.parameters.box.width/2),ue=this.parameters.rotation+180*(ce-Z)/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,P){var D=this.snapToGrid(k,P,this.parameters.pointCoords[0],this.parameters.pointCoords[1]),V=this.el.array().valueOf();V[this.parameters.i][0]=this.parameters.pointCoords[0]+D[0],V[this.parameters.i][1]=this.parameters.pointCoords[1]+D[1],this.el.plot(V)}}this.el.fire("resizestart",{dx:this.parameters.x,dy:this.parameters.y,event:m}),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()})},Ce.prototype.update=function(m){if(m){var p=this._extractPosition(m),N=this.transformPoint(p.x,p.y),A=N.x-this.parameters.p.x,k=N.y-this.parameters.p.y;this.lastUpdateCall=[A,k],this.calc(A,k),this.el.fire("resizing",{dx:A,dy:k,event:m})}else this.lastUpdateCall&&this.calc(this.lastUpdateCall[0],this.lastUpdateCall[1])},Ce.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")},Ce.prototype.snapToGrid=function(m,p,N,A){var k;return A!==void 0?k=[(N+m)%this.options.snapToGrid,(A+p)%this.options.snapToGrid]:(N=N??3,k=[(this.parameters.box.x+m+(1&N?0:this.parameters.box.width))%this.options.snapToGrid,(this.parameters.box.y+p+(2&N?0:this.parameters.box.height))%this.options.snapToGrid]),m<0&&(k[0]-=this.options.snapToGrid),p<0&&(k[1]-=this.options.snapToGrid),m-=Math.abs(k[0])<this.options.snapToGrid/2?k[0]:k[0]-(m<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(m,p,N,A)},Ce.prototype.constraintToBox=function(m,p,N,A){var k,P,D=this.options.constraint||{};return A!==void 0?(k=N,P=A):(k=this.parameters.box.x+(1&N?0:this.parameters.box.width),P=this.parameters.box.y+(2&N?0:this.parameters.box.height)),D.minX!==void 0&&k+m<D.minX&&(m=D.minX-k),D.maxX!==void 0&&k+m>D.maxX&&(m=D.maxX-k),D.minY!==void 0&&P+p<D.minY&&(p=D.minY-P),D.maxY!==void 0&&P+p>D.maxY&&(p=D.maxY-P),[m,p]},Ce.prototype.checkAspectRatio=function(m,p){if(!this.options.saveAspectRatio)return m;var N=m.slice(),A=this.parameters.box.width/this.parameters.box.height,k=this.parameters.box.width+m[0],P=this.parameters.box.height-m[1],D=k/P;return D<A?(N[1]=k/A-this.parameters.box.height,p&&(N[1]=-N[1])):D>A&&(N[0]=this.parameters.box.width-P*A,p&&(N[0]=-N[0])),N},SVG.extend(SVG.Element,{resize:function(m){return(this.remember("_resizeHandler")||new Ce(this)).init(m||{}),this}}),SVG.Element.prototype.resize.defaults={snapToAngle:.1,snapToGrid:1,constraint:{},saveAspectRatio:!1}}).call(this)}(),window.Apex===void 0&&(window.Apex={});var Wt=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{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 Kt(this.ctx),this.ctx.core=new mn(this.ctx.el,this.ctx),this.ctx.config=new Se({}),this.ctx.data=new Qe(this.ctx),this.ctx.grid=new st(this.ctx),this.ctx.graphics=new U(this.ctx),this.ctx.coreUtils=new Y(this.ctx),this.ctx.crosshairs=new jt(this.ctx),this.ctx.events=new vt(this.ctx),this.ctx.exports=new Ye(this.ctx),this.ctx.fill=new be(this.ctx),this.ctx.localization=new yt(this.ctx),this.ctx.options=new K,this.ctx.responsive=new un(this.ctx),this.ctx.series=new Re(this.ctx),this.ctx.theme=new vn(this.ctx),this.ctx.formatters=new te(this.ctx),this.ctx.titleSubtitle=new Hn(this.ctx),this.ctx.legend=new wn(this.ctx),this.ctx.toolbar=new Jt(this.ctx),this.ctx.tooltip=new Ht(this.ctx),this.ctx.dimensions=new nt(this.ctx),this.ctx.updateHelpers=new gt(this.ctx),this.ctx.zoomPanSelection=new Vt(this.ctx),this.ctx.w.globals.tooltip=new Ht(this.ctx)}}]),Ce}(),jn=function(){function Ce(m){s(this,Ce),this.ctx=m,this.w=m.w}return o(Ce,[{key:"clear",value:function(m){var p=m.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(m){m.each(function(){this.removeClass("*"),this.off(),this.stop()},!0),m.ungroup(),m.clear()}},{key:"clearDomElements",value:function(m){var p=this,N=m.isUpdating,A=this.w.globals.dom.Paper.node;A.parentNode&&A.parentNode.parentNode&&!N&&(A.parentNode.parentNode.style.minHeight="unset");var k=this.w.globals.dom.baseEl;k&&this.ctx.eventList.forEach(function(D){k.removeEventListener(D,p.ctx.events.documentEvent)});var P=this.w.globals.dom;if(this.ctx.el!==null)for(;this.ctx.el.firstChild;)this.ctx.el.removeChild(this.ctx.el.firstChild);this.killSVG(P.Paper),P.Paper.remove(),P.elWrap=null,P.elGraphical=null,P.elLegendWrap=null,P.elLegendForeign=null,P.baseEl=null,P.elGridRect=null,P.elGridRectMask=null,P.elGridRectBarMask=null,P.elGridRectMarkerMask=null,P.elForecastMask=null,P.elNonForecastMask=null,P.elDefs=null}}]),Ce}(),kt=new WeakMap,cn=function(){function Ce(m,p){s(this,Ce),this.opts=p,this.ctx=this,this.w=new ve(p).init(),this.el=m,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 Wt(this).initModules(),this.create=F.bind(this.create,this),this.windowResizeHandler=this._windowResizeHandler.bind(this),this.parentResizeHandler=this._parentResizeCallback.bind(this)}return o(Ce,[{key:"render",value:function(){var m=this;return new Promise(function(p,N){if(m.el!==null){Apex._chartInstances===void 0&&(Apex._chartInstances=[]),m.w.config.chart.id&&Apex._chartInstances.push({id:m.w.globals.chartID,group:m.w.config.chart.group,chart:m}),m.setLocale(m.w.config.chart.defaultLocale);var A=m.w.config.chart.events.beforeMount;typeof A=="function"&&A(m,m.w),m.events.fireEvent("beforeMount",[m,m.w]),window.addEventListener("resize",m.windowResizeHandler),function(me,Ne){var Ie=!1;if(me.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){var Le=me.getBoundingClientRect();me.style.display!=="none"&&Le.width!==0||(Ie=!0)}var Xe=new ResizeObserver(function(Oe){Ie&&Ne.call(me,Oe),Ie=!0});me.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Array.from(me.children).forEach(function(Oe){return Xe.observe(Oe)}):Xe.observe(me),kt.set(Ne,Xe)}(m.el.parentNode,m.parentResizeHandler);var k=m.el.getRootNode&&m.el.getRootNode(),P=F.is("ShadowRoot",k),D=m.el.ownerDocument,V=P?k.getElementById("apexcharts-css"):D.getElementById("apexcharts-css");if(!V){var Z;(V=document.createElement("style")).id="apexcharts-css",V.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=((Z=m.opts.chart)===null||Z===void 0?void 0:Z.nonce)||m.w.config.chart.nonce;ce&&V.setAttribute("nonce",ce),P?k.prepend(V):D.head.appendChild(V)}var ue=m.create(m.w.config.series,{});if(!ue)return p(m);m.mount(ue).then(function(){typeof m.w.config.chart.events.mounted=="function"&&m.w.config.chart.events.mounted(m,m.w),m.events.fireEvent("mounted",[m,m.w]),p(ue)}).catch(function(me){N(me)})}else N(new Error("Element not found"))})}},{key:"create",value:function(m,p){var N=this,A=this.w;new Wt(this).initModules();var k=this.w.globals;if(k.noData=!1,k.animationEnded=!1,this.responsive.checkResponsiveConfig(p),A.config.xaxis.convertedCatToNumeric&&new pe(A.config).convertCatToNumericXaxis(A.config,this.ctx),this.el===null||(this.core.setupElements(),A.config.chart.type==="treemap"&&(A.config.grid.show=!1,A.config.yaxis[0].show=!1),k.svgWidth===0))return k.animationEnded=!0,null;var P=m;m.forEach(function(me,Ne){me.hidden&&(P=N.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:Ne}))});var D=Y.checkComboSeries(P,A.config.chart.type);k.comboCharts=D.comboCharts,k.comboBarCount=D.comboBarCount;var V=P.every(function(me){return me.data&&me.data.length===0});(P.length===0||V&&k.collapsedSeries.length<1)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(P),this.theme.init(),new we(this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),k.noData&&k.collapsedSeries.length!==k.series.length&&!A.config.legend.showForSingleSeries||this.legend.init(),this.series.hasAllSeriesEqualX(),k.axisCharts&&(this.core.coreCalculations(),A.config.xaxis.type!=="category"&&this.formatters.setLabelFormatters(),this.ctx.toolbar.minX=A.globals.minX,this.ctx.toolbar.maxX=A.globals.maxX),this.formatters.heatmapLabelFormatters(),new Y(this).getLargestMarkerSize(),this.dimensions.plotCoords();var Z=this.core.xySettings();this.grid.createGridMask();var ce=this.core.plotChartType(P,Z),ue=new Fe(this);return ue.bringForward(),A.config.dataLabels.background.enabled&&ue.dataLabelsBackground(),this.core.shiftGraphPosition(),{elGraph:ce,xyRatios:Z,dimensions:{plot:{left:A.globals.translateX,top:A.globals.translateY,width:A.globals.gridWidth,height:A.globals.gridHeight}}}}},{key:"mount",value:function(){var m=this,p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,N=this,A=N.w;return new Promise(function(k,P){if(N.el===null)return P(new Error("Not enough data to display or target element not found"));(p===null||A.globals.allSeriesCollapsed)&&N.series.handleNoData(),N.grid=new st(N);var D,V,Z=N.grid.drawGrid();if(N.annotations=new H(N),N.annotations.drawImageAnnos(),N.annotations.drawTextAnnos(),A.config.grid.position==="back"&&(Z&&A.globals.dom.elGraphical.add(Z.el),Z!=null&&(D=Z.elGridBorders)!==null&&D!==void 0&&D.node&&A.globals.dom.elGraphical.add(Z.elGridBorders)),Array.isArray(p.elGraph))for(var ce=0;ce<p.elGraph.length;ce++)A.globals.dom.elGraphical.add(p.elGraph[ce]);else A.globals.dom.elGraphical.add(p.elGraph);A.config.grid.position==="front"&&(Z&&A.globals.dom.elGraphical.add(Z.el),Z!=null&&(V=Z.elGridBorders)!==null&&V!==void 0&&V.node&&A.globals.dom.elGraphical.add(Z.elGridBorders)),A.config.xaxis.crosshairs.position==="front"&&N.crosshairs.drawXCrosshairs(),A.config.yaxis[0].crosshairs.position==="front"&&N.crosshairs.drawYCrosshairs(),A.config.chart.type!=="treemap"&&N.axes.drawAxis(A.config.chart.type,Z);var ue=new dt(m.ctx,Z),me=new qe(m.ctx,Z);if(Z!==null&&(ue.xAxisLabelCorrections(Z.xAxisTickWidth),me.setYAxisTextAlignments(),A.config.yaxis.map(function(Ie,Le){A.globals.ignoreYAxisIndexes.indexOf(Le)===-1&&me.yAxisTitleRotate(Le,Ie.opposite)})),N.annotations.drawAxesAnnotations(),!A.globals.noData){if(A.config.tooltip.enabled&&!A.globals.noData&&N.w.globals.tooltip.drawTooltip(p.xyRatios),A.globals.axisCharts&&(A.globals.isXNumeric||A.config.xaxis.convertedCatToNumeric||A.globals.isRangeBar))(A.config.chart.zoom.enabled||A.config.chart.selection&&A.config.chart.selection.enabled||A.config.chart.pan&&A.config.chart.pan.enabled)&&N.zoomPanSelection.init({xyRatios:p.xyRatios});else{var Ne=A.config.chart.toolbar.tools;["zoom","zoomin","zoomout","selection","pan","reset"].forEach(function(Ie){Ne[Ie]=!1})}A.config.chart.toolbar.show&&!A.globals.allSeriesCollapsed&&N.toolbar.createToolbar()}A.globals.memory.methodsToExec.length>0&&A.globals.memory.methodsToExec.forEach(function(Ie){Ie.method(Ie.params,!1,Ie.context)}),A.globals.axisCharts||A.globals.noData||N.core.resizeNonAxisCharts(),k(N)})}},{key:"destroy",value:function(){var m,p;window.removeEventListener("resize",this.windowResizeHandler),this.el.parentNode,m=this.parentResizeHandler,(p=kt.get(m))&&(p.disconnect(),kt.delete(m));var N=this.w.config.chart.id;N&&Apex._chartInstances.forEach(function(A,k){A.id===F.escapeString(N)&&Apex._chartInstances.splice(k,1)}),new jn(this.ctx).clear({isUpdating:!1})}},{key:"updateOptions",value:function(m){var p=this,N=arguments.length>1&&arguments[1]!==void 0&&arguments[1],A=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],k=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],P=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],D=this.w;return D.globals.selection=void 0,m.series&&(this.series.resetSeries(!1,!0,!1),m.series.length&&m.series[0].data&&(m.series=m.series.map(function(V,Z){return p.updateHelpers._extendSeries(V,Z)})),this.updateHelpers.revertDefaultAxisMinMax()),m.xaxis&&(m=this.updateHelpers.forceXAxisUpdate(m)),m.yaxis&&(m=this.updateHelpers.forceYAxisUpdate(m)),D.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),m.theme&&(m=this.theme.updateThemeOptions(m)),this.updateHelpers._updateOptions(m,N,A,k,P)}},{key:"updateSeries",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],N=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(m,p,N)}},{key:"appendSeries",value:function(m){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],N=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],A=this.w.config.series.slice();return A.push(m),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(A,p,N)}},{key:"appendData",value:function(m){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],N=this;N.w.globals.dataChanged=!0,N.series.getPreviousPaths();for(var A=N.w.config.series.slice(),k=0;k<A.length;k++)if(m[k]!==null&&m[k]!==void 0)for(var P=0;P<m[k].data.length;P++)A[k].data.push(m[k].data[P]);return N.w.config.series=A,p&&(N.w.globals.initialSeries=F.clone(N.w.config.series)),this.update()}},{key:"update",value:function(m){var p=this;return new Promise(function(N,A){new jn(p.ctx).clear({isUpdating:!0});var k=p.create(p.w.config.series,m);if(!k)return N(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,N(p)}).catch(function(P){A(P)})})}},{key:"getSyncedCharts",value:function(){var m=this.getGroupedCharts(),p=[this];return m.length&&(p=[],m.forEach(function(N){p.push(N)})),p}},{key:"getGroupedCharts",value:function(){var m=this;return Apex._chartInstances.filter(function(p){if(p.group)return!0}).map(function(p){return m.w.config.chart.group===p.group?p.chart:m})}},{key:"toggleSeries",value:function(m){return this.series.toggleSeries(m)}},{key:"highlightSeriesOnLegendHover",value:function(m,p){return this.series.toggleSeriesOnHover(m,p)}},{key:"showSeries",value:function(m){this.series.showSeries(m)}},{key:"hideSeries",value:function(m){this.series.hideSeries(m)}},{key:"highlightSeries",value:function(m){this.series.highlightSeries(m)}},{key:"isSeriesHidden",value:function(m){this.series.isSeriesHidden(m)}},{key:"resetSeries",value:function(){var m=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.series.resetSeries(m,p)}},{key:"addEventListener",value:function(m,p){this.events.addEventListener(m,p)}},{key:"removeEventListener",value:function(m,p){this.events.removeEventListener(m,p)}},{key:"addXaxisAnnotation",value:function(m){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,A=this;N&&(A=N),A.annotations.addXaxisAnnotationExternal(m,p,A)}},{key:"addYaxisAnnotation",value:function(m){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,A=this;N&&(A=N),A.annotations.addYaxisAnnotationExternal(m,p,A)}},{key:"addPointAnnotation",value:function(m){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,A=this;N&&(A=N),A.annotations.addPointAnnotationExternal(m,p,A)}},{key:"clearAnnotations",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,p=this;m&&(p=m),p.annotations.clearAnnotations(p)}},{key:"removeAnnotation",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,N=this;p&&(N=p),N.annotations.removeAnnotation(N,m)}},{key:"getChartArea",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner")}},{key:"getSeriesTotalXRange",value:function(m,p){return this.coreUtils.getSeriesTotalsXRange(m,p)}},{key:"getHighestValueInSeries",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new He(this.ctx).getMinYMaxY(m).highestY}},{key:"getLowestValueInSeries",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new He(this.ctx).getMinYMaxY(m).lowestY}},{key:"getSeriesTotal",value:function(){return this.w.globals.seriesTotals}},{key:"toggleDataPointSelection",value:function(m,p){return this.updateHelpers.toggleDataPointSelection(m,p)}},{key:"zoomX",value:function(m,p){this.ctx.toolbar.zoomUpdateOptions(m,p)}},{key:"setLocale",value:function(m){this.localization.setCurrentLocaleValues(m)}},{key:"dataURI",value:function(m){return new Ye(this.ctx).dataURI(m)}},{key:"exportToCSV",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Ye(this.ctx).exportToCSV(m)}},{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 m=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout(function(){m.w.globals.resized=!0,m.w.globals.dataChanged=!1,m.ctx.update()},150)}},{key:"_windowResizeHandler",value:function(){var m=this.w.config.chart.redrawOnWindowResize;typeof m=="function"&&(m=m()),m&&this._windowResize()}}],[{key:"getChartByID",value:function(m){var p=F.escapeString(m);if(Apex._chartInstances){var N=Apex._chartInstances.filter(function(A){return A.id===p})[0];return N&&N.chart}}},{key:"initOnLoad",value:function(){for(var m=document.querySelectorAll("[data-apexcharts]"),p=0;p<m.length;p++)new Ce(m[p],JSON.parse(m[p].getAttribute("data-options"))).render()}},{key:"exec",value:function(m,p){var N=this.getChartByID(m);if(N){N.w.globals.isExecCalled=!0;var A=null;if(N.publicMethods.indexOf(p)!==-1){for(var k=arguments.length,P=new Array(k>2?k-2:0),D=2;D<k;D++)P[D-2]=arguments[D];A=N[p].apply(N,P)}return A}}},{key:"merge",value:function(m,p){return F.extend(m,p)}}]),Ce}();t.exports=cn}(MF,MF.exports)),MF.exports}var dNe;function Cln(){if(dNe)return OF;dNe=1,Object.defineProperty(OF,"__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 S=1;S<arguments.length;S++){var T,I=arguments[S];for(T in I)Object.prototype.hasOwnProperty.call(I,T)&&(C[T]=I[T])}return C},n=function(){function C(S,T){for(var I=0;I<T.length;I++){var L=T[I];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(S,L.key,L)}}return function(S,T,I){return T&&C(S.prototype,T),I&&C(S,I),S}}(),r=wln(),s=u(r),a=bx(),o=u(a),l=zU(),c=u(l);function u(C){return C&&C.__esModule?C:{default:C}}function d(C,S,T){return S in C?Object.defineProperty(C,S,{value:T,enumerable:!0,configurable:!0,writable:!0}):C[S]=T,C}function f(C,S){var T,I={};for(T in C)0<=S.indexOf(T)||Object.prototype.hasOwnProperty.call(C,T)&&(I[T]=C[T]);return I}function x(C,S){if(!(C instanceof S))throw new TypeError("Cannot call a class as a function")}function g(C,S){if(C)return!S||typeof S!="object"&&typeof S!="function"?C:S;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function y(C,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);C.prototype=Object.create(S&&S.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(C,S):C.__proto__=S)}window.ApexCharts=s.default;var v=function(){function C(S){x(this,C);var T=g(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,S));return o.default.createRef?T.chartRef=o.default.createRef():T.setRef=function(I){return T.chartRef=I},T.chart=null,T}return y(C,a.Component),n(C,[{key:"render",value:function(){var S=f(this.props,[]);return o.default.createElement("div",e({ref:o.default.createRef?this.chartRef:this.setRef},S))}},{key:"componentDidMount",value:function(){var S=o.default.createRef?this.chartRef.current:this.chartRef;this.chart=new s.default(S,this.getConfig()),this.chart.render()}},{key:"getConfig",value:function(){var F=this.props,S=F.type,T=F.height,I=F.width,L=F.series,F=F.options;return this.extend(F,{chart:{type:S,height:T,width:I},series:L})}},{key:"isObject",value:function(S){return S&&(S===void 0?"undefined":t(S))==="object"&&!Array.isArray(S)&&S!=null}},{key:"extend",value:function(S,T){var I=this,L=(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),O=1;O<arguments.length;O++){var U=arguments[O];if(U!=null)for(var Y in U)U.hasOwnProperty(Y)&&($[Y]=U[Y])}return $}),Object.assign({},S));return this.isObject(S)&&this.isObject(T)&&Object.keys(T).forEach(function(F){I.isObject(T[F])&&F in S?L[F]=I.extend(S[F],T[F]):Object.assign(L,d({},F,T[F]))}),L}},{key:"componentDidUpdate",value:function(S){if(!this.chart)return null;var L=this.props,O=L.options,T=L.series,I=L.height,L=L.width,F=JSON.stringify(S.options),$=JSON.stringify(S.series),O=JSON.stringify(O),U=JSON.stringify(T);F===O&&$===U&&I===S.height&&L===S.width||($!==U&&F===O&&I===S.height&&L===S.width?this.chart.updateSeries(T):this.chart.updateOptions(this.getConfig()))}},{key:"componentWillUnmount",value:function(){this.chart&&typeof this.chart.destroy=="function"&&this.chart.destroy()}}]),C}();return(OF.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"},OF}var Nln=Cln();const eB=Pi(Nln),Sln=()=>{const[t,e]=h.useState([]),[n,r]=h.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]=h.useState("pnlHistory"),[o,l]=h.useState("perp only"),c=v2(),u=(c==null?void 0:c.walletAddress)||"",d=n==="day",{setLatestPnL:f}=h.useContext(Qr);h.useEffect(()=>{const y=async()=>{var S,T,I,L,F,$,O,U,Y,re,Q,q,te,fe,G,ie,oe,K,H,ee,se,pe,Se;const C=o==="combined"?n:`perp${n.charAt(0).toUpperCase()+n.slice(1)}`;try{const ve=(await Ns.post("https://api-ui.hyperliquid.xyz/info",{type:"portfolio",user:u},{headers:{Accept:"*/*","Content-Type":"application/json"}})).data,we=Date.now()-90*24*60*60*1e3,je=(Ut,wn=!1)=>{const Jt=(Ut==null?void 0:Ut.filter(([Vt])=>Number(Vt)>=we))||[];if(wn&&Jt.length>0){const Vt=parseFloat(Jt[0][1]);return Jt.map(([xt,We])=>[xt,(parseFloat(We)-Vt).toString()])}return Jt},Fe=ve.find(Ut=>Ut[0]==="allTime"),Re=ve.find(Ut=>Ut[0]==="perpAllTime"),Qe={accountValueHistory:je((S=Fe==null?void 0:Fe[1])==null?void 0:S.accountValueHistory,!1),pnlHistory:je((T=Fe==null?void 0:Fe[1])==null?void 0:T.pnlHistory,!0),vlm:(I=Fe==null?void 0:Fe[1])==null?void 0:I.vlm},Ye={accountValueHistory:je((L=Re==null?void 0:Re[1])==null?void 0:L.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=[...ve,["threeMonth",Qe],["perpThreeMonth",Ye]],st=((U=(O=dt.find(Ut=>Ut[0]===C))==null?void 0:O[1])==null?void 0:U[s])||[];e(st);const at=o==="combined"?"day":"perpDay",He=o==="combined"?"week":"perpWeek",qe=o==="combined"?"month":"perpMonth",vt=o==="combined"?"allTime":"perpAllTime",yt=o==="combined"?"threeMonth":"perpThreeMonth",Kt=((re=(Y=dt.find(Ut=>Ut[0]===at))==null?void 0:Y[1])==null?void 0:re.pnlHistory)||[],jt=((q=(Q=dt.find(Ut=>Ut[0]===He))==null?void 0:Q[1])==null?void 0:q.pnlHistory)||[],un=((fe=(te=dt.find(Ut=>Ut[0]===qe))==null?void 0:te[1])==null?void 0:fe.pnlHistory)||[],vn=((ie=(G=dt.find(Ut=>Ut[0]===vt))==null?void 0:G[1])==null?void 0:ie.pnlHistory)||[],Hn=((K=(oe=dt.find(Ut=>Ut[0]===yt))==null?void 0:oe[1])==null?void 0:K.pnlHistory)||[],ln=((H=Kt[Kt.length-1])==null?void 0:H[1])??0,Nn=((ee=jt[jt.length-1])==null?void 0:ee[1])??0,dn=((se=un[un.length-1])==null?void 0:se[1])??0,rt=((pe=Hn[Hn.length-1])==null?void 0:pe[1])??0,nt=((Se=vn[vn.length-1])==null?void 0:Se[1])??0;f({activeRange:n,day:ln,week:Nn,month:dn,threeMonth:rt,all:nt})}catch(ge){console.error("Error fetching data:",ge)}};y();const v=setInterval(y,3e4);return()=>clearInterval(v)},[n,s,o,u]);const x=h.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=>`$${Ir(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 S=`'${C.getFullYear().toString().slice(-2)}`;return`${C.toLocaleDateString("en-US",{month:"short",day:"2-digit"}).toUpperCase()} ${S}`}}},tooltip:{custom:function({series:y,seriesIndex:v,dataPointIndex:C,w:S}){var $,O;const T=y[v][C],I=(O=($=S.globals.seriesX)==null?void 0:$[v])==null?void 0:O[C],L=S.globals.seriesNames[v];return`
<div class="p-2 rounded-2xl">
<p class="text-[12px] font-medium text-[#909090]">${I?new Date(I).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">${L}</span>
<span>$${Ir(T)}</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(eB,{options:x,series:g,type:"area",height:410})]})]})};var ig={},_7={},fNe;function qVe(){if(fNe)return _7;fNe=1,Object.defineProperty(_7,"__esModule",{value:!0}),_7.parseLengthAndUnit=e,_7.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 _7}var E7={},hNe;function GVe(){if(hNe)return E7;hNe=1,Object.defineProperty(E7,"__esModule",{value:!0}),E7.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 E7.createAnimation=t,E7}var pNe;function jln(){if(pNe)return ig;pNe=1;var t=ig.__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=ig.__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=ig.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=ig.__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=ig.__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(ig,"__esModule",{value:!0});var a=r(bx()),o=qVe(),l=GVe(),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,S=d.cssOverride,T=S===void 0?{}:S,I=d.size,L=I===void 0?35:I,F=s(d,["loading","color","speedMultiplier","cssOverride","size"]),$=t({background:"transparent !important",width:(0,o.cssValue)(L),height:(0,o.cssValue)(L),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"},T);return x?a.createElement("span",t({style:$},F)):null}return ig.default=u,ig}var Aln=jln();const p2=Pi(Aln),Hg=t=>Number(t).toLocaleString("en-US",{maximumFractionDigits:2}),x_=t=>!isFinite(t)||isNaN(t)?"-":`${Math.floor(t)}h ${Math.round((t-Math.floor(t))*60)}m`,Ede=({className:t="h-5"})=>i.jsx("div",{className:`w-full bg-gray-700/40 rounded animate-pulse ${t}`}),_ln=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 Eln({trades:t}){const[e,n]=h.useState(!1),r=h.useMemo(()=>t?_ln(t):null,[t]),s=h.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(p2,{color:"#fff",size:20})]}),i.jsxs("div",{className:"mb-4 text-xs text-white",children:[o," – ",l]}),!a&&(!r||r.totalTrades===0)?i.jsx(kln,{}):i.jsx(Tln,{stats:r,maxCoinPnl:s,loading:a})]})]})}function kln(){return i.jsxs("div",{className:"w-full h-[60vh] flex flex-col items-center justify-center text-white text-sm",children:[i.jsx(JNt,{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 Tln({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(k7,{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:["$",Hg(t.totalPnL-t.totalFees)]}),i.jsx(Tb,{label:"Gross:",value:`$${Hg(t.grossPnL+t.totalFees)}`}),i.jsx(Tb,{label:"Fees:",value:`$${Hg(t.totalFees)}`,red:!0})]})}),i.jsx(k7,{title:"Position Split",loading:n,children:t&&i.jsxs(i.Fragment,{children:[i.jsx(Tb,{label:"Long PnL",value:`$${Hg(Math.abs(t.longPnL))}`,green:!0}),i.jsx(Tb,{label:"Short PnL",value:`$${Hg(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(k7,{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(Tb,{label:"Winning:",value:t.wins}),i.jsx(Tb,{label:"Total:",value:t.totalTrades})]})}),i.jsx(k7,{title:"Trade Duration",loading:n,children:t&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-xl font-semibold text-white",children:x_(t.avgDur)}),i.jsx(Tb,{label:"Range:",value:`${x_(t.minDur)} – ${x_(t.maxDur)}`}),i.jsx(Tb,{label:"Median:",value:x_(t.medianDur)})]})})]}),i.jsx(Iln,{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(Fln,{stats:t,loading:n,maxCoinPnl:e}),i.jsx(k7,{title:"Liquidations",loading:n,children:t&&t.liquidations.length>0?i.jsx(Pln,{data:t.liquidations}):i.jsx("p",{className:"text-white text-lg text-center font-bold",children:"No liquidations"})})]})]})}function k7({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(Ede,{className:"h-10"}):n]})}function Pln({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:["$",Hg(Math.abs(e.totalPnL))]}),i.jsx("td",{className:"py-1 text-right",children:e.count})]},e.coin))})]})})}function Tb({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 Iln({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(Ede,{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:["$",Hg(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: ",x_(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 Fln({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(Ede,{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:["$",Hg(Math.abs(r.pnl))]})]}),i.jsxs("div",{className:"text-[11px] text-white font-semibold",children:["Fees: $",Hg(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",hse=2e3,YVe=365*24*60*60*1e3*2;async function XVe(t,e){const{data:n}=await Ns.post(KVe,{type:"userFillsByTime",user:t,startTime:e,aggregateByTime:!0},{headers:{"Content-Type":"application/json"},timeout:1e4});return n}async function kde(t){let e=Date.now()-YVe;const n=[],r=new Set;for(;;){const s=await XVe(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<hse)break;e=Math.max(...s.map(a=>a.time))+1}return n.sort((s,a)=>s.time-a.time)}async function Tde(t){const{data:e}=await Ns.post(KVe,{type:"userTwapSliceFills",user:t},{headers:{"Content-Type":"application/json"},timeout:1e4});return e}async function Oln(t,e){let n=Date.now()-YVe;const r=[],s=new Set;let a=0;for(;;){const c=await XVe(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>=hse,fills:r.slice(0,10),isComplete:!1}),c.length<hse)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 mNe(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 Pde(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"),S=o.includes(">"),T=!!s.liquidation;if(v){if(mNe(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 I=n[a]??(n[a]={}),L=(I.total_size||0)+l;I.oids=(I.oids||[]).concat(s.oid),I.entry_price_wma=((I.entry_price_wma||0)*(I.total_size||0)+c*l)/L,I.total_size=L,I.last_fill_time=g,I.transaction_count=(I.transaction_count||0)+1,I.total_fee=(I.total_fee||0)+f,I.has_builder_fee=I.has_builder_fee||d!==0,I.builder_fee=(I.builder_fee||0)+d,I.twapId=y}continue}if(S){const I=n[a];I&&(I.close_size+=l,I.total_pnl+=x,I.total_fee+=f,I.last_fill_time=g,I.close_px=c,I.transaction_count++,I.oids.push(s.oid),I.has_builder_fee=I.has_builder_fee||d!==0,I.builder_fee=(I.builder_fee||0)+d,I.twapId=y,I.isClosed=!0,I.close_time=g,I.duration_hours=(g-I.open_time)/36e5,e.push(I),delete n[a]);const L=Math.max(Math.abs(l)-Math.abs(u),0);L>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,isLiquidated:!1,oids:[s.oid],has_builder_fee:d!==0,builder_fee:d,twapId:y});continue}if(C||T){const I=n[a];if(!I)continue;I.close_size+=l,I.total_pnl+=x,I.total_fee+=f,I.last_fill_time=g,I.close_px=c,I.transaction_count++,I.oids.push(s.oid),I.has_builder_fee=I.has_builder_fee||d!==0,I.builder_fee=(I.builder_fee||0)+d,I.twapId=y,T&&(I.isLiquidated=!0,I.liquidation_px_sum=(I.liquidation_px_sum||0)+c,I.liquidationCount=(I.liquidationCount||0)+1),mNe(Math.abs(l),Math.abs(u),1e-6)&&(I.isClosed=!0,I.close_time=g,I.duration_hours=(g-I.open_time)/36e5,e.push(I),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 xd=({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 cP({open:t,setOpen:e,data:n,setTradeInfo:r,pnlTitle:s="UNREALIZED PNL",showPnl:a=!0}){const o=h.useRef(null),l=async()=>{if(o.current)try{await document.fonts.ready,await new Promise(C=>setTimeout(C,500));const y=await q1(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),fn.success("PNG successfully downloaded!")}catch(y){console.error("Error generating PNG:",y),fn.error("Failed to download PNG.")}},[c,u]=h.useState(),[d,f]=h.useState(!0),x=async y=>{f(!0);try{const C=await(await fetch(`https://api.cors.lol/?url=${encodeURIComponent(y)}`)).blob();return new Promise((S,T)=>{const I=new FileReader;I.onloadend=()=>S(I.result),I.onerror=T,I.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 h.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(Ha))},[n==null?void 0:n.coin]),i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),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:Yj,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||Ha,alt:"",className:"rounded-full w-8 h-8",loading:"lazy",onError:y=>Zi(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?"+":"-",mo(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?`$${mo(Math.abs(n==null?void 0:n.pnl).toFixed(2))}`:mo(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?`$${Ir(n==null?void 0:n.entryPrice)}`:Ir(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?`$${Ir(n==null?void 0:n.markPrice)}`:Ir(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:Gj,alt:"",className:"h-full"}):i.jsx("img",{src:Kj,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"),fn.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 Mln({open:t,setOpen:e,data:n,setTradeInfo:r}){var o,l;const s=h.useRef(null),a=async()=>{if(s.current)try{await document.fonts.ready,await new Promise(d=>setTimeout(d,500));const c=await q1(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),fn.success("PNG successfully downloaded!")}catch(c){console.error("Error generating PNG:",c),fn.error("Failed to download PNG.")}};return i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),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:Yj,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))?"":zs(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?`$${Ir(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:Gj,alt:"",className:"h-full"}):i.jsx("img",{src:Kj,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"),fn.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 Lln({open:t,setOpen:e,data:n,setShare:r,setTradeInfo:s}){var x;const a=h.useRef(null),o=async()=>{if(a.current)try{await document.fonts.ready,await new Promise(v=>setTimeout(v,500));const g=await q1(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),fn.success("PNG successfully downloaded!")}catch(g){console.error("Error generating PNG:",g),fn.error("Failed to download PNG.")}},[l,c]=h.useState(),[u,d]=h.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,S)=>{const T=new FileReader;T.onloadend=()=>C(T.result),T.onerror=S,T.readAsDataURL(v)})}catch(y){throw console.error("Image conversion failed:",y),y}finally{d(!1)}};return h.useEffect(()=>{n!=null&&n.coin&&f(`https://app.hyperliquid.xyz/coins/${n==null?void 0:n.coin}.svg`).then(g=>c(g)).catch(()=>c(Ha))},[n==null?void 0:n.coin]),i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),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:Yj,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||Ha,alt:"",className:"rounded-full w-8 h-8",loading:"lazy",onError:g=>Zi(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?"+":"-","$",mo(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?`$${Ey(n==null?void 0:n.entryPrice)}`:Ey(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?`$${Ey(n==null?void 0:n.markPrice)}`:Ey(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:Gj,alt:"",className:"h-full"}):i.jsx("img",{src:Kj,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"),fn.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 Rln=({wallet:t,wallets:e})=>{const[n,r]=h.useState([]),[s,a]=h.useState(!0),[o,l]=h.useState("oid"),[c,u]=h.useState(""),[d,f]=h.useState(!1),x=h.useRef(null),g=h.useRef(null),[y,v]=h.useState(!1),[C,S]=h.useState(null);h.useContext(Qr);const[T,I]=h.useState({key:null,direction:null});h.useEffect(()=>{function fe(G){g.current&&!g.current.contains(G.target)&&setIsDropdownOpen(!1),x.current&&!x.current.contains(G.target)&&f(!1)}return document.addEventListener("mousedown",fe),()=>document.removeEventListener("mousedown",fe)},[]);const L=fe=>`${fe.time}_${fe.coin}_${fe.dir}_${fe.px}_${fe.sz}`;h.useEffect(()=>{if(!e||e.length===0)return;const fe=e.map(ie=>ie.wallet_address.toLowerCase());if(fe.length===0)return;let G=!0;return(async()=>{try{const ie=(await Promise.all(fe.map(K=>Ns.post("https://api-ui.hyperliquid.xyz/info",{aggregateByTime:!0,type:"userFills",user:K})))).flatMap(K=>K.data??[]);if(!G)return;const oe=new Map;ie.forEach(K=>{const H=L(K);oe.has(H)||oe.set(H,K)}),r(Array.from(oe.values()).sort((K,H)=>H.time-K.time))}catch(ie){console.error("Multi-wallet trade fetch error:",ie)}finally{G&&a(!1)}})(),()=>{G=!1}},[e]),h.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=G=>{const ie=JSON.parse(G.data);ie&&ie.data&&Array.isArray(ie.data.fills)&&r(oe=>{const K=[...oe];return ie.data.fills.forEach(H=>{const ee=L(H);K.some(se=>L(se)===ee)||K.push(H)}),K.sort((H,ee)=>ee.time-H.time)})},()=>fe.close()},[]),h.useEffect(()=>{(async()=>{try{const G=await Ns.post("https://api-ui.hyperliquid.xyz/info",{aggregateByTime:!0,type:"userFills",user:t});r(G.data||[])}catch(G){console.error("Error fetching trade data:",G)}finally{a(!1)}})()},[t]);const F=fe=>{let G="asc";T.key===fe&&(T.direction==="asc"?G="desc":T.direction==="desc"&&(G=null)),I({key:fe,direction:G})};let $=[...n];c&&($=$.filter(fe=>String(fe.oid).includes(c)));const O=$.sort((fe,G)=>{if(!T.key||!T.direction)return 0;const ie=(H,ee)=>{switch(ee){case"sz":return parseFloat(H.sz);case"closedPnl":return parseFloat(H.closedPnl||0)-parseFloat(H.fee||0);case"fee":return parseFloat(H.fee);case"tradeValue":return parseFloat(H.px)*parseFloat(H.sz);default:return H[ee]}},oe=ie(fe,T.key),K=ie(G,T.key);return oe<K?T.direction==="asc"?-1:1:oe>K?T.direction==="asc"?1:-1:0}),U=fe=>{if(T.key===fe){if(T.direction==="asc")return i.jsx(o2,{className:"inline ml-2 text-white"});if(T.direction==="desc")return i.jsx(a2,{className:"inline ml-2 text-white"})}return i.jsx(l2,{className:"inline ml-2 text-white"})},re=localStorage.getItem("isDateTradeHistoryFormat")||"date",[Q,q]=h.useState(re);h.useEffect(()=>{localStorage.setItem("isDateTradeHistoryFormat",Q)},[Q]);function te({date:fe}){const[G,ie]=h.useState(vo(fe));return h.useEffect(()=>{const oe=setInterval(()=>{ie(vo(fe))},1e3);return()=>clearInterval(oe)},[fe]),i.jsx("span",{className:"text-white leading-[13px] tracking-[0.26px] text-[13px] font-semibold font-manrope",children:G.dateTime})}return i.jsxs("div",{className:"relative w-full text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx(Lln,{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 ",U("time")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("coin"),children:["Coin ",U("coin")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("dir"),children:["Direction ",U("dir")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("px"),children:["Price ",U("px")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("sz"),children:["Size ",U("sz")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("tradeValue"),children:["Trade Value ",U("tradeValue")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("fee"),children:["Fee (USDC) ",U("fee")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("closedPnl"),children:["Closed PNL ",U("closedPnl")]}),i.jsx("th",{children:i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx(hi,{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(xd,{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..."})}):O.map((fe,G)=>{var ie,oe;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:()=>{q(Q=="time"?"date":"time")},className:"text-left rounded-l-2xl cursor-pointer",children:Q=="time"?i.jsx(te,{date:fe.time}):$c(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]":(ie=fe.dir)!=null&&ie.includes("Short")?"text-[#ff6b6b]":(oe=fe.dir)!=null&&oe.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:Ir(parseFloat(fe.sz))}),i.jsxs("td",{className:"text-left",children:["$",Ir(parseFloat(fe.px)*parseFloat(fe.sz))]}),i.jsxs("td",{className:"text-left",children:[Ir(parseFloat(fe.fee)),fe.builderFee&&i.jsxs("span",{className:"text-xs",children:["(",Ir(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:["$",Ir(parseFloat(fe.closedPnl)-parseFloat(fe.fee))]}),i.jsx("td",{className:"rounded-r-2xl ",children:fe.oid})]},G)})})]})})]})};var g_={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 Dln=g_.exports,xNe;function Bln(){return xNe||(xNe=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,S=2,T=4,I=8,L=16,F=32,$=64,O=128,U=256,Y=512,re=30,Q="...",q=800,te=16,fe=1,G=2,ie=3,oe=1/0,K=9007199254740991,H=17976931348623157e292,ee=NaN,se=4294967295,pe=se-1,Se=se>>>1,ge=[["ary",O],["bind",C],["bindKey",S],["curry",I],["curryRight",L],["flip",Y],["partial",F],["partialRight",$],["rearg",U]],ve="[object Arguments]",be="[object Array]",we="[object AsyncFunction]",je="[object Boolean]",Fe="[object Date]",Re="[object DOMException]",Qe="[object Error]",Ye="[object Function]",dt="[object GeneratorFunction]",st="[object Map]",at="[object Number]",He="[object Null]",qe="[object Object]",vt="[object Promise]",yt="[object Proxy]",Kt="[object RegExp]",jt="[object Set]",un="[object String]",vn="[object Symbol]",Hn="[object Undefined]",ln="[object WeakMap]",Nn="[object WeakSet]",dn="[object ArrayBuffer]",rt="[object DataView]",nt="[object Float32Array]",Ut="[object Float64Array]",wn="[object Int8Array]",Jt="[object Int16Array]",Vt="[object Int32Array]",xt="[object Uint8Array]",We="[object Uint8ClampedArray]",Pt="[object Uint16Array]",Ke="[object Uint32Array]",ct=/\b__p \+= '';/g,Nt=/\b(__p \+=) '' \+/g,Ht=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Rt=/&(?:amp|lt|gt|quot|#39);/g,hn=/[&<>"']/g,yn=RegExp(Rt.source),Cn=RegExp(hn.source),En=/<%-([\s\S]+?)%>/g,Rn=/<%([\s\S]+?)%>/g,Mn=/<%=([\s\S]+?)%>/g,Yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Zn=/^\w*$/,Vn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tr=/[\\^$.*+?()[\]{}|]/g,Sn=RegExp(tr.source),ze=/^\s+/,xe=/\s/,Ge=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,_e=/\{\n\/\* \[wrapped with (.+)\] \*/,Be=/,? & /,qt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,It=/[()=,{}\[\]\/\s]/,mt=/\\(\\)?/g,Ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Tn=/\w*$/,kn=/^[-+]0x[0-9a-f]+$/i,Gt=/^0b[01]+$/i,mn=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,Wt=/^(?:0|[1-9]\d*)$/,jn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,kt=/($^)/,cn=/['\n\r\u2028\u2029\\]/g,Ce="\\ud800-\\udfff",m="\\u0300-\\u036f",p="\\ufe20-\\ufe2f",N="\\u20d0-\\u20ff",A=m+p+N,k="\\u2700-\\u27bf",P="a-z\\xdf-\\xf6\\xf8-\\xff",D="\\xac\\xb1\\xd7\\xf7",V="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Z="\\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",me="\\ufe0e\\ufe0f",Ne=D+V+Z+ce,Ie="['’]",Le="["+Ce+"]",Xe="["+Ne+"]",Oe="["+A+"]",$e="\\d+",ae="["+k+"]",he="["+P+"]",Pe="[^"+Ce+Ne+$e+k+P+ue+"]",Ve="\\ud83c[\\udffb-\\udfff]",Te="(?:"+Oe+"|"+Ve+")",Ze="[^"+Ce+"]",it="(?:\\ud83c[\\udde6-\\uddff]){2}",wt="[\\ud800-\\udbff][\\udc00-\\udfff]",Dt="["+ue+"]",Qt="\\u200d",xn="(?:"+he+"|"+Pe+")",pn="(?:"+Dt+"|"+Pe+")",An="(?:"+Ie+"(?:d|ll|m|re|s|t|ve))?",or="(?:"+Ie+"(?:D|LL|M|RE|S|T|VE))?",$t=Te+"?",bt="["+me+"]?",rn="(?:"+Qt+"(?:"+[Ze,it,wt].join("|")+")"+bt+$t+")*",ur="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",gr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",br=bt+$t+rn,Br="(?:"+[ae,it,wt].join("|")+")"+br,Gr="(?:"+[Ze+Oe+"?",Oe,it,wt,Le].join("|")+")",Or=RegExp(Ie,"g"),Lt=RegExp(Oe,"g"),nn=RegExp(Ve+"(?="+Ve+")|"+Gr+br,"g"),Ot=RegExp([Dt+"?"+he+"+"+An+"(?="+[Xe,Dt,"$"].join("|")+")",pn+"+"+or+"(?="+[Xe,Dt+xn,"$"].join("|")+")",Dt+"?"+xn+"+"+An,Dt+"+"+or,gr,ur,$e,Br].join("|"),"g"),en=RegExp("["+Qt+Ce+A+me+"]"),Fn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,yr=["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"],hr=-1,lt={};lt[nt]=lt[Ut]=lt[wn]=lt[Jt]=lt[Vt]=lt[xt]=lt[We]=lt[Pt]=lt[Ke]=!0,lt[ve]=lt[be]=lt[dn]=lt[je]=lt[rt]=lt[Fe]=lt[Qe]=lt[Ye]=lt[st]=lt[at]=lt[qe]=lt[Kt]=lt[jt]=lt[un]=lt[ln]=!1;var Ct={};Ct[ve]=Ct[be]=Ct[dn]=Ct[rt]=Ct[je]=Ct[Fe]=Ct[nt]=Ct[Ut]=Ct[wn]=Ct[Jt]=Ct[Vt]=Ct[st]=Ct[at]=Ct[qe]=Ct[Kt]=Ct[jt]=Ct[un]=Ct[vn]=Ct[xt]=Ct[We]=Ct[Pt]=Ct[Ke]=!0,Ct[Qe]=Ct[Ye]=Ct[ln]=!1;var On={À:"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"},qn={"&":"&","<":"<",">":">",'"':""","'":"'"},_r={"&":"&","<":"<",">":">",""":'"',"'":"'"},jr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Fr=parseFloat,nr=parseInt,vr=typeof Lu=="object"&&Lu&&Lu.Object===Object&&Lu,Yr=typeof self=="object"&&self&&self.Object===Object&&self,dr=vr||Yr||Function("return this")(),rs=e&&!e.nodeType&&e,gs=rs&&!0&&t&&!t.nodeType&&t,ms=gs&&gs.exports===rs,At=ms&&vr.process,pt=function(){try{var Tt=gs&&gs.require&&gs.require("util").types;return Tt||At&&At.binding&&At.binding("util")}catch{}}(),le=pt&&pt.isArrayBuffer,Me=pt&&pt.isDate,ft=pt&&pt.isMap,ut=pt&&pt.isRegExp,on=pt&&pt.isSet,bn=pt&&pt.isTypedArray;function Gn(Tt,Zt,sn){switch(sn.length){case 0:return Tt.call(Zt);case 1:return Tt.call(Zt,sn[0]);case 2:return Tt.call(Zt,sn[0],sn[1]);case 3:return Tt.call(Zt,sn[0],sn[1],sn[2])}return Tt.apply(Zt,sn)}function rr(Tt,Zt,sn,$n){for(var Cr=-1,kr=Tt==null?0:Tt.length;++Cr<kr;){var Pr=Tt[Cr];Zt($n,Pr,sn(Pr),Tt)}return $n}function Jn(Tt,Zt){for(var sn=-1,$n=Tt==null?0:Tt.length;++sn<$n&&Zt(Tt[sn],sn,Tt)!==!1;);return Tt}function Xn(Tt,Zt){for(var sn=Tt==null?0:Tt.length;sn--&&Zt(Tt[sn],sn,Tt)!==!1;);return Tt}function Zr(Tt,Zt){for(var sn=-1,$n=Tt==null?0:Tt.length;++sn<$n;)if(!Zt(Tt[sn],sn,Tt))return!1;return!0}function $r(Tt,Zt){for(var sn=-1,$n=Tt==null?0:Tt.length,Cr=0,kr=[];++sn<$n;){var Pr=Tt[sn];Zt(Pr,sn,Tt)&&(kr[Cr++]=Pr)}return kr}function wr(Tt,Zt){var sn=Tt==null?0:Tt.length;return!!sn&&sr(Tt,Zt,0)>-1}function pr(Tt,Zt,sn){for(var $n=-1,Cr=Tt==null?0:Tt.length;++$n<Cr;)if(sn(Zt,Tt[$n]))return!0;return!1}function ar(Tt,Zt){for(var sn=-1,$n=Tt==null?0:Tt.length,Cr=Array($n);++sn<$n;)Cr[sn]=Zt(Tt[sn],sn,Tt);return Cr}function Vr(Tt,Zt){for(var sn=-1,$n=Zt.length,Cr=Tt.length;++sn<$n;)Tt[Cr+sn]=Zt[sn];return Tt}function Ur(Tt,Zt,sn,$n){var Cr=-1,kr=Tt==null?0:Tt.length;for($n&&kr&&(sn=Tt[++Cr]);++Cr<kr;)sn=Zt(sn,Tt[Cr],Cr,Tt);return sn}function bs(Tt,Zt,sn,$n){var Cr=Tt==null?0:Tt.length;for($n&&Cr&&(sn=Tt[--Cr]);Cr--;)sn=Zt(sn,Tt[Cr],Cr,Tt);return sn}function Sr(Tt,Zt){for(var sn=-1,$n=Tt==null?0:Tt.length;++sn<$n;)if(Zt(Tt[sn],sn,Tt))return!0;return!1}var Pn=ys("length");function Ln(Tt){return Tt.split("")}function ht(Tt){return Tt.match(qt)||[]}function Yt(Tt,Zt,sn){var $n;return sn(Tt,function(Cr,kr,Pr){if(Zt(Cr,kr,Pr))return $n=kr,!1}),$n}function lr(Tt,Zt,sn,$n){for(var Cr=Tt.length,kr=sn+($n?1:-1);$n?kr--:++kr<Cr;)if(Zt(Tt[kr],kr,Tt))return kr;return-1}function sr(Tt,Zt,sn){return Zt===Zt?M(Tt,Zt,sn):lr(Tt,Lr,sn)}function Mr(Tt,Zt,sn,$n){for(var Cr=sn-1,kr=Tt.length;++Cr<kr;)if($n(Tt[Cr],Zt))return Cr;return-1}function Lr(Tt){return Tt!==Tt}function ss(Tt,Zt){var sn=Tt==null?0:Tt.length;return sn?qr(Tt,Zt)/sn:ee}function ys(Tt){return function(Zt){return Zt==null?n:Zt[Tt]}}function Bt(Tt){return function(Zt){return Tt==null?n:Tt[Zt]}}function mr(Tt,Zt,sn,$n,Cr){return Cr(Tt,function(kr,Pr,Is){sn=$n?($n=!1,kr):Zt(sn,kr,Pr,Is)}),sn}function er(Tt,Zt){var sn=Tt.length;for(Tt.sort(Zt);sn--;)Tt[sn]=Tt[sn].value;return Tt}function qr(Tt,Zt){for(var sn,$n=-1,Cr=Tt.length;++$n<Cr;){var kr=Zt(Tt[$n]);kr!==n&&(sn=sn===n?kr:sn+kr)}return sn}function xs(Tt,Zt){for(var sn=-1,$n=Array(Tt);++sn<Tt;)$n[sn]=Zt(sn);return $n}function ls(Tt,Zt){return ar(Zt,function(sn){return[sn,Tt[sn]]})}function hs(Tt){return Tt&&Tt.slice(0,de(Tt)+1).replace(ze,"")}function vs(Tt){return function(Zt){return Tt(Zt)}}function vi(Tt,Zt){return ar(Zt,function(sn){return Tt[sn]})}function Ps(Tt,Zt){return Tt.has(Zt)}function As(Tt,Zt){for(var sn=-1,$n=Tt.length;++sn<$n&&sr(Zt,Tt[sn],0)>-1;);return sn}function Ts(Tt,Zt){for(var sn=Tt.length;sn--&&sr(Zt,Tt[sn],0)>-1;);return sn}function mc(Tt,Zt){for(var sn=Tt.length,$n=0;sn--;)Tt[sn]===Zt&&++$n;return $n}var Ls=Bt(On),Pa=Bt(qn);function Wu(Tt){return"\\"+jr[Tt]}function Sa(Tt,Zt){return Tt==null?n:Tt[Zt]}function Xo(Tt){return en.test(Tt)}function qu(Tt){return Fn.test(Tt)}function Ql(Tt){for(var Zt,sn=[];!(Zt=Tt.next()).done;)sn.push(Zt.value);return sn}function Ci(Tt){var Zt=-1,sn=Array(Tt.size);return Tt.forEach(function($n,Cr){sn[++Zt]=[Cr,$n]}),sn}function Ed(Tt,Zt){return function(sn){return Tt(Zt(sn))}}function St(Tt,Zt){for(var sn=-1,$n=Tt.length,Cr=0,kr=[];++sn<$n;){var Pr=Tt[sn];(Pr===Zt||Pr===d)&&(Tt[sn]=d,kr[Cr++]=sn)}return kr}function w(Tt){var Zt=-1,sn=Array(Tt.size);return Tt.forEach(function($n){sn[++Zt]=$n}),sn}function E(Tt){var Zt=-1,sn=Array(Tt.size);return Tt.forEach(function($n){sn[++Zt]=[$n,$n]}),sn}function M(Tt,Zt,sn){for(var $n=sn-1,Cr=Tt.length;++$n<Cr;)if(Tt[$n]===Zt)return $n;return-1}function z(Tt,Zt,sn){for(var $n=sn+1;$n--;)if(Tt[$n]===Zt)return $n;return $n}function W(Tt){return Xo(Tt)?De(Tt):Pn(Tt)}function J(Tt){return Xo(Tt)?ot(Tt):Ln(Tt)}function de(Tt){for(var Zt=Tt.length;Zt--&&xe.test(Tt.charAt(Zt)););return Zt}var Ee=Bt(_r);function De(Tt){for(var Zt=nn.lastIndex=0;nn.test(Tt);)++Zt;return Zt}function ot(Tt){return Tt.match(nn)||[]}function _t(Tt){return Tt.match(Ot)||[]}var zt=function Tt(Zt){Zt=Zt==null?dr:gn.defaults(dr.Object(),Zt,gn.pick(dr,yr));var sn=Zt.Array,$n=Zt.Date,Cr=Zt.Error,kr=Zt.Function,Pr=Zt.Math,Is=Zt.Object,ni=Zt.RegExp,xc=Zt.String,ao=Zt.TypeError,oo=sn.prototype,ga=kr.prototype,Ia=Is.prototype,Qo=Zt["__core-js_shared__"],kd=ga.toString,Mi=Ia.hasOwnProperty,Rm=0,G1=function(){var B=/[^.]+$/.exec(Qo&&Qo.keys&&Qo.keys.IE_PROTO||"");return B?"Symbol(src)_1."+B:""}(),q2=Ia.toString,e6=kd.call(Is),wP=dr._,CP=ni("^"+kd.call(Mi).replace(tr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),G2=ms?Zt.Buffer:n,Sp=Zt.Symbol,K2=Zt.Uint8Array,G8=G2?G2.allocUnsafe:n,Sf=Ed(Is.getPrototypeOf,Is),t6=Is.create,n6=Ia.propertyIsEnumerable,r6=oo.splice,NP=Sp?Sp.isConcatSpreadable:n,jp=Sp?Sp.iterator:n,jx=Sp?Sp.toStringTag:n,Y2=function(){try{var B=Km(Is,"defineProperty");return B({},"",{}),B}catch{}}(),SP=Zt.clearTimeout!==dr.clearTimeout&&Zt.clearTimeout,Qa=$n&&$n.now!==dr.Date.now&&$n.now,K8=Zt.setTimeout!==dr.setTimeout&&Zt.setTimeout,Ax=Pr.ceil,Dm=Pr.floor,s6=Is.getOwnPropertySymbols,Y8=G2?G2.isBuffer:n,K1=Zt.isFinite,i6=oo.join,Y1=Ed(Is.keys,Is),Zo=Pr.max,gc=Pr.min,Yz=$n.now,jP=Zt.parseInt,X2=Pr.random,a6=oo.reverse,Q2=Km(Zt,"DataView"),_x=Km(Zt,"Map"),Z2=Km(Zt,"Promise"),Bm=Km(Zt,"Set"),J2=Km(Zt,"WeakMap"),X1=Km(Is,"create"),o6=J2&&new J2,Q1={},X8=Ym(Q2),$m=Ym(_x),AP=Ym(Z2),Z1=Ym(Bm),uh=Ym(J2),Um=Sp?Sp.prototype:n,Gu=Um?Um.valueOf:n,l6=Um?Um.toString:n;function Xt(B){if(el(B)&&!Ei(B)&&!(B instanceof _i)){if(B instanceof bc)return B;if(Mi.call(B,"__wrapped__"))return eI(B)}return new bc(B)}var J1=function(){function B(){}return function(X){if(!Ho(X))return{};if(t6)return t6(X);B.prototype=X;var Ae=new B;return B.prototype=n,Ae}}();function dh(){}function bc(B,X){this.__wrapped__=B,this.__actions__=[],this.__chain__=!!X,this.__index__=0,this.__values__=n}Xt.templateSettings={escape:En,evaluate:Rn,interpolate:Mn,variable:"",imports:{_:Xt}},Xt.prototype=dh.prototype,Xt.prototype.constructor=Xt,bc.prototype=J1(dh.prototype),bc.prototype.constructor=bc;function _i(B){this.__wrapped__=B,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=se,this.__views__=[]}function c6(){var B=new _i(this.__wrapped__);return B.__actions__=Wc(this.__actions__),B.__dir__=this.__dir__,B.__filtered__=this.__filtered__,B.__iteratees__=Wc(this.__iteratees__),B.__takeCount__=this.__takeCount__,B.__views__=Wc(this.__views__),B}function Q8(){if(this.__filtered__){var B=new _i(this);B.__dir__=-1,B.__filtered__=!0}else B=this.clone(),B.__dir__*=-1;return B}function eb(){var B=this.__wrapped__.value(),X=this.__dir__,Ae=Ei(B),tt=X<0,Et=Ae?B.length:0,an=jA(0,Et,this.__views__),In=an.start,zn=an.end,ir=zn-In,Rr=tt?zn:In-1,Dr=this.__iteratees__,Xr=Dr.length,ws=0,Vs=gc(ir,this.__takeCount__);if(!Ae||!tt&&Et==ir&&Vs==ir)return lb(B,this.__actions__);var ri=[];e:for(;ir--&&ws<Vs;){Rr+=X;for(var Di=-1,si=B[Rr];++Di<Xr;){var Yi=Dr[Di],ta=Yi.iteratee,Of=Yi.type,Zu=ta(si);if(Of==G)si=Zu;else if(!Zu){if(Of==fe)continue e;break e}}ri[ws++]=si}return ri}_i.prototype=J1(dh.prototype),_i.prototype.constructor=_i;function hu(B){var X=-1,Ae=B==null?0:B.length;for(this.clear();++X<Ae;){var tt=B[X];this.set(tt[0],tt[1])}}function Za(){this.__data__=X1?X1(null):{},this.size=0}function Wa(B){var X=this.has(B)&&delete this.__data__[B];return this.size-=X?1:0,X}function zm(B){var X=this.__data__;if(X1){var Ae=X[B];return Ae===c?n:Ae}return Mi.call(X,B)?X[B]:n}function yc(B){var X=this.__data__;return X1?X[B]!==n:Mi.call(X,B)}function pu(B,X){var Ae=this.__data__;return this.size+=this.has(B)?0:1,Ae[B]=X1&&X===n?c:X,this}hu.prototype.clear=Za,hu.prototype.delete=Wa,hu.prototype.get=zm,hu.prototype.has=yc,hu.prototype.set=pu;function Vc(B){var X=-1,Ae=B==null?0:B.length;for(this.clear();++X<Ae;){var tt=B[X];this.set(tt[0],tt[1])}}function tb(){this.__data__=[],this.size=0}function mu(B){var X=this.__data__,Ae=wc(X,B);if(Ae<0)return!1;var tt=X.length-1;return Ae==tt?X.pop():r6.call(X,Ae,1),--this.size,!0}function u6(B){var X=this.__data__,Ae=wc(X,B);return Ae<0?n:X[Ae][1]}function _P(B){return wc(this.__data__,B)>-1}function EP(B,X){var Ae=this.__data__,tt=wc(Ae,B);return tt<0?(++this.size,Ae.push([B,X])):Ae[tt][1]=X,this}Vc.prototype.clear=tb,Vc.prototype.delete=mu,Vc.prototype.get=u6,Vc.prototype.has=_P,Vc.prototype.set=EP;function Td(B){var X=-1,Ae=B==null?0:B.length;for(this.clear();++X<Ae;){var tt=B[X];this.set(tt[0],tt[1])}}function kP(){this.size=0,this.__data__={hash:new hu,map:new(_x||Vc),string:new hu}}function Ap(B){var X=mv(this,B).delete(B);return this.size-=X?1:0,X}function d6(B){return mv(this,B).get(B)}function Z8(B){return mv(this,B).has(B)}function TP(B,X){var Ae=mv(this,B),tt=Ae.size;return Ae.set(B,X),this.size+=Ae.size==tt?0:1,this}Td.prototype.clear=kP,Td.prototype.delete=Ap,Td.prototype.get=d6,Td.prototype.has=Z8,Td.prototype.set=TP;function Ex(B){var X=-1,Ae=B==null?0:B.length;for(this.__data__=new Td;++X<Ae;)this.add(B[X])}function Hm(B){return this.__data__.set(B,c),this}function nb(B){return this.__data__.has(B)}Ex.prototype.add=Ex.prototype.push=Hm,Ex.prototype.has=nb;function vc(B){var X=this.__data__=new Vc(B);this.size=X.size}function f6(){this.__data__=new Vc,this.size=0}function h6(B){var X=this.__data__,Ae=X.delete(B);return this.size=X.size,Ae}function Pd(B){return this.__data__.get(B)}function Id(B){return this.__data__.has(B)}function kx(B,X){var Ae=this.__data__;if(Ae instanceof Vc){var tt=Ae.__data__;if(!_x||tt.length<s-1)return tt.push([B,X]),this.size=++Ae.size,this;Ae=this.__data__=new Td(tt)}return Ae.set(B,X),this.size=Ae.size,this}vc.prototype.clear=f6,vc.prototype.delete=h6,vc.prototype.get=Pd,vc.prototype.has=Id,vc.prototype.set=kx;function fh(B,X){var Ae=Ei(B),tt=!Ae&&_v(B),Et=!Ae&&!tt&&bb(B),an=!Ae&&!tt&&!Et&&sC(B),In=Ae||tt||Et||an,zn=In?xs(B.length,xc):[],ir=zn.length;for(var Rr in B)(X||Mi.call(B,Rr))&&!(In&&(Rr=="length"||Et&&(Rr=="offset"||Rr=="parent")||an&&(Rr=="buffer"||Rr=="byteLength"||Rr=="byteOffset")||co(Rr,ir)))&&zn.push(Rr);return zn}function hh(B){var X=B.length;return X?B[ab(0,X-1)]:n}function Tx(B,X){return B6(Wc(B),_p(X,0,B.length))}function PP(B){return B6(Wc(B))}function ev(B,X,Ae){(Ae!==n&&!Rp(B[X],Ae)||Ae===n&&!(X in B))&&ph(B,X,Ae)}function Px(B,X,Ae){var tt=B[X];(!(Mi.call(B,X)&&Rp(tt,Ae))||Ae===n&&!(X in B))&&ph(B,X,Ae)}function wc(B,X){for(var Ae=B.length;Ae--;)if(Rp(B[Ae][0],X))return Ae;return-1}function Ku(B,X,Ae,tt){return xh(B,function(Et,an,In){X(tt,Et,Ae(Et),In)}),tt}function Ja(B,X){return B&&Af(X,Sc(X),B)}function jf(B,X){return B&&Af(X,Ud(X),B)}function ph(B,X,Ae){X=="__proto__"&&Y2?Y2(B,X,{configurable:!0,enumerable:!0,value:Ae,writable:!0}):B[X]=Ae}function p6(B,X){for(var Ae=-1,tt=X.length,Et=sn(tt),an=B==null;++Ae<tt;)Et[Ae]=an?n:gH(B,X[Ae]);return Et}function _p(B,X,Ae){return B===B&&(Ae!==n&&(B=B<=Ae?B:Ae),X!==n&&(B=B>=X?B:X)),B}function xu(B,X,Ae,tt,Et,an){var In,zn=X&f,ir=X&x,Rr=X&g;if(Ae&&(In=Et?Ae(B,tt,Et,an):Ae(B)),In!==n)return In;if(!Ho(B))return B;var Dr=Ei(B);if(Dr){if(In=gv(B),!zn)return Wc(B,In)}else{var Xr=ec(B),ws=Xr==Ye||Xr==dt;if(bb(B))return hA(B,zn);if(Xr==qe||Xr==ve||ws&&!Et){if(In=ir||ws?{}:tc(B),!zn)return ir?Qz(B,jf(In,B)):_6(B,Ja(In,B))}else{if(!Ct[Xr])return Et?B:{};In=Zz(B,Xr,zn)}}an||(an=new vc);var Vs=an.get(B);if(Vs)return Vs;an.set(B,In),Zfe(B)?B.forEach(function(si){In.add(xu(si,X,Ae,si,B,an))}):Xfe(B)&&B.forEach(function(si,Yi){In.set(Yi,xu(si,X,Ae,Yi,B,an))});var ri=Rr?ir?pv:hv:ir?Ud:Sc,Di=Dr?n:ri(B);return Jn(Di||B,function(si,Yi){Di&&(Yi=si,si=B[Yi]),Px(In,Yi,xu(si,X,Ae,Yi,B,an))}),In}function IP(B){var X=Sc(B);return function(Ae){return tv(Ae,B,X)}}function tv(B,X,Ae){var tt=Ae.length;if(B==null)return!tt;for(B=Is(B);tt--;){var Et=Ae[tt],an=X[Et],In=B[Et];if(In===n&&!(Et in B)||!an(In))return!1}return!0}function J8(B,X,Ae){if(typeof B!="function")throw new ao(o);return mb(function(){B.apply(n,Ae)},X)}function mh(B,X,Ae,tt){var Et=-1,an=wr,In=!0,zn=B.length,ir=[],Rr=X.length;if(!zn)return ir;Ae&&(X=ar(X,vs(Ae))),tt?(an=pr,In=!1):X.length>=s&&(an=Ps,In=!1,X=new Ex(X));e:for(;++Et<zn;){var Dr=B[Et],Xr=Ae==null?Dr:Ae(Dr);if(Dr=tt||Dr!==0?Dr:0,In&&Xr===Xr){for(var ws=Rr;ws--;)if(X[ws]===Xr)continue e;ir.push(Dr)}else an(X,Xr,tt)||ir.push(Dr)}return ir}var xh=Rd(Yu),FP=Rd(Vm,!0);function nv(B,X){var Ae=!0;return xh(B,function(tt,Et,an){return Ae=!!X(tt,Et,an),Ae}),Ae}function Ix(B,X,Ae){for(var tt=-1,Et=B.length;++tt<Et;){var an=B[tt],In=X(an);if(In!=null&&(zn===n?In===In&&!Ff(In):Ae(In,zn)))var zn=In,ir=an}return ir}function OP(B,X,Ae,tt){var Et=B.length;for(Ae=Ri(Ae),Ae<0&&(Ae=-Ae>Et?0:Et+Ae),tt=tt===n||tt>Et?Et:Ri(tt),tt<0&&(tt+=Et),tt=Ae>tt?0:ehe(tt);Ae<tt;)B[Ae++]=X;return B}function eA(B,X){var Ae=[];return xh(B,function(tt,Et,an){X(tt,Et,an)&&Ae.push(tt)}),Ae}function Po(B,X,Ae,tt,Et){var an=-1,In=B.length;for(Ae||(Ae=L6),Et||(Et=[]);++an<In;){var zn=B[an];X>0&&Ae(zn)?X>1?Po(zn,X-1,Ae,tt,Et):Vr(Et,zn):tt||(Et[Et.length]=zn)}return Et}var m6=k6(),rv=k6(!0);function Yu(B,X){return B&&m6(B,X,Sc)}function Vm(B,X){return B&&rv(B,X,Sc)}function rb(B,X){return $r(X,function(Ae){return Vx(B[Ae])})}function Ep(B,X){X=yh(X,B);for(var Ae=0,tt=X.length;B!=null&&Ae<tt;)B=B[Tf(X[Ae++])];return Ae&&Ae==tt?B:n}function x6(B,X,Ae){var tt=X(B);return Ei(B)?tt:Vr(tt,Ae(B))}function Zl(B){return B==null?B===n?Hn:He:jx&&jx in Is(B)?M6(B):_A(B)}function Wm(B,X){return B>X}function Fd(B,X){return B!=null&&Mi.call(B,X)}function Fx(B,X){return B!=null&&X in Is(B)}function tA(B,X,Ae){return B>=gc(X,Ae)&&B<Zo(X,Ae)}function g6(B,X,Ae){for(var tt=Ae?pr:wr,Et=B[0].length,an=B.length,In=an,zn=sn(an),ir=1/0,Rr=[];In--;){var Dr=B[In];In&&X&&(Dr=ar(Dr,vs(X))),ir=gc(Dr.length,ir),zn[In]=!Ae&&(X||Et>=120&&Dr.length>=120)?new Ex(In&&Dr):n}Dr=B[0];var Xr=-1,ws=zn[0];e:for(;++Xr<Et&&Rr.length<ir;){var Vs=Dr[Xr],ri=X?X(Vs):Vs;if(Vs=Ae||Vs!==0?Vs:0,!(ws?Ps(ws,ri):tt(Rr,ri,Ae))){for(In=an;--In;){var Di=zn[In];if(!(Di?Ps(Di,ri):tt(B[In],ri,Ae)))continue e}ws&&ws.push(ri),Rr.push(Vs)}}return Rr}function kp(B,X,Ae,tt){return Yu(B,function(Et,an,In){X(tt,Ae(Et),an,In)}),tt}function Od(B,X,Ae){X=yh(X,B),B=Ml(B,X);var tt=B==null?B:B[Tf(Kc(X))];return tt==null?n:Gn(tt,B,Ae)}function b6(B){return el(B)&&Zl(B)==ve}function MP(B){return el(B)&&Zl(B)==dn}function Tp(B){return el(B)&&Zl(B)==Fe}function Md(B,X,Ae,tt,Et){return B===X?!0:B==null||X==null||!el(B)&&!el(X)?B!==B&&X!==X:y6(B,X,Ae,tt,Md,Et)}function y6(B,X,Ae,tt,Et,an){var In=Ei(B),zn=Ei(X),ir=In?be:ec(B),Rr=zn?be:ec(X);ir=ir==ve?qe:ir,Rr=Rr==ve?qe:Rr;var Dr=ir==qe,Xr=Rr==qe,ws=ir==Rr;if(ws&&bb(B)){if(!bb(X))return!1;In=!0,Dr=!1}if(ws&&!Dr)return an||(an=new vc),In||sC(B)?NA(B,X,Ae,tt,Et,an):SA(B,X,ir,Ae,tt,Et,an);if(!(Ae&y)){var Vs=Dr&&Mi.call(B,"__wrapped__"),ri=Xr&&Mi.call(X,"__wrapped__");if(Vs||ri){var Di=Vs?B.value():B,si=ri?X.value():X;return an||(an=new vc),Et(Di,si,Ae,tt,an)}}return ws?(an||(an=new vc),qP(B,X,Ae,tt,Et,an)):!1}function LP(B){return el(B)&&ec(B)==st}function sb(B,X,Ae,tt){var Et=Ae.length,an=Et,In=!tt;if(B==null)return!an;for(B=Is(B);Et--;){var zn=Ae[Et];if(In&&zn[2]?zn[1]!==B[zn[0]]:!(zn[0]in B))return!1}for(;++Et<an;){zn=Ae[Et];var ir=zn[0],Rr=B[ir],Dr=zn[1];if(In&&zn[2]){if(Rr===n&&!(ir in B))return!1}else{var Xr=new vc;if(tt)var ws=tt(Rr,Dr,ir,B,X,Xr);if(!(ws===n?Md(Dr,Rr,y|v,tt,Xr):ws))return!1}}return!0}function nA(B){if(!Ho(B)||YP(B))return!1;var X=Vx(B)?CP:mn;return X.test(Ym(B))}function sv(B){return el(B)&&Zl(B)==Kt}function gh(B){return el(B)&&ec(B)==jt}function iv(B){return el(B)&&pI(B.length)&&!!lt[Zl(B)]}function ib(B){return typeof B=="function"?B:B==null?zd:typeof B=="object"?Ei(B)?lo(B[0],B[1]):v6(B):dhe(B)}function Pp(B){if(!Mp(B))return Y1(B);var X=[];for(var Ae in Is(B))Mi.call(B,Ae)&&Ae!="constructor"&&X.push(Ae);return X}function rA(B){if(!Ho(B))return ZP(B);var X=Mp(B),Ae=[];for(var tt in B)tt=="constructor"&&(X||!Mi.call(B,tt))||Ae.push(tt);return Ae}function qm(B,X){return B<X}function sA(B,X){var Ae=-1,tt=$d(B)?sn(B.length):[];return xh(B,function(Et,an,In){tt[++Ae]=X(Et,an,In)}),tt}function v6(B){var X=xv(B);return X.length==1&&X[0][2]?R6(X[0][0],X[0][1]):function(Ae){return Ae===B||sb(Ae,B,X)}}function lo(B,X){return _s(B)&&yv(X)?R6(Tf(B),X):function(Ae){var tt=gH(Ae,B);return tt===n&&tt===X?bH(Ae,B):Md(X,tt,y|v)}}function Ox(B,X,Ae,tt,Et){B!==X&&m6(X,function(an,In){if(Et||(Et=new vc),Ho(an))iA(B,X,In,Ae,Ox,tt,Et);else{var zn=tt?tt(Ch(B,In),an,In+"",B,X,Et):n;zn===n&&(zn=an),ev(B,In,zn)}},Ud)}function iA(B,X,Ae,tt,Et,an,In){var zn=Ch(B,Ae),ir=Ch(X,Ae),Rr=In.get(ir);if(Rr){ev(B,Ae,Rr);return}var Dr=an?an(zn,ir,Ae+"",B,X,In):n,Xr=Dr===n;if(Xr){var ws=Ei(ir),Vs=!ws&&bb(ir),ri=!ws&&!Vs&&sC(ir);Dr=ir,ws||Vs||ri?Ei(zn)?Dr=zn:bl(zn)?Dr=Wc(zn):Vs?(Xr=!1,Dr=hA(ir,!0)):ri?(Xr=!1,Dr=UP(ir,!0)):Dr=[]:WA(ir)||_v(ir)?(Dr=zn,_v(zn)?Dr=the(zn):(!Ho(zn)||Vx(zn))&&(Dr=tc(ir))):Xr=!1}Xr&&(In.set(ir,Dr),Et(Dr,ir,tt,an,In),In.delete(ir)),ev(B,Ae,Dr)}function w6(B,X){var Ae=B.length;if(Ae)return X+=X<0?Ae:0,co(X,Ae)?B[X]:n}function av(B,X,Ae){X.length?X=ar(X,function(an){return Ei(an)?function(In){return Ep(In,an.length===1?an[0]:an)}:an}):X=[zd];var tt=-1;X=ar(X,vs(Zs()));var Et=sA(B,function(an,In,zn){var ir=ar(X,function(Rr){return Rr(an)});return{criteria:ir,index:++tt,value:an}});return er(Et,function(an,In){return Xz(an,In,Ae)})}function aA(B,X){return Gm(B,X,function(Ae,tt){return bH(B,tt)})}function Gm(B,X,Ae){for(var tt=-1,Et=X.length,an={};++tt<Et;){var In=X[tt],zn=Ep(B,In);Ae(zn,In)&&Lx(an,yh(In,B),zn)}return an}function Co(B){return function(X){return Ep(X,B)}}function zo(B,X,Ae,tt){var Et=tt?Mr:sr,an=-1,In=X.length,zn=B;for(B===X&&(X=Wc(X)),Ae&&(zn=ar(B,vs(Ae)));++an<In;)for(var ir=0,Rr=X[an],Dr=Ae?Ae(Rr):Rr;(ir=Et(zn,Dr,ir,tt))>-1;)zn!==B&&r6.call(zn,ir,1),r6.call(B,ir,1);return B}function ml(B,X){for(var Ae=B?X.length:0,tt=Ae-1;Ae--;){var Et=X[Ae];if(Ae==tt||Et!==an){var an=Et;co(Et)?r6.call(B,Et,1):S6(B,Et)}}return B}function ab(B,X){return B+Dm(X2()*(X-B+1))}function ov(B,X,Ae,tt){for(var Et=-1,an=Zo(Ax((X-B)/(Ae||1)),0),In=sn(an);an--;)In[tt?an:++Et]=B,B+=Ae;return In}function Mx(B,X){var Ae="";if(!B||X<1||X>K)return Ae;do X%2&&(Ae+=B),X=Dm(X/2),X&&(B+=B);while(X);return Ae}function Li(B,X){return Xu(D6(B,X,zd),B+"")}function Cc(B){return hh(iC(B))}function oA(B,X){var Ae=iC(B);return B6(Ae,_p(X,0,Ae.length))}function Lx(B,X,Ae,tt){if(!Ho(B))return B;X=yh(X,B);for(var Et=-1,an=X.length,In=an-1,zn=B;zn!=null&&++Et<an;){var ir=Tf(X[Et]),Rr=Ae;if(ir==="__proto__"||ir==="constructor"||ir==="prototype")return B;if(Et!=In){var Dr=zn[ir];Rr=tt?tt(Dr,ir,zn):n,Rr===n&&(Rr=Ho(Dr)?Dr:co(X[Et+1])?[]:{})}Px(zn,ir,Rr),zn=zn[ir]}return B}var C6=o6?function(B,X){return o6.set(B,X),B}:zd,bh=Y2?function(B,X){return Y2(B,"toString",{configurable:!0,enumerable:!1,value:vH(X),writable:!0})}:zd;function Ld(B){return B6(iC(B))}function Nc(B,X,Ae){var tt=-1,Et=B.length;X<0&&(X=-X>Et?0:Et+X),Ae=Ae>Et?Et:Ae,Ae<0&&(Ae+=Et),Et=X>Ae?0:Ae-X>>>0,X>>>=0;for(var an=sn(Et);++tt<Et;)an[tt]=B[tt+X];return an}function lA(B,X){var Ae;return xh(B,function(tt,Et,an){return Ae=X(tt,Et,an),!Ae}),!!Ae}function ob(B,X,Ae){var tt=0,Et=B==null?tt:B.length;if(typeof X=="number"&&X===X&&Et<=Se){for(;tt<Et;){var an=tt+Et>>>1,In=B[an];In!==null&&!Ff(In)&&(Ae?In<=X:In<X)?tt=an+1:Et=an}return Et}return N6(B,X,zd,Ae)}function N6(B,X,Ae,tt){var Et=0,an=B==null?0:B.length;if(an===0)return 0;X=Ae(X);for(var In=X!==X,zn=X===null,ir=Ff(X),Rr=X===n;Et<an;){var Dr=Dm((Et+an)/2),Xr=Ae(B[Dr]),ws=Xr!==n,Vs=Xr===null,ri=Xr===Xr,Di=Ff(Xr);if(In)var si=tt||ri;else Rr?si=ri&&(tt||ws):zn?si=ri&&ws&&(tt||!Vs):ir?si=ri&&ws&&!Vs&&(tt||!Di):Vs||Di?si=!1:si=tt?Xr<=X:Xr<X;si?Et=Dr+1:an=Dr}return gc(an,pe)}function cA(B,X){for(var Ae=-1,tt=B.length,Et=0,an=[];++Ae<tt;){var In=B[Ae],zn=X?X(In):In;if(!Ae||!Rp(zn,ir)){var ir=zn;an[Et++]=In===0?0:In}}return an}function uA(B){return typeof B=="number"?B:Ff(B)?ee:+B}function gu(B){if(typeof B=="string")return B;if(Ei(B))return ar(B,gu)+"";if(Ff(B))return l6?l6.call(B):"";var X=B+"";return X=="0"&&1/B==-1/0?"-0":X}function Ip(B,X,Ae){var tt=-1,Et=wr,an=B.length,In=!0,zn=[],ir=zn;if(Ae)In=!1,Et=pr;else if(an>=s){var Rr=X?null:WP(B);if(Rr)return w(Rr);In=!1,Et=Ps,ir=new Ex}else ir=X?[]:zn;e:for(;++tt<an;){var Dr=B[tt],Xr=X?X(Dr):Dr;if(Dr=Ae||Dr!==0?Dr:0,In&&Xr===Xr){for(var ws=ir.length;ws--;)if(ir[ws]===Xr)continue e;X&&ir.push(Xr),zn.push(Dr)}else Et(ir,Xr,Ae)||(ir!==zn&&ir.push(Xr),zn.push(Dr))}return zn}function S6(B,X){return X=yh(X,B),B=Ml(B,X),B==null||delete B[Tf(Kc(X))]}function dA(B,X,Ae,tt){return Lx(B,X,Ae(Ep(B,X)),tt)}function lv(B,X,Ae,tt){for(var Et=B.length,an=tt?Et:-1;(tt?an--:++an<Et)&&X(B[an],an,B););return Ae?Nc(B,tt?0:an,tt?an+1:Et):Nc(B,tt?an+1:0,tt?Et:an)}function lb(B,X){var Ae=B;return Ae instanceof _i&&(Ae=Ae.value()),Ur(X,function(tt,Et){return Et.func.apply(Et.thisArg,Vr([tt],Et.args))},Ae)}function j6(B,X,Ae){var tt=B.length;if(tt<2)return tt?Ip(B[0]):[];for(var Et=-1,an=sn(tt);++Et<tt;)for(var In=B[Et],zn=-1;++zn<tt;)zn!=Et&&(an[Et]=mh(an[Et]||In,B[zn],X,Ae));return Ip(Po(an,1),X,Ae)}function cv(B,X,Ae){for(var tt=-1,Et=B.length,an=X.length,In={};++tt<Et;){var zn=tt<an?X[tt]:n;Ae(In,B[tt],zn)}return In}function cb(B){return bl(B)?B:[]}function A6(B){return typeof B=="function"?B:zd}function yh(B,X){return Ei(B)?B:_s(B,X)?[B]:TA(Fa(B))}var RP=Li;function Fp(B,X,Ae){var tt=B.length;return Ae=Ae===n?tt:Ae,!X&&Ae>=tt?B:Nc(B,X,Ae)}var fA=SP||function(B){return dr.clearTimeout(B)};function hA(B,X){if(X)return B.slice();var Ae=B.length,tt=G8?G8(Ae):new B.constructor(Ae);return B.copy(tt),tt}function uv(B){var X=new B.constructor(B.byteLength);return new K2(X).set(new K2(B)),X}function DP(B,X){var Ae=X?uv(B.buffer):B.buffer;return new B.constructor(Ae,B.byteOffset,B.byteLength)}function BP(B){var X=new B.constructor(B.source,Tn.exec(B));return X.lastIndex=B.lastIndex,X}function $P(B){return Gu?Is(Gu.call(B)):{}}function UP(B,X){var Ae=X?uv(B.buffer):B.buffer;return new B.constructor(Ae,B.byteOffset,B.length)}function pA(B,X){if(B!==X){var Ae=B!==n,tt=B===null,Et=B===B,an=Ff(B),In=X!==n,zn=X===null,ir=X===X,Rr=Ff(X);if(!zn&&!Rr&&!an&&B>X||an&&In&&ir&&!zn&&!Rr||tt&&In&&ir||!Ae&&ir||!Et)return 1;if(!tt&&!an&&!Rr&&B<X||Rr&&Ae&&Et&&!tt&&!an||zn&&Ae&&Et||!In&&Et||!ir)return-1}return 0}function Xz(B,X,Ae){for(var tt=-1,Et=B.criteria,an=X.criteria,In=Et.length,zn=Ae.length;++tt<In;){var ir=pA(Et[tt],an[tt]);if(ir){if(tt>=zn)return ir;var Rr=Ae[tt];return ir*(Rr=="desc"?-1:1)}}return B.index-X.index}function zP(B,X,Ae,tt){for(var Et=-1,an=B.length,In=Ae.length,zn=-1,ir=X.length,Rr=Zo(an-In,0),Dr=sn(ir+Rr),Xr=!tt;++zn<ir;)Dr[zn]=X[zn];for(;++Et<In;)(Xr||Et<an)&&(Dr[Ae[Et]]=B[Et]);for(;Rr--;)Dr[zn++]=B[Et++];return Dr}function mA(B,X,Ae,tt){for(var Et=-1,an=B.length,In=-1,zn=Ae.length,ir=-1,Rr=X.length,Dr=Zo(an-zn,0),Xr=sn(Dr+Rr),ws=!tt;++Et<Dr;)Xr[Et]=B[Et];for(var Vs=Et;++ir<Rr;)Xr[Vs+ir]=X[ir];for(;++In<zn;)(ws||Et<an)&&(Xr[Vs+Ae[In]]=B[Et++]);return Xr}function Wc(B,X){var Ae=-1,tt=B.length;for(X||(X=sn(tt));++Ae<tt;)X[Ae]=B[Ae];return X}function Af(B,X,Ae,tt){var Et=!Ae;Ae||(Ae={});for(var an=-1,In=X.length;++an<In;){var zn=X[an],ir=tt?tt(Ae[zn],B[zn],zn,Ae,B):n;ir===n&&(ir=B[zn]),Et?ph(Ae,zn,ir):Px(Ae,zn,ir)}return Ae}function _6(B,X){return Af(B,_f(B),X)}function Qz(B,X){return Af(B,GP(B),X)}function E6(B,X){return function(Ae,tt){var Et=Ei(Ae)?rr:Ku,an=X?X():{};return Et(Ae,B,Zs(tt,2),an)}}function ub(B){return Li(function(X,Ae){var tt=-1,Et=Ae.length,an=Et>1?Ae[Et-1]:n,In=Et>2?Ae[2]:n;for(an=B.length>3&&typeof an=="function"?(Et--,an):n,In&&Gc(Ae[0],Ae[1],In)&&(an=Et<3?n:an,Et=1),X=Is(X);++tt<Et;){var zn=Ae[tt];zn&&B(X,zn,tt,an)}return X})}function Rd(B,X){return function(Ae,tt){if(Ae==null)return Ae;if(!$d(Ae))return B(Ae,tt);for(var Et=Ae.length,an=X?Et:-1,In=Is(Ae);(X?an--:++an<Et)&&tt(In[an],an,In)!==!1;);return Ae}}function k6(B){return function(X,Ae,tt){for(var Et=-1,an=Is(X),In=tt(X),zn=In.length;zn--;){var ir=In[B?zn:++Et];if(Ae(an[ir],ir,an)===!1)break}return X}}function T6(B,X,Ae){var tt=X&C,Et=db(B);function an(){var In=this&&this!==dr&&this instanceof an?Et:B;return In.apply(tt?Ae:this,arguments)}return an}function xA(B){return function(X){X=Fa(X);var Ae=Xo(X)?J(X):n,tt=Ae?Ae[0]:X.charAt(0),Et=Ae?Fp(Ae,1).join(""):X.slice(1);return tt[B]()+Et}}function Rx(B){return function(X){return Ur(che(lhe(X).replace(Or,"")),B,"")}}function db(B){return function(){var X=arguments;switch(X.length){case 0:return new B;case 1:return new B(X[0]);case 2:return new B(X[0],X[1]);case 3:return new B(X[0],X[1],X[2]);case 4:return new B(X[0],X[1],X[2],X[3]);case 5:return new B(X[0],X[1],X[2],X[3],X[4]);case 6:return new B(X[0],X[1],X[2],X[3],X[4],X[5]);case 7:return new B(X[0],X[1],X[2],X[3],X[4],X[5],X[6])}var Ae=J1(B.prototype),tt=B.apply(Ae,X);return Ho(tt)?tt:Ae}}function gA(B,X,Ae){var tt=db(B);function Et(){for(var an=arguments.length,In=sn(an),zn=an,ir=Op(Et);zn--;)In[zn]=arguments[zn];var Rr=an<3&&In[0]!==ir&&In[an-1]!==ir?[]:St(In,ir);if(an-=Rr.length,an<Ae)return qc(B,X,fb,Et.placeholder,n,In,Rr,n,n,Ae-an);var Dr=this&&this!==dr&&this instanceof Et?tt:B;return Gn(Dr,this,In)}return Et}function Dx(B){return function(X,Ae,tt){var Et=Is(X);if(!$d(X)){var an=Zs(Ae,3);X=Sc(X),Ae=function(zn){return an(Et[zn],zn,Et)}}var In=B(X,Ae,tt);return In>-1?Et[an?X[In]:In]:n}}function P6(B){return wh(function(X){var Ae=X.length,tt=Ae,Et=bc.prototype.thru;for(B&&X.reverse();tt--;){var an=X[tt];if(typeof an!="function")throw new ao(o);if(Et&&!In&&hb(an)=="wrapper")var In=new bc([],!0)}for(tt=In?tt:Ae;++tt<Ae;){an=X[tt];var zn=hb(an),ir=zn=="wrapper"?O6(an):n;ir&&bv(ir[0])&&ir[1]==(O|I|F|U)&&!ir[4].length&&ir[9]==1?In=In[hb(ir[0])].apply(In,ir[3]):In=an.length==1&&bv(an)?In[zn]():In.thru(an)}return function(){var Rr=arguments,Dr=Rr[0];if(In&&Rr.length==1&&Ei(Dr))return In.plant(Dr).value();for(var Xr=0,ws=Ae?X[Xr].apply(this,Rr):Dr;++Xr<Ae;)ws=X[Xr].call(this,ws);return ws}})}function fb(B,X,Ae,tt,Et,an,In,zn,ir,Rr){var Dr=X&O,Xr=X&C,ws=X&S,Vs=X&(I|L),ri=X&Y,Di=ws?n:db(B);function si(){for(var Yi=arguments.length,ta=sn(Yi),Of=Yi;Of--;)ta[Of]=arguments[Of];if(Vs)var Zu=Op(si),Mf=mc(ta,Zu);if(tt&&(ta=zP(ta,tt,Et,Vs)),an&&(ta=mA(ta,an,In,Vs)),Yi-=Mf,Vs&&Yi<Rr){var yl=St(ta,Zu);return qc(B,X,fb,si.placeholder,Ae,ta,yl,zn,ir,Rr-Yi)}var Dp=Xr?Ae:this,qx=ws?Dp[B]:B;return Yi=ta.length,zn?ta=Ef(ta,zn):ri&&Yi>1&&ta.reverse(),Dr&&ir<Yi&&(ta.length=ir),this&&this!==dr&&this instanceof si&&(qx=Di||db(qx)),qx.apply(Dp,ta)}return si}function HP(B,X){return function(Ae,tt){return kp(Ae,B,X(tt),{})}}function dv(B,X){return function(Ae,tt){var Et;if(Ae===n&&tt===n)return X;if(Ae!==n&&(Et=Ae),tt!==n){if(Et===n)return tt;typeof Ae=="string"||typeof tt=="string"?(Ae=gu(Ae),tt=gu(tt)):(Ae=uA(Ae),tt=uA(tt)),Et=B(Ae,tt)}return Et}}function I6(B){return wh(function(X){return X=ar(X,vs(Zs())),Li(function(Ae){var tt=this;return B(X,function(Et){return Gn(Et,tt,Ae)})})})}function fv(B,X){X=X===n?" ":gu(X);var Ae=X.length;if(Ae<2)return Ae?Mx(X,B):X;var tt=Mx(X,Ax(B/W(X)));return Xo(X)?Fp(J(tt),0,B).join(""):tt.slice(0,B)}function VP(B,X,Ae,tt){var Et=X&C,an=db(B);function In(){for(var zn=-1,ir=arguments.length,Rr=-1,Dr=tt.length,Xr=sn(Dr+ir),ws=this&&this!==dr&&this instanceof In?an:B;++Rr<Dr;)Xr[Rr]=tt[Rr];for(;ir--;)Xr[Rr++]=arguments[++zn];return Gn(ws,Et?Ae:this,Xr)}return In}function bA(B){return function(X,Ae,tt){return tt&&typeof tt!="number"&&Gc(X,Ae,tt)&&(Ae=tt=n),X=Wx(X),Ae===n?(Ae=X,X=0):Ae=Wx(Ae),tt=tt===n?X<Ae?1:-1:Wx(tt),ov(X,Ae,tt,B)}}function F6(B){return function(X,Ae){return typeof X=="string"&&typeof Ae=="string"||(X=Nh(X),Ae=Nh(Ae)),B(X,Ae)}}function qc(B,X,Ae,tt,Et,an,In,zn,ir,Rr){var Dr=X&I,Xr=Dr?In:n,ws=Dr?n:In,Vs=Dr?an:n,ri=Dr?n:an;X|=Dr?F:$,X&=~(Dr?$:F),X&T||(X&=-4);var Di=[B,X,Et,Vs,Xr,ri,ws,zn,ir,Rr],si=Ae.apply(n,Di);return bv(B)&&EA(si,Di),si.placeholder=tt,kA(si,B,X)}function Jl(B){var X=Pr[B];return function(Ae,tt){if(Ae=Nh(Ae),tt=tt==null?0:gc(Ri(tt),292),tt&&K1(Ae)){var Et=(Fa(Ae)+"e").split("e"),an=X(Et[0]+"e"+(+Et[1]+tt));return Et=(Fa(an)+"e").split("e"),+(Et[0]+"e"+(+Et[1]-tt))}return X(Ae)}}var WP=Bm&&1/w(new Bm([,-0]))[1]==oe?function(B){return new Bm(B)}:NH;function yA(B){return function(X){var Ae=ec(X);return Ae==st?Ci(X):Ae==jt?E(X):ls(X,B(X))}}function vh(B,X,Ae,tt,Et,an,In,zn){var ir=X&S;if(!ir&&typeof B!="function")throw new ao(o);var Rr=tt?tt.length:0;if(Rr||(X&=-97,tt=Et=n),In=In===n?In:Zo(Ri(In),0),zn=zn===n?zn:Ri(zn),Rr-=Et?Et.length:0,X&$){var Dr=tt,Xr=Et;tt=Et=n}var ws=ir?n:O6(B),Vs=[B,X,Ae,tt,Et,Dr,Xr,an,In,zn];if(ws&&QP(Vs,ws),B=Vs[0],X=Vs[1],Ae=Vs[2],tt=Vs[3],Et=Vs[4],zn=Vs[9]=Vs[9]===n?ir?0:B.length:Zo(Vs[9]-Rr,0),!zn&&X&(I|L)&&(X&=-25),!X||X==C)var ri=T6(B,X,Ae);else X==I||X==L?ri=gA(B,X,zn):(X==F||X==(C|F))&&!Et.length?ri=VP(B,X,Ae,tt):ri=fb.apply(n,Vs);var Di=ws?C6:EA;return kA(Di(ri,Vs),B,X)}function vA(B,X,Ae,tt){return B===n||Rp(B,Ia[Ae])&&!Mi.call(tt,Ae)?X:B}function wA(B,X,Ae,tt,Et,an){return Ho(B)&&Ho(X)&&(an.set(X,B),Ox(B,X,n,wA,an),an.delete(X)),B}function CA(B){return WA(B)?n:B}function NA(B,X,Ae,tt,Et,an){var In=Ae&y,zn=B.length,ir=X.length;if(zn!=ir&&!(In&&ir>zn))return!1;var Rr=an.get(B),Dr=an.get(X);if(Rr&&Dr)return Rr==X&&Dr==B;var Xr=-1,ws=!0,Vs=Ae&v?new Ex:n;for(an.set(B,X),an.set(X,B);++Xr<zn;){var ri=B[Xr],Di=X[Xr];if(tt)var si=In?tt(Di,ri,Xr,X,B,an):tt(ri,Di,Xr,B,X,an);if(si!==n){if(si)continue;ws=!1;break}if(Vs){if(!Sr(X,function(Yi,ta){if(!Ps(Vs,ta)&&(ri===Yi||Et(ri,Yi,Ae,tt,an)))return Vs.push(ta)})){ws=!1;break}}else if(!(ri===Di||Et(ri,Di,Ae,tt,an))){ws=!1;break}}return an.delete(B),an.delete(X),ws}function SA(B,X,Ae,tt,Et,an,In){switch(Ae){case rt:if(B.byteLength!=X.byteLength||B.byteOffset!=X.byteOffset)return!1;B=B.buffer,X=X.buffer;case dn:return!(B.byteLength!=X.byteLength||!an(new K2(B),new K2(X)));case je:case Fe:case at:return Rp(+B,+X);case Qe:return B.name==X.name&&B.message==X.message;case Kt:case un:return B==X+"";case st:var zn=Ci;case jt:var ir=tt&y;if(zn||(zn=w),B.size!=X.size&&!ir)return!1;var Rr=In.get(B);if(Rr)return Rr==X;tt|=v,In.set(B,X);var Dr=NA(zn(B),zn(X),tt,Et,an,In);return In.delete(B),Dr;case vn:if(Gu)return Gu.call(B)==Gu.call(X)}return!1}function qP(B,X,Ae,tt,Et,an){var In=Ae&y,zn=hv(B),ir=zn.length,Rr=hv(X),Dr=Rr.length;if(ir!=Dr&&!In)return!1;for(var Xr=ir;Xr--;){var ws=zn[Xr];if(!(In?ws in X:Mi.call(X,ws)))return!1}var Vs=an.get(B),ri=an.get(X);if(Vs&&ri)return Vs==X&&ri==B;var Di=!0;an.set(B,X),an.set(X,B);for(var si=In;++Xr<ir;){ws=zn[Xr];var Yi=B[ws],ta=X[ws];if(tt)var Of=In?tt(ta,Yi,ws,X,B,an):tt(Yi,ta,ws,B,X,an);if(!(Of===n?Yi===ta||Et(Yi,ta,Ae,tt,an):Of)){Di=!1;break}si||(si=ws=="constructor")}if(Di&&!si){var Zu=B.constructor,Mf=X.constructor;Zu!=Mf&&"constructor"in B&&"constructor"in X&&!(typeof Zu=="function"&&Zu instanceof Zu&&typeof Mf=="function"&&Mf instanceof Mf)&&(Di=!1)}return an.delete(B),an.delete(X),Di}function wh(B){return Xu(D6(B,n,U6),B+"")}function hv(B){return x6(B,Sc,_f)}function pv(B){return x6(B,Ud,GP)}var O6=o6?function(B){return o6.get(B)}:NH;function hb(B){for(var X=B.name+"",Ae=Q1[X],tt=Mi.call(Q1,X)?Ae.length:0;tt--;){var Et=Ae[tt],an=Et.func;if(an==null||an==B)return Et.name}return X}function Op(B){var X=Mi.call(Xt,"placeholder")?Xt:B;return X.placeholder}function Zs(){var B=Xt.iteratee||wH;return B=B===wH?ib:B,arguments.length?B(arguments[0],arguments[1]):B}function mv(B,X){var Ae=B.__data__;return pb(X)?Ae[typeof X=="string"?"string":"hash"]:Ae.map}function xv(B){for(var X=Sc(B),Ae=X.length;Ae--;){var tt=X[Ae],Et=B[tt];X[Ae]=[tt,Et,yv(Et)]}return X}function Km(B,X){var Ae=Sa(B,X);return nA(Ae)?Ae:n}function M6(B){var X=Mi.call(B,jx),Ae=B[jx];try{B[jx]=n;var tt=!0}catch{}var Et=q2.call(B);return tt&&(X?B[jx]=Ae:delete B[jx]),Et}var _f=s6?function(B){return B==null?[]:(B=Is(B),$r(s6(B),function(X){return n6.call(B,X)}))}:SH,GP=s6?function(B){for(var X=[];B;)Vr(X,_f(B)),B=Sf(B);return X}:SH,ec=Zl;(Q2&&ec(new Q2(new ArrayBuffer(1)))!=rt||_x&&ec(new _x)!=st||Z2&&ec(Z2.resolve())!=vt||Bm&&ec(new Bm)!=jt||J2&&ec(new J2)!=ln)&&(ec=function(B){var X=Zl(B),Ae=X==qe?B.constructor:n,tt=Ae?Ym(Ae):"";if(tt)switch(tt){case X8:return rt;case $m:return st;case AP:return vt;case Z1:return jt;case uh:return ln}return X});function jA(B,X,Ae){for(var tt=-1,Et=Ae.length;++tt<Et;){var an=Ae[tt],In=an.size;switch(an.type){case"drop":B+=In;break;case"dropRight":X-=In;break;case"take":X=gc(X,B+In);break;case"takeRight":B=Zo(B,X-In);break}}return{start:B,end:X}}function KP(B){var X=B.match(_e);return X?X[1].split(Be):[]}function AA(B,X,Ae){X=yh(X,B);for(var tt=-1,Et=X.length,an=!1;++tt<Et;){var In=Tf(X[tt]);if(!(an=B!=null&&Ae(B,In)))break;B=B[In]}return an||++tt!=Et?an:(Et=B==null?0:B.length,!!Et&&pI(Et)&&co(In,Et)&&(Ei(B)||_v(B)))}function gv(B){var X=B.length,Ae=new B.constructor(X);return X&&typeof B[0]=="string"&&Mi.call(B,"index")&&(Ae.index=B.index,Ae.input=B.input),Ae}function tc(B){return typeof B.constructor=="function"&&!Mp(B)?J1(Sf(B)):{}}function Zz(B,X,Ae){var tt=B.constructor;switch(X){case dn:return uv(B);case je:case Fe:return new tt(+B);case rt:return DP(B,Ae);case nt:case Ut:case wn:case Jt:case Vt:case xt:case We:case Pt:case Ke:return UP(B,Ae);case st:return new tt;case at:case un:return new tt(B);case Kt:return BP(B);case jt:return new tt;case vn:return $P(B)}}function Jz(B,X){var Ae=X.length;if(!Ae)return B;var tt=Ae-1;return X[tt]=(Ae>1?"& ":"")+X[tt],X=X.join(Ae>2?", ":" "),B.replace(Ge,`{
/* [wrapped with `+X+`] */
`)}function L6(B){return Ei(B)||_v(B)||!!(NP&&B&&B[NP])}function co(B,X){var Ae=typeof B;return X=X??K,!!X&&(Ae=="number"||Ae!="symbol"&&Wt.test(B))&&B>-1&&B%1==0&&B<X}function Gc(B,X,Ae){if(!Ho(Ae))return!1;var tt=typeof X;return(tt=="number"?$d(Ae)&&co(X,Ae.length):tt=="string"&&X in Ae)?Rp(Ae[X],B):!1}function _s(B,X){if(Ei(B))return!1;var Ae=typeof B;return Ae=="number"||Ae=="symbol"||Ae=="boolean"||B==null||Ff(B)?!0:Zn.test(B)||!Yn.test(B)||X!=null&&B in Is(X)}function pb(B){var X=typeof B;return X=="string"||X=="number"||X=="symbol"||X=="boolean"?B!=="__proto__":B===null}function bv(B){var X=hb(B),Ae=Xt[X];if(typeof Ae!="function"||!(X in _i.prototype))return!1;if(B===Ae)return!0;var tt=O6(Ae);return!!tt&&B===tt[0]}function YP(B){return!!G1&&G1 in B}var eH=Qo?Vx:jH;function Mp(B){var X=B&&B.constructor,Ae=typeof X=="function"&&X.prototype||Ia;return B===Ae}function yv(B){return B===B&&!Ho(B)}function R6(B,X){return function(Ae){return Ae==null?!1:Ae[B]===X&&(X!==n||B in Is(Ae))}}function XP(B){var X=is(B,function(tt){return Ae.size===u&&Ae.clear(),tt}),Ae=X.cache;return X}function QP(B,X){var Ae=B[1],tt=X[1],Et=Ae|tt,an=Et<(C|S|O),In=tt==O&&Ae==I||tt==O&&Ae==U&&B[7].length<=X[8]||tt==(O|U)&&X[7].length<=X[8]&&Ae==I;if(!(an||In))return B;tt&C&&(B[2]=X[2],Et|=Ae&C?0:T);var zn=X[3];if(zn){var ir=B[3];B[3]=ir?zP(ir,zn,X[4]):zn,B[4]=ir?St(B[3],d):X[4]}return zn=X[5],zn&&(ir=B[5],B[5]=ir?mA(ir,zn,X[6]):zn,B[6]=ir?St(B[5],d):X[6]),zn=X[7],zn&&(B[7]=zn),tt&O&&(B[8]=B[8]==null?X[8]:gc(B[8],X[8])),B[9]==null&&(B[9]=X[9]),B[0]=X[0],B[1]=Et,B}function ZP(B){var X=[];if(B!=null)for(var Ae in Is(B))X.push(Ae);return X}function _A(B){return q2.call(B)}function D6(B,X,Ae){return X=Zo(X===n?B.length-1:X,0),function(){for(var tt=arguments,Et=-1,an=Zo(tt.length-X,0),In=sn(an);++Et<an;)In[Et]=tt[X+Et];Et=-1;for(var zn=sn(X+1);++Et<X;)zn[Et]=tt[Et];return zn[X]=Ae(In),Gn(B,this,zn)}}function Ml(B,X){return X.length<2?B:Ep(B,Nc(X,0,-1))}function Ef(B,X){for(var Ae=B.length,tt=gc(X.length,Ae),Et=Wc(B);tt--;){var an=X[tt];B[tt]=co(an,Ae)?Et[an]:n}return B}function Ch(B,X){if(!(X==="constructor"&&typeof B[X]=="function")&&X!="__proto__")return B[X]}var EA=kf(C6),mb=K8||function(B,X){return dr.setTimeout(B,X)},Xu=kf(bh);function kA(B,X,Ae){var tt=X+"";return Xu(B,Jz(tt,JP(KP(tt),Ae)))}function kf(B){var X=0,Ae=0;return function(){var tt=Yz(),Et=te-(tt-Ae);if(Ae=tt,Et>0){if(++X>=q)return arguments[0]}else X=0;return B.apply(n,arguments)}}function B6(B,X){var Ae=-1,tt=B.length,Et=tt-1;for(X=X===n?tt:X;++Ae<X;){var an=ab(Ae,Et),In=B[an];B[an]=B[Ae],B[Ae]=In}return B.length=X,B}var TA=XP(function(B){var X=[];return B.charCodeAt(0)===46&&X.push(""),B.replace(Vn,function(Ae,tt,Et,an){X.push(Et?an.replace(mt,"$1"):tt||Ae)}),X});function Tf(B){if(typeof B=="string"||Ff(B))return B;var X=B+"";return X=="0"&&1/B==-1/0?"-0":X}function Ym(B){if(B!=null){try{return kd.call(B)}catch{}try{return B+""}catch{}}return""}function JP(B,X){return Jn(ge,function(Ae){var tt="_."+Ae[0];X&Ae[1]&&!wr(B,tt)&&B.push(tt)}),B.sort()}function eI(B){if(B instanceof _i)return B.clone();var X=new bc(B.__wrapped__,B.__chain__);return X.__actions__=Wc(B.__actions__),X.__index__=B.__index__,X.__values__=B.__values__,X}function $6(B,X,Ae){(Ae?Gc(B,X,Ae):X===n)?X=1:X=Zo(Ri(X),0);var tt=B==null?0:B.length;if(!tt||X<1)return[];for(var Et=0,an=0,In=sn(Ax(tt/X));Et<tt;)In[an++]=Nc(B,Et,Et+=X);return In}function PA(B){for(var X=-1,Ae=B==null?0:B.length,tt=0,Et=[];++X<Ae;){var an=B[X];an&&(Et[tt++]=an)}return Et}function Dd(){var B=arguments.length;if(!B)return[];for(var X=sn(B-1),Ae=arguments[0],tt=B;tt--;)X[tt-1]=arguments[tt];return Vr(Ei(Ae)?Wc(Ae):[Ae],Po(X,1))}var ea=Li(function(B,X){return bl(B)?mh(B,Po(X,1,bl,!0)):[]}),Ll=Li(function(B,X){var Ae=Kc(X);return bl(Ae)&&(Ae=n),bl(B)?mh(B,Po(X,1,bl,!0),Zs(Ae,2)):[]}),Jo=Li(function(B,X){var Ae=Kc(X);return bl(Ae)&&(Ae=n),bl(B)?mh(B,Po(X,1,bl,!0),n,Ae):[]});function nc(B,X,Ae){var tt=B==null?0:B.length;return tt?(X=Ae||X===n?1:Ri(X),Nc(B,X<0?0:X,tt)):[]}function Qu(B,X,Ae){var tt=B==null?0:B.length;return tt?(X=Ae||X===n?1:Ri(X),X=tt-X,Nc(B,0,X<0?0:X)):[]}function xb(B,X){return B&&B.length?lv(B,Zs(X,3),!0,!0):[]}function xl(B,X){return B&&B.length?lv(B,Zs(X,3),!0):[]}function vv(B,X,Ae,tt){var Et=B==null?0:B.length;return Et?(Ae&&typeof Ae!="number"&&Gc(B,X,Ae)&&(Ae=0,tt=Et),OP(B,X,Ae,tt)):[]}function Xm(B,X,Ae){var tt=B==null?0:B.length;if(!tt)return-1;var Et=Ae==null?0:Ri(Ae);return Et<0&&(Et=Zo(tt+Et,0)),lr(B,Zs(X,3),Et)}function wv(B,X,Ae){var tt=B==null?0:B.length;if(!tt)return-1;var Et=tt-1;return Ae!==n&&(Et=Ri(Ae),Et=Ae<0?Zo(tt+Et,0):gc(Et,tt-1)),lr(B,Zs(X,3),Et,!0)}function U6(B){var X=B==null?0:B.length;return X?Po(B,1):[]}function Cv(B){var X=B==null?0:B.length;return X?Po(B,oe):[]}function bu(B,X){var Ae=B==null?0:B.length;return Ae?(X=X===n?1:Ri(X),Po(B,X)):[]}function IA(B){for(var X=-1,Ae=B==null?0:B.length,tt={};++X<Ae;){var Et=B[X];tt[Et[0]]=Et[1]}return tt}function Bx(B){return B&&B.length?B[0]:n}function Lp(B,X,Ae){var tt=B==null?0:B.length;if(!tt)return-1;var Et=Ae==null?0:Ri(Ae);return Et<0&&(Et=Zo(tt+Et,0)),sr(B,X,Et)}function z6(B){var X=B==null?0:B.length;return X?Nc(B,0,-1):[]}var FA=Li(function(B){var X=ar(B,cb);return X.length&&X[0]===B[0]?g6(X):[]}),Qm=Li(function(B){var X=Kc(B),Ae=ar(B,cb);return X===Kc(Ae)?X=n:Ae.pop(),Ae.length&&Ae[0]===B[0]?g6(Ae,Zs(X,2)):[]}),H6=Li(function(B){var X=Kc(B),Ae=ar(B,cb);return X=typeof X=="function"?X:n,X&&Ae.pop(),Ae.length&&Ae[0]===B[0]?g6(Ae,n,X):[]});function Zm(B,X){return B==null?"":i6.call(B,X)}function Kc(B){var X=B==null?0:B.length;return X?B[X-1]:n}function Nv(B,X,Ae){var tt=B==null?0:B.length;if(!tt)return-1;var Et=tt;return Ae!==n&&(Et=Ri(Ae),Et=Et<0?Zo(tt+Et,0):gc(Et,tt-1)),X===X?z(B,X,Et):lr(B,Lr,Et,!0)}function OA(B,X){return B&&B.length?w6(B,Ri(X)):n}var V6=Li(Sv);function Sv(B,X){return B&&B.length&&X&&X.length?zo(B,X):B}function Yc(B,X,Ae){return B&&B.length&&X&&X.length?zo(B,X,Zs(Ae,2)):B}function Jm(B,X,Ae){return B&&B.length&&X&&X.length?zo(B,X,n,Ae):B}var Pf=wh(function(B,X){var Ae=B==null?0:B.length,tt=p6(B,X);return ml(B,ar(X,function(Et){return co(Et,Ae)?+Et:Et}).sort(pA)),tt});function yu(B,X){var Ae=[];if(!(B&&B.length))return Ae;var tt=-1,Et=[],an=B.length;for(X=Zs(X,3);++tt<an;){var In=B[tt];X(In,tt,B)&&(Ae.push(In),Et.push(tt))}return ml(B,Et),Ae}function W6(B){return B==null?B:a6.call(B)}function MA(B,X,Ae){var tt=B==null?0:B.length;return tt?(Ae&&typeof Ae!="number"&&Gc(B,X,Ae)?(X=0,Ae=tt):(X=X==null?0:Ri(X),Ae=Ae===n?tt:Ri(Ae)),Nc(B,X,Ae)):[]}function LA(B,X){return ob(B,X)}function tH(B,X,Ae){return N6(B,X,Zs(Ae,2))}function e0(B,X){var Ae=B==null?0:B.length;if(Ae){var tt=ob(B,X);if(tt<Ae&&Rp(B[tt],X))return tt}return-1}function tI(B,X){return ob(B,X,!0)}function RA(B,X,Ae){return N6(B,X,Zs(Ae,2),!0)}function $x(B,X){var Ae=B==null?0:B.length;if(Ae){var tt=ob(B,X,!0)-1;if(Rp(B[tt],X))return tt}return-1}function DA(B){return B&&B.length?cA(B):[]}function Ux(B,X){return B&&B.length?cA(B,Zs(X,2)):[]}function nI(B){var X=B==null?0:B.length;return X?Nc(B,1,X):[]}function rI(B,X,Ae){return B&&B.length?(X=Ae||X===n?1:Ri(X),Nc(B,0,X<0?0:X)):[]}function BA(B,X,Ae){var tt=B==null?0:B.length;return tt?(X=Ae||X===n?1:Ri(X),X=tt-X,Nc(B,X<0?0:X,tt)):[]}function q6(B,X){return B&&B.length?lv(B,Zs(X,3),!1,!0):[]}function nH(B,X){return B&&B.length?lv(B,Zs(X,3)):[]}var rH=Li(function(B){return Ip(Po(B,1,bl,!0))}),sI=Li(function(B){var X=Kc(B);return bl(X)&&(X=n),Ip(Po(B,1,bl,!0),Zs(X,2))}),iI=Li(function(B){var X=Kc(B);return X=typeof X=="function"?X:n,Ip(Po(B,1,bl,!0),n,X)});function zx(B){return B&&B.length?Ip(B):[]}function sH(B,X){return B&&B.length?Ip(B,Zs(X,2)):[]}function gb(B,X){return X=typeof X=="function"?X:n,B&&B.length?Ip(B,n,X):[]}function G6(B){if(!(B&&B.length))return[];var X=0;return B=$r(B,function(Ae){if(bl(Ae))return X=Zo(Ae.length,X),!0}),xs(X,function(Ae){return ar(B,ys(Ae))})}function No(B,X){if(!(B&&B.length))return[];var Ae=G6(B);return X==null?Ae:ar(Ae,function(tt){return Gn(X,n,tt)})}var iH=Li(function(B,X){return bl(B)?mh(B,X):[]}),aI=Li(function(B){return j6($r(B,bl))}),aH=Li(function(B){var X=Kc(B);return bl(X)&&(X=n),j6($r(B,bl),Zs(X,2))}),oH=Li(function(B){var X=Kc(B);return X=typeof X=="function"?X:n,j6($r(B,bl),n,X)}),oI=Li(G6);function lI(B,X){return cv(B||[],X||[],Px)}function lH(B,X){return cv(B||[],X||[],Lx)}var Bd=Li(function(B){var X=B.length,Ae=X>1?B[X-1]:n;return Ae=typeof Ae=="function"?(B.pop(),Ae):n,No(B,Ae)});function K6(B){var X=Xt(B);return X.__chain__=!0,X}function cH(B,X){return X(B),B}function If(B,X){return X(B)}var Y6=wh(function(B){var X=B.length,Ae=X?B[0]:0,tt=this.__wrapped__,Et=function(an){return p6(an,B)};return X>1||this.__actions__.length||!(tt instanceof _i)||!co(Ae)?this.thru(Et):(tt=tt.slice(Ae,+Ae+(X?1:0)),tt.__actions__.push({func:If,args:[Et],thisArg:n}),new bc(tt,this.__chain__).thru(function(an){return X&&!an.length&&an.push(n),an}))});function Hx(){return K6(this)}function X6(){return new bc(this.value(),this.__chain__)}function $A(){this.__values__===n&&(this.__values__=Jfe(this.value()));var B=this.__index__>=this.__values__.length,X=B?n:this.__values__[this.__index__++];return{done:B,value:X}}function UA(){return this}function uH(B){for(var X,Ae=this;Ae instanceof dh;){var tt=eI(Ae);tt.__index__=0,tt.__values__=n,X?Et.__wrapped__=tt:X=tt;var Et=tt;Ae=Ae.__wrapped__}return Et.__wrapped__=B,X}function zA(){var B=this.__wrapped__;if(B instanceof _i){var X=B;return this.__actions__.length&&(X=new _i(this)),X=X.reverse(),X.__actions__.push({func:If,args:[W6],thisArg:n}),new bc(X,this.__chain__)}return this.thru(W6)}function dH(){return lb(this.__wrapped__,this.__actions__)}var cI=E6(function(B,X,Ae){Mi.call(B,Ae)?++B[Ae]:ph(B,Ae,1)});function uI(B,X,Ae){var tt=Ei(B)?Zr:nv;return Ae&&Gc(B,X,Ae)&&(X=n),tt(B,Zs(X,3))}function Q6(B,X){var Ae=Ei(B)?$r:eA;return Ae(B,Zs(X,3))}var Z6=Dx(Xm),dI=Dx(wv);function HA(B,X){return Po(nC(B,X),1)}function fI(B,X){return Po(nC(B,X),oe)}function VA(B,X,Ae){return Ae=Ae===n?1:Ri(Ae),Po(nC(B,X),Ae)}function jv(B,X){var Ae=Ei(B)?Jn:xh;return Ae(B,Zs(X,3))}function J6(B,X){var Ae=Ei(B)?Xn:FP;return Ae(B,Zs(X,3))}var eC=E6(function(B,X,Ae){Mi.call(B,Ae)?B[Ae].push(X):ph(B,Ae,[X])});function hI(B,X,Ae,tt){B=$d(B)?B:iC(B),Ae=Ae&&!tt?Ri(Ae):0;var Et=B.length;return Ae<0&&(Ae=Zo(Et+Ae,0)),mI(B)?Ae<=Et&&B.indexOf(X,Ae)>-1:!!Et&&sr(B,X,Ae)>-1}var fH=Li(function(B,X,Ae){var tt=-1,Et=typeof X=="function",an=$d(B)?sn(B.length):[];return xh(B,function(In){an[++tt]=Et?Gn(X,In,Ae):Od(In,X,Ae)}),an}),tC=E6(function(B,X,Ae){ph(B,Ae,X)});function nC(B,X){var Ae=Ei(B)?ar:sA;return Ae(B,Zs(X,3))}function Av(B,X,Ae,tt){return B==null?[]:(Ei(X)||(X=X==null?[]:[X]),Ae=tt?n:Ae,Ei(Ae)||(Ae=Ae==null?[]:[Ae]),av(B,X,Ae))}var hH=E6(function(B,X,Ae){B[Ae?0:1].push(X)},function(){return[[],[]]});function rC(B,X,Ae){var tt=Ei(B)?Ur:mr,Et=arguments.length<3;return tt(B,Zs(X,4),Ae,Et,xh)}function _(B,X,Ae){var tt=Ei(B)?bs:mr,Et=arguments.length<3;return tt(B,Zs(X,4),Ae,Et,FP)}function R(B,X){var Ae=Ei(B)?$r:eA;return Ae(B,$s(Zs(X,3)))}function ne(B){var X=Ei(B)?hh:Cc;return X(B)}function ye(B,X,Ae){(Ae?Gc(B,X,Ae):X===n)?X=1:X=Ri(X);var tt=Ei(B)?Tx:oA;return tt(B,X)}function Ue(B){var X=Ei(B)?PP:Ld;return X(B)}function et(B){if(B==null)return 0;if($d(B))return mI(B)?W(B):B.length;var X=ec(B);return X==st||X==jt?B.size:Pp(B).length}function Mt(B,X,Ae){var tt=Ei(B)?Sr:lA;return Ae&&Gc(B,X,Ae)&&(X=n),tt(B,Zs(X,3))}var _n=Li(function(B,X){if(B==null)return[];var Ae=X.length;return Ae>1&&Gc(B,X[0],X[1])?X=[]:Ae>2&&Gc(X[0],X[1],X[2])&&(X=[X[0]]),av(B,Po(X,1),[])}),Un=Qa||function(){return dr.Date.now()};function xr(B,X){if(typeof X!="function")throw new ao(o);return B=Ri(B),function(){if(--B<1)return X.apply(this,arguments)}}function Kr(B,X,Ae){return X=Ae?n:X,X=B&&X==null?B.length:X,vh(B,O,n,n,n,n,X)}function Jr(B,X){var Ae;if(typeof X!="function")throw new ao(o);return B=Ri(B),function(){return--B>0&&(Ae=X.apply(this,arguments)),B<=1&&(X=n),Ae}}var Wr=Li(function(B,X,Ae){var tt=C;if(Ae.length){var Et=St(Ae,Op(Wr));tt|=F}return vh(B,tt,X,Ae,Et)}),Ss=Li(function(B,X,Ae){var tt=C|S;if(Ae.length){var Et=St(Ae,Op(Ss));tt|=F}return vh(X,tt,B,Ae,Et)});function Fs(B,X,Ae){X=Ae?n:X;var tt=vh(B,I,n,n,n,n,n,X);return tt.placeholder=Fs.placeholder,tt}function Bs(B,X,Ae){X=Ae?n:X;var tt=vh(B,L,n,n,n,n,n,X);return tt.placeholder=Bs.placeholder,tt}function Io(B,X,Ae){var tt,Et,an,In,zn,ir,Rr=0,Dr=!1,Xr=!1,ws=!0;if(typeof B!="function")throw new ao(o);X=Nh(X)||0,Ho(Ae)&&(Dr=!!Ae.leading,Xr="maxWait"in Ae,an=Xr?Zo(Nh(Ae.maxWait)||0,X):an,ws="trailing"in Ae?!!Ae.trailing:ws);function Vs(yl){var Dp=tt,qx=Et;return tt=Et=n,Rr=yl,In=B.apply(qx,Dp),In}function ri(yl){return Rr=yl,zn=mb(Yi,X),Dr?Vs(yl):In}function Di(yl){var Dp=yl-ir,qx=yl-Rr,fhe=X-Dp;return Xr?gc(fhe,an-qx):fhe}function si(yl){var Dp=yl-ir,qx=yl-Rr;return ir===n||Dp>=X||Dp<0||Xr&&qx>=an}function Yi(){var yl=Un();if(si(yl))return ta(yl);zn=mb(Yi,Di(yl))}function ta(yl){return zn=n,ws&&tt?Vs(yl):(tt=Et=n,In)}function Of(){zn!==n&&fA(zn),Rr=0,tt=ir=Et=zn=n}function Zu(){return zn===n?In:ta(Un())}function Mf(){var yl=Un(),Dp=si(yl);if(tt=arguments,Et=this,ir=yl,Dp){if(zn===n)return ri(ir);if(Xr)return fA(zn),zn=mb(Yi,X),Vs(ir)}return zn===n&&(zn=mb(Yi,X)),In}return Mf.cancel=Of,Mf.flush=Zu,Mf}var cr=Li(function(B,X){return J8(B,1,X)}),Kn=Li(function(B,X,Ae){return J8(B,Nh(X)||0,Ae)});function fr(B){return vh(B,Y)}function is(B,X){if(typeof B!="function"||X!=null&&typeof X!="function")throw new ao(o);var Ae=function(){var tt=arguments,Et=X?X.apply(this,tt):tt[0],an=Ae.cache;if(an.has(Et))return an.get(Et);var In=B.apply(this,tt);return Ae.cache=an.set(Et,In)||an,In};return Ae.cache=new(is.Cache||Td),Ae}is.Cache=Td;function $s(B){if(typeof B!="function")throw new ao(o);return function(){var X=arguments;switch(X.length){case 0:return!B.call(this);case 1:return!B.call(this,X[0]);case 2:return!B.call(this,X[0],X[1]);case 3:return!B.call(this,X[0],X[1],X[2])}return!B.apply(this,X)}}function Ys(B){return Jr(2,B)}var Xs=RP(function(B,X){X=X.length==1&&Ei(X[0])?ar(X[0],vs(Zs())):ar(Po(X,1),vs(Zs()));var Ae=X.length;return Li(function(tt){for(var Et=-1,an=gc(tt.length,Ae);++Et<an;)tt[Et]=X[Et].call(this,tt[Et]);return Gn(B,this,tt)})}),ti=Li(function(B,X){var Ae=St(X,Op(ti));return vh(B,F,n,X,Ae)}),gl=Li(function(B,X){var Ae=St(X,Op(gl));return vh(B,$,n,X,Ae)}),pa=wh(function(B,X){return vh(B,U,n,n,n,X)});function t0(B,X){if(typeof B!="function")throw new ao(o);return X=X===n?X:Ri(X),Li(B,X)}function pH(B,X){if(typeof B!="function")throw new ao(o);return X=X==null?0:Zo(Ri(X),0),Li(function(Ae){var tt=Ae[X],Et=Fp(Ae,0,X);return tt&&Vr(Et,tt),Gn(B,this,Et)})}function XKe(B,X,Ae){var tt=!0,Et=!0;if(typeof B!="function")throw new ao(o);return Ho(Ae)&&(tt="leading"in Ae?!!Ae.leading:tt,Et="trailing"in Ae?!!Ae.trailing:Et),Io(B,X,{leading:tt,maxWait:X,trailing:Et})}function QKe(B){return Kr(B,1)}function ZKe(B,X){return ti(A6(X),B)}function JKe(){if(!arguments.length)return[];var B=arguments[0];return Ei(B)?B:[B]}function eYe(B){return xu(B,g)}function tYe(B,X){return X=typeof X=="function"?X:n,xu(B,g,X)}function nYe(B){return xu(B,f|g)}function rYe(B,X){return X=typeof X=="function"?X:n,xu(B,f|g,X)}function sYe(B,X){return X==null||tv(B,X,Sc(X))}function Rp(B,X){return B===X||B!==B&&X!==X}var iYe=F6(Wm),aYe=F6(function(B,X){return B>=X}),_v=b6(function(){return arguments}())?b6:function(B){return el(B)&&Mi.call(B,"callee")&&!n6.call(B,"callee")},Ei=sn.isArray,oYe=le?vs(le):MP;function $d(B){return B!=null&&pI(B.length)&&!Vx(B)}function bl(B){return el(B)&&$d(B)}function lYe(B){return B===!0||B===!1||el(B)&&Zl(B)==je}var bb=Y8||jH,cYe=Me?vs(Me):Tp;function uYe(B){return el(B)&&B.nodeType===1&&!WA(B)}function dYe(B){if(B==null)return!0;if($d(B)&&(Ei(B)||typeof B=="string"||typeof B.splice=="function"||bb(B)||sC(B)||_v(B)))return!B.length;var X=ec(B);if(X==st||X==jt)return!B.size;if(Mp(B))return!Pp(B).length;for(var Ae in B)if(Mi.call(B,Ae))return!1;return!0}function fYe(B,X){return Md(B,X)}function hYe(B,X,Ae){Ae=typeof Ae=="function"?Ae:n;var tt=Ae?Ae(B,X):n;return tt===n?Md(B,X,n,Ae):!!tt}function mH(B){if(!el(B))return!1;var X=Zl(B);return X==Qe||X==Re||typeof B.message=="string"&&typeof B.name=="string"&&!WA(B)}function pYe(B){return typeof B=="number"&&K1(B)}function Vx(B){if(!Ho(B))return!1;var X=Zl(B);return X==Ye||X==dt||X==we||X==yt}function Yfe(B){return typeof B=="number"&&B==Ri(B)}function pI(B){return typeof B=="number"&&B>-1&&B%1==0&&B<=K}function Ho(B){var X=typeof B;return B!=null&&(X=="object"||X=="function")}function el(B){return B!=null&&typeof B=="object"}var Xfe=ft?vs(ft):LP;function mYe(B,X){return B===X||sb(B,X,xv(X))}function xYe(B,X,Ae){return Ae=typeof Ae=="function"?Ae:n,sb(B,X,xv(X),Ae)}function gYe(B){return Qfe(B)&&B!=+B}function bYe(B){if(eH(B))throw new Cr(a);return nA(B)}function yYe(B){return B===null}function vYe(B){return B==null}function Qfe(B){return typeof B=="number"||el(B)&&Zl(B)==at}function WA(B){if(!el(B)||Zl(B)!=qe)return!1;var X=Sf(B);if(X===null)return!0;var Ae=Mi.call(X,"constructor")&&X.constructor;return typeof Ae=="function"&&Ae instanceof Ae&&kd.call(Ae)==e6}var xH=ut?vs(ut):sv;function wYe(B){return Yfe(B)&&B>=-9007199254740991&&B<=K}var Zfe=on?vs(on):gh;function mI(B){return typeof B=="string"||!Ei(B)&&el(B)&&Zl(B)==un}function Ff(B){return typeof B=="symbol"||el(B)&&Zl(B)==vn}var sC=bn?vs(bn):iv;function CYe(B){return B===n}function NYe(B){return el(B)&&ec(B)==ln}function SYe(B){return el(B)&&Zl(B)==Nn}var jYe=F6(qm),AYe=F6(function(B,X){return B<=X});function Jfe(B){if(!B)return[];if($d(B))return mI(B)?J(B):Wc(B);if(jp&&B[jp])return Ql(B[jp]());var X=ec(B),Ae=X==st?Ci:X==jt?w:iC;return Ae(B)}function Wx(B){if(!B)return B===0?B:0;if(B=Nh(B),B===oe||B===-1/0){var X=B<0?-1:1;return X*H}return B===B?B:0}function Ri(B){var X=Wx(B),Ae=X%1;return X===X?Ae?X-Ae:X:0}function ehe(B){return B?_p(Ri(B),0,se):0}function Nh(B){if(typeof B=="number")return B;if(Ff(B))return ee;if(Ho(B)){var X=typeof B.valueOf=="function"?B.valueOf():B;B=Ho(X)?X+"":X}if(typeof B!="string")return B===0?B:+B;B=hs(B);var Ae=Gt.test(B);return Ae||gt.test(B)?nr(B.slice(2),Ae?2:8):kn.test(B)?ee:+B}function the(B){return Af(B,Ud(B))}function _Ye(B){return B?_p(Ri(B),-9007199254740991,K):B===0?B:0}function Fa(B){return B==null?"":gu(B)}var EYe=ub(function(B,X){if(Mp(X)||$d(X)){Af(X,Sc(X),B);return}for(var Ae in X)Mi.call(X,Ae)&&Px(B,Ae,X[Ae])}),nhe=ub(function(B,X){Af(X,Ud(X),B)}),xI=ub(function(B,X,Ae,tt){Af(X,Ud(X),B,tt)}),kYe=ub(function(B,X,Ae,tt){Af(X,Sc(X),B,tt)}),TYe=wh(p6);function PYe(B,X){var Ae=J1(B);return X==null?Ae:Ja(Ae,X)}var IYe=Li(function(B,X){B=Is(B);var Ae=-1,tt=X.length,Et=tt>2?X[2]:n;for(Et&&Gc(X[0],X[1],Et)&&(tt=1);++Ae<tt;)for(var an=X[Ae],In=Ud(an),zn=-1,ir=In.length;++zn<ir;){var Rr=In[zn],Dr=B[Rr];(Dr===n||Rp(Dr,Ia[Rr])&&!Mi.call(B,Rr))&&(B[Rr]=an[Rr])}return B}),FYe=Li(function(B){return B.push(n,wA),Gn(rhe,n,B)});function OYe(B,X){return Yt(B,Zs(X,3),Yu)}function MYe(B,X){return Yt(B,Zs(X,3),Vm)}function LYe(B,X){return B==null?B:m6(B,Zs(X,3),Ud)}function RYe(B,X){return B==null?B:rv(B,Zs(X,3),Ud)}function DYe(B,X){return B&&Yu(B,Zs(X,3))}function BYe(B,X){return B&&Vm(B,Zs(X,3))}function $Ye(B){return B==null?[]:rb(B,Sc(B))}function UYe(B){return B==null?[]:rb(B,Ud(B))}function gH(B,X,Ae){var tt=B==null?n:Ep(B,X);return tt===n?Ae:tt}function zYe(B,X){return B!=null&&AA(B,X,Fd)}function bH(B,X){return B!=null&&AA(B,X,Fx)}var HYe=HP(function(B,X,Ae){X!=null&&typeof X.toString!="function"&&(X=q2.call(X)),B[X]=Ae},vH(zd)),VYe=HP(function(B,X,Ae){X!=null&&typeof X.toString!="function"&&(X=q2.call(X)),Mi.call(B,X)?B[X].push(Ae):B[X]=[Ae]},Zs),WYe=Li(Od);function Sc(B){return $d(B)?fh(B):Pp(B)}function Ud(B){return $d(B)?fh(B,!0):rA(B)}function qYe(B,X){var Ae={};return X=Zs(X,3),Yu(B,function(tt,Et,an){ph(Ae,X(tt,Et,an),tt)}),Ae}function GYe(B,X){var Ae={};return X=Zs(X,3),Yu(B,function(tt,Et,an){ph(Ae,Et,X(tt,Et,an))}),Ae}var KYe=ub(function(B,X,Ae){Ox(B,X,Ae)}),rhe=ub(function(B,X,Ae,tt){Ox(B,X,Ae,tt)}),YYe=wh(function(B,X){var Ae={};if(B==null)return Ae;var tt=!1;X=ar(X,function(an){return an=yh(an,B),tt||(tt=an.length>1),an}),Af(B,pv(B),Ae),tt&&(Ae=xu(Ae,f|x|g,CA));for(var Et=X.length;Et--;)S6(Ae,X[Et]);return Ae});function XYe(B,X){return she(B,$s(Zs(X)))}var QYe=wh(function(B,X){return B==null?{}:aA(B,X)});function she(B,X){if(B==null)return{};var Ae=ar(pv(B),function(tt){return[tt]});return X=Zs(X),Gm(B,Ae,function(tt,Et){return X(tt,Et[0])})}function ZYe(B,X,Ae){X=yh(X,B);var tt=-1,Et=X.length;for(Et||(Et=1,B=n);++tt<Et;){var an=B==null?n:B[Tf(X[tt])];an===n&&(tt=Et,an=Ae),B=Vx(an)?an.call(B):an}return B}function JYe(B,X,Ae){return B==null?B:Lx(B,X,Ae)}function eXe(B,X,Ae,tt){return tt=typeof tt=="function"?tt:n,B==null?B:Lx(B,X,Ae,tt)}var ihe=yA(Sc),ahe=yA(Ud);function tXe(B,X,Ae){var tt=Ei(B),Et=tt||bb(B)||sC(B);if(X=Zs(X,4),Ae==null){var an=B&&B.constructor;Et?Ae=tt?new an:[]:Ho(B)?Ae=Vx(an)?J1(Sf(B)):{}:Ae={}}return(Et?Jn:Yu)(B,function(In,zn,ir){return X(Ae,In,zn,ir)}),Ae}function nXe(B,X){return B==null?!0:S6(B,X)}function rXe(B,X,Ae){return B==null?B:dA(B,X,A6(Ae))}function sXe(B,X,Ae,tt){return tt=typeof tt=="function"?tt:n,B==null?B:dA(B,X,A6(Ae),tt)}function iC(B){return B==null?[]:vi(B,Sc(B))}function iXe(B){return B==null?[]:vi(B,Ud(B))}function aXe(B,X,Ae){return Ae===n&&(Ae=X,X=n),Ae!==n&&(Ae=Nh(Ae),Ae=Ae===Ae?Ae:0),X!==n&&(X=Nh(X),X=X===X?X:0),_p(Nh(B),X,Ae)}function oXe(B,X,Ae){return X=Wx(X),Ae===n?(Ae=X,X=0):Ae=Wx(Ae),B=Nh(B),tA(B,X,Ae)}function lXe(B,X,Ae){if(Ae&&typeof Ae!="boolean"&&Gc(B,X,Ae)&&(X=Ae=n),Ae===n&&(typeof X=="boolean"?(Ae=X,X=n):typeof B=="boolean"&&(Ae=B,B=n)),B===n&&X===n?(B=0,X=1):(B=Wx(B),X===n?(X=B,B=0):X=Wx(X)),B>X){var tt=B;B=X,X=tt}if(Ae||B%1||X%1){var Et=X2();return gc(B+Et*(X-B+Fr("1e-"+((Et+"").length-1))),X)}return ab(B,X)}var cXe=Rx(function(B,X,Ae){return X=X.toLowerCase(),B+(Ae?ohe(X):X)});function ohe(B){return yH(Fa(B).toLowerCase())}function lhe(B){return B=Fa(B),B&&B.replace(jn,Ls).replace(Lt,"")}function uXe(B,X,Ae){B=Fa(B),X=gu(X);var tt=B.length;Ae=Ae===n?tt:_p(Ri(Ae),0,tt);var Et=Ae;return Ae-=X.length,Ae>=0&&B.slice(Ae,Et)==X}function dXe(B){return B=Fa(B),B&&Cn.test(B)?B.replace(hn,Pa):B}function fXe(B){return B=Fa(B),B&&Sn.test(B)?B.replace(tr,"\\$&"):B}var hXe=Rx(function(B,X,Ae){return B+(Ae?"-":"")+X.toLowerCase()}),pXe=Rx(function(B,X,Ae){return B+(Ae?" ":"")+X.toLowerCase()}),mXe=xA("toLowerCase");function xXe(B,X,Ae){B=Fa(B),X=Ri(X);var tt=X?W(B):0;if(!X||tt>=X)return B;var Et=(X-tt)/2;return fv(Dm(Et),Ae)+B+fv(Ax(Et),Ae)}function gXe(B,X,Ae){B=Fa(B),X=Ri(X);var tt=X?W(B):0;return X&&tt<X?B+fv(X-tt,Ae):B}function bXe(B,X,Ae){B=Fa(B),X=Ri(X);var tt=X?W(B):0;return X&&tt<X?fv(X-tt,Ae)+B:B}function yXe(B,X,Ae){return Ae||X==null?X=0:X&&(X=+X),jP(Fa(B).replace(ze,""),X||0)}function vXe(B,X,Ae){return(Ae?Gc(B,X,Ae):X===n)?X=1:X=Ri(X),Mx(Fa(B),X)}function wXe(){var B=arguments,X=Fa(B[0]);return B.length<3?X:X.replace(B[1],B[2])}var CXe=Rx(function(B,X,Ae){return B+(Ae?"_":"")+X.toLowerCase()});function NXe(B,X,Ae){return Ae&&typeof Ae!="number"&&Gc(B,X,Ae)&&(X=Ae=n),Ae=Ae===n?se:Ae>>>0,Ae?(B=Fa(B),B&&(typeof X=="string"||X!=null&&!xH(X))&&(X=gu(X),!X&&Xo(B))?Fp(J(B),0,Ae):B.split(X,Ae)):[]}var SXe=Rx(function(B,X,Ae){return B+(Ae?" ":"")+yH(X)});function jXe(B,X,Ae){return B=Fa(B),Ae=Ae==null?0:_p(Ri(Ae),0,B.length),X=gu(X),B.slice(Ae,Ae+X.length)==X}function AXe(B,X,Ae){var tt=Xt.templateSettings;Ae&&Gc(B,X,Ae)&&(X=n),B=Fa(B),X=xI({},X,tt,vA);var Et=xI({},X.imports,tt.imports,vA),an=Sc(Et),In=vi(Et,an),zn,ir,Rr=0,Dr=X.interpolate||kt,Xr="__p += '",ws=ni((X.escape||kt).source+"|"+Dr.source+"|"+(Dr===Mn?Ft:kt).source+"|"+(X.evaluate||kt).source+"|$","g"),Vs="//# sourceURL="+(Mi.call(X,"sourceURL")?(X.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++hr+"]")+`
`;B.replace(ws,function(si,Yi,ta,Of,Zu,Mf){return ta||(ta=Of),Xr+=B.slice(Rr,Mf).replace(cn,Wu),Yi&&(zn=!0,Xr+=`' +
__e(`+Yi+`) +
'`),Zu&&(ir=!0,Xr+=`';
`+Zu+`;
__p += '`),ta&&(Xr+=`' +
((__t = (`+ta+`)) == null ? '' : __t) +
'`),Rr=Mf+si.length,si}),Xr+=`';
`;var ri=Mi.call(X,"variable")&&X.variable;if(!ri)Xr=`with (obj) {
`+Xr+`
}
`;else if(It.test(ri))throw new Cr(l);Xr=(ir?Xr.replace(ct,""):Xr).replace(Nt,"$1").replace(Ht,"$1;"),Xr="function("+(ri||"obj")+`) {
`+(ri?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(zn?", __e = _.escape":"")+(ir?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+Xr+`return __p
}`;var Di=uhe(function(){return kr(an,Vs+"return "+Xr).apply(n,In)});if(Di.source=Xr,mH(Di))throw Di;return Di}function _Xe(B){return Fa(B).toLowerCase()}function EXe(B){return Fa(B).toUpperCase()}function kXe(B,X,Ae){if(B=Fa(B),B&&(Ae||X===n))return hs(B);if(!B||!(X=gu(X)))return B;var tt=J(B),Et=J(X),an=As(tt,Et),In=Ts(tt,Et)+1;return Fp(tt,an,In).join("")}function TXe(B,X,Ae){if(B=Fa(B),B&&(Ae||X===n))return B.slice(0,de(B)+1);if(!B||!(X=gu(X)))return B;var tt=J(B),Et=Ts(tt,J(X))+1;return Fp(tt,0,Et).join("")}function PXe(B,X,Ae){if(B=Fa(B),B&&(Ae||X===n))return B.replace(ze,"");if(!B||!(X=gu(X)))return B;var tt=J(B),Et=As(tt,J(X));return Fp(tt,Et).join("")}function IXe(B,X){var Ae=re,tt=Q;if(Ho(X)){var Et="separator"in X?X.separator:Et;Ae="length"in X?Ri(X.length):Ae,tt="omission"in X?gu(X.omission):tt}B=Fa(B);var an=B.length;if(Xo(B)){var In=J(B);an=In.length}if(Ae>=an)return B;var zn=Ae-W(tt);if(zn<1)return tt;var ir=In?Fp(In,0,zn).join(""):B.slice(0,zn);if(Et===n)return ir+tt;if(In&&(zn+=ir.length-zn),xH(Et)){if(B.slice(zn).search(Et)){var Rr,Dr=ir;for(Et.global||(Et=ni(Et.source,Fa(Tn.exec(Et))+"g")),Et.lastIndex=0;Rr=Et.exec(Dr);)var Xr=Rr.index;ir=ir.slice(0,Xr===n?zn:Xr)}}else if(B.indexOf(gu(Et),zn)!=zn){var ws=ir.lastIndexOf(Et);ws>-1&&(ir=ir.slice(0,ws))}return ir+tt}function FXe(B){return B=Fa(B),B&&yn.test(B)?B.replace(Rt,Ee):B}var OXe=Rx(function(B,X,Ae){return B+(Ae?" ":"")+X.toUpperCase()}),yH=xA("toUpperCase");function che(B,X,Ae){return B=Fa(B),X=Ae?n:X,X===n?qu(B)?_t(B):ht(B):B.match(X)||[]}var uhe=Li(function(B,X){try{return Gn(B,n,X)}catch(Ae){return mH(Ae)?Ae:new Cr(Ae)}}),MXe=wh(function(B,X){return Jn(X,function(Ae){Ae=Tf(Ae),ph(B,Ae,Wr(B[Ae],B))}),B});function LXe(B){var X=B==null?0:B.length,Ae=Zs();return B=X?ar(B,function(tt){if(typeof tt[1]!="function")throw new ao(o);return[Ae(tt[0]),tt[1]]}):[],Li(function(tt){for(var Et=-1;++Et<X;){var an=B[Et];if(Gn(an[0],this,tt))return Gn(an[1],this,tt)}})}function RXe(B){return IP(xu(B,f))}function vH(B){return function(){return B}}function DXe(B,X){return B==null||B!==B?X:B}var BXe=P6(),$Xe=P6(!0);function zd(B){return B}function wH(B){return ib(typeof B=="function"?B:xu(B,f))}function UXe(B){return v6(xu(B,f))}function zXe(B,X){return lo(B,xu(X,f))}var HXe=Li(function(B,X){return function(Ae){return Od(Ae,B,X)}}),VXe=Li(function(B,X){return function(Ae){return Od(B,Ae,X)}});function CH(B,X,Ae){var tt=Sc(X),Et=rb(X,tt);Ae==null&&!(Ho(X)&&(Et.length||!tt.length))&&(Ae=X,X=B,B=this,Et=rb(X,Sc(X)));var an=!(Ho(Ae)&&"chain"in Ae)||!!Ae.chain,In=Vx(B);return Jn(Et,function(zn){var ir=X[zn];B[zn]=ir,In&&(B.prototype[zn]=function(){var Rr=this.__chain__;if(an||Rr){var Dr=B(this.__wrapped__),Xr=Dr.__actions__=Wc(this.__actions__);return Xr.push({func:ir,args:arguments,thisArg:B}),Dr.__chain__=Rr,Dr}return ir.apply(B,Vr([this.value()],arguments))})}),B}function WXe(){return dr._===this&&(dr._=wP),this}function NH(){}function qXe(B){return B=Ri(B),Li(function(X){return w6(X,B)})}var GXe=I6(ar),KXe=I6(Zr),YXe=I6(Sr);function dhe(B){return _s(B)?ys(Tf(B)):Co(B)}function XXe(B){return function(X){return B==null?n:Ep(B,X)}}var QXe=bA(),ZXe=bA(!0);function SH(){return[]}function jH(){return!1}function JXe(){return{}}function eQe(){return""}function tQe(){return!0}function nQe(B,X){if(B=Ri(B),B<1||B>K)return[];var Ae=se,tt=gc(B,se);X=Zs(X),B-=se;for(var Et=xs(tt,X);++Ae<B;)X(Ae);return Et}function rQe(B){return Ei(B)?ar(B,Tf):Ff(B)?[B]:Wc(TA(Fa(B)))}function sQe(B){var X=++Rm;return Fa(B)+X}var iQe=dv(function(B,X){return B+X},0),aQe=Jl("ceil"),oQe=dv(function(B,X){return B/X},1),lQe=Jl("floor");function cQe(B){return B&&B.length?Ix(B,zd,Wm):n}function uQe(B,X){return B&&B.length?Ix(B,Zs(X,2),Wm):n}function dQe(B){return ss(B,zd)}function fQe(B,X){return ss(B,Zs(X,2))}function hQe(B){return B&&B.length?Ix(B,zd,qm):n}function pQe(B,X){return B&&B.length?Ix(B,Zs(X,2),qm):n}var mQe=dv(function(B,X){return B*X},1),xQe=Jl("round"),gQe=dv(function(B,X){return B-X},0);function bQe(B){return B&&B.length?qr(B,zd):0}function yQe(B,X){return B&&B.length?qr(B,Zs(X,2)):0}return Xt.after=xr,Xt.ary=Kr,Xt.assign=EYe,Xt.assignIn=nhe,Xt.assignInWith=xI,Xt.assignWith=kYe,Xt.at=TYe,Xt.before=Jr,Xt.bind=Wr,Xt.bindAll=MXe,Xt.bindKey=Ss,Xt.castArray=JKe,Xt.chain=K6,Xt.chunk=$6,Xt.compact=PA,Xt.concat=Dd,Xt.cond=LXe,Xt.conforms=RXe,Xt.constant=vH,Xt.countBy=cI,Xt.create=PYe,Xt.curry=Fs,Xt.curryRight=Bs,Xt.debounce=Io,Xt.defaults=IYe,Xt.defaultsDeep=FYe,Xt.defer=cr,Xt.delay=Kn,Xt.difference=ea,Xt.differenceBy=Ll,Xt.differenceWith=Jo,Xt.drop=nc,Xt.dropRight=Qu,Xt.dropRightWhile=xb,Xt.dropWhile=xl,Xt.fill=vv,Xt.filter=Q6,Xt.flatMap=HA,Xt.flatMapDeep=fI,Xt.flatMapDepth=VA,Xt.flatten=U6,Xt.flattenDeep=Cv,Xt.flattenDepth=bu,Xt.flip=fr,Xt.flow=BXe,Xt.flowRight=$Xe,Xt.fromPairs=IA,Xt.functions=$Ye,Xt.functionsIn=UYe,Xt.groupBy=eC,Xt.initial=z6,Xt.intersection=FA,Xt.intersectionBy=Qm,Xt.intersectionWith=H6,Xt.invert=HYe,Xt.invertBy=VYe,Xt.invokeMap=fH,Xt.iteratee=wH,Xt.keyBy=tC,Xt.keys=Sc,Xt.keysIn=Ud,Xt.map=nC,Xt.mapKeys=qYe,Xt.mapValues=GYe,Xt.matches=UXe,Xt.matchesProperty=zXe,Xt.memoize=is,Xt.merge=KYe,Xt.mergeWith=rhe,Xt.method=HXe,Xt.methodOf=VXe,Xt.mixin=CH,Xt.negate=$s,Xt.nthArg=qXe,Xt.omit=YYe,Xt.omitBy=XYe,Xt.once=Ys,Xt.orderBy=Av,Xt.over=GXe,Xt.overArgs=Xs,Xt.overEvery=KXe,Xt.overSome=YXe,Xt.partial=ti,Xt.partialRight=gl,Xt.partition=hH,Xt.pick=QYe,Xt.pickBy=she,Xt.property=dhe,Xt.propertyOf=XXe,Xt.pull=V6,Xt.pullAll=Sv,Xt.pullAllBy=Yc,Xt.pullAllWith=Jm,Xt.pullAt=Pf,Xt.range=QXe,Xt.rangeRight=ZXe,Xt.rearg=pa,Xt.reject=R,Xt.remove=yu,Xt.rest=t0,Xt.reverse=W6,Xt.sampleSize=ye,Xt.set=JYe,Xt.setWith=eXe,Xt.shuffle=Ue,Xt.slice=MA,Xt.sortBy=_n,Xt.sortedUniq=DA,Xt.sortedUniqBy=Ux,Xt.split=NXe,Xt.spread=pH,Xt.tail=nI,Xt.take=rI,Xt.takeRight=BA,Xt.takeRightWhile=q6,Xt.takeWhile=nH,Xt.tap=cH,Xt.throttle=XKe,Xt.thru=If,Xt.toArray=Jfe,Xt.toPairs=ihe,Xt.toPairsIn=ahe,Xt.toPath=rQe,Xt.toPlainObject=the,Xt.transform=tXe,Xt.unary=QKe,Xt.union=rH,Xt.unionBy=sI,Xt.unionWith=iI,Xt.uniq=zx,Xt.uniqBy=sH,Xt.uniqWith=gb,Xt.unset=nXe,Xt.unzip=G6,Xt.unzipWith=No,Xt.update=rXe,Xt.updateWith=sXe,Xt.values=iC,Xt.valuesIn=iXe,Xt.without=iH,Xt.words=che,Xt.wrap=ZKe,Xt.xor=aI,Xt.xorBy=aH,Xt.xorWith=oH,Xt.zip=oI,Xt.zipObject=lI,Xt.zipObjectDeep=lH,Xt.zipWith=Bd,Xt.entries=ihe,Xt.entriesIn=ahe,Xt.extend=nhe,Xt.extendWith=xI,CH(Xt,Xt),Xt.add=iQe,Xt.attempt=uhe,Xt.camelCase=cXe,Xt.capitalize=ohe,Xt.ceil=aQe,Xt.clamp=aXe,Xt.clone=eYe,Xt.cloneDeep=nYe,Xt.cloneDeepWith=rYe,Xt.cloneWith=tYe,Xt.conformsTo=sYe,Xt.deburr=lhe,Xt.defaultTo=DXe,Xt.divide=oQe,Xt.endsWith=uXe,Xt.eq=Rp,Xt.escape=dXe,Xt.escapeRegExp=fXe,Xt.every=uI,Xt.find=Z6,Xt.findIndex=Xm,Xt.findKey=OYe,Xt.findLast=dI,Xt.findLastIndex=wv,Xt.findLastKey=MYe,Xt.floor=lQe,Xt.forEach=jv,Xt.forEachRight=J6,Xt.forIn=LYe,Xt.forInRight=RYe,Xt.forOwn=DYe,Xt.forOwnRight=BYe,Xt.get=gH,Xt.gt=iYe,Xt.gte=aYe,Xt.has=zYe,Xt.hasIn=bH,Xt.head=Bx,Xt.identity=zd,Xt.includes=hI,Xt.indexOf=Lp,Xt.inRange=oXe,Xt.invoke=WYe,Xt.isArguments=_v,Xt.isArray=Ei,Xt.isArrayBuffer=oYe,Xt.isArrayLike=$d,Xt.isArrayLikeObject=bl,Xt.isBoolean=lYe,Xt.isBuffer=bb,Xt.isDate=cYe,Xt.isElement=uYe,Xt.isEmpty=dYe,Xt.isEqual=fYe,Xt.isEqualWith=hYe,Xt.isError=mH,Xt.isFinite=pYe,Xt.isFunction=Vx,Xt.isInteger=Yfe,Xt.isLength=pI,Xt.isMap=Xfe,Xt.isMatch=mYe,Xt.isMatchWith=xYe,Xt.isNaN=gYe,Xt.isNative=bYe,Xt.isNil=vYe,Xt.isNull=yYe,Xt.isNumber=Qfe,Xt.isObject=Ho,Xt.isObjectLike=el,Xt.isPlainObject=WA,Xt.isRegExp=xH,Xt.isSafeInteger=wYe,Xt.isSet=Zfe,Xt.isString=mI,Xt.isSymbol=Ff,Xt.isTypedArray=sC,Xt.isUndefined=CYe,Xt.isWeakMap=NYe,Xt.isWeakSet=SYe,Xt.join=Zm,Xt.kebabCase=hXe,Xt.last=Kc,Xt.lastIndexOf=Nv,Xt.lowerCase=pXe,Xt.lowerFirst=mXe,Xt.lt=jYe,Xt.lte=AYe,Xt.max=cQe,Xt.maxBy=uQe,Xt.mean=dQe,Xt.meanBy=fQe,Xt.min=hQe,Xt.minBy=pQe,Xt.stubArray=SH,Xt.stubFalse=jH,Xt.stubObject=JXe,Xt.stubString=eQe,Xt.stubTrue=tQe,Xt.multiply=mQe,Xt.nth=OA,Xt.noConflict=WXe,Xt.noop=NH,Xt.now=Un,Xt.pad=xXe,Xt.padEnd=gXe,Xt.padStart=bXe,Xt.parseInt=yXe,Xt.random=lXe,Xt.reduce=rC,Xt.reduceRight=_,Xt.repeat=vXe,Xt.replace=wXe,Xt.result=ZYe,Xt.round=xQe,Xt.runInContext=Tt,Xt.sample=ne,Xt.size=et,Xt.snakeCase=CXe,Xt.some=Mt,Xt.sortedIndex=LA,Xt.sortedIndexBy=tH,Xt.sortedIndexOf=e0,Xt.sortedLastIndex=tI,Xt.sortedLastIndexBy=RA,Xt.sortedLastIndexOf=$x,Xt.startCase=SXe,Xt.startsWith=jXe,Xt.subtract=gQe,Xt.sum=bQe,Xt.sumBy=yQe,Xt.template=AXe,Xt.times=nQe,Xt.toFinite=Wx,Xt.toInteger=Ri,Xt.toLength=ehe,Xt.toLower=_Xe,Xt.toNumber=Nh,Xt.toSafeInteger=_Ye,Xt.toString=Fa,Xt.toUpper=EXe,Xt.trim=kXe,Xt.trimEnd=TXe,Xt.trimStart=PXe,Xt.truncate=IXe,Xt.unescape=FXe,Xt.uniqueId=sQe,Xt.upperCase=OXe,Xt.upperFirst=yH,Xt.each=jv,Xt.eachRight=J6,Xt.first=Bx,CH(Xt,function(){var B={};return Yu(Xt,function(X,Ae){Mi.call(Xt.prototype,Ae)||(B[Ae]=X)}),B}(),{chain:!1}),Xt.VERSION=r,Jn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(B){Xt[B].placeholder=Xt}),Jn(["drop","take"],function(B,X){_i.prototype[B]=function(Ae){Ae=Ae===n?1:Zo(Ri(Ae),0);var tt=this.__filtered__&&!X?new _i(this):this.clone();return tt.__filtered__?tt.__takeCount__=gc(Ae,tt.__takeCount__):tt.__views__.push({size:gc(Ae,se),type:B+(tt.__dir__<0?"Right":"")}),tt},_i.prototype[B+"Right"]=function(Ae){return this.reverse()[B](Ae).reverse()}}),Jn(["filter","map","takeWhile"],function(B,X){var Ae=X+1,tt=Ae==fe||Ae==ie;_i.prototype[B]=function(Et){var an=this.clone();return an.__iteratees__.push({iteratee:Zs(Et,3),type:Ae}),an.__filtered__=an.__filtered__||tt,an}}),Jn(["head","last"],function(B,X){var Ae="take"+(X?"Right":"");_i.prototype[B]=function(){return this[Ae](1).value()[0]}}),Jn(["initial","tail"],function(B,X){var Ae="drop"+(X?"":"Right");_i.prototype[B]=function(){return this.__filtered__?new _i(this):this[Ae](1)}}),_i.prototype.compact=function(){return this.filter(zd)},_i.prototype.find=function(B){return this.filter(B).head()},_i.prototype.findLast=function(B){return this.reverse().find(B)},_i.prototype.invokeMap=Li(function(B,X){return typeof B=="function"?new _i(this):this.map(function(Ae){return Od(Ae,B,X)})}),_i.prototype.reject=function(B){return this.filter($s(Zs(B)))},_i.prototype.slice=function(B,X){B=Ri(B);var Ae=this;return Ae.__filtered__&&(B>0||X<0)?new _i(Ae):(B<0?Ae=Ae.takeRight(-B):B&&(Ae=Ae.drop(B)),X!==n&&(X=Ri(X),Ae=X<0?Ae.dropRight(-X):Ae.take(X-B)),Ae)},_i.prototype.takeRightWhile=function(B){return this.reverse().takeWhile(B).reverse()},_i.prototype.toArray=function(){return this.take(se)},Yu(_i.prototype,function(B,X){var Ae=/^(?:filter|find|map|reject)|While$/.test(X),tt=/^(?:head|last)$/.test(X),Et=Xt[tt?"take"+(X=="last"?"Right":""):X],an=tt||/^find/.test(X);Et&&(Xt.prototype[X]=function(){var In=this.__wrapped__,zn=tt?[1]:arguments,ir=In instanceof _i,Rr=zn[0],Dr=ir||Ei(In),Xr=function(Yi){var ta=Et.apply(Xt,Vr([Yi],zn));return tt&&ws?ta[0]:ta};Dr&&Ae&&typeof Rr=="function"&&Rr.length!=1&&(ir=Dr=!1);var ws=this.__chain__,Vs=!!this.__actions__.length,ri=an&&!ws,Di=ir&&!Vs;if(!an&&Dr){In=Di?In:new _i(this);var si=B.apply(In,zn);return si.__actions__.push({func:If,args:[Xr],thisArg:n}),new bc(si,ws)}return ri&&Di?B.apply(this,zn):(si=this.thru(Xr),ri?tt?si.value()[0]:si.value():si)})}),Jn(["pop","push","shift","sort","splice","unshift"],function(B){var X=oo[B],Ae=/^(?:push|sort|unshift)$/.test(B)?"tap":"thru",tt=/^(?:pop|shift)$/.test(B);Xt.prototype[B]=function(){var Et=arguments;if(tt&&!this.__chain__){var an=this.value();return X.apply(Ei(an)?an:[],Et)}return this[Ae](function(In){return X.apply(Ei(In)?In:[],Et)})}}),Yu(_i.prototype,function(B,X){var Ae=Xt[X];if(Ae){var tt=Ae.name+"";Mi.call(Q1,tt)||(Q1[tt]=[]),Q1[tt].push({name:X,func:Ae})}}),Q1[fb(n,S).name]=[{name:"wrapper",func:n}],_i.prototype.clone=c6,_i.prototype.reverse=Q8,_i.prototype.value=eb,Xt.prototype.at=Y6,Xt.prototype.chain=Hx,Xt.prototype.commit=X6,Xt.prototype.next=$A,Xt.prototype.plant=uH,Xt.prototype.reverse=zA,Xt.prototype.toJSON=Xt.prototype.valueOf=Xt.prototype.value=dH,Xt.prototype.first=Xt.prototype.head,jp&&(Xt.prototype[jp]=UA),Xt},gn=zt();gs?((gs.exports=gn)._=gn,rs._=gn):dr._=gn}).call(Dln)}(g_,g_.exports)),g_.exports}var $ln=Bln();const gNe=Pi($ln),Uln=({wallet:t="",wallets:e=[]})=>{const[n,r]=h.useState([]),[s,a]=h.useState(!0),[o,l]=h.useState({key:null,direction:null}),c=C=>C.filter(Boolean).map(S=>{var T,I;return typeof S=="string"?S.toLowerCase():((I=(T=S==null?void 0:S.wallet_address)==null?void 0:T.toLowerCase)==null?void 0:I.call(T))||""}).filter(Boolean);h.useEffect(()=>{(async()=>{a(!0);const S=e&&e.length?c(e):[t];if(!S[0]){r([]),a(!1);return}const T=Date.now()-30*24*60*60*1e3;try{const L=(await Promise.all(S.map(F=>Ns.post("https://api-ui.hyperliquid.xyz/info",{type:"userNonFundingLedgerUpdates",user:F,startTime:T})))).flatMap(F=>F.data||[]).sort((F,$)=>$.time-F.time);r(L)}catch(I){console.error("Error fetching transaction data:",I)}finally{a(!1)}})()},[t,JSON.stringify(e)]);const u=C=>{let S="asc";o.key===C&&(o.direction==="asc"?S="desc":o.direction==="desc"&&(S=null)),l({key:C,direction:S})},d=[...n].sort((C,S)=>{if(!o.key||!o.direction)return 0;const T=gNe.get(C,o.key),I=gNe.get(S,o.key);return T<I?o.direction==="asc"?-1:1:T>I?o.direction==="asc"?1:-1:0}),f=C=>{if(o.key===C){if(o.direction==="asc")return i.jsx(o2,{className:"inline ml-2 text-white"});if(o.direction==="desc")return i.jsx(a2,{className:"inline ml-2 text-white"})}return i.jsx(l2,{className:"inline ml-2 text-white"})},x=localStorage.getItem("isDateDepositWithdrawFormat")||"date",[g,y]=h.useState(x);h.useEffect(()=>{localStorage.setItem("isDateDepositWithdrawFormat",g)},[g]);const v=({date:C})=>{const[S,T]=h.useState(vo(C));return h.useEffect(()=>{const I=setInterval(()=>T(vo(C)),1e3);return()=>clearInterval(I)},[C]),i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope",children:S.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,S)=>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}):$c(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:["$",Ir(+C.delta.usdc)]}),i.jsx("td",{className:"break-all",children:l$(C.hash)})]},S))})]})})})};function pse(){return pse=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},pse.apply(null,arguments)}function bNe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function mse(t,e){return mse=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},mse(t,e)}function zln(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,mse(t,e)}var yNe=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Hln(t,e){return!!(t===e||yNe(t)&&yNe(e))}function Vln(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!Hln(t[n],e[n]))return!1;return!0}function lQ(t,e){e===void 0&&(e=Vln);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 Wln=typeof performance=="object"&&typeof performance.now=="function",vNe=Wln?function(){return performance.now()}:function(){return Date.now()};function wNe(t){cancelAnimationFrame(t.id)}function qln(t,e){var n=vNe();function r(){vNe()-n>=e?t.call(null):s.id=requestAnimationFrame(r)}var s={id:requestAnimationFrame(r)};return s}var cQ=-1;function CNe(t){if(t===void 0&&(t=!1),cQ===-1||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(e),cQ=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return cQ}var PC=null;function NNe(t){if(t===void 0&&(t=!1),PC===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?PC="positive-descending":(e.scrollLeft=1,e.scrollLeft===0?PC="negative":PC="positive-ascending"),document.body.removeChild(e),PC}return PC}var Gln=150,Kln=function(e,n){return e};function Yln(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){zln(x,f);function x(y){var v;return v=f.call(this,y)||this,v._instanceProps=c(v.props,bNe(v)),v._outerRef=void 0,v._resetIsScrollingTimeoutId=null,v.state={instance:bNe(v),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof v.props.initialScrollOffset=="number"?v.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},v._callOnItemsRendered=void 0,v._callOnItemsRendered=lQ(function(C,S,T,I){return v.props.onItemsRendered({overscanStartIndex:C,overscanStopIndex:S,visibleStartIndex:T,visibleStopIndex:I})}),v._callOnScroll=void 0,v._callOnScroll=lQ(function(C,S,T){return v.props.onScroll({scrollDirection:C,scrollOffset:S,scrollUpdateWasRequested:T})}),v._getItemStyle=void 0,v._getItemStyle=function(C){var S=v.props,T=S.direction,I=S.itemSize,L=S.layout,F=v._getItemStyleCache(u&&I,u&&L,u&&T),$;if(F.hasOwnProperty(C))$=F[C];else{var O=n(v.props,C,v._instanceProps),U=s(v.props,C,v._instanceProps),Y=T==="horizontal"||L==="horizontal",re=T==="rtl",Q=Y?O:0;F[C]=$={position:"absolute",left:re?void 0:Q,right:re?Q:void 0,top:Y?0:O,height:Y?"100%":U,width:Y?U:"100%"}}return $},v._getItemStyleCache=void 0,v._getItemStyleCache=lQ(function(C,S,T){return{}}),v._onScrollHorizontal=function(C){var S=C.currentTarget,T=S.clientWidth,I=S.scrollLeft,L=S.scrollWidth;v.setState(function(F){if(F.scrollOffset===I)return null;var $=v.props.direction,O=I;if($==="rtl")switch(NNe()){case"negative":O=-I;break;case"positive-descending":O=L-T-I;break}return O=Math.max(0,Math.min(O,L-T)),{isScrolling:!0,scrollDirection:F.scrollOffset<O?"forward":"backward",scrollOffset:O,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._onScrollVertical=function(C){var S=C.currentTarget,T=S.clientHeight,I=S.scrollHeight,L=S.scrollTop;v.setState(function(F){if(F.scrollOffset===L)return null;var $=Math.max(0,Math.min(L,I-T));return{isScrolling:!0,scrollDirection:F.scrollOffset<$?"forward":"backward",scrollOffset:$,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._outerRefSetter=function(C){var S=v.props.outerRef;v._outerRef=C,typeof S=="function"?S(C):S!=null&&typeof S=="object"&&S.hasOwnProperty("current")&&(S.current=C)},v._resetIsScrollingDebounced=function(){v._resetIsScrollingTimeoutId!==null&&wNe(v._resetIsScrollingTimeoutId),v._resetIsScrollingTimeoutId=qln(v._resetIsScrolling,Gln)},v._resetIsScrolling=function(){v._resetIsScrollingTimeoutId=null,v.setState({isScrolling:!1},function(){v._getItemStyleCache(-1,null)})},v}x.getDerivedStateFromProps=function(v,C){return Xln(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 S=this.props,T=S.itemCount,I=S.layout,L=this.state.scrollOffset;v=Math.max(0,Math.min(v,T-1));var F=0;if(this._outerRef){var $=this._outerRef;I==="vertical"?F=$.scrollWidth>$.clientWidth?CNe():0:F=$.scrollHeight>$.clientHeight?CNe():0}this.scrollTo(a(this.props,v,C,L,this._instanceProps,F))},g.componentDidMount=function(){var v=this.props,C=v.direction,S=v.initialScrollOffset,T=v.layout;if(typeof S=="number"&&this._outerRef!=null){var I=this._outerRef;C==="horizontal"||T==="horizontal"?I.scrollLeft=S:I.scrollTop=S}this._callPropsCallbacks()},g.componentDidUpdate=function(){var v=this.props,C=v.direction,S=v.layout,T=this.state,I=T.scrollOffset,L=T.scrollUpdateWasRequested;if(L&&this._outerRef!=null){var F=this._outerRef;if(C==="horizontal"||S==="horizontal")if(C==="rtl")switch(NNe()){case"negative":F.scrollLeft=-I;break;case"positive-ascending":F.scrollLeft=I;break;default:var $=F.clientWidth,O=F.scrollWidth;F.scrollLeft=O-$-I;break}else F.scrollLeft=I;else F.scrollTop=I}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&wNe(this._resetIsScrollingTimeoutId)},g.render=function(){var v=this.props,C=v.children,S=v.className,T=v.direction,I=v.height,L=v.innerRef,F=v.innerElementType,$=v.innerTagName,O=v.itemCount,U=v.itemData,Y=v.itemKey,re=Y===void 0?Kln:Y,Q=v.layout,q=v.outerElementType,te=v.outerTagName,fe=v.style,G=v.useIsScrolling,ie=v.width,oe=this.state.isScrolling,K=T==="horizontal"||Q==="horizontal",H=K?this._onScrollHorizontal:this._onScrollVertical,ee=this._getRangeToRender(),se=ee[0],pe=ee[1],Se=[];if(O>0)for(var ge=se;ge<=pe;ge++)Se.push(h.createElement(C,{data:U,key:re(ge,U),index:ge,isScrolling:G?oe:void 0,style:this._getItemStyle(ge)}));var ve=r(this.props,this._instanceProps);return h.createElement(q||te||"div",{className:S,onScroll:H,ref:this._outerRefSetter,style:pse({position:"relative",height:I,width:ie,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:T},fe)},h.createElement(F||$||"div",{children:Se,ref:L,style:{height:K?"100%":ve,pointerEvents:oe?"none":void 0,width:K?ve:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var v=this.props.itemCount;if(v>0){var C=this._getRangeToRender(),S=C[0],T=C[1],I=C[2],L=C[3];this._callOnItemsRendered(S,T,I,L)}}if(typeof this.props.onScroll=="function"){var F=this.state,$=F.scrollDirection,O=F.scrollOffset,U=F.scrollUpdateWasRequested;this._callOnScroll($,O,U)}},g._getRangeToRender=function(){var v=this.props,C=v.itemCount,S=v.overscanCount,T=this.state,I=T.isScrolling,L=T.scrollDirection,F=T.scrollOffset;if(C===0)return[0,0,0,0];var $=o(this.props,F,this._instanceProps),O=l(this.props,$,F,this._instanceProps),U=!I||L==="backward"?Math.max(1,S):1,Y=!I||L==="forward"?Math.max(1,S):1;return[Math.max(0,$-U),Math.max(0,Math.min(C-1,O+Y)),$,O]},x}(h.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},e}var Xln=function(e,n){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,n.instance},Qln=Yln({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),S=Math.max(0,n*d-y+d+o);switch(r==="smart"&&(s>=S-y&&s<=C+y?r="auto":r="center"),r){case"start":return C;case"end":return S;case"center":{var T=Math.round(S+(C-S)/2);return T<Math.ceil(y/2)?0:T>v+Math.floor(y/2)?v:T}case"auto":default:return s>=S&&s<=C?s:s<S?S: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}}),TM={exports:{}},Zln=TM.exports,SNe;function Jln(){return SNe||(SNe=1,function(t,e){(function(n,r){t.exports=r()})(Zln,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+)?$/,S=/\[([^\]]+)]|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,T={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 G=["th","st","nd","rd"],ie=fe%100;return"["+fe+(G[(ie-20)%10]||G[ie]||G[0])+"]"}},I=function(fe,G,ie){var oe=String(fe);return!oe||oe.length>=G?fe:""+Array(G+1-oe.length).join(ie)+fe},L={s:I,z:function(fe){var G=-fe.utcOffset(),ie=Math.abs(G),oe=Math.floor(ie/60),K=ie%60;return(G<=0?"+":"-")+I(oe,2,"0")+":"+I(K,2,"0")},m:function fe(G,ie){if(G.date()<ie.date())return-fe(ie,G);var oe=12*(ie.year()-G.year())+(ie.month()-G.month()),K=G.clone().add(oe,f),H=ie-K<0,ee=G.clone().add(oe+(H?-1:1),f);return+(-(oe+(ie-K)/(H?K-ee:ee-K))||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]=T;var O="$isDayjsObject",U=function(fe){return fe instanceof q||!(!fe||!fe[O])},Y=function fe(G,ie,oe){var K;if(!G)return F;if(typeof G=="string"){var H=G.toLowerCase();$[H]&&(K=H),ie&&($[H]=ie,K=H);var ee=G.split("-");if(!K&&ee.length>1)return fe(ee[0])}else{var se=G.name;$[se]=G,K=se}return!oe&&K&&(F=K),K||!oe&&F},re=function(fe,G){if(U(fe))return fe.clone();var ie=typeof G=="object"?G:{};return ie.date=fe,ie.args=arguments,new q(ie)},Q=L;Q.l=Y,Q.i=U,Q.w=function(fe,G){return re(fe,{locale:G.$L,utc:G.$u,x:G.$x,$offset:G.$offset})};var q=function(){function fe(ie){this.$L=Y(ie.locale,null,!0),this.parse(ie),this.$x=this.$x||ie.x||{},this[O]=!0}var G=fe.prototype;return G.parse=function(ie){this.$d=function(oe){var K=oe.date,H=oe.utc;if(K===null)return new Date(NaN);if(Q.u(K))return new Date;if(K instanceof Date)return new Date(K);if(typeof K=="string"&&!/Z$/i.test(K)){var ee=K.match(C);if(ee){var se=ee[2]-1||0,pe=(ee[7]||"0").substring(0,3);return H?new Date(Date.UTC(ee[1],se,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,pe)):new Date(ee[1],se,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,pe)}}return new Date(K)}(ie),this.init()},G.init=function(){var ie=this.$d;this.$y=ie.getFullYear(),this.$M=ie.getMonth(),this.$D=ie.getDate(),this.$W=ie.getDay(),this.$H=ie.getHours(),this.$m=ie.getMinutes(),this.$s=ie.getSeconds(),this.$ms=ie.getMilliseconds()},G.$utils=function(){return Q},G.isValid=function(){return this.$d.toString()!==v},G.isSame=function(ie,oe){var K=re(ie);return this.startOf(oe)<=K&&K<=this.endOf(oe)},G.isAfter=function(ie,oe){return re(ie)<this.startOf(oe)},G.isBefore=function(ie,oe){return this.endOf(oe)<re(ie)},G.$g=function(ie,oe,K){return Q.u(ie)?this[oe]:this.set(K,ie)},G.unix=function(){return Math.floor(this.valueOf()/1e3)},G.valueOf=function(){return this.$d.getTime()},G.startOf=function(ie,oe){var K=this,H=!!Q.u(oe)||oe,ee=Q.p(ie),se=function(Fe,Re){var Qe=Q.w(K.$u?Date.UTC(K.$y,Re,Fe):new Date(K.$y,Re,Fe),K);return H?Qe:Qe.endOf(u)},pe=function(Fe,Re){return Q.w(K.toDate()[Fe].apply(K.toDate("s"),(H?[0,0,0,0]:[23,59,59,999]).slice(Re)),K)},Se=this.$W,ge=this.$M,ve=this.$D,be="set"+(this.$u?"UTC":"");switch(ee){case g:return H?se(1,0):se(31,11);case f:return H?se(1,ge):se(0,ge+1);case d:var we=this.$locale().weekStart||0,je=(Se<we?Se+7:Se)-we;return se(H?ve-je:ve+(6-je),ge);case u:case y:return pe(be+"Hours",0);case c:return pe(be+"Minutes",1);case l:return pe(be+"Seconds",2);case o:return pe(be+"Milliseconds",3);default:return this.clone()}},G.endOf=function(ie){return this.startOf(ie,!1)},G.$set=function(ie,oe){var K,H=Q.p(ie),ee="set"+(this.$u?"UTC":""),se=(K={},K[u]=ee+"Date",K[y]=ee+"Date",K[f]=ee+"Month",K[g]=ee+"FullYear",K[c]=ee+"Hours",K[l]=ee+"Minutes",K[o]=ee+"Seconds",K[a]=ee+"Milliseconds",K)[H],pe=H===u?this.$D+(oe-this.$W):oe;if(H===f||H===g){var Se=this.clone().set(y,1);Se.$d[se](pe),Se.init(),this.$d=Se.set(y,Math.min(this.$D,Se.daysInMonth())).$d}else se&&this.$d[se](pe);return this.init(),this},G.set=function(ie,oe){return this.clone().$set(ie,oe)},G.get=function(ie){return this[Q.p(ie)]()},G.add=function(ie,oe){var K,H=this;ie=Number(ie);var ee=Q.p(oe),se=function(ge){var ve=re(H);return Q.w(ve.date(ve.date()+Math.round(ge*ie)),H)};if(ee===f)return this.set(f,this.$M+ie);if(ee===g)return this.set(g,this.$y+ie);if(ee===u)return se(1);if(ee===d)return se(7);var pe=(K={},K[l]=r,K[c]=s,K[o]=n,K)[ee]||1,Se=this.$d.getTime()+ie*pe;return Q.w(Se,this)},G.subtract=function(ie,oe){return this.add(-1*ie,oe)},G.format=function(ie){var oe=this,K=this.$locale();if(!this.isValid())return K.invalidDate||v;var H=ie||"YYYY-MM-DDTHH:mm:ssZ",ee=Q.z(this),se=this.$H,pe=this.$m,Se=this.$M,ge=K.weekdays,ve=K.months,be=K.meridiem,we=function(Re,Qe,Ye,dt){return Re&&(Re[Qe]||Re(oe,H))||Ye[Qe].slice(0,dt)},je=function(Re){return Q.s(se%12||12,Re,"0")},Fe=be||function(Re,Qe,Ye){var dt=Re<12?"AM":"PM";return Ye?dt.toLowerCase():dt};return H.replace(S,function(Re,Qe){return Qe||function(Ye){switch(Ye){case"YY":return String(oe.$y).slice(-2);case"YYYY":return Q.s(oe.$y,4,"0");case"M":return Se+1;case"MM":return Q.s(Se+1,2,"0");case"MMM":return we(K.monthsShort,Se,ve,3);case"MMMM":return we(ve,Se);case"D":return oe.$D;case"DD":return Q.s(oe.$D,2,"0");case"d":return String(oe.$W);case"dd":return we(K.weekdaysMin,oe.$W,ge,2);case"ddd":return we(K.weekdaysShort,oe.$W,ge,3);case"dddd":return ge[oe.$W];case"H":return String(se);case"HH":return Q.s(se,2,"0");case"h":return je(1);case"hh":return je(2);case"a":return Fe(se,pe,!0);case"A":return Fe(se,pe,!1);case"m":return String(pe);case"mm":return Q.s(pe,2,"0");case"s":return String(oe.$s);case"ss":return Q.s(oe.$s,2,"0");case"SSS":return Q.s(oe.$ms,3,"0");case"Z":return ee}return null}(Re)||ee.replace(":","")})},G.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},G.diff=function(ie,oe,K){var H,ee=this,se=Q.p(oe),pe=re(ie),Se=(pe.utcOffset()-this.utcOffset())*r,ge=this-pe,ve=function(){return Q.m(ee,pe)};switch(se){case g:H=ve()/12;break;case f:H=ve();break;case x:H=ve()/3;break;case d:H=(ge-Se)/6048e5;break;case u:H=(ge-Se)/864e5;break;case c:H=ge/s;break;case l:H=ge/r;break;case o:H=ge/n;break;default:H=ge}return K?H:Q.a(H)},G.daysInMonth=function(){return this.endOf(f).$D},G.$locale=function(){return $[this.$L]},G.locale=function(ie,oe){if(!ie)return this.$L;var K=this.clone(),H=Y(ie,oe,!0);return H&&(K.$L=H),K},G.clone=function(){return Q.w(this.$d,this)},G.toDate=function(){return new Date(this.valueOf())},G.toJSON=function(){return this.isValid()?this.toISOString():null},G.toISOString=function(){return this.$d.toISOString()},G.toString=function(){return this.$d.toUTCString()},fe}(),te=q.prototype;return re.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(G){return this.$g(G,fe[0],fe[1])}}),re.extend=function(fe,G){return fe.$i||(fe(G,q,re),fe.$i=!0),re},re.locale=Y,re.isDayjs=U,re.unix=function(fe){return re(1e3*fe)},re.en=$[F],re.Ls=$,re.p={},re})}(TM)),TM.exports}var ecn=Jln();const uQ=Pi(ecn),tcn=ke.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[S,T]=h.useState({key:null,direction:null}),[I,L]=h.useState({}),[F,$]=h.useState(null),[O,U]=h.useState(null),[Y,re]=h.useState({top:0,left:0}),Q=h.useRef(null),q=h.useRef(null);h.useEffect(()=>{function st(at){Q.current&&!Q.current.contains(at.target)&&($(null),U(null))}return document.addEventListener("mousedown",st),()=>document.removeEventListener("mousedown",st)},[]),h.useEffect(()=>{F&&(O==null?void 0:O.filterType)==="text"&&setTimeout(()=>{var st;return(st=q.current)==null?void 0:st.focus()},0)},[F,O]);function te(st,at,He){return st.filter(qe=>at.every(vt=>{const yt=He[vt.key];if(!vt.filterType||!yt)return!0;const Kt=qe[vt.key];if(yt.filterType==="text"){const jt=yt.value||"";return Kt==null?void 0:Kt.toString().toLowerCase().includes(jt.toLowerCase())}if(yt.filterType==="select")return!yt.values||yt.values.length===0?!0:yt.values.includes(Kt);if(yt.filterType==="dateRange"){if(!Kt)return!1;const jt=uQ(Kt);return!(yt.start&&jt.isBefore(uQ(yt.start))||yt.end&&jt.isAfter(uQ(yt.end)))}if(yt.filterType==="numberRange"){const jt=parseFloat(yt.min),un=parseFloat(yt.max),vn=parseFloat(Kt);return!(!isNaN(jt)&&vn<jt||!isNaN(un)&&vn>un)}return!0}))}function fe(st,at){if(!at.key||!at.direction)return st;const He=e.find(qe=>qe.key===at.key);return He?[...st].sort((qe,vt)=>{const yt=He.sortValue?He.sortValue(qe):qe[at.key],Kt=He.sortValue?He.sortValue(vt):vt[at.key],jt=yt==null||yt==="-",un=Kt==null||Kt==="-";return jt&&un?0:jt?1:un?-1:typeof yt=="number"&&typeof Kt=="number"?at.direction==="asc"?yt-Kt:Kt-yt:typeof yt=="string"&&typeof Kt=="string"?at.direction==="asc"?yt.localeCompare(Kt):Kt.localeCompare(yt):yt<Kt?at.direction==="asc"?-1:1:yt>Kt?at.direction==="asc"?1:-1:0}):st}function G(st){T(at=>at.key===st?at.direction==="asc"?{key:st,direction:"desc"}:at.direction==="desc"?{key:null,direction:null}:{key:st,direction:"asc"}:{key:st,direction:"asc"})}function ie(st){if(S.key===st){if(S.direction==="asc")return i.jsx(o2,{className:"inline ml-1"});if(S.direction==="desc")return i.jsx(a2,{className:"inline ml-1"})}return i.jsx(l2,{className:"inline ml-1"})}function oe(st,at){L(He=>{const qe=He[st]||{};return{...He,[st]:{...qe,...at}}})}function K(st){L(at=>{const He={...at};return delete He[st],He})}function H(st,at){const He=st.currentTarget.getBoundingClientRect(),qe=He.left+He.width/2-192/2+window.scrollX,vt=He.bottom+window.scrollY;if(re({top:vt,left:qe}),F===at.key)$(null),U(null);else{$(at.key);const yt=I[at.key]||{};U({filterType:at.filterType,value:yt.value||"",values:yt.values||[],start:yt.start||"",end:yt.end||"",min:yt.min||"",max:yt.max||""})}}function ee(st){O&&oe(st,O),$(null),U(null)}function se(st){if(!O)return null;const at=O.filterType;return fie.createPortal(i.jsxs("div",{ref:Q,style:{position:"absolute",top:Y.top,left:Y.left,zIndex:9999},children:[at==="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:q,type:"text",value:O.value,onChange:He=>U(qe=>({...qe,value:He.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:()=>{K(st.key),$(null),U(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(st.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]}),at==="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:[(st.options||[]).map(He=>{const qe=O.values,vt=qe.includes(He);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:vt,onChange:()=>{U(vt?yt=>({...yt,values:qe.filter(Kt=>Kt!==He)}):yt=>({...yt,values:[...qe,He]}))}}),He]},He)}),i.jsxs("div",{className:"flex justify-between mt-2",children:[i.jsx("button",{onClick:()=>{K(st.key),$(null),U(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(st.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]}),at==="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:O.start,onChange:He=>U(qe=>({...qe,start:He.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:O.end,onChange:He=>U(qe=>({...qe,end:He.target.value}))})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("button",{onClick:()=>{K(st.key),$(null),U(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(st.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]}),at==="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:O.min,onChange:He=>U(qe=>({...qe,min:He.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:O.max,onChange:He=>U(qe=>({...qe,max:He.target.value}))})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("button",{onClick:()=>{K(st.key),$(null),U(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(st.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]})]}),document.body)}const pe=Array.isArray(t)?t:[],Se=x?[]:fe(te(pe,e,I),S),ge=e.map(st=>st.width||"minmax(0, 100%)").join(" "),ve=e.map((st,at)=>typeof st.skeletonWidth=="number"?st.skeletonWidth:60+at*23%80),be=Object.keys(I).length>0,we=!x&&Se.length===0;function je({w:st}){return i.jsx("span",{className:"block h-[14px] rounded bg-[#242424] animate-pulse",style:{width:st}})}function Fe({index:st,style:at}){return i.jsx("div",{style:{...at,display:"grid",gridTemplateColumns:ge,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({},st)||"":a||""}`,children:e.map((He,qe)=>i.jsx("div",{className:`px-4 ${typeof o=="function"?o(He,{},st)||"":o||""}`,children:y?y({column:He,index:st,width:ve[qe]}):i.jsx(je,{w:ve[qe]})},`sk-${He.key}-${qe}`))})}function Re({index:st,style:at}){if(st<0||st>=Se.length)return null;const He=Se[st];return i.jsx("div",{onClick:()=>f&&f(He),style:{...at,display:"grid",gridTemplateColumns:ge,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(He,st)||"":a||""}`,children:e.map(qe=>{const vt=qe.render?qe.render(He[qe.key],He,st):He[qe.key];return i.jsx("div",{className:`px-4 overflow-hidden whitespace-nowrap ${typeof o=="function"?o(qe,He,st)||"":o||""}`,children:vt},qe.key)})})}const Qe=x?g:Se.length,Ye=x?void 0:u?st=>u(Se[st]):void 0,dt=st=>st.headerTooltip?i.jsx(as,{content:st.headerTooltip,align:st.headerTooltipAlign||"center",children:i.jsx("span",{className:"inline-flex underline decoration-dotted underline-offset-2 cursor-help pointer-events-auto",children:st.label})}):st.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:ge},children:e.map(st=>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&&st.sortable&&G(st.key),children:[dt(st),st.sortable&&i.jsx("span",{className:"ml-1",children:ie(st.key)}),st.filterType&&i.jsx("span",{className:"ml-2 cursor-pointer",onClick:at=>{at.stopPropagation(),x||H(at,st)},children:i.jsx(eSt,{className:"w-3 h-3"})}),F===st.key&&se(st)]},st.key))}),x&&C?i.jsx("div",{className:`${s||""} min-w-max`,children:typeof C=="function"?C({hasFilters:be}):C}):we?i.jsx("div",{className:`${s||""} min-w-max text-xs text-center text-[#9B9B9B]`,children:typeof v=="function"?v({hasFilters:be}):v}):i.jsx(Qln,{className:`${s||""} min-w-max`,height:c,itemCount:Qe,itemSize:l,itemKey:Ye,innerElementType:tcn,width:"100%",onItemsRendered:({visibleStartIndex:st,visibleStopIndex:at})=>!x&&d&&d(Se.slice(st,at+1)),children:x?Fe:Re})]})})})},LF=t=>Number(t).toLocaleString("en-US",{maximumFractionDigits:2}),ncn=t=>!isFinite(t)||isNaN(t)?"-":`${Math.floor(t)}h ${Math.round((t-Math.floor(t))*60)}m`,rcn=(t,e,n,r)=>{const s=t*e/n;return r/s*100};function scn({trades:t,generatedWallets:e,wallet:n,wallets:r}){const[s,a]=h.useState(!1),[o,l]=h.useState(null),[c,u]=h.useState(()=>new Map),[d,f]=h.useState(new Map),[x,g]=h.useState(new Map),[y,v]=h.useState([]),[C,S]=h.useState(!0),T=h.useRef(new Set),I=h.useRef(new Set),{isReferralCodeName:L}=h.useContext(Qr),F=h.useCallback(K=>{const H=K==null?void 0:K.toLowerCase();return H?(r==null?void 0:r.length)>0?r.some(ee=>{var se;return((se=ee.wallet_address)==null?void 0:se.toLowerCase())===H}):(n==null?void 0:n.toLowerCase())===H:!1},[r,n]),$=h.useMemo(()=>r&&r.length?y:Array.isArray(t)?t:[],[r,y,t]),O=h.useCallback(async K=>{const H=localStorage.getItem("hyperAddress"),ee=localStorage.getItem("hyperToken");if(!(!H||!ee||K.length===0))try{const{data:se}=await Ns.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_leverage_with_oids/",{address:H,token:ee,position_oids:K},{headers:{"Content-Type":"application/json"}});if(se&&se.success){const pe=parseFloat(se.leverage);f(Se=>{const ge=new Map(Se);return K.forEach(ve=>ge.set(String(ve),pe)),ge})}}catch(se){console.error("leverage fetch error:",se)}},[]),U=h.useCallback(async K=>{const H=localStorage.getItem("hyperAddress"),ee=localStorage.getItem("hyperToken");if(!(!H||!ee||K.length===0))try{const{data:se}=await Ns.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_position_details_with_oids/",{address:H,token:ee,position_oids:K},{headers:{"Content-Type":"application/json"}});se&&se.success&&g(pe=>{const Se=new Map(pe);return se.data.forEach(ge=>Se.set(String(ge.oid),ge)),Se})}catch(se){console.error("source details fetch error:",se)}},[]),Y=h.useMemo(()=>(r??[]).map(K=>{var H;return(H=K.wallet_address)==null?void 0:H.toLowerCase()}).sort().join(","),[r]);h.useEffect(()=>{if(Y===""){S(!1),v([]);return}let K=!1;return S(!0),a(!1),T.current.clear(),I.current.clear(),f(new Map),g(new Map),u(new Map),(async()=>{try{const H=Y.split(","),ee=(await Promise.all(H.map(async pe=>{const[Se,ge]=await Promise.all([kde(pe),Tde(pe)]),ve=[...Se,...ge.map(({fill:be,twapId:we})=>({...be,twapId:we}))];return Pde(ve).closed_positions||[]}))).flat();if(K)return;const se=ee.sort((pe,Se)=>(Se.close_time||0)-(pe.close_time||0));v(se),l(null)}catch(H){console.error("multi-wallet completed-trades fetch:",H)}finally{K||S(!1)}})(),()=>{K=!0}},[Y]);const re=h.useCallback(K=>{const H=new Set,ee=new Set;K.forEach(se=>{((e==null?void 0:e.some(Se=>F(Se.wallet_address)))||!1)&&se.has_builder_fee&&(se.oids||[]).forEach(Se=>{T.current.has(Se)||H.add(Se),I.current.has(Se)||ee.add(Se)})}),H.size>0&&(H.forEach(se=>T.current.add(se)),O([...H])),ee.size>0&&(ee.forEach(se=>I.current.add(se)),U([...ee]))},[e,F,O,U]);function Q({date:K}){const[H,ee]=h.useState(vo(K));return h.useEffect(()=>{const se=setInterval(()=>{ee(vo(K))},1e3);return()=>clearInterval(se)},[K]),i.jsx("span",{className:"text-white text-sm font-bold font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:H.dateTime})}const q=K=>u(H=>new Map(H).set(K,!H.get(K))),te=(K,H)=>c.get(H)?i.jsx(Q,{date:K}):$c(K),fe=h.useMemo(()=>[...new Set($.map(K=>K.coin))],[$]),G=h.useMemo(()=>$.map(K=>({...K,uid:K.trade_id||K.oid||`${K.open_time}_${K.close_time}`,liqStatus:K.isLiquidated?"Liquidated":"Not Liquidated"})).sort((K,H)=>(H.close_time||0)-(K.close_time||0)),[$]),ie=async K=>{var ve;const H=localStorage.getItem("hyperAddress"),ee=localStorage.getItem("hyperToken"),se=K.oids??[];let pe=K.leverage??K.positionDistribution??0;if(H&&ee&&se.length>0)try{pe=((ve=(await Ns.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_leverage_with_oids/",{address:H,token:ee,position_oids:se},{headers:{"Content-Type":"application/json"}})).data)==null?void 0:ve.leverage)??pe}catch(be){console.error("Leverage fetch failed:",be)}const Se=rcn(K.entry_price_wma,K.total_size,pe,K.total_pnl),ge=be=>Math.abs(be)<1?be.toFixed(4):be.toFixed(2);l({coin:K.coin,type:K.position_side,leverage:pe,roe:ge(Se),entryPrice:K.entry_price_wma,markPrice:K.close_px,positionDistribution:K.total_size,pnl:K.total_pnl-K.total_fee,closePx:K.close_px,referral:L??"--"}),a(!0)},oe=h.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,filterType:"text",render:(K,H)=>i.jsxs("a",{href:`/terminal/${H.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/${H.coin}.svg`,alt:H.coin,className:"w-5 h-5 mr-2",loading:"lazy",onError:Zi}),H.coin]})},{key:"source_tag",label:"Source Tag",sortable:!0,filterType:"text",render:(K,H)=>{const ee=x.get(H.oids&&String(H.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:(K,H)=>{const se={Sell:"Sell",Buy:"Buy","Close Short":"Short","Close Long":"Long","Open Short":"Short","Open Long":"Long"}[K]??K??"--",pe=["buy","long"].includes(se.toLowerCase()),Se=["sell","short"].includes(se.toLowerCase()),ge=(()=>{if(!(((e==null?void 0:e.some(we=>F(we.wallet_address)))||!1)&&H.has_builder_fee))return"";const be=d.get(H.oids&&String(H.oids[0]));return be?` - ${be}x`:""})();return i.jsxs("div",{className:`h-5 pl-1 pr-1.5 py-1 rounded-md inline-flex items-center gap-0.5 ${pe?"text-[#67ffbd] bg-[#67ffbd]/20":Se?"text-[#ff787b] bg-[#ff797c]/20":"text-white"}`,children:[i.jsx(Us,{className:`w-3 h-3 ${pe?"fill-[#67ffbd] rotate-180":Se?"fill-[#ff787b]":""}`}),i.jsxs("span",{className:"text-[11px] font-semibold uppercase",children:[se,ge," "]})]})}},{key:"total_size",label:"Size",sortable:!0,filterType:"numberRange",render:LF},{key:"entry_price_wma",label:"Entry Price",sortable:!0,filterType:"numberRange",render:LF},{key:"close_px",label:"Close Price",sortable:!0,filterType:"numberRange",render:LF},{key:"total_pnl",label:"PnL",sortable:!0,filterType:"numberRange",sortValue:K=>K.total_pnl-K.total_fee,render:(K,H)=>{const ee=(e==null?void 0:e.some(se=>F(se.wallet_address)))||!1;return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:H.total_pnl-H.total_fee>0?"text-[#4ae3b5]":H.total_pnl-H.total_fee<0?"text-[#ff6b6b]":"text-white",children:["$",LF(Math.abs(H.total_pnl-H.total_fee))]}),ee&&H.has_builder_fee&&i.jsx("img",{src:jm,alt:"share",className:"w-4 h-4 cursor-pointer",onClick:se=>{se.stopPropagation(),ie(H)}})]})}},{key:"total_fee",label:"Fee (USDC)",sortable:!0,filterType:"numberRange",width:"240px",render:(K,H)=>i.jsxs("span",{children:[Ir(parseFloat(H.total_fee))," ",H.builder_fee?i.jsxs("span",{className:"text-xs",children:["(",Ir(parseFloat(H.builder_fee))," builder fee)"]}):""]})},{key:"duration_hours",label:"Duration",sortable:!0,filterType:"numberRange",render:ncn},{key:"open_time",label:"Opened",sortable:!0,filterType:"dateRange",render:(K,H)=>i.jsx("div",{onClick:()=>q(H.uid),className:"cursor-pointer",children:te(H.open_time,H.uid)}),width:"200px"},{key:"close_time",label:"Closed",sortable:!0,filterType:"dateRange",render:(K,H)=>i.jsx("div",{onClick:()=>q(H.uid),className:"cursor-pointer",children:te(H.close_time,H.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:G,columns:oe,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:K=>K.uid,onVisibleRows:re}),s&&i.jsx(cP,{open:s,setOpen:a,data:o,setShare:()=>{},setTradeInfo:()=>{},pnlTitle:"REALIZED PNL"})]})}const icn=({data:t,setData:e,wallet:n,coinNameData:r})=>{var K;const[s,a]=h.useState(!1),[o,l]=h.useState(!1),[c,u]=h.useState(!1),[d,f]=h.useState(""),[x,g]=h.useState(""),y=h.useRef(null),v=h.useRef(null),S=localStorage.getItem("isDateTwapFillsFormat")||"date",[T,I]=h.useState(S);h.useEffect(()=>{localStorage.setItem("isDateTwapFillsFormat",T)},[T]);const L="-time",[F,$]=h.useState(L),O=H=>{const ee=r.find(se=>se.label===H);return ee?ee.value.toUpperCase():H==null?void 0:H.toUpperCase()},U=t==null?void 0:t.filter(H=>d?O(H.coin).includes(d.toUpperCase()):!0).filter(H=>{var ee,se;return x?(se=(ee=H==null?void 0:H.oid)==null?void 0:ee.toString())==null?void 0:se.includes(x):!0}),Y=H=>U==null?void 0:U.sort((ee,se)=>{const pe=ee.coin?ee.coin.toUpperCase():"",Se=se.coin?se.coin.toUpperCase():"",ge=je=>parseFloat(je.closedPnl||0)-parseFloat(je.fee||0),ve=(je="")=>{const Fe=je.toLowerCase(),Re=Fe.includes("long")||Fe==="buy",Qe=Fe.includes("short")||Fe==="sell";return Re&&!Qe?3:Re&&Qe?2:Qe&&!Re?1:0},be=parseFloat(ee.sz)*parseFloat(ee.px),we=parseFloat(se.sz)*parseFloat(se.px);return H==="-price"?se.px-ee.px:H==="price"?ee.px-se.px:H==="-size"?se.sz-ee.sz:H==="size"?ee.sz-se.sz:H==="-fee"?se.fee-ee.fee:H==="fee"?ee.fee-se.fee:H==="-closedPnl"?ge(se)-ge(ee):H==="closedPnl"?ge(ee)-ge(se):H==="-oid"?se.oid-ee.oid:H==="oid"?ee.oid-se.oid:H==="-coin"?pe<Se?-1:pe>Se?1:0:H==="coin"?pe>Se?-1:pe<Se?1:0:H==="-time"?new Date(se.time)-new Date(ee.time):H==="time"?new Date(ee.time)-new Date(se.time):H==="-dir"?ve(se.dir)-ve(ee.dir):H==="dir"?ve(ee.dir)-ve(se.dir):H==="-tradeValue"?we-be:H==="tradeValue"?be-we:0});h.useEffect(()=>{(async()=>{try{a(!0);const ee=await Ns.post("https://api-ui.hyperliquid.xyz/info",{type:"userTwapSliceFills",user:n}),pe=((ee==null?void 0:ee.data)||[]).map(Se=>({...Se.fill,twapId:Se.twapId||null}));e(pe==null?void 0:pe.sort((Se,ge)=>ge.time-Se.time))}catch(ee){console.error("Error fetching twap data:",ee)}finally{a(!1)}})()},[n]),h.useEffect(()=>{function H(ee){y.current&&!y.current.contains(ee.target)&&l(!1),v.current&&!v.current.contains(ee.target)&&u(!1)}return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[]);const re=h.useRef(null),Q=()=>{re.current&&(re.current.scrollLeft-=200)},q=()=>{re.current&&(re.current.scrollLeft+=200)},te=()=>{re.current&&(re.current.scrollTop+=200)},fe=()=>{re.current&&(re.current.scrollTop-=200)},G=H=>H>=640&&H<1024?5:H>=1024&&H<1240?8:H>=1240&&H<1540||H>=1540?9:4;function ie({date:H}){const[ee,se]=h.useState(vo(H));return h.useEffect(()=>{const pe=setInterval(()=>{se(vo(H))},1e3);return()=>clearInterval(pe)},[H]),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:ee.dateTime})}const oe={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:Q,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(Vl,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),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 block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Vl,{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(Vl,{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(Vl,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:re,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(jNe,{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(hi,{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(xd,{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:H=>f(H.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(jNe,{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(T7,{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(T7,{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(T7,{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(T7,{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(T7,{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(hi,{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(xd,{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:H=>g(H.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||Y(F).length==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:G(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(ka,{}):i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:Yl,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."})})]})]})})})})}):(K=Y(F))==null?void 0:K.map((H,ee)=>{var se,pe,Se,ge,ve,be;return i.jsxs(ke.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:()=>{I(T=="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:T=="time"?i.jsx(ie,{date:H.time}):$c(H.time)})}),i.jsx("td",{className:"text-left cursor-pointer",children:i.jsx("div",{onClick:()=>{var we;window.open(`/terminal/${((we=r==null?void 0:r.find(je=>je.label===H.coin))==null?void 0:we.value)||H.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/${((se=r==null?void 0:r.find(we=>we.label===H.coin))==null?void 0:se.value)||oe[H.coin]||((pe=H.coin)==null?void 0:pe.split("/")[0])}.svg`||Ha,alt:H==null?void 0:H.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:we=>Zi(we)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:(()=>{const we=r.find(je=>je.label===H.coin);return we?we.value:H.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 ${H!=null&&H.liquidation?"text-white":(Se=H.dir)!=null&&Se.includes("Short")||(ge=H.dir)!=null&&ge.includes("Sell")?"text-[#ff6b6b]":(ve=H.dir)!=null&&ve.includes("Long")||(be=H.dir)!=null&&be.includes("Buy")?"text-[#4ae3b5]":"text-white"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:H!=null&&H.liquidation?"Liquidation":H.dir?H.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:H.px!=null&&!isNaN(parseFloat(H.px))?`$${parseFloat(H.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:H.sz!=null&&!isNaN(parseFloat(H.sz))?Ir(parseFloat(H.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:H.px!=null&&H.sz!=null&&!isNaN(parseFloat(H.px))&&!isNaN(parseFloat(H.sz))?i.jsxs(i.Fragment,{children:["$",Ir(parseFloat(H.px)*parseFloat(H.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:H.fee!=null&&!isNaN(parseFloat(H.fee))?Ir(parseFloat(H.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(H.closedPnl)-parseFloat(H.fee)>0?"text-[#4ae3b5]":parseFloat(H.closedPnl)-parseFloat(H.fee)<0?"text-[#ff6b6b]":"text-white"} text-sm font-normal font-manrope leading-[13px] tracking-[0.18px]`,children:H.closedPnl!=null&&H.fee!=null&&!isNaN(parseFloat(H.closedPnl))&&!isNaN(parseFloat(H.fee))?i.jsxs(i.Fragment,{children:["$",Ir(Math.abs(parseFloat(H.closedPnl)-parseFloat(H.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:H!=null&&H.oid?H==null?void 0:H.oid:"--"})})})]},ee),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},ee)})})]})})]})},T7=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(hi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!0})}),jNe=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(hi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!1})}),IC="https://api-ui.hyperliquid.xyz/info",acn="wss://api.hyperliquid.xyz/ws",QVe=({initialAddress:t="",wallets:e})=>{var ms,At,pt;h.useState(t);const[n,r]=h.useState([]),[s,a]=h.useState([]),o=h.useRef({}),[l,c]=h.useState(!1),[u,d]=h.useState(!0),[f,x]=h.useState(1),[g,y]=h.useState(null),[v,C]=h.useState(!1),[S,T]=h.useState("positions"),I=h.useRef(null),L=yo(),F=h.useRef(t),$=h.useRef(null),O=h.useRef(null),[U,Y]=h.useState({});h.useState(!1),h.useState("");const[re,Q]=h.useState(null),{getTrackedWatchList:q,hyperToken:te,copyTradeWatchList:fe,getCopyTradeWatchList:G,setTelegramChatId:ie,setSubscriberRole:oe,setSubsExpireDay:K,setMushboomerETH:H,setMushboomerSOL:ee,setIsReferralCode:se,isReferralCodeName:pe,setIsReferralCodeName:Se,setIsWhitelist:ge,setHyperToken:ve,setHyperAddress:be,setSignModalOpen:we,latestPnL:je}=h.useContext(Qr),{isConnected:Fe,address:Re}=ds();h.useState(!1),h.useState(!1),h.useState(null),h.useState("");const[Qe,Ye]=h.useState(!1);h.useState(!1);const[dt,st]=h.useState({}),[at,He]=h.useState(!1),[qe,vt]=h.useState([]),[yt,Kt]=h.useState(null);yt||je.activeRange;const jt=Pl(),un=jt.pathname.includes("/wallet-management");h.useEffect(()=>{Kt(null)},[je.activeRange]);const vn=[{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 Hn(le,Me){const ft=Me.map(({fill:ut,twapId:on})=>({...ut,twapId:on}));return[...le,...ft]}const ln=(le,Me)=>{const ft=Vt(Me,le);o.current={...o.current,[le]:ft},a(Object.values(o.current).flat()),d(!1)};h.useEffect(()=>{t&&(async()=>{const le=await kde(t),Me=await Tde(t),ft=Hn(le,Me),{closed_positions:ut}=Pde(ft);Q(ut)})()},[t]);const Nn=(e??[]).map(le=>{var Me;return(Me=le.wallet_address)==null?void 0:Me.toLowerCase()}).filter(Boolean),dn=h.useMemo(()=>[...new Set(Nn)].sort().join("|"),[Nn.join("|")]);h.useEffect(()=>{if(!e||e.length===0)return;const le=e.map(ft=>ft.wallet_address.toLowerCase());if(le.length===0)return;let Me=!0;return c(!0),d(!0),(async()=>{try{const ft=await Promise.all(le.map(async rr=>{const[Jn,Xn]=await Promise.all([Ns.post(IC,{aggregateByTime:!0,type:"userFills",user:rr}),Ns.post(IC,{type:"clearinghouseState",user:rr})]);return{addr:rr,fills:Jn.data??[],state:Xn.data}}));if(!Me)return;const ut=ft.flatMap(rr=>rr.fills),on=Ut(ut);r(on);const bn=ft.flatMap(rr=>{var Jn;return(Jn=rr.state)!=null&&Jn.assetPositions?rr.state.assetPositions.map(Xn=>({...Xn,_wallet:rr.addr})):[]}),Gn=Vt({assetPositions:bn});a(Gn),rt(le)}catch(ft){console.error("Multi-wallet fetch error:",ft)}finally{Me&&c(!1)}})(),()=>{Me=!1}},[dn]),h.useEffect(()=>(t&&(F.current=t,nt(t)),()=>{I.current&&(I.current.close(),I.current=null),$.current&&(clearTimeout($.current),$.current=null),O.current&&(clearInterval(O.current),O.current=null)}),[t]),h.useEffect(()=>{const le=async()=>{var Me;document.visibilityState==="visible"&&(((Me=I.current)==null?void 0:Me.readyState)!==WebSocket.OPEN&&rt(F.current.split("|")),F.current.split("|").forEach(ft=>{Ns.post(IC,{type:"clearinghouseState",user:ft}).then(ut=>ln(ft,ut.data))}))};return document.addEventListener("visibilitychange",le),()=>document.removeEventListener("visibilitychange",le)},[]),h.useEffect(()=>{const le=localStorage.getItem("favoriteAddresses");le&&Y(JSON.parse(le))},[]);const rt=le=>{var ft;const Me=Array.isArray(le)?le:[le];o.current={},a([]),!(((ft=I.current)==null?void 0:ft.readyState)===WebSocket.OPEN&&F.current===Re)&&(O.current&&(clearInterval(O.current),O.current=null),$.current&&(clearTimeout($.current),$.current=null),I.current&&(I.current.close(),I.current=null),F.current=Me.join("|"),I.current=new WebSocket(acn),I.current.onopen=()=>{console.log("WebSocket Connected"),C(!0);const ut=[];Me.forEach(on=>{ut.push({method:"subscribe",subscription:{aggregateByTime:!0,type:"userFills",user:on}},{method:"subscribe",subscription:{type:"user",user:on}},{method:"subscribe",subscription:{type:"webData2",user:on}},{method:"subscribe",subscription:{type:"userTwapSliceFills",user:on}})}),ut.forEach(on=>{I.current.send(JSON.stringify(on))}),O.current=setInterval(()=>{var on;if(((on=I.current)==null?void 0:on.readyState)===WebSocket.OPEN){const bn={id:99,method:"ping"};I.current.send(JSON.stringify(bn))}},3e4)},I.current.onclose=ut=>{C(!1),O.current&&(clearInterval(O.current),O.current=null),ut.code!==1e3&&($.current||($.current=setTimeout(()=>{$.current=null,F.current===Re&&rt([Re])},5e3)))},I.current.onerror=ut=>{console.error("WebSocket Error:",ut),C(!1)},I.current.onmessage=ut=>{var on,bn,Gn,rr;try{const Jn=JSON.parse(ut.data);if(Jn.method==="pong"||Jn.result==="success")return;if(Jn.channel==="userFills"&&((on=Jn.data)!=null&&on.fills)&&F.current.toLowerCase()===Jn.data.user.toLowerCase()&&r(Xn=>{const Zr=Xn.flatMap(ar=>ar.fills),$r=new Map;Zr.forEach(ar=>{$r.set(ar.hash,!0)});const wr=Jn.data.fills.filter(ar=>!$r.has(ar.hash));if(wr.length===0)return Xn;const pr=[...wr,...Zr];return Ut(pr)}),Jn.channel==="webData2"&&((bn=Jn.data)!=null&&bn.clearinghouseState)&&(y(Jn.data.clearinghouseState),ln(Jn.data.user.toLowerCase(),Jn.data.clearinghouseState)),Jn.channel==="user"&&((Gn=Jn.data)!=null&&Gn.fills&&r(Xn=>{const Zr=Xn.flatMap(ar=>ar.fills),$r=new Map;Zr.forEach(ar=>{$r.set(ar.hash,!0)});const wr=Jn.data.fills.filter(ar=>!$r.has(ar.hash));if(wr.length===0)return Xn;const pr=[...wr,...Zr];return Ut(pr)}),(rr=Jn.data)!=null&&rr.state)){y(Jn.data.state);const Xn=Vt(Jn.data.state);a(Xn)}if(Jn.channel==="userTwapSliceFills"){const Xn=Jn==null?void 0:Jn.data;if(!qe||qe.length===0||!Xn||Xn.length===0)return;const Zr=Xn==null?void 0:Xn.map(wr=>({...wr.fill,twapId:wr.twapId||null})),$r=[...qe];Zr.forEach(wr=>{const pr=$r==null?void 0:$r.findIndex(ar=>ar.oid===wr.oid);pr!==-1?$r[pr]={...$r[pr],...wr}:$r.unshift(wr)}),vt($r)}}catch(Jn){console.error("Error processing WebSocket message:",Jn),console.error("Raw message that caused error:",ut.data)}})},nt=async le=>{const[Me,ft]=await Promise.all([Ns.post(IC,{aggregateByTime:!0,type:"userFills",user:le}),Ns.post(IC,{type:"clearinghouseState",user:le})]);if(ft.data&&ln(le.toLowerCase(),ft.data),!le){fn.error("Please enter a wallet address");return}if(!le.match(/^0x[a-fA-F0-9]{40}$/)){fn.error("Please enter a valid Ethereum address");return}c(!0),d(!0);try{le!==t&&L(`/wallet-details/${le}`),rt(le);const ut=await Ns.post(IC,{aggregateByTime:!0,type:"userFills",user:le});if(ut.data&&Array.isArray(ut.data)){const on=Ut(ut.data);r(on),x(1)}else console.error("Invalid response format:",ut.data)}catch(ut){console.error("Error fetching data:",ut)}finally{c(!1)}},Ut=le=>{const Me=[...le].sort((ut,on)=>on.time-ut.time),ft=new Map;return Me.forEach(ut=>{var bn;const on=ut.oid;if(!ft.has(on)){const Gn=Me.filter(pr=>pr.oid===ut.oid),rr=Gn.reduce((pr,ar)=>pr+parseFloat(ar.sz),0),Jn=Gn.map(pr=>parseFloat(pr.startPosition));let Xn;Jn.includes(0)?Xn=0:Jn.every(pr=>pr>0)?Xn=Math.max(...Jn):Jn.every(pr=>pr<0)?Xn=Math.min(...Jn):Xn=Gn.reduce((pr,ar)=>pr+parseFloat(ar.startPosition),0);const Zr=Gn.reduce((pr,ar)=>pr+parseFloat(ar.sz)*parseFloat(ar.px),0),$r=Gn.reduce((pr,ar)=>pr+parseFloat(ar.closedPnl||0),0),wr=((bn=Gn.find(pr=>pr.dir==="Long > Short"||pr.dir==="Short > Long"))==null?void 0:bn.dir)||"";ft.set(on,{oid:ut.oid,asset:ut.coin,direction:wr==""?ut.dir:wr,fills:Gn,totalSize:rr,totalStartPositions:Xn,totalValue:Zr,pnl:$r,latestFill:ut.time,isLiquidation:!!ut.liquidation})}}),Array.from(ft.values()).sort((ut,on)=>on.latestFill-ut.latestFill)},wn=le=>{const Me=new Date(le),ft=Me.toLocaleString("en-US",{month:"short"}),ut=Me.getDate(),on=Me.getFullYear(),bn=Me.getHours().toString().padStart(2,"0"),Gn=Me.getMinutes().toString().padStart(2,"0"),rr=Me.getHours()>=12?" PM":" AM";return`${ft} ${ut}, ${on}, ${bn}:${Gn} ${rr}`},Jt=n,Vt=(le,Me="")=>{if(!(le!=null&&le.assetPositions))return[];const ft=new Map;return n.forEach(ut=>{ut.fills.forEach(on=>{let bn="";on.dir.includes("Open")?bn=on.dir.includes("Long")?"Long":"Short":on.side==="B"?bn="Long":on.side==="S"&&(bn="Short");const Gn=`${on.coin}-${bn}`;(!ft.has(Gn)||on.time<ft.get(Gn))&&ft.set(Gn,on.time)})}),le.assetPositions.filter(ut=>{if(!ut.position||!ut.position.szi)return!1;const on=parseFloat(ut.position.szi);return!isNaN(on)&&on!==0}).map(ut=>{const on=ut._wallet||Me||(t==null?void 0:t.toLowerCase()),bn=ut.position,Gn=parseFloat(bn.szi),rr=parseFloat(bn.entryPx),Jn=parseFloat(bn.positionValue),Xn=parseFloat(bn.unrealizedPnl),Zr=parseFloat(bn.returnOnEquity)*100,$r=parseFloat(bn.marginUsed),wr=bn.leverage.value,pr=bn.leverage.type,ar=parseFloat(bn.cumFunding.sinceOpen),Vr=Gn>0?"Long":"Short",Ur=ft.get(`${bn.coin}-${Vr}`);return{wallet:on,asset:bn.coin,type:Vr,size:Gn,entryPrice:rr.toFixed(4),currentPrice:(Jn/Math.abs(Gn)).toFixed(4),leverage:wr,marginMode:pr,positionValue:Jn.toFixed(2),marginUsed:$r.toFixed(2),unrealizedPnl:Xn.toFixed(2),roe:Zr.toFixed(2),funding:ar.toFixed(4),startTime:Ur?wn(Ur):"N/A",liquidationPrice:bn.liquidationPx?parseFloat(bn.liquidationPx).toFixed(2):"N/A"}})};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&(q(),G())},[]);const xt=h.useRef(null),We=()=>{xt.current&&(xt.current.scrollLeft-=200)},Pt=()=>{xt.current&&(xt.current.scrollLeft+=200)},Ke=()=>{xt.current&&(xt.current.scrollTop+=200)},ct=()=>{xt.current&&(xt.current.scrollTop-=200)};h.useRef(null);const Nt=h.useRef(null),Ht=()=>{Nt.current&&(Nt.current.scrollLeft-=200)},Rt=()=>{Nt.current&&(Nt.current.scrollLeft+=200)},hn=()=>{Nt.current&&(Nt.current.scrollTop+=200)},yn=()=>{Nt.current&&(Nt.current.scrollTop-=200)};h.useRef(null),h.useEffect(()=>{(async()=>{var ut,on;const Me=window.localStorage.getItem("hyperToken"),ft=window.localStorage.getItem("hyperAddress");if(!(!Me||!ft))try{const bn=await bi(ft.toLowerCase(),Me);bn!=null&&bn.success?(ie(bn==null?void 0:bn.telegram_chat_id),oe(bn==null?void 0:bn.subscriber_role),K(bn==null?void 0:bn.subs_expire_day),H((ut=bn==null?void 0:bn.mushboomer_counts)==null?void 0:ut.eth),ee((on=bn==null?void 0:bn.mushboomer_counts)==null?void 0:on.sol),se(bn==null?void 0:bn.referral_code),Se(bn==null?void 0:bn.refcode),ge(bn==null?void 0:bn.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),ve(""),be(""))}catch(bn){console.error("Token verification error:",bn),console.error(bn.message||"An unknown error occurred.")}})()},[]);const Cn=["Open Position","Increase","Decrease","Changed Position","Position Closed","Spot","Liquidation"],En="-latestFill",[Rn,Mn]=h.useState(En),[Yn,Zn]=h.useState([]),[Vn,tr]=h.useState(""),[Sn,ze]=h.useState(""),[xe,Ge]=h.useState(""),[_e,Be]=h.useState(!1),[qt,It]=h.useState(!1),[mt,Ft]=h.useState(!1),[Tn,kn]=h.useState(!1),Gt=h.useRef(null),mn=h.useRef(null),gt=h.useRef(null),Wt=h.useRef(null),jn=le=>{Zn(Me=>Me.includes(le)?Me.filter(ft=>ft!==le):[...Me,le])};h.useEffect(()=>{function le(Me){Gt.current&&!Gt.current.contains(Me.target)&&Be(!1),mn.current&&!mn.current.contains(Me.target)&&It(!1),gt.current&&!gt.current.contains(Me.target)&&Ft(!1),Wt.current&&!Wt.current.contains(Me.target)&&kn(!1)}return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[]);const kt=Jt.map(le=>{let Me=le.isLiquidation?"Liquidation":le.totalStartPositions==0?"Open Position":le.direction!="Short > Long"&&le.direction!="Long > Short"?(le==null?void 0:le.totalSize)-Math.abs(le==null?void 0:le.totalStartPositions)==0&&(le.direction=="Close Long"||le.direction=="Close Short")?"Position Closed":le.direction=="Open Short"||le.direction=="Open Long"?"Increase":le.direction=="Close Long"||le.direction=="Close Short"?"Decrease":le.direction=="Sell"||le.direction=="Buy"?"Spot":"Changed Position":le.direction=="Short > Long"||le.direction=="Long > Short"?"Changed Position":"Open Position";return{...le,computedType:Me}}),cn=le=>{const Me=vn.find(ft=>ft.label===le);return Me?Me.value.toUpperCase():le==null?void 0:le.toUpperCase()},Ce=kt.filter(le=>Yn.length?Yn.includes(le.computedType):!0).filter(le=>{var Me,ft;return Vn?(ft=(Me=le==null?void 0:le.oid)==null?void 0:Me.toString())==null?void 0:ft.includes(Vn):!0}).filter(le=>Sn?cn(le.asset).includes(Sn.toUpperCase()):!0),m=le=>Ce==null?void 0:Ce.sort((Me,ft)=>{var $r,wr,pr,ar;const ut=Me.totalSize?Me.totalValue/Me.totalSize:0,on=ft.totalSize?ft.totalValue/ft.totalSize:0,bn=Vr=>{const Ur=vn.find(bs=>bs.label===Vr);return Ur?Ur.value.toUpperCase():Vr==null?void 0:Vr.toUpperCase()},Gn=bn(Me.asset),rr=bn(ft.asset),Jn=Vr=>{if(!Vr)return"";const Ur=Vr.toLowerCase();return Ur.includes("short")?"Short":Ur.includes("long")?"Long":Ur==="buy"?"Buy":Ur==="sell"?"Sell":Vr},Xn=Jn(Me.direction),Zr=Jn(ft.direction);if(le==="-totalSize")return ft.totalSize-Me.totalSize;if(le==="totalSize")return Me.totalSize-ft.totalSize;if(le==="-pnl")return ft.pnl-Me.pnl;if(le==="pnl")return Me.pnl-ft.pnl;if(le==="-fills")return((($r=ft.fills)==null?void 0:$r.length)||0)-(((wr=Me.fills)==null?void 0:wr.length)||0);if(le==="fills")return(((pr=Me.fills)==null?void 0:pr.length)||0)-(((ar=ft.fills)==null?void 0:ar.length)||0);if(le==="-latestFill")return new Date(ft.latestFill)-new Date(Me.latestFill);if(le==="latestFill")return new Date(Me.latestFill)-new Date(ft.latestFill);if(le==="-avgPrice")return on-ut;if(le==="avgPrice")return ut-on;if(le==="-oid")return ft.oid-Me.oid;if(le==="oid")return Me.oid-ft.oid;if(le==="direction"){const Vr={Short:1,Sell:2,Long:3,Buy:4};return(Vr[Xn]||99)-(Vr[Zr]||99)}else if(le==="-direction"){const Vr={Long:1,Buy:2,Short:3,Sell:4};return(Vr[Xn]||99)-(Vr[Zr]||99)}else{if(le==="-coin")return Gn<rr?-1:Gn>rr?1:0;if(le==="coin")return Gn>rr?-1:Gn<rr?1:0}return 0}),p=m(Rn).filter(le=>(le.totalStartPositions==0?"Open Position":le.direction!="Short > Long"&&le.direction!="Long > Short"?(le==null?void 0:le.totalSize)-Math.abs(le==null?void 0:le.totalStartPositions)==0&&(le.direction=="Close Long"||le.direction=="Close Short")?"Position Closed":le.direction=="Open Short"||le.direction=="Open Long"?"Increase":le.direction=="Close Long"||le.direction=="Close Short"?"Decrease":le.direction=="Sell"||le.direction=="Buy"?"Spot":"Changed Position":le.direction=="Short > Long"||le.direction=="Long > Short"?"Changed Position":"Open Position")==="Open Position"),N={};p.forEach(le=>{var ut;const Me=le==null?void 0:le.asset,ft=new Date(le==null?void 0:le.latestFill).getTime();if(!N[Me])N[Me]=le;else{const on=new Date((ut=N[Me])==null?void 0:ut.latestFill).getTime();ft>on&&(N[Me]=le)}});const A=Object.values(N),[k,P]=h.useState([]),D=s==null?void 0:s.filter(le=>{var Me;return xe?(Me=le.asset)==null?void 0:Me.toLowerCase().includes(xe.toLowerCase()):!0}).map(le=>{const Me=A.find(ut=>(ut==null?void 0:ut.asset)===(le==null?void 0:le.asset)),ft=k.find(ut=>ut.coin===le.asset&&(ut.wallet||"").toLowerCase()===(le.wallet||"").toLowerCase());return{...le,latestFill:(Me==null?void 0:Me.latestFill)||null,tagName:(ft==null?void 0:ft.tag)||null,tagWallet:(ft==null?void 0:ft.cp_wallet)||null}}),V="-unrealizedPnl",[Z,ce]=h.useState(V),ue=le=>D==null?void 0:D.sort((Me,ft)=>{const ut=Me.tagName?Me.tagName.toUpperCase():"",on=ft.tagName?ft.tagName.toUpperCase():"",bn=Me.asset?Me.asset.toUpperCase():"",Gn=ft.asset?ft.asset.toUpperCase():"",rr=Me.type==="Long"?1:0,Jn=ft.type==="Long"?1:0,Xn=Me.type==="Short"?1:0,Zr=ft.type==="Short"?1:0;return le==="-unrealizedPnl"?ft.unrealizedPnl-Me.unrealizedPnl:le==="unrealizedPnl"?Me.unrealizedPnl-ft.unrealizedPnl:le==="-roe"?ft.roe-Me.roe:le==="roe"?Me.roe-ft.roe:le==="-size"?ft.size-Me.size:le==="size"?Me.size-ft.size:le==="-entryPrice"?ft.entryPrice-Me.entryPrice:le==="entryPrice"?Me.entryPrice-ft.entryPrice:le==="-currentPrice"?ft.currentPrice-Me.currentPrice:le==="currentPrice"?Me.currentPrice-ft.currentPrice:le==="-leverage"?ft.leverage-Me.leverage:le==="leverage"?Me.leverage-ft.leverage:le==="-positionValue"?ft.positionValue-Me.positionValue:le==="positionValue"?Me.positionValue-ft.positionValue:le==="-marginUsed"?ft.marginUsed-Me.marginUsed:le==="marginUsed"?Me.marginUsed-ft.marginUsed:le==="funding"?ft.funding-Me.funding:le==="-funding"?Me.funding-ft.funding:le==="-liquidationPrice"?ft.liquidationPrice-Me.liquidationPrice:le==="liquidationPrice"?Me.liquidationPrice-ft.liquidationPrice:le==="-entryTime"?new Date(ft.latestFill)-new Date(Me.latestFill):le==="entryTime"?new Date(Me.latestFill)-new Date(ft.latestFill):le==="-source_tag"?ut<on?-1:ut>on?1:0:le==="source_tag"?ut>on?-1:ut<on?1:0:le==="-type_leverage"?rr!==Jn?Jn-rr:ft.leverage-Me.leverage:le==="type_leverage"?Xn!==Zr?Zr-Xn:ft.leverage-Me.leverage:le==="-asset"?bn<Gn?-1:bn>Gn?1:0:le==="asset"?bn>Gn?-1:bn<Gn?1:0:0}),[me,Ne]=h.useState([]),[Ie,Le]=h.useState(!0),[Xe,Oe]=h.useState(null),[$e,ae]=h.useState([]),[he,Pe]=h.useState(!0),[Ve,Te]=h.useState(null),[Ze,it]=h.useState([]),[wt,Dt]=h.useState(!0),[Qt,xn]=h.useState(null);async function pn(){try{Le(!0);const le=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(!le.ok)throw new Error(`HTTP error! status: ${le.status}`);const Me=await le.json();Ne(Me.results)}catch(le){console.error("Error resetting filters:",le),Oe(le.message)}finally{Le(!1)}}async function An(){try{Pe(!0);const le=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(!le.ok)throw new Error(`HTTP error! status: ${le.status}`);const Me=await le.json();ae(Me.results)}catch(le){console.error("Error resetting filters:",le),Te(le.message)}finally{Pe(!1)}}async function or(){try{Dt(!0);const le=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(!le.ok)throw new Error(`HTTP error! status: ${le.status}`);const Me=await le.json();it(Me.results)}catch(le){console.error("Error resetting filters:",le),xn(le.message)}finally{Dt(!1)}}h.useEffect(()=>{pn(),An(),or()},[]),h.useState("7D"),h.useState("7D"),s.length,s.filter(le=>le.unrealizedPnl>=0).length;const[$t,bt]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0});((ms=ue(Z))==null?void 0:ms.reduce((le,Me)=>le+((Me==null?void 0:Me.leverage)||0),0))/(((At=ue(Z))==null?void 0:At.length)||1),(pt=ue(Z))==null||pt.reduce((le,Me)=>{const ft=parseFloat(Me==null?void 0:Me.funding)||0;return le+ft},0);const gr=localStorage.getItem("isDateOpenPositionsFormat")||"date",[br,Br]=h.useState(gr);h.useEffect(()=>{localStorage.setItem("isDateOpenPositionsFormat",br)},[br]);const Or=localStorage.getItem("isDateFillsFormat")||"date",[Lt,nn]=h.useState(Or);h.useEffect(()=>{localStorage.setItem("isDateFillsFormat",Lt)},[Lt]);function Ot({date:le}){const[Me,ft]=h.useState(vo(le));return h.useEffect(()=>{const ut=setInterval(()=>{ft(vo(le))},1e3);return()=>clearInterval(ut)},[le]),i.jsx("span",{className:"text-white text-sm font-normal font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:Me.dateTime})}const[en,Fn]=h.useState([]),yr=async()=>{try{const le=window.localStorage.getItem("hyperToken");if(!le){we(!0);return}const Me="https://dextrabothypev2.nftinit.io/api/wallet/list",ft=window.localStorage.getItem("hyperAddress"),on=await(await fetch(Me,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Re?Re.toLowerCase():ft,token:le,balance:"false"})})).json();on!=null&&on.success?(Fn(on.data||[]),jr(on.data)):console.log(on.error_message)}catch(le){console.error("Error fetching generate wallet list:",le)}};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&yr()},[te]);const[hr,lt]=h.useState([]),[Ct,On]=h.useState(!0),[qn,_r]=h.useState(!1);h.useEffect(()=>{D&&D.length>0&&(Fr(),en.length>0&&Ct&&jr())},[D]);const jr=()=>{hr.length!==0&&(nr(hr),Ct&&On(!1))};h.useEffect(()=>{const le=window.localStorage.getItem("hyperToken");hr.length&&le&&nr(hr)},[hr]);const Fr=()=>{const le=window.localStorage.getItem("hyperToken");let Me=!1;const ft=[...hr];D.forEach(ut=>{var rr;const on=ut.asset,bn=(rr=ut.wallet||t)==null?void 0:rr.toLowerCase();ft.some(Jn=>Jn.coin===on&&(Jn.wallet||"").toLowerCase()===bn)||(ft.push({coin:on,wallet:bn}),Me=!0)}),Me&&(lt(ft),en.some(on=>on.wallet_address===(t==null?void 0:t.toLowerCase()))&&le&&nr(ft))},nr=async le=>{if(!qn)try{_r(!0);const Me=window.localStorage.getItem("hyperToken"),ft="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!Me||!le){_r(!1);return}Me||we(!0);const ut=window.localStorage.getItem("hyperAddress"),bn=await(await fetch(ft,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Re?Re.toLowerCase():ut,token:Me,positions:le})})).json();bn.success?P(bn==null?void 0:bn.data):(console.log(bn.error_message),fn.error(bn.error_message))}catch(Me){console.error("Error tag request",Me),fn.error(Me.message)}finally{_r(!1)}},vr=(e==null?void 0:e.length)>1||en.some(le=>le.wallet_address===(t==null?void 0:t.toLowerCase())),Yr=async(le,Me,ft,ut,on)=>{if(!le||!ft||!ut||!on){console.error("Close order called with invalid parameters"),fn.error("Close order called with invalid parameters");return}const bn=`${ut}_${ft}_${on}`;try{st($r=>({...$r,[bn]:!0}));const Gn=window.localStorage.getItem("hyperToken"),rr="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_new/";if(!Gn){we(!0),st($r=>({...$r,[bn]:!1}));return}const Jn=window.localStorage.getItem("hyperAddress"),Xn=await fetch(rr,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Re?Re.toLowerCase():Jn,token:Gn,coin:ft,wallet_id:le.toString(),leverage:ut,size:on})});if(!Xn.ok)throw new Error(`Server responded with status ${Xn.status}`);const Zr=await Xn.json();Zr.success?(st($r=>({...$r,[bn]:!1})),fn.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"}})):Zr.status=="ok"?(st($r=>({...$r,[bn]:!1})),fn.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!"),fn.error("Something went wrong!"),st($r=>({...$r,[bn]:!1})))}catch{console.error("Something went wrong!"),fn.error("Something went wrong!"),st(rr=>({...rr,[bn]:!1}))}},dr=async(le=[])=>{if(le.length!==0){He(!0);try{await Promise.all(le.map(Me=>rs(Me)))}finally{He(!1)}}},rs=async le=>{if((D==null?void 0:D.length)===0){fn.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(!le){console.error("Close order called with invalid parameters"),fn.error("Close order called with invalid parameters");return}try{He(!0);const Me=window.localStorage.getItem("hyperToken"),ft="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_all_new/";if(!Me){we(!0),He(!1);return}const ut=window.localStorage.getItem("hyperAddress"),on=await fetch(ft,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Re?Re.toLowerCase():ut,token:Me,wallet_id:le.toString()})});if(!on.ok)throw new Error(`Server responded with status ${on.status}`);const bn=await on.json();bn.status=="ok"?(He(!1),fn.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"}})):bn.success?(He(!1),fn.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."),fn.error("Close order operation failed."),He(!1))}catch(Me){throw console.error("Something went wrong!"),fn.error("Something went wrong!"),He(!1),Me}},gs={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("div",{className:"w-full",children:[i.jsx(cP,{open:Qe,setOpen:Ye,data:$t,setTradeInfo:bt}),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:()=>T("positions"),className:`${S==="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:()=>T("fills"),className:`${S==="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:()=>T("trade-history"),className:`${S==="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:()=>T("twap-history"),className:`${S==="twap-history"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} ${jt.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:()=>T("completed-trades"),className:`${S==="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:()=>T("deposit-withdraw"),className:`${S==="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"})}),!un&&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:Glt,className:"w-[19px] h-[18px]"}),i.jsx("div",{className:"text-[#C1C1C1] text-[13px] font-semibold font-manrope leading-[8px] hover:text-[#67FFBD]",children:"HypurrScan"})]})]}),S==="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:Ht,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(Vl,{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 block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Vl,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:yn,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(Vl,{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(Vl,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:Nt,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(hi,{title:"Coin",sortKey:"coin",sortOption:Rn,setSortOption:Mn,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>Ft(!mt),className:`${Sn?"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(xd,{className:`w-4 h-4 ${Sn?"text-blue-500":"text-white"}`})}),mt&&i.jsxs("div",{ref:gt,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:()=>ze(""),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:Sn,onChange:le=>ze(le.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(dQ,{className:"pl-4 min-w-[120px] max-w-[120px] sm:min-w-[144px] sm:max-w-[144px] px-1",title:"Direction",sortKey:"direction",sortOption:Rn,setSortOption:Mn}),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:()=>Be(!_e),className:`${Yn.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(xd,{className:`w-4 h-4 ${Yn.length>0?"text-blue-500":"text-white"}`})}),_e&&i.jsxs("div",{ref:Gt,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:()=>Zn([]),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"})})]}),Cn.map(le=>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:Yn.includes(le),onChange:()=>jn(le),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 ${Yn.includes(le)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:Yn.includes(le)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),le]},le))]})]})}),i.jsx(Vd,{className:"min-w-[80px] max-w-[80px] px-1",title:"Size",sortKey:"totalSize",sortOption:Rn,setSortOption:Mn}),i.jsx(Vd,{className:"min-w-[110px] max-w-[110px] sm:min-w-[130px] sm:max-w-[130px] px-1",title:"Avg. Price",sortKey:"avgPrice",sortOption:Rn,setSortOption:Mn}),i.jsx(Vd,{className:"min-w-[100px] max-w-[100px] sm:min-w-[120px] sm:max-w-[120px] px-1",title:"PnL",sortKey:"pnl",sortOption:Rn,setSortOption:Mn}),i.jsx(Vd,{className:"min-w-[100px] max-w-[100px] sm:min-w-[120px] sm:max-w-[120px] px-1",title:"Fill Count",sortKey:"fills",sortOption:Rn,setSortOption:Mn}),i.jsx(Vd,{className:"min-w-[200px] max-w-[200px] px-1",title:"Latest Fill",sortKey:"latestFill",sortOption:Rn,setSortOption:Mn}),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(hi,{title:"Order ID",sortKey:"oid",sortOption:Rn,setSortOption:Mn,isFilterIcon:!0}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>It(!qt),className:`${Vn?"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(xd,{className:`w-4 h-4 ${Vn?"text-blue-500":"text-white"}`})}),qt&&i.jsxs("div",{ref:mn,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:()=>tr(""),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:Vn,onChange:le=>tr(le.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:m(Rn).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:Yl,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"})})]})]})})})})}):m(Rn).map((le,Me)=>{var ut,on,bn,Gn,rr,Jn;const ft=le.totalValue/le.totalSize;return(ut=le==null?void 0:le.direction)==null||ut.includes("Long"),i.jsxs(ke.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 Xn;window.open(`/terminal/${((Xn=vn.find(Zr=>Zr.label===le.asset))==null?void 0:Xn.value)||le.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/${((on=vn.find(Xn=>Xn.label===le.asset))==null?void 0:on.value)||gs[le.asset]||((bn=le.asset)==null?void 0:bn.split("/")[0])}.svg`||Ha,alt:le==null?void 0:le.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:Xn=>Zi(Xn)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:(()=>{const Xn=vn.find(Zr=>Zr.label===le.asset);return Xn?Xn.value:le.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:`${(Gn=le.direction)!=null&&Gn.includes("Long")?le.direction==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":le.direction==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":le.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:(rr=le.direction)!=null&&rr.includes("Long")?le.direction==="Short > Long"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):le.direction==="Long > Short"?i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):le.direction=="Buy"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:le.direction=="Sell"?"Sell":le.direction=="Buy"?"Buy":le.direction=="Close Short"?"Short":le.direction=="Close Long"?"Long":le.direction=="Open Short"?"Short":le.direction=="Open Long"?"Long":le.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:`${le!=null&&le.isLiquidation?"text-[#ff787b]":"text-white"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px] min-w-max`,children:le!=null&&le.isLiquidation?`Market Liquidation: ${le.direction=="Sell"?"Sell":le.direction=="Buy"?"Buy":le.direction=="Close Short"?"Close Short":le.direction=="Close Long"?"Close Long":le.direction=="Open Short"?"Close Short":le.direction=="Open Long"?"Close Long":"Close "+le.direction} `:le.totalStartPositions==0?"Open Position":le.direction!="Short > Long"&&le.direction!="Long > Short"?(le==null?void 0:le.totalSize)-Math.abs(le==null?void 0:le.totalStartPositions)==0&&(le.direction=="Close Long"||le.direction=="Close Short")?"Position Closed":le.direction=="Open Short"||le.direction=="Open Long"?"Increase":le.direction=="Close Long"||le.direction=="Close Short"?"Decrease":le.direction=="Sell"||le.direction=="Buy"?"Spot":"Changed Position":le.direction=="Short > Long"||le.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:mo(le.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:ft?`$${Gv(ft)}`:Gv(ft)})})}),i.jsx("td",{children:i.jsx("div",{className:`${le.pnl,""} px-1 flex justify-end gap-2 font-manrope min-w-max`,children:i.jsx("div",{className:`${le.pnl>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:le.pnl?`$${Gv(Math.abs(le.pnl))}`:Gv(Math.abs(le.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:[(Jn=le==null?void 0:le.fills)==null?void 0:Jn.length," Fills"]})})}),i.jsx("td",{children:i.jsx("div",{onClick:()=>{nn(Lt=="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:Lt=="time"?i.jsx(Ot,{date:le.latestFill}):$c(le.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:le==null?void 0:le.oid})})})]},Me),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},Me)})})]})})]}):S==="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: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(Vl,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:Pt,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(Vl,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:ct,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(Vl,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:Ke,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(Vl,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:xt,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(hi,{title:"Coin",sortKey:"asset",sortOption:Z,setSortOption:ce,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>kn(!Tn),className:`${xe?"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(xd,{className:`w-4 h-4 ${xe?"text-blue-500":"text-white"}`})}),Tn&&i.jsxs("div",{ref:Wt,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:()=>Ge(""),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:xe,onChange:le=>Ge(le.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"})]})]})]})}),vr&&i.jsx(dQ,{className:"min-w-[130px] sm:min-w-[130px] px-1",title:"Source Tag",sortKey:"source_tag",sortOption:Z,setSortOption:ce}),i.jsx(dQ,{className:"min-w-[100px] sm:min-w-[120px] px-1",title:"Type",sortKey:"type_leverage",sortOption:Z,setSortOption:ce}),i.jsx(Vd,{className:"min-w-[80px] sm:min-w-[80px] px-1",title:"Size",sortKey:"size",sortOption:Z,setSortOption:ce}),i.jsx(Vd,{className:"min-w-[130px] sm:min-w-[145px] px-1",title:"Position Value",sortKey:"positionValue",sortOption:Z,setSortOption:ce}),i.jsx(Vd,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Entry Price",sortKey:"entryPrice",sortOption:Z,setSortOption:ce}),i.jsx(Vd,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Mark Price",sortKey:"currentPrice",sortOption:Z,setSortOption:ce}),i.jsx(Vd,{className:"min-w-[100px] sm:min-w-[160px] px-1",title:"PnL(ROE%)",sortKey:"unrealizedPnl",sortOption:Z,setSortOption:ce}),i.jsx(Vd,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Liq. Price",sortKey:"liquidationPrice",sortOption:Z,setSortOption:ce}),i.jsx(Vd,{className:"min-w-[120px] sm:min-w-[130px] px-1",title:"Margin",sortKey:"marginUsed",sortOption:Z,setSortOption:ce}),i.jsx(Vd,{className:"min-w-[110px] sm:min-w-[130px] px-1",title:"Funding",sortKey:"funding",sortOption:Z,setSortOption:ce}),i.jsx(Vd,{className:`${vr?"pr-0":"pr-8"} min-w-[185px] sm:min-w-[185px] pl-1`,title:"Entry Time",sortKey:"entryTime",sortOption:Z,setSortOption:ce}),vr&&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:le=>{if(le.preventDefault(),at)return;const ft=(e!=null&&e.length?e.map(ut=>ut.wallet_address.toLowerCase()):[t==null?void 0:t.toLowerCase()]).map(ut=>{var on;return(on=en.find(bn=>bn.wallet_address===ut))==null?void 0:on.wallet_id}).filter(Boolean);dr(ft)},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:Pae,alt:"",className:"w-4 h-4"})}),at?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(ka,{}):i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:Yl,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."]})]})]})]})})})})}):D==null?void 0:D.map((le,Me)=>{var ft,ut,on,bn,Gn;return i.jsxs(ke.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/${le==null?void 0:le.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/${gs[le.asset]||((ft=le.asset)==null?void 0:ft.split("/")[0])}.svg`||Ha,alt:le==null?void 0:le.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:rr=>Zi(rr)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:le.asset})]})})}),vr&&i.jsx("td",{children:i.jsx("div",{onClick:rr=>{rr.preventDefault(),le!=null&&le.tagWallet&&(le==null?void 0:le.tagWallet)!=null&&window.open(`/wallet-details/${le==null?void 0:le.tagWallet}`,"_blank")},className:`${le!=null&&le.tagWallet&&(le==null?void 0:le.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:[(le==null?void 0:le.tagName)==null||(le==null?void 0:le.tagName)==""?"--":((ut=le==null?void 0:le.tagName)==null?void 0:ut.length)>10?((on=le==null?void 0:le.tagName)==null?void 0:on.slice(0,10))+"...":le==null?void 0:le.tagName,(le==null?void 0:le.tagName)&&(le==null?void 0:le.tagName.length)>10&&i.jsx("span",{children:i.jsx(Ra,{content:`${le==null?void 0:le.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:`${le.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:le.type==="Long"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsxs("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase",children:[le.type," - ",le==null?void 0:le.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:mo(Math.abs(le.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:le.positionValue?`$${mo(le.positionValue)}`:mo(le.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:le.entryPrice?`$${Ir(le.entryPrice)}`:Ir(le.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:le.currentPrice?`$${Ir(le.currentPrice)}`:Ir(le.currentPrice)})})}),i.jsx("td",{children:i.jsxs("div",{onClick:()=>{bt(rr=>({...rr,coin:le.asset,type:le.type,leverage:le.leverage,roe:le.roe,entryPrice:le.entryPrice,markPrice:le.currentPrice,pnl:le.unrealizedPnl,referral:window.localStorage.getItem("hyperToken")?pe:null})),Ye(!0)},className:"pl-1 pr-2 flex justify-end gap-2 font-manrope cursor-pointer min-w-max",children:[i.jsxs("div",{className:`${le.unrealizedPnl>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:[le.unrealizedPnl?`$${mo(Math.abs(le.unrealizedPnl))}`:mo(Math.abs(le.unrealizedPnl)),` (${mo(Math.abs(le==null?void 0:le.roe))}%)`]}),i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:jm,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:le.liquidationPrice!=null&&le.liquidationPrice!==""&&!isNaN(le.liquidationPrice)?`$${mo(le.liquidationPrice)}`:mo(le.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:[le.marginUsed?`$${mo(le.marginUsed)}`:mo(le.marginUsed)," (",((bn=le==null?void 0:le.marginMode)==null?void 0:bn.charAt(0).toUpperCase())+((Gn=le==null?void 0:le.marginMode)==null?void 0:Gn.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:`${le.funding<=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:le.funding?`$${Gv(Math.abs(le.funding))}`:Gv(Math.abs(le.funding))})})}),i.jsx("td",{className:`${vr?"":"pr-8 sm:rounded-r-2xl"}`,children:i.jsx("div",{onClick:()=>{Br(br=="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:le!=null&&le.latestFill?br=="time"?i.jsx(Ot,{date:le==null?void 0:le.latestFill}):$c(le==null?void 0:le.latestFill):i.jsx("span",{className:"text-[#979797]",children:"--"})})})}),vr&&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[`${le==null?void 0:le.leverage}_${le==null?void 0:le.asset}_${le==null?void 0:le.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 rr=en.find(Zr=>{var $r;return Zr.wallet_address===(($r=le.wallet||t)==null?void 0:$r.toLowerCase())}),Jn=rr==null?void 0:rr.wallet_id,Xn=rr==null?void 0:rr.wallet_address;Jn&&Yr(Jn,Xn,le==null?void 0:le.asset,le==null?void 0:le.leverage,le==null?void 0:le.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"}})})]},Me)})})]})})]}):S==="twap-history"&&jt.pathname.startsWith("/wallet-details")?i.jsx(icn,{data:qe,setData:vt,wallet:t,coinNameData:vn}):S==="trade-history"?i.jsx(Rln,{wallet:t,wallets:e}):S==="completed-trades"?i.jsx(scn,{trades:re,generatedWallets:en,wallet:t,wallets:e}):S==="deposit-withdraw"?i.jsx(Uln,{wallet:t,wallets:e}):""]})},Vd=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(hi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!0})}),dQ=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(hi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!1})});function fQ({walletAddress:t}){const[e,n]=h.useState(!1),[r,s]=h.useState(0),[a,o]=h.useState([]),[l,c]=h.useState({}),[u,d]=h.useState(null),[f,x]=h.useState(""),[g,y]=h.useState(""),v=()=>{Ns.post("https://dextrabothypev2.nftinit.io/api/hyper/wallet/getwalletreportsdetail/",{wallet_address:t}).then(T=>{s(T.data.report_count||0);const I=T.data.report_detail.reduce((L,F)=>(L[F.report_type_id]=(L[F.report_type_id]||0)+1,L),{});c(I)})};h.useEffect(()=>{v()},[t]),h.useEffect(()=>{const T=I=>{I.key==="Escape"&&n(!1)};return e&&window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T)}},[e]);const C=()=>{a.length||Ns.get("https://dextrabothypev2.nftinit.io/api/hyper/wallet/getreporttypes/").then(T=>{var I;return o(((I=T.data)==null?void 0:I.data)||[])})},S=()=>{if(!u){y("Please select a report type");return}const T=localStorage.getItem("hyperAddress"),I=localStorage.getItem("hyperToken");Ns.post("https://dextrabothypev2.nftinit.io/api/hyper/wallet/walletreport/",{address:T,token:I,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:T=>T.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(zOe,{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(T=>i.jsxs("button",{onClick:()=>{d(T.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===T.id?"bg-white text-[#161616]":"bg-[#1f1f1f] border border-[#353535]"}`,children:[T.name,i.jsx("span",{className:"bg-[#FFC940] text-[#30260E] text-13px font-bold rounded-[6px] px-2",children:l[T.id]||0})]},T.id))}),i.jsx("label",{className:"block text-xs mb-1",children:"Comment (Optional)"}),i.jsx("textarea",{value:f,onChange:T=>x(T.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:S,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 ANe="https://api-ui.hyperliquid.xyz/info",ocn="wss://api.hyperliquid.xyz/ws",lcn=({initialAddress:t=""})=>{var ms,At,pt;const[e,n]=h.useState(t),[r,s]=h.useState([]),[a,o]=h.useState([]),[l,c]=h.useState(!1),[u,d]=h.useState(1),[f,x]=h.useState(null),[g,y]=h.useState(!1),v=h.useRef(null),C=yo(),S=h.useRef(t),T=h.useRef(null),I=h.useRef(null),L=h.useRef(null),[F,$]=h.useState({}),[O,U]=h.useState(!1),[Y,re]=h.useState(""),[Q,q]=h.useState(null),{trackedWatchList:te,getTrackedWatchList:fe,hyperToken:G,copyTradeWatchList:ie,getCopyTradeWatchList:oe,setTelegramChatId:K,setSubscriberRole:H,setSubsExpireDay:ee,setMushboomerETH:se,setMushboomerSOL:pe,setIsReferralCode:Se,isReferralCodeName:ge,setIsReferralCodeName:ve,setIsWhitelist:be,setHyperToken:we,setHyperAddress:je,setSignModalOpen:Fe,latestPnL:Re}=h.useContext(Qr),{isConnected:Qe,address:Ye}=ds(),[dt,st]=h.useState(!1),[at,He]=h.useState(!1),[qe,vt]=h.useState(null),[yt,Kt]=h.useState(null),[jt,un]=h.useState(""),[vn,Hn]=h.useState(!1),[ln,Nn]=h.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),dn=ln||Re.activeRange;h.useEffect(()=>{Nn(null)},[Re.activeRange]);const rt=[{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 nt(le,Me){const ft=Me.map(({fill:ut,twapId:on})=>({...ut,twapId:on}));return[...le,...ft]}h.useEffect(()=>{t&&(async()=>{const le=await kde(t),Me=await Tde(t),ft=nt(le,Me),{closed_positions:ut}=Pde(ft);q(ut)})()},[t]),h.useEffect(()=>(t&&(S.current=t,Jt(t),Ke(t)),()=>{v.current&&(v.current.close(),v.current=null),T.current&&(clearTimeout(T.current),T.current=null),I.current&&(clearInterval(I.current),I.current=null),L.current&&(clearInterval(L.current),L.current=null)}),[t]),h.useEffect(()=>{const le=localStorage.getItem("favoriteAddresses");le&&$(JSON.parse(le))},[]),h.useCallback(()=>{if(F[e]){const le={...F};delete le[e],$(le),localStorage.setItem("favoriteAddresses",JSON.stringify(le))}else U(!0),re("")},[e,F]),h.useCallback(()=>{if(!Y.trim())return;const le={...F,[e]:{name:Y,address:e}};$(le),localStorage.setItem("favoriteAddresses",JSON.stringify(le)),U(!1)},[Y,e,F]),h.useCallback(le=>{le&&(n(le),Jt(le),C(`/wallet-details/${le}`))},[]);const Ut=le=>{var Me;((Me=v.current)==null?void 0:Me.readyState)===WebSocket.OPEN&&S.current===le||(I.current&&(clearInterval(I.current),I.current=null),T.current&&(clearTimeout(T.current),T.current=null),v.current&&(v.current.close(),v.current=null),S.current=le,v.current=new WebSocket(ocn),v.current.onopen=()=>{console.log("WebSocket Connected"),y(!0),[{method:"subscribe",subscription:{aggregateByTime:!0,type:"userFills",user:le}},{method:"subscribe",subscription:{type:"user",user:le}}].forEach(ut=>{v.current.send(JSON.stringify(ut))}),I.current=setInterval(()=>{var ut;if(((ut=v.current)==null?void 0:ut.readyState)===WebSocket.OPEN){const on={id:99,method:"ping"};v.current.send(JSON.stringify(on))}},3e4)},v.current.onclose=ft=>{y(!1),I.current&&(clearInterval(I.current),I.current=null),ft.code!==1e3&&(T.current||(T.current=setTimeout(()=>{T.current=null,S.current===le&&Ut(le)},5e3)))},v.current.onerror=ft=>{console.error("WebSocket Error:",ft),y(!1)},v.current.onmessage=ft=>{var ut,on,bn;try{const Gn=JSON.parse(ft.data);if(Gn.method==="pong"||Gn.result==="success")return;if(Gn.channel==="userFills"&&((ut=Gn.data)!=null&&ut.fills)&&S.current.toLowerCase()===Gn.data.user.toLowerCase()&&(s(rr=>{const Jn=rr.flatMap(wr=>wr.fills),Xn=new Map;Jn.forEach(wr=>{Xn.set(wr.hash,!0)});const Zr=Gn.data.fills.filter(wr=>!Xn.has(wr.hash));if(Zr.length===0)return rr;const $r=[...Zr,...Jn];return Vt($r)}),L.current||Ke(S.current)),Gn.channel==="user"&&((on=Gn.data)!=null&&on.fills&&s(rr=>{const Jn=rr.flatMap(wr=>wr.fills),Xn=new Map;Jn.forEach(wr=>{Xn.set(wr.hash,!0)});const Zr=Gn.data.fills.filter(wr=>!Xn.has(wr.hash));if(Zr.length===0)return rr;const $r=[...Zr,...Jn];return Vt($r)}),(bn=Gn.data)!=null&&bn.state)){x(Gn.data.state);const rr=Pt(Gn.data.state);o(rr)}}catch(Gn){console.error("Error processing WebSocket message:",Gn),console.error("Raw message that caused error:",ft.data)}})},wn=async le=>{try{st(!0);const Me=await Ns.post(ANe,{type:"clearinghouseState",user:le});if(Me.data){x(Me.data);const ft=Pt(Me.data);o(ft),st(!1),ft.length>0&&!L.current?Ke(le):ft.length===0&&L.current&&(clearInterval(L.current),L.current=null)}}catch(Me){console.error("Error fetching user state:",Me),st(!1)}},Jt=async le=>{if(!le){fn.error("Please enter a wallet address");return}if(!le.match(/^0x[a-fA-F0-9]{40}$/)){fn.error("Please enter a valid Ethereum address");return}c(!0);try{le!==t&&C(`/wallet-details/${le}`),Ut(le);const[Me]=await Promise.all([Ns.post(ANe,{aggregateByTime:!0,type:"userFills",user:le}),wn(le)]);if(Me.data&&Array.isArray(Me.data)){const ft=Vt(Me.data);s(ft),d(1)}else console.error("Invalid response format:",Me.data)}catch(Me){console.error("Error fetching data:",Me)}finally{c(!1)}},Vt=le=>{const Me=[...le].sort((ut,on)=>on.time-ut.time),ft=new Map;return Me.forEach(ut=>{var bn;const on=ut.oid;if(!ft.has(on)){const Gn=Me.filter(pr=>pr.oid===ut.oid),rr=Gn.reduce((pr,ar)=>pr+parseFloat(ar.sz),0),Jn=Gn.map(pr=>parseFloat(pr.startPosition));let Xn;Jn.includes(0)?Xn=0:Jn.every(pr=>pr>0)?Xn=Math.max(...Jn):Jn.every(pr=>pr<0)?Xn=Math.min(...Jn):Xn=Gn.reduce((pr,ar)=>pr+parseFloat(ar.startPosition),0);const Zr=Gn.reduce((pr,ar)=>pr+parseFloat(ar.sz)*parseFloat(ar.px),0),$r=Gn.reduce((pr,ar)=>pr+parseFloat(ar.closedPnl||0),0),wr=((bn=Gn.find(pr=>pr.dir==="Long > Short"||pr.dir==="Short > Long"))==null?void 0:bn.dir)||"";ft.set(on,{oid:ut.oid,asset:ut.coin,direction:wr==""?ut.dir:wr,fills:Gn,totalSize:rr,totalStartPositions:Xn,totalValue:Zr,pnl:$r,latestFill:ut.time})}}),Array.from(ft.values()).sort((ut,on)=>on.latestFill-ut.latestFill)},xt=le=>{const Me=new Date(le),ft=Me.toLocaleString("en-US",{month:"short"}),ut=Me.getDate(),on=Me.getFullYear(),bn=Me.getHours().toString().padStart(2,"0"),Gn=Me.getMinutes().toString().padStart(2,"0"),rr=Me.getHours()>=12?" PM":" AM";return`${ft} ${ut}, ${on}, ${bn}:${Gn} ${rr}`},We=r,Pt=le=>{if(!(le!=null&&le.assetPositions))return[];const Me=new Map;return r.forEach(ft=>{ft.fills.forEach(ut=>{let on="";ut.dir.includes("Open")?on=ut.dir.includes("Long")?"Long":"Short":ut.side==="B"?on="Long":ut.side==="S"&&(on="Short");const bn=`${ut.coin}-${on}`;(!Me.has(bn)||ut.time<Me.get(bn))&&Me.set(bn,ut.time)})}),le.assetPositions.filter(ft=>{if(!ft.position||!ft.position.szi)return!1;const ut=parseFloat(ft.position.szi);return!isNaN(ut)&&ut!==0}).map(ft=>{const ut=ft.position,on=parseFloat(ut.szi),bn=parseFloat(ut.entryPx),Gn=parseFloat(ut.positionValue),rr=parseFloat(ut.unrealizedPnl),Jn=parseFloat(ut.returnOnEquity)*100,Xn=parseFloat(ut.marginUsed),Zr=ut.leverage.value,$r=ut.leverage.type,wr=parseFloat(ut.cumFunding.sinceOpen),pr=on>0?"Long":"Short",ar=Me.get(`${ut.coin}-${pr}`);return{asset:ut.coin,type:pr,size:on,entryPrice:bn.toFixed(4),currentPrice:(Gn/Math.abs(on)).toFixed(4),leverage:Zr,marginMode:$r,positionValue:Gn.toFixed(2),marginUsed:Xn.toFixed(2),unrealizedPnl:rr.toFixed(2),roe:Jn.toFixed(2),funding:wr.toFixed(4),startTime:ar?xt(ar):"N/A",liquidationPrice:ut.liquidationPx?parseFloat(ut.liquidationPx).toFixed(2):"N/A"}})},Ke=le=>{L.current&&(clearInterval(L.current),L.current=null),L.current=setInterval(()=>{wn(le)},7e3)},ct=le=>le>=1e6?`${(le/1e6).toFixed(2)}M`:le>=1e3?`${(le/1e3).toFixed(2)}K`:le.toFixed(2);h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&(fe(),oe())},[]);const Nt=h.useRef(null),Ht=()=>{Nt.current&&(Nt.current.scrollLeft-=200)},Rt=()=>{Nt.current&&(Nt.current.scrollLeft+=200)};h.useEffect(()=>{(async()=>{var ut,on;const Me=window.localStorage.getItem("hyperToken"),ft=window.localStorage.getItem("hyperAddress");if(!(!Me||!ft))try{const bn=await bi(ft.toLowerCase(),Me);bn!=null&&bn.success?(K(bn==null?void 0:bn.telegram_chat_id),H(bn==null?void 0:bn.subscriber_role),ee(bn==null?void 0:bn.subs_expire_day),se((ut=bn==null?void 0:bn.mushboomer_counts)==null?void 0:ut.eth),pe((on=bn==null?void 0:bn.mushboomer_counts)==null?void 0:on.sol),Se(bn==null?void 0:bn.referral_code),ve(bn==null?void 0:bn.refcode),be(bn==null?void 0:bn.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),we(""),je(""))}catch(bn){console.error("Token verification error:",bn),console.error(bn.message||"An unknown error occurred.")}})()},[]);const hn=async({walletAddress:le,isFollow:Me,isScalper:ft})=>{try{un(le);const ut=window.localStorage.getItem("hyperToken"),on=window.localStorage.getItem("hyperAddress");if(!ut){Fe(!0);return}const bn=Me?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",Gn=Me?{address:Ye?Ye.toLowerCase():on,token:ut,follow_address:le.toLowerCase()}:{address:Ye?Ye.toLowerCase():on,token:ut},rr=await fetch(bn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Gn)});if(!rr.ok)throw new Error(`Server responded with status ${rr.status}`);const Jn=await rr.json();Jn.success?(vt(Array.isArray(Jn==null?void 0:Jn.data)?[...Jn.data].sort((Xn,Zr)=>new Date(Zr.created_at||0)-new Date(Xn.created_at||0)):Jn==null?void 0:Jn.data),Kt(ft),He(!0)):(console.log(Jn.error_message),fn.error(Jn.error_message))}catch(ut){console.error("Error in like function:",ut),fn.error(ut.message||"Something went wrong!")}},yn="-latestFill",[Cn,En]=h.useState(yn),[Rn,Mn]=h.useState([]),[Yn,Zn]=h.useState(""),[Vn,tr]=h.useState(""),[Sn,ze]=h.useState(""),[xe,Ge]=h.useState(!1),[_e,Be]=h.useState(!1),[qt,It]=h.useState(!1),[mt,Ft]=h.useState(!1),Tn=h.useRef(null),kn=h.useRef(null),Gt=h.useRef(null),mn=h.useRef(null);h.useEffect(()=>{function le(Me){Tn.current&&!Tn.current.contains(Me.target)&&Ge(!1),kn.current&&!kn.current.contains(Me.target)&&Be(!1),Gt.current&&!Gt.current.contains(Me.target)&&It(!1),mn.current&&!mn.current.contains(Me.target)&&Ft(!1)}return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[]);const gt=We.map(le=>{let Me=le.totalStartPositions==0?"Open Position":le.direction!="Short > Long"&&le.direction!="Long > Short"?(le==null?void 0:le.totalSize)-Math.abs(le==null?void 0:le.totalStartPositions)==0&&(le.direction=="Close Long"||le.direction=="Close Short")?"Position Closed":le.direction=="Open Short"||le.direction=="Open Long"?"Increase":le.direction=="Close Long"||le.direction=="Close Short"?"Decrease":le.direction=="Sell"||le.direction=="Buy"?"Spot":"Changed Position":le.direction=="Short > Long"||le.direction=="Long > Short"?"Changed Position":"Open Position";return{...le,computedType:Me}}),Wt=le=>{const Me=rt.find(ft=>ft.label===le);return Me?Me.value.toUpperCase():le==null?void 0:le.toUpperCase()},jn=gt.filter(le=>Rn.length?Rn.includes(le.computedType):!0).filter(le=>{var Me,ft;return Yn?(ft=(Me=le==null?void 0:le.oid)==null?void 0:Me.toString())==null?void 0:ft.includes(Yn):!0}).filter(le=>Vn?Wt(le.asset).includes(Vn.toUpperCase()):!0),cn=(le=>jn==null?void 0:jn.sort((Me,ft)=>{var $r,wr,pr,ar;const ut=Me.totalSize?Me.totalValue/Me.totalSize:0,on=ft.totalSize?ft.totalValue/ft.totalSize:0,bn=Vr=>{const Ur=rt.find(bs=>bs.label===Vr);return Ur?Ur.value.toUpperCase():Vr==null?void 0:Vr.toUpperCase()},Gn=bn(Me.asset),rr=bn(ft.asset),Jn=Vr=>{if(!Vr)return"";const Ur=Vr.toLowerCase();return Ur.includes("short")?"Short":Ur.includes("long")?"Long":Ur==="buy"?"Buy":Ur==="sell"?"Sell":Vr},Xn=Jn(Me.direction),Zr=Jn(ft.direction);if(le==="-totalSize")return ft.totalSize-Me.totalSize;if(le==="totalSize")return Me.totalSize-ft.totalSize;if(le==="-pnl")return ft.pnl-Me.pnl;if(le==="pnl")return Me.pnl-ft.pnl;if(le==="-fills")return((($r=ft.fills)==null?void 0:$r.length)||0)-(((wr=Me.fills)==null?void 0:wr.length)||0);if(le==="fills")return(((pr=Me.fills)==null?void 0:pr.length)||0)-(((ar=ft.fills)==null?void 0:ar.length)||0);if(le==="-latestFill")return new Date(ft.latestFill)-new Date(Me.latestFill);if(le==="latestFill")return new Date(Me.latestFill)-new Date(ft.latestFill);if(le==="-avgPrice")return on-ut;if(le==="avgPrice")return ut-on;if(le==="-oid")return ft.oid-Me.oid;if(le==="oid")return Me.oid-ft.oid;if(le==="direction"){const Vr={Short:1,Sell:2,Long:3,Buy:4};return(Vr[Xn]||99)-(Vr[Zr]||99)}else if(le==="-direction"){const Vr={Long:1,Buy:2,Short:3,Sell:4};return(Vr[Xn]||99)-(Vr[Zr]||99)}else{if(le==="-coin")return Gn<rr?-1:Gn>rr?1:0;if(le==="coin")return Gn>rr?-1:Gn<rr?1:0}return 0}))(Cn).filter(le=>(le.totalStartPositions==0?"Open Position":le.direction!="Short > Long"&&le.direction!="Long > Short"?(le==null?void 0:le.totalSize)-Math.abs(le==null?void 0:le.totalStartPositions)==0&&(le.direction=="Close Long"||le.direction=="Close Short")?"Position Closed":le.direction=="Open Short"||le.direction=="Open Long"?"Increase":le.direction=="Close Long"||le.direction=="Close Short"?"Decrease":le.direction=="Sell"||le.direction=="Buy"?"Spot":"Changed Position":le.direction=="Short > Long"||le.direction=="Long > Short"?"Changed Position":"Open Position")==="Open Position"),Ce={};cn.forEach(le=>{var ut;const Me=le==null?void 0:le.asset,ft=new Date(le==null?void 0:le.latestFill).getTime();if(!Ce[Me])Ce[Me]=le;else{const on=new Date((ut=Ce[Me])==null?void 0:ut.latestFill).getTime();ft>on&&(Ce[Me]=le)}});const m=Object.values(Ce),[p,N]=h.useState([]),A=a==null?void 0:a.filter(le=>{var Me;return Sn?(Me=le.asset)==null?void 0:Me.toLowerCase().includes(Sn.toLowerCase()):!0}).map(le=>{const Me=m.find(ut=>(ut==null?void 0:ut.asset)===(le==null?void 0:le.asset)),ft=p.find(ut=>(ut==null?void 0:ut.coin)===(le==null?void 0:le.asset));return{...le,latestFill:(Me==null?void 0:Me.latestFill)||null,tagName:(ft==null?void 0:ft.tag)||null,tagWallet:(ft==null?void 0:ft.cp_wallet)||null}}),k="-unrealizedPnl",[P,D]=h.useState(k),V=le=>A==null?void 0:A.sort((Me,ft)=>{const ut=Me.tagName?Me.tagName.toUpperCase():"",on=ft.tagName?ft.tagName.toUpperCase():"",bn=Me.asset?Me.asset.toUpperCase():"",Gn=ft.asset?ft.asset.toUpperCase():"",rr=Me.type==="Long"?1:0,Jn=ft.type==="Long"?1:0,Xn=Me.type==="Short"?1:0,Zr=ft.type==="Short"?1:0;return le==="-unrealizedPnl"?ft.unrealizedPnl-Me.unrealizedPnl:le==="unrealizedPnl"?Me.unrealizedPnl-ft.unrealizedPnl:le==="-roe"?ft.roe-Me.roe:le==="roe"?Me.roe-ft.roe:le==="-size"?ft.size-Me.size:le==="size"?Me.size-ft.size:le==="-entryPrice"?ft.entryPrice-Me.entryPrice:le==="entryPrice"?Me.entryPrice-ft.entryPrice:le==="-currentPrice"?ft.currentPrice-Me.currentPrice:le==="currentPrice"?Me.currentPrice-ft.currentPrice:le==="-leverage"?ft.leverage-Me.leverage:le==="leverage"?Me.leverage-ft.leverage:le==="-positionValue"?ft.positionValue-Me.positionValue:le==="positionValue"?Me.positionValue-ft.positionValue:le==="-marginUsed"?ft.marginUsed-Me.marginUsed:le==="marginUsed"?Me.marginUsed-ft.marginUsed:le==="funding"?ft.funding-Me.funding:le==="-funding"?Me.funding-ft.funding:le==="-liquidationPrice"?ft.liquidationPrice-Me.liquidationPrice:le==="liquidationPrice"?Me.liquidationPrice-ft.liquidationPrice:le==="-entryTime"?new Date(ft.latestFill)-new Date(Me.latestFill):le==="entryTime"?new Date(Me.latestFill)-new Date(ft.latestFill):le==="-source_tag"?ut<on?-1:ut>on?1:0:le==="source_tag"?ut>on?-1:ut<on?1:0:le==="-type_leverage"?rr!==Jn?Jn-rr:ft.leverage-Me.leverage:le==="type_leverage"?Xn!==Zr?Zr-Xn:ft.leverage-Me.leverage:le==="-asset"?bn<Gn?-1:bn>Gn?1:0:le==="asset"?bn>Gn?-1:bn<Gn?1:0:0}),[Z,ce]=h.useState([]),[ue,me]=h.useState([]),[Ne,Ie]=h.useState([]),[Le,Xe]=h.useState([]),[Oe,$e]=h.useState([]);async function ae(){try{const le=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(!le.ok)throw new Error(`HTTP error! status: ${le.status}`);const Me=await le.json();ce(Me.results)}catch(le){console.error("Error resetting filters:",le)}}async function he(){try{const le=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(!le.ok)throw new Error(`HTTP error! status: ${le.status}`);const Me=await le.json();me(Me.results)}catch(le){console.error("Error resetting filters:",le)}}async function Pe(){try{const le=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(!le.ok)throw new Error(`HTTP error! status: ${le.status}`);const Me=await le.json();Ie(Me.results)}catch(le){console.error("Error resetting filters:",le)}}async function Ve(){try{const le=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(!le.ok)throw new Error(`HTTP error! status: ${le.status}`);const Me=await le.json();Xe(Me.results)}catch(le){console.error("Error resetting filters:",le)}}async function Te(){try{const le=await fetch(`https://dextradata.nftinit.io/api/hyper/wallet/details/?user_token=${t}`);if(!le.ok)throw new Error(`HTTP error! status: ${le.status}`);const Me=await le.json();$e(Me)}catch(le){console.error("Error pnlSharpeRateData:",le)}}h.useEffect(()=>{ae(),he(),Pe(),Ve(),Te()},[]);const[Ze,it]=h.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"),[wt,Dt]=h.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"),[Qt,xn]=h.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"),pn=Ze==="1D"?Z:Ze==="7D"?ue:Ze==="30D"?Ne:Le,An=wt==="1D"?Z:wt==="7D"?ue:wt==="30D"?Ne:Le,or=a.length,$t=a.filter(le=>le.unrealizedPnl>=0).length,bt=or>0?$t/or*100:0,[rn,ur]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),br=((ms=V(P))==null?void 0:ms.reduce((le,Me)=>le+((Me==null?void 0:Me.leverage)||0),0))/(((At=V(P))==null?void 0:At.length)||1),Br=(pt=V(P))==null?void 0:pt.reduce((le,Me)=>{const ft=parseFloat(Me==null?void 0:Me.funding)||0;return le+ft},0),Or=localStorage.getItem("isDateOpenPositionsFormat")||"date",[Lt,nn]=h.useState(Or);h.useEffect(()=>{localStorage.setItem("isDateOpenPositionsFormat",Lt)},[Lt]);const en=localStorage.getItem("isDateFillsFormat")||"date",[Fn,yr]=h.useState(en);h.useEffect(()=>{localStorage.setItem("isDateFillsFormat",Fn)},[Fn]);const[hr,lt]=h.useState([]),Ct=async()=>{try{const le=window.localStorage.getItem("hyperToken");if(!le){Fe(!0);return}const Me="https://dextrabothypev2.nftinit.io/api/wallet/list",ft=window.localStorage.getItem("hyperAddress"),on=await(await fetch(Me,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Ye?Ye.toLowerCase():ft,token:le,balance:"false"})})).json();on!=null&&on.success?(lt(on.data||[]),dr(on.data)):console.log(on.error_message)}catch(le){console.error("Error fetching generate wallet list:",le)}};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&Ct()},[G]);const On=hr==null?void 0:hr.find(le=>(le==null?void 0:le.wallet_address)===(t==null?void 0:t.toLowerCase())),qn=ie==null?void 0:ie.find(le=>(le==null?void 0:le.wallet_address)===(t==null?void 0:t.toLowerCase())),[_r,jr]=h.useState([]),[Fr,nr]=h.useState(!0),[vr,Yr]=h.useState(!1);h.useEffect(()=>{A&&A.length>0&&(rs(),hr.length>0&&Fr&&dr())},[A]);const dr=le=>{const Me=[..._r];Me.length>0&&((le==null?void 0:le.some(ut=>(ut==null?void 0:ut.wallet_address)===(t==null?void 0:t.toLowerCase())))?gs(Me):Fr&&(gs(Me),nr(!1)))},rs=()=>{const le=window.localStorage.getItem("hyperToken");let Me=!1;const ft=[..._r];A==null||A.forEach(ut=>{const on=ut.asset;(ft==null?void 0:ft.some(Gn=>Gn.coin===on))||(ft==null||ft.push({coin:on,wallet:t}),Me=!0)}),Me&&(jr(ft),hr!=null&&hr.some(on=>(on==null?void 0:on.wallet_address)===(t==null?void 0:t.toLowerCase()))&&le&&gs(ft))},gs=async le=>{if(!vr)try{Yr(!0);const Me=window.localStorage.getItem("hyperToken"),ft="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!Me||!le){Yr(!1);return}Me||Fe(!0);const ut=window.localStorage.getItem("hyperAddress"),bn=await(await fetch(ft,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Ye?Ye.toLowerCase():ut,token:Me,positions:le})})).json();bn.success?N(bn==null?void 0:bn.data):(console.log(bn.error_message),fn.error(bn.error_message))}catch(Me){console.error("Error tag request",Me),fn.error(Me.message)}finally{Yr(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(DVe,{}),i.jsx(V5,{open:at,setOpen:He,copyTradeData:qe,copyTradeWallet:jt,setCopyTradeWallet:un,isScalper:yt,setCopyTradeData:vt}),i.jsx(Mln,{open:vn,setOpen:Hn,data:rn,setTradeInfo:ur}),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(aUe,{wallet:t,className:"w-10 h-10 rounded-full"}),i.jsxs("div",{className:`${hr.some(le=>(le==null?void 0:le.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:`${hr.some(le=>(le==null?void 0:le.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:le=>{le.stopPropagation(),navigator.clipboard.writeText(t),fn.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:`${hr.some(le=>(le==null?void 0:le.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:`${hr.some(le=>(le==null?void 0:le.wallet_address)==(t==null?void 0:t.toLowerCase()))?"#67FFBD":"#909090"}`,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),i.jsxs("div",{className:`${hr.some(le=>(le==null?void 0:le.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:[On&&i.jsx("div",{className:"text-[#67ffbd] text-sm font-semibold font-manrope leading-[8px]",children:On.wallet_name.length>13?On.wallet_name.slice(0,13)+"...":On.wallet_name}),On&&On.wallet_name.length>13&&i.jsx("span",{className:"",children:i.jsx(Ra,{content:`${On==null?void 0:On.wallet_name}`,positionTop:!1,alignRight:!1})})]}),i.jsxs("div",{className:`${ie.some(le=>le.wallet_address===t)?On?"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:[qn&&i.jsx("div",{className:"text-[#67ffbd] text-sm font-semibold font-manrope leading-[8px]",children:(qn==null?void 0:qn.tag.length)>13?(qn==null?void 0:qn.tag.slice(0,13))+"...":qn==null?void 0:qn.tag}),qn&&qn.tag.length>13&&i.jsx("span",{className:"",children:i.jsx(Ra,{content:`${qn==null?void 0:qn.tag}`,positionTop:!1,alignRight:!1})})]})]}),i.jsx(H5,{walletAddress:t,children:i.jsx("div",{className:`${te.some(le=>le.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(le=>le.wallet_address===t)?i.jsx("img",{src:k5,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:le=>{var ut;le.preventDefault();const Me=ie==null?void 0:ie.some(on=>on.wallet_address===t),ft=(ue==null?void 0:ue.length)>0?(ut=ue[0])==null?void 0:ut.is_scalper:!1;hn({walletAddress:t,isFollow:Me,isScalper:ft})},className:`${ie.some(le=>le.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:ie.some(le=>le.wallet_address===t)?"Edit Copy Trade":"Copy Trade"})}),i.jsx("div",{className:"sm:hidden h-6 flex justify-end",children:G&&i.jsx(fQ,{walletAddress:t})})]}),i.jsx(Eln,{traderWallet:t,trades:Q})]}),i.jsxs("div",{className:"absolute right-0 flex justify-end",children:[G&&i.jsx(fQ,{walletAddress:t}),i.jsx("div",{className:"absolute right-0 hidden sm:flex",children:G&&i.jsx(fQ,{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:Nt,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?Ir(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:()=>{ur(le=>({...le,coin:"--",type:f?parseFloat(f.marginSummary.totalNtlPos)===0?"NEUTRAL":a.reduce((Me,ft)=>Me+(ft.type==="Long"?parseFloat(ft.positionValue):-parseFloat(ft.positionValue)),0)>0?"LONG":"SHORT":"--",leverage:br&&br!=0?`${parseFloat(br).toFixed(2)}x`:"--",roe:An.length>0?An.map(Me=>Me==null?void 0:Me.margin_roi).join(", "):"--",entryPrice:f?a.reduce((Me,ft)=>Me+parseFloat(ft.unrealizedPnl||0),0):"-",markPrice:or>0?`${$t} / ${or} (${$t/or*100===0||$t/or*100===100?$t/or*100:($t/or*100).toFixed(2)}%)`:"--",positionDistribution:f?`${isNaN(a.reduce((Me,ft)=>ft.type==="Long"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:a.reduce((Me,ft)=>ft.type==="Long"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100===0||a.reduce((Me,ft)=>ft.type==="Long"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100===100?a.reduce((Me,ft)=>ft.type==="Long"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100:(a.reduce((Me,ft)=>ft.type==="Long"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2)}% / ${isNaN(a.reduce((Me,ft)=>ft.type==="Short"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:a.reduce((Me,ft)=>ft.type==="Short"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100===0||a.reduce((Me,ft)=>ft.type==="Short"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100===100?a.reduce((Me,ft)=>ft.type==="Short"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100:(a.reduce((Me,ft)=>ft.type==="Short"?Me+parseFloat(ft.positionValue):Me,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2)}%`:"-",referral:window.localStorage.getItem("hyperToken")?ge:null})),Hn(!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:ect,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((le,Me)=>le+parseFloat(Me.unrealizedPnl),0)>=0?"text-[#67FFBD]":"text-[#FF7173]"} font-semibold font-manrope leading-[13px] tracking-[0.18px] text-[18px]`,children:["$",f?Ir(Math.abs(a.reduce((le,Me)=>le+parseFloat(Me.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:$t})," ","/ ",or," (",bt==0?"0":bt!=0&&bt!=100?bt.toFixed(2):bt,"%)"]})]})})]}),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:()=>{it("1D"),localStorage.setItem("discover_period",0)},className:`${Ze==="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:()=>{it("7D"),localStorage.setItem("discover_period",1)},className:`${Ze==="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:()=>{it("30D"),localStorage.setItem("discover_period",2)},className:`${Ze==="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:()=>{it("90D"),localStorage.setItem("discover_period",3)},className:`${Ze==="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"})})]}),(pn==null?void 0:pn.length)>0?pn==null?void 0:pn.map((le,Me)=>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:(le==null?void 0:le.win_complated_rate)==null||isNaN(parseFloat(le==null?void 0:le.win_complated_rate))?"--":(le==null?void 0:le.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:(le==null?void 0:le.rtx_count)==null||isNaN(parseFloat(le==null?void 0:le.rtx_count))?"--":zs(le==null?void 0:le.rtx_count)})]})]},Me)):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:()=>{Nn("day"),Dt("1D"),localStorage.setItem("discover_period",0)},className:`${dn==="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:()=>{Nn("week"),Dt("7D"),localStorage.setItem("discover_period",1)},className:`${dn==="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:()=>{Nn("month"),Dt("30D"),localStorage.setItem("discover_period",2)},className:`${dn==="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:()=>{Nn("threeMonth"),Dt("90D"),localStorage.setItem("discover_period",3)},className:`${dn==="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:()=>{Nn("allTime"),Dt("90D"),localStorage.setItem("discover_period",4)},className:`${dn==="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:`${!(An!=null&&An.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":dn==="day"?Re.day>0?"text-[#67FFBD]":Re.day<0?"text-[#FF7173]":"text-white":dn==="week"?Re.week>0?"text-[#67FFBD]":Re.week<0?"text-[#FF7173]":"text-white":dn==="month"?Re.month>0?"text-[#67FFBD]":Re.month<0?"text-[#FF7173]":"text-white":dn==="threeMonth"?Re.threeMonth>0?"text-[#67FFBD]":Re.threeMonth<0?"text-[#FF7173]":"text-white":dn==="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 le={day:Re.day,week:Re.week,month:Re.month,threeMonth:Re.threeMonth,allTime:Re.all}[dn];return`$${zs(Math.abs(le))}`})()}):i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:"No trades in this period"})]}),!(An!=null&&An.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"}),(An==null?void 0:An.length)>0?An==null?void 0:An.map((le,Me)=>i.jsx("div",{className:`${(le==null?void 0:le.margin_roi)==null||isNaN(parseFloat(le==null?void 0:le.margin_roi))||(le==null?void 0:le.margin_roi)==0?"text-white":(le==null?void 0:le.margin_roi)>0?"text-[#67FFBD]":"text-[#FF7173]"} text-lg font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:(le==null?void 0:le.margin_roi)==null||isNaN(parseFloat(le==null?void 0:le.margin_roi))?"--":zs(Math.abs(le==null?void 0:le.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((le,Me)=>le+(Me.type==="Long"?parseFloat(Me.positionValue):-parseFloat(Me.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((le,Me)=>Me.type==="Long"?le+parseFloat(Me.positionValue):le,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((le,Me)=>Me.type==="Long"?le+parseFloat(Me.positionValue):le,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((le,Me)=>Me.type==="Long"?le+parseFloat(Me.positionValue):le,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:(a.reduce((le,Me)=>Me.type==="Long"?le+parseFloat(Me.positionValue):le,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2):"-","%"]}),i.jsxs("span",{className:"text-[#FF7173]",children:[f?isNaN(a.reduce((le,Me)=>Me.type==="Short"?le+parseFloat(Me.positionValue):le,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:(a.reduce((le,Me)=>Me.type==="Short"?le+parseFloat(Me.positionValue):le,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?ct(a.reduce((le,Me)=>Me.type==="Long"?le+parseFloat(Me.positionValue):le,0)):"-"}),i.jsx("span",{className:"text-[#ff787b]",children:f?ct(a.reduce((le,Me)=>Me.type==="Short"?le+parseFloat(Me.positionValue):le,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((le,Me)=>Me.type==="Long"?le+parseFloat(Me.positionValue):le,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?{width:"0%"}:{width:`${a.reduce((le,Me)=>Me.type==="Long"?le+parseFloat(Me.positionValue):le,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((le,Me)=>Me.type==="Short"?le+parseFloat(Me.positionValue):le,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?{width:"0%"}:{width:`${a.reduce((le,Me)=>Me.type==="Short"?le+parseFloat(Me.positionValue):le,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:br&&br!=0?`${parseFloat(br).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:`${Br<=0?"text-[#67FFBD]":"text-[#FF7173]"} text-sm font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Br&&Br!=0?`$${Gv(Math.abs(Br))}`:"--"})]})})]}),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:()=>{xn("7D"),localStorage.setItem("discover_period",1)},className:`${Qt==="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:()=>{xn("30D"),localStorage.setItem("discover_period",2)},className:`${Qt==="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:()=>{xn("90D"),localStorage.setItem("discover_period",3)},className:`${Qt==="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"})})]}),Oe?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(us,{className:"text-[#7C7C7C] w-3 min-w-3 min-h-3 h-3"}),i.jsx("span",{className:"",children:i.jsx(fo,{content:"Sharpe_tooltip",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[80px] min-w-[80px] leading-[16px] -mb-12"})})]})})]}),i.jsx("div",{className:`${(Qt==="7D"?Oe==null?void 0:Oe.portfolio_perp_week_sharpe:Qt==="30D"?Oe==null?void 0:Oe.portfolio_perp_month_sharpe:Oe==null?void 0:Oe.portfolio_perp_3month_sharpe)>=1&&(Qt==="7D"?Oe==null?void 0:Oe.portfolio_perp_week_sharpe:Qt==="30D"?Oe==null?void 0:Oe.portfolio_perp_month_sharpe:Oe==null?void 0:Oe.portfolio_perp_3month_sharpe)<=2?"text-[#E5BB18]":(Qt==="7D"?Oe==null?void 0:Oe.portfolio_perp_week_sharp:Qt==="30D"?Oe==null?void 0:Oe.portfolio_perp_month_sharpe:Oe==null?void 0:Oe.portfolio_perp_3month_sharpe)>2?"text-[#1DE6A3]":"text-[#FF7173]"} text-base font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Qt==="7D"?(Oe==null?void 0:Oe.portfolio_perp_week_sharpe)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_week_sharpe))?"--":Ir(Oe==null?void 0:Oe.portfolio_perp_week_sharpe):Qt==="30D"?(Oe==null?void 0:Oe.portfolio_perp_month_sharpe)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_month_sharpe))?"--":Ir(Oe==null?void 0:Oe.portfolio_perp_month_sharpe):(Oe==null?void 0:Oe.portfolio_perp_3month_sharpe)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_3month_sharpe))?"--":Ir(Oe==null?void 0:Oe.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:`${(Qt==="7D"?Oe==null?void 0:Oe.portfolio_perp_week_growth_rate:Qt==="30D"?Oe==null?void 0:Oe.portfolio_perp_month_growth_rate:Oe==null?void 0:Oe.portfolio_perp_3month_growth_rate)==0?"text-white":(Qt==="7D"?Oe==null?void 0:Oe.portfolio_perp_week_growth_rate:Qt==="30D"?Oe==null?void 0:Oe.portfolio_perp_month_growth_rate:Oe==null?void 0:Oe.portfolio_perp_3month_growth_rate)>0?"text-[#67FFBD]":"text-[#FF7173]"} text-base font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Qt==="7D"?(Oe==null?void 0:Oe.portfolio_perp_week_growth_rate)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_week_growth_rate))?"--":zs(Oe==null?void 0:Oe.portfolio_perp_week_growth_rate)+"%":Qt==="30D"?(Oe==null?void 0:Oe.portfolio_perp_month_growth_rate)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_month_growth_rate))?"--":zs(Oe==null?void 0:Oe.portfolio_perp_month_growth_rate)+"%":(Oe==null?void 0:Oe.portfolio_perp_3month_growth_rate)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_3month_growth_rate))?"--":zs(Oe==null?void 0:Oe.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:`${(Qt==="7D"?Oe==null?void 0:Oe.portfolio_perp_week_dd:Qt==="30D"?Oe==null?void 0:Oe.portfolio_perp_month_dd:Oe==null?void 0:Oe.portfolio_perp_3month_dd)==0?"text-white":(Qt==="7D"?Oe==null?void 0:Oe.portfolio_perp_week_dd:Qt==="30D"?Oe==null?void 0:Oe.portfolio_perp_month_dd:Oe==null?void 0:Oe.portfolio_perp_3month_dd)>0?"text-[#67FFBD]":"text-[#FF7173]"} text-base font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Qt==="7D"?(Oe==null?void 0:Oe.portfolio_perp_week_dd)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_week_dd))?"--":zs(Math.abs(Oe==null?void 0:Oe.portfolio_perp_week_dd))+"%":Qt==="30D"?(Oe==null?void 0:Oe.portfolio_perp_month_dd)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_month_dd))?"--":zs(Math.abs(Oe==null?void 0:Oe.portfolio_perp_month_dd))+"%":(Oe==null?void 0:Oe.portfolio_perp_3month_dd)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_3month_dd))?"--":zs(Math.abs(Oe==null?void 0:Oe.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:Ht,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(Vl,{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 block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Vl,{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(Sln,{})})]})]}),i.jsx(QVe,{initialAddress:t})]})]})},ccn=()=>{const t=v2(),e=(t==null?void 0:t.walletAddress.toLowerCase())||"";return i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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(lcn,{initialAddress:e})})]})},ucn=({isOpen:t,onClose:e,children:n,zIndex:r=9999,closeOnBackdropClick:s=!0})=>(h.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t?fie.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 dcn(){const{signModalOpen:t,setSignModalOpen:e,signIn:n,hyperToken:r,walletLogin:s}=h.useContext(Qr),{isConnected:a}=ds(),{openConnectModal:o}=z5(),l=typeof window<"u"&&window.matchMedia("(max-width:640px)").matches,c=()=>{window.localStorage.getItem("hyperToken")&&r?s():(n(1),e(!1))};return i.jsx(ucn,{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:Na,alt:"close",className:"p-1"})}),i.jsx("img",{src:Hi,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(KE,{}):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(KE,{})})}):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 El=()=>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:Rlt,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"]})]})]})]}),fcn=({data:t,loading:e,error:n,trackerData:r,isRequest:s,setIsRequest:a})=>{var be;const{trackedWatchList:o,getTrackedWatchList:l,setSignModalOpen:c}=h.useContext(Qr),{isConnected:u,address:d}=ds(),[f,x]=h.useState(!1),[g,y]=h.useState(null),[v,C]=h.useState(null),[S,T]=h.useState(""),[I,L]=h.useState([]),[F,$]=h.useState(!1),[O,U]=h.useState({}),Y="-tag",[re,Q]=h.useState(Y),q=we=>r.sort((je,Fe)=>{const Re=I.find(vt=>vt.wallet_address===je.wallet_address)||{},Qe=I.find(vt=>vt.wallet_address===Fe.wallet_address)||{},Ye=Re.data?Re.data.reduce((vt,yt)=>vt+parseFloat(yt.unrealizedPnl||0),0):Re.unrealizedPnl||0,dt=Qe.data?Qe.data.reduce((vt,yt)=>vt+parseFloat(yt.unrealizedPnl||0),0):Qe.unrealizedPnl||0,st=je.tag?je.tag.toUpperCase():"",at=Fe.tag?Fe.tag.toUpperCase():"",He=je.wallet_address?je.wallet_address.toLowerCase():"",qe=Fe.wallet_address?Fe.wallet_address.toLowerCase():"";return we==="tag"?st<at?-1:st>at?1:0:we==="-tag"?st>at?-1:st<at?1:0:we==="-wallet_address"?He<qe?-1:He>qe?1:0:we==="wallet_address"?He>qe?-1:He<qe?1:0:we==="perp_equity"?(Re.perp_equity||0)-(Qe.perp_equity||0):we==="-perp_equity"?(Qe.perp_equity||0)-(Re.perp_equity||0):we==="margin_usage"?(Re.margin_usage||0)-(Qe.margin_usage||0):we==="-margin_usage"?(Qe.margin_usage||0)-(Re.margin_usage||0):we==="unrealizedPnl"?Ye-dt:we==="-unrealizedPnl"?dt-Ye:we==="-expire_date"?new Date(Fe.expire_date)-new Date(je.expire_date):we==="expire_date"?new Date(je.expire_date)-new Date(Fe.expire_date):0}),te=async({walletAddress:we,isFollow:je,isScalper:Fe})=>{try{T(we);const Re=window.localStorage.getItem("hyperToken"),Qe=window.localStorage.getItem("hyperAddress");if(!Re){c(!0);return}const Ye=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:we.toLowerCase()}:{address:d?d.toLowerCase():Qe,token:Re},st=await fetch(Ye,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(dt)});if(!st.ok)throw new El(`Server responded with status ${st.status}`);const at=await st.json();at.success?(y(Array.isArray(at==null?void 0:at.data)?[...at.data].sort((He,qe)=>new Date(qe.created_at||0)-new Date(He.created_at||0)):at==null?void 0:at.data),C(Fe),x(!0)):(console.log(at.error_message),fn.error(at.error_message))}catch(Re){console.error("Error in like function:",Re),fn.error(Re.message||"Something went wrong!")}},fe=we=>we!=null&&we.assetPositions?we.assetPositions.filter(je=>{if(!je.position||!je.position.szi)return!1;const Fe=parseFloat(je.position.szi);return!isNaN(Fe)&&Fe!==0}).map(je=>{const Fe=je.position,Re=parseFloat(Fe.szi),Qe=parseFloat(Fe.entryPx),Ye=parseFloat(Fe.positionValue),dt=parseFloat(Fe.unrealizedPnl),st=parseFloat(Fe.returnOnEquity)*100,at=parseFloat(Fe.marginUsed),He=Fe.leverage.value,qe=parseFloat(Fe.cumFunding.sinceOpen),vt=Re>0?"Long":"Short";return{asset:Fe.coin,type:vt,size:Math.abs(Re),entryPrice:Qe.toFixed(2),currentPrice:(Ye/Math.abs(Re)).toFixed(2),leverage:He,positionValue:Ye.toFixed(2),marginUsed:at.toFixed(2),unrealizedPnl:dt.toFixed(2),roe:st.toFixed(2),funding:qe.toFixed(4),liquidationPrice:Fe.liquidationPx?parseFloat(Fe.liquidationPx).toFixed(2):"N/A"}}):[],G=async we=>{try{const Fe=await Ns.post("https://api-ui.hyperliquid.xyz/info",{type:"clearinghouseState",user:we});if(Fe.data){const Re=fe(Fe.data);L(Qe=>{var Ye,dt,st,at;return[...Qe,{wallet_address:we,perp_equity:(dt=(Ye=Fe==null?void 0:Fe.data)==null?void 0:Ye.marginSummary)==null?void 0:dt.accountValue,margin_usage:parseFloat((st=Fe==null?void 0:Fe.data)==null?void 0:st.marginSummary.totalMarginUsed)/parseFloat((at=Fe==null?void 0:Fe.data)==null?void 0:at.marginSummary.accountValue),data:Re}]})}}catch(je){console.error("Error fetching user state from HyperState:",je)}},ie=async we=>{try{const je=window.localStorage.getItem("hyperToken"),Fe="https://dextrabothypev2.nftinit.io/api/hyper/tracker/getclearinghousestate/",Re=window.localStorage.getItem("hyperAddress"),Qe=await fetch(Fe,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d.toLowerCase():Re,token:je,follow_address:we})});if(Qe.ok){const Ye=await Qe.json();if(Ye.success){const dt=fe(Ye==null?void 0:Ye.data);L(st=>{var at;return[...st,{wallet_address:we,perp_equity:(at=Ye==null?void 0:Ye.data.marginSummary)==null?void 0:at.accountValue,margin_usage:parseFloat(Ye==null?void 0:Ye.data.marginSummary.totalMarginUsed)/parseFloat(Ye==null?void 0:Ye.data.marginSummary.accountValue),data:dt}]})}}else if(Qe.status===500)console.warn(`Received 500 error for ${we}, retrying with getUserHyperState`),await G(we);else throw new El(`Request failed with status ${Qe.status}`)}catch(je){console.error("Error fetching user state:",je)}},oe=h.useRef(!1);h.useEffect(()=>{!e&&s&&!oe.current&&(oe.current=!0,(async()=>{for(let je=0;je<r.length;je++){const Fe=r[je];ie(Fe==null?void 0:Fe.wallet_address.toLowerCase()).catch(Re=>{console.error(`Error fetching user state for wallet ${Fe.wallet_address}:`,Re)}),await new Promise(Re=>setTimeout(Re,500))}})())},[s,e,r]);const K=async(we,je)=>{try{const Fe=window.localStorage.getItem("hyperToken"),Re="https://dextrabothypev2.nftinit.io/api/hyper/tracker/extend_tracker_expiry/";if(!Fe||!we||!je)return;U(st=>({...st,[je]:!0}));const Qe=window.localStorage.getItem("hyperAddress"),Ye=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:Fe,tracker_id:we})});if(!Ye.ok)throw new El(`Failed to unlike: ${Ye.status} ${Ye.statusText}`);const dt=await Ye.json();dt.success?(U(st=>({...st,[je]:!1})),l(),fn.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"}})):(fn.error(dt.error_message),U(st=>({...st,[je]:!1})))}catch(Fe){fn.error(Fe.message||"Something went wrong!"),U(Re=>({...Re,[je]:!1}))}},H=h.useRef(null),ee=()=>{H.current&&(H.current.scrollLeft-=100)},se=()=>{H.current&&(H.current.scrollLeft+=100)},pe=()=>{H.current&&(H.current.scrollTop+=200)},Se=()=>{H.current&&(H.current.scrollTop-=200)},ge=we=>{const je=new Date(we),Fe=new Date,Re=new Date(je.getFullYear(),je.getMonth(),je.getDate()),Qe=new Date(Fe.getFullYear(),Fe.getMonth(),Fe.getDate());return(Re-Qe)/(1e3*60*60*24)<=3},ve=we=>we>=640&&we<1024?5:we>=1024&&we<1240?6:we>=1240&&we<1540||we>=1540?7:3;return i.jsxs(i.Fragment,{children:[i.jsx(V5,{open:f,setOpen:x,copyTradeData:g,copyTradeWallet:S,setCopyTradeWallet:T,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(ro,{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 block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(ro,{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(ro,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:pe,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(ro,{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:H,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(hi,{title:"Tag",sortKey:"tag",sortOption:re,setSortOption:Q,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(hi,{title:"Wallet",sortKey:"wallet_address",sortOption:re,setSortOption:Q,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[140px] sm:min-w-[130px] px-1",children:i.jsx(hi,{title:"Perp Equity",sortKey:"perp_equity",sortOption:re,setSortOption:Q,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] sm:min-w-[144px] px-1",children:i.jsx(hi,{title:"Margin Usage",sortKey:"margin_usage",sortOption:re,setSortOption:Q,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[120px] sm:min-w-[150px] px-1",children:i.jsx(hi,{title:"uPnL",sortKey:"unrealizedPnl",sortOption:re,setSortOption:Q,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(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(fo,{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(hi,{title:"Expire Date",sortKey:"expire_date",sortOption:re,setSortOption:Q,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:ve(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(ka,{})})})}):n&&!r?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:ve(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(El,{})})})}):(r==null?void 0:r.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:ve(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:Yl,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."]})]})]})]})})})})}):(be=q(re))==null?void 0:be.map((we,je)=>{var Re,Qe;const Fe=I.find(Ye=>Ye.wallet_address===we.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:Ye=>{Ye.preventDefault();const dt=t==null?void 0:t.some(st=>st.wallet_address===(we==null?void 0:we.wallet_address));te({walletAddress:we==null?void 0:we.wallet_address,isFollow:dt,isScalper:we==null?void 0:we.is_scalper})},className:`${t!=null&&t.some(Ye=>Ye.wallet_address===(we==null?void 0:we.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(H5,{walletAddress:we==null?void 0:we.wallet_address,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:o.some(Ye=>Ye.wallet_address===(we==null?void 0:we.wallet_address))?i.jsx("img",{src:k5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:qj,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(sa,{info1:we!=null&&we.tag?(we==null?void 0:we.tag.length)>=13?(we==null?void 0:we.tag).slice(0,13)+"...":we==null?void 0:we.tag:"--",info1_Color:"text-white",rowTwo:!1}),(we==null?void 0:we.tag)&&(we==null?void 0:we.tag.length)>=13&&i.jsx("span",{className:"-ml-[9px]",children:i.jsx(Ra,{content:`${we==null?void 0:we.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/${we==null?void 0:we.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:Hi,alt:"dextra",className:"w-4 h-4 sm:w-8 sm:h-8",loading:"lazy",onError:Ye=>{Ye.target.onerror=null,Ye.target.src="https://app.dextrabot.com/dextrabotIcon.png"}})})}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx(sa,{info1:`${(we==null?void 0:we.wallet_address).slice(0,5)+"..."+(we==null?void 0:we.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:Ye=>{Ye.stopPropagation(),navigator.clipboard.writeText(we==null?void 0:we.wallet_address),fn.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:io,alt:"",className:"cursor-pointer"})]})]})})}),i.jsx("td",{className:"pr-1",children:F?i.jsx(l0,{info:"Loading...",textColor:"text-white"}):Fe?i.jsx(l0,{info:(Fe==null?void 0:Fe.perp_equity)!=0?`$${Ir(Fe==null?void 0:Fe.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"}):Fe?i.jsx(l0,{info:isNaN(Fe==null?void 0:Fe.margin_usage)?"0%":`${((Fe==null?void 0:Fe.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"}):Fe?i.jsx(l0,{info:(Fe==null?void 0:Fe.data)!=0?`$${Ir(Math.abs((Re=Fe==null?void 0:Fe.data)==null?void 0:Re.reduce((Ye,dt)=>Ye+parseFloat(dt.unrealizedPnl||0),0)))}`:"$0",textColor:`${((Qe=Fe==null?void 0:Fe.data)==null?void 0:Qe.reduce((Ye,dt)=>Ye+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:[ge(we==null?void 0:we.expire_date)&&i.jsxs("div",{className:"flex justify-end items-center has-tooltip relative min-w-max",children:[i.jsx("img",{src:Cct,alt:"",className:"w-[14px] min-w-[14px] min-h-[14px] h-[14px]"}),i.jsx("span",{className:"",children:i.jsx(fo,{content:`This tracker will expire on ${B3(we==null?void 0:we.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:we!=null&&we.expire_date?B3(we==null?void 0:we.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:ge(we==null?void 0:we.expire_date)&&(O[we==null?void 0:we.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:()=>{K(we==null?void 0:we.id,we==null?void 0:we.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:Nct,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})}),Az=()=>{const{isConnected:t}=ds(),{openConnectModal:e}=z5(),{walletLogin:n,signIn:r}=h.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:Hi,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(KE,{}):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(KE,{}):"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"})]})]})},hcn=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState(!1);ds();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:S,setIsReferralCodeName:T,setIsWhitelist:I,setHyperToken:L,setHyperAddress:F}=h.useContext(Qr);return h.useEffect(()=>{!n&&window.localStorage.getItem("hyperToken")&&(o(),u(),e(!0),r(!0))},[n,s]),h.useEffect(()=>{(async()=>{var Y,re;const O=window.localStorage.getItem("hyperToken"),U=window.localStorage.getItem("hyperAddress");if(!(!O||!U))try{const Q=await bi(U,O);Q!=null&&Q.success?(x(Q==null?void 0:Q.telegram_chat_id),g(Q==null?void 0:Q.subscriber_role),y(Q==null?void 0:Q.subs_expire_day),v((Y=Q==null?void 0:Q.mushboomer_counts)==null?void 0:Y.eth),C((re=Q==null?void 0:Q.mushboomer_counts)==null?void 0:re.sol),S(Q==null?void 0:Q.referral_code),T(Q==null?void 0:Q.refcode),I(Q==null?void 0:Q.whitelist),L(O),F(U)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),L(""),F(""))}catch(Q){console.error("Token verification error:",Q),console.error(Q.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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(fcn,{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(Az,{})})})})]})},pcn=()=>{h.useRef([]);const t=h.useRef(null),{isConnected:e,address:n}=ds(),{setSignModalOpen:r,trackedWatchList:s,hyperToken:a}=h.useContext(Qr),o=h.useRef(a),[l,c]=h.useState(!1),d=localStorage.getItem("isDateTrackedWalletsFormat")||"date",[f,x]=h.useState(d);h.useEffect(()=>{localStorage.setItem("isDateTrackedWalletsFormat",f)},[f]);const[g,y]=h.useState([]);function v(O){const U={};return O.forEach(re=>{const{oid:Q,px:q,dir:te,side:fe,crossed:G,feeToken:ie,listen_user:oe,cloid:K,coin:H,subs_address:ee,sz:se,closedPnl:pe,fee:Se,time:ge,startPosition:ve,insert_date:be,hash:we}=re;U[Q]||(U[Q]={oid:Q,px:q,dir:te,side:fe,crossed:G,feeToken:ie,listen_user:oe,cloid:K,coin:H,subs_address:ee,totalSize:0,totalStartPositions:0,totalClosedPnl:0,totalFee:0,closestTime:ge,earliestStartPosition:ve,insertDate:be,hashes:[],hasZeroStartPosition:!1}),parseFloat(ve)===0&&(U[Q].hasZeroStartPosition=!0),U[Q].hasZeroStartPosition?U[Q].totalStartPositions=0:U[Q].totalStartPositions+=parseFloat(ve),U[Q].totalSize+=parseFloat(se),U[Q].totalClosedPnl+=parseFloat(pe),U[Q].totalFee+=parseFloat(Se),new Date(ge)>new Date(U[Q].closestTime)&&(U[Q].closestTime=ge),new Date(ge)>new Date(U[Q].insertDate)&&(U[Q].insertDate=be),new Date(ge)<new Date(U[Q].closestTime)&&(U[Q].earliestStartPosition=ve),U[Q].hashes.push(we)}),Object.keys(U).map(re=>({oid:re,...U[re]}))}async function C(){const O=window.localStorage.getItem("hyperToken");try{c(!0);const U="https://dextrabothypev2.nftinit.io/api/hyper/feed/",Y=window.localStorage.getItem("hyperAddress");O||r(!0);const re=await fetch(U,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():Y,token:O,offset:0})});if(!re.ok)throw new Error(`Server responded with status ${re.status}`);const Q=await re.json();if(Q.success){const q=v(Q==null?void 0:Q.data);y(q)}else console.log(Q.error_message)}catch(U){console.log("Error :>> ",U),c(!1)}finally{c(!1)}}h.useEffect(()=>{C()},[window.localStorage.getItem("hyperToken")]);function S(O,U){const Y={};return O.forEach(re=>{Y[re.oid]={...re}}),U.forEach(re=>{const{oid:Q,px:q,dir:te,side:fe,crossed:G,feeToken:ie,listen_user:oe,cloid:K,coin:H,subs_address:ee,sz:se,closedPnl:pe,fee:Se,time:ge,startPosition:ve,insert_date:be,hash:we}=re;Y[Q]||(Y[Q]={oid:Q,px:q,dir:te,side:fe,crossed:G,feeToken:ie,listen_user:oe,cloid:K,coin:H,subs_address:ee,totalSize:0,totalStartPositions:0,totalClosedPnl:0,totalFee:0,closestTime:ge,earliestStartPosition:ve,insertDate:be,hashes:[],hasZeroStartPosition:!1}),parseFloat(ve)===0&&(Y[Q].hasZeroStartPosition=!0),Y[Q].hasZeroStartPosition?Y[Q].totalStartPositions=0:Y[Q].totalStartPositions+=parseFloat(ve),Y[Q].totalSize+=parseFloat(se),Y[Q].totalClosedPnl+=parseFloat(pe),Y[Q].totalFee+=parseFloat(Se),new Date(ge)>new Date(Y[Q].closestTime)&&(Y[Q].closestTime=ge),new Date(ge)>new Date(Y[Q].insertDate)&&(Y[Q].insertDate=be),new Date(ge)<new Date(Y[Q].closestTime)&&(Y[Q].earliestStartPosition=ve),Y[Q].hashes.push(we)}),Object.values(Y).sort((re,Q)=>new Date(Q.closestTime)-new Date(re.closestTime))}const T=h.useRef(!1),I=h.useRef(n),L=h.useRef(s);h.useEffect(()=>{I.current=n},[n]),h.useEffect(()=>{o.current=a},[a]),h.useEffect(()=>{L.current=s},[s]);const F="hyper_get_message";h.useEffect(()=>{if(!a||T.current)return;const O=K0("https://dextrabothypesocketv2.nftinit.io/");return t.current=O,T.current=!0,t.current.on("connect",()=>{console.log("Socket connected");const U=()=>{var Q;const Y=(Q=I.current)==null?void 0:Q.toLowerCase(),re=o.current;Y&&re?O.emit("subscribe",{login:Y,token:re}):setTimeout(U,300)};U()}),t.current.on(F,function(U){if(U){const Y=Array.isArray(U)?U:[U];y(re=>{const Q=S([],Y);let q=re.filter(G=>Y.some(ie=>ie.oid===G.oid)),te=[];q.length>0?te=S(Q,q):te=Q;const fe=re.filter(G=>!Y.some(ie=>ie.oid===G.oid));return[...te,...fe]})}}),t.current.io.on("reconnect_attempt",U=>{console.log("reconnect_attempt",U)}),t.current.io.on("reconnect",U=>{console.log("reconnect",U),t.current.emit("room",F)}),t.current.io.on("reconnect_failed",()=>{console.log("reconnect_failed")}),t.current.io.on("reconnect_error",U=>{console.log("reconnect_error",U)}),t.current.io.on("error",U=>{console.log("error",U)}),t.current.on("disconnect",()=>{console.log("Socket disconnected"),T.current=!1}),()=>{t.current.disconnect(),console.log("Socket cleanup on unmount")}},[a]);function $({date:O}){const[U,Y]=h.useState(vo(O));return h.useEffect(()=>{const re=setInterval(()=>{Y(vo(O))},1e3);return()=>clearInterval(re)},[O]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:U.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(ka,{}):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:Yl,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(O=>{var U,Y,re,Q,q,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:`${(U=O==null?void 0:O.dir)!=null&&U.includes("Long")?(O==null?void 0:O.dir)==="Short > Long"?"bg-[#67ffbd]/20":(O==null?void 0:O.dir)==="Long > Short"?"bg-[#ff797c]/20":"bg-[#67ffbd]/20":(O==null?void 0:O.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:(Y=O==null?void 0:O.dir)!=null&&Y.includes("Long")?(O==null?void 0:O.dir)==="Short > Long"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(O==null?void 0:O.dir)==="Long > Short"?i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(O==null?void 0:O.dir)=="Buy"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Us,{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:Hi,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/${O==null?void 0:O.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:(O==null?void 0:O.listen_user)&&((re=O==null?void 0:O.listen_user)==null?void 0:re.slice(0,5))+"..."+((Q=O==null?void 0:O.listen_user)==null?void 0:Q.slice(-4))}),i.jsx("img",{onClick:G=>{G.stopPropagation(),navigator.clipboard.writeText(O==null?void 0:O.listen_user),fn.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:io,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:(O==null?void 0:O.oid)&&(O==null?void 0:O.oid)})]}),i.jsx("span",{onClick:G=>{G.stopPropagation(),navigator.clipboard.writeText(O==null?void 0:O.oid),fn.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:io,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:O==null?void 0:O.closestTime}):$c(O==null?void 0:O.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"," ",(O==null?void 0:O.dir)=="Sell"?"spot sell":(O==null?void 0:O.dir)=="Buy"?"spot buy":(q=O==null?void 0:O.dir)==null?void 0:q.toLowerCase()," ","position for"," "]}),i.jsxs("span",{className:"pl-1 text-white text-[13px] font-normal font-manrope leading-[21px] tracking-tight",children:[O==null?void 0:O.coin,"/",O==null?void 0:O.feeToken]})]}),i.jsx("div",{className:"w-5 h-5 bg-transparent rounded-[256px]",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${O==null?void 0:O.coin}.svg`||Ha,alt:O==null?void 0:O.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:G=>Zi(G)})})]})]})]}),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/${O==null?void 0:O.coin}.svg`||Ha,alt:O==null?void 0:O.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:G=>Zi(G)})}),i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:[O==null?void 0:O.coin,"/",O==null?void 0:O.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=O==null?void 0:O.dir)!=null&&te.includes("Long")?(O==null?void 0:O.dir)==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":(O==null?void 0:O.dir)==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":(O==null?void 0:O.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=O==null?void 0:O.dir)!=null&&fe.includes("Long")?(O==null?void 0:O.dir)==="Short > Long"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(O==null?void 0:O.dir)==="Long > Short"?i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(O==null?void 0:O.dir)=="Buy"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:(O==null?void 0:O.dir)=="Sell"?"Sell":(O==null?void 0:O.dir)=="Buy"?"Buy":(O==null?void 0:O.dir)=="Close Short"?"Short":(O==null?void 0:O.dir)=="Close Long"?"Long":(O==null?void 0:O.dir)=="Open Short"?"Short":(O==null?void 0:O.dir)=="Open Long"?"Long":O==null?void 0:O.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(FC,{title:"Type",value:(O==null?void 0:O.totalStartPositions)==0?"Open Position":(O==null?void 0:O.dir)!="Short > Long"&&(O==null?void 0:O.dir)!="Long > Short"?(O==null?void 0:O.totalSize)-Math.abs(O==null?void 0:O.totalStartPositions)==0&&((O==null?void 0:O.dir)=="Close Long"||(O==null?void 0:O.dir)=="Close Short")?"Position Closed":(O==null?void 0:O.dir)=="Open Short"||(O==null?void 0:O.dir)=="Open Long"?"Increase":(O==null?void 0:O.dir)=="Close Long"||(O==null?void 0:O.dir)=="Close Short"?"Decrease":(O==null?void 0:O.dir)=="Sell"||(O==null?void 0:O.dir)=="Buy"?"Spot":"Changed Position":(O==null?void 0:O.dir)=="Short > Long"||(O==null?void 0:O.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(FC,{title:"Price",value:Ir(O==null?void 0:O.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(FC,{title:"Size",value:Ir(O==null?void 0:O.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(FC,{title:"PnL",value:O!=null&&O.totalClosedPnl?`$${Ir(Math.abs(O==null?void 0:O.totalClosedPnl))}`:Ir(Math.abs(O==null?void 0:O.totalClosedPnl)),color:`${(O==null?void 0:O.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(FC,{title:"Fee",value:O!=null&&O.totalFee?`$${Ir(Math.abs(O==null?void 0:O.totalFee))}`:Ir(Math.abs(O==null?void 0:O.totalFee)),color:`${(O==null?void 0:O.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(FC,{title:"Margin Mode",value:O!=null&&O.crossed?"Cross":"Isolated",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-transparent"})]})]})})]})]})},O.oid)})})})},FC=({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})})]}),mcn="https://dextrabothypesocketv2.nftinit.io/";function xcn(){var Y,re;const{isConnected:t,address:e}=ds(),{setSignModalOpen:n,trackedWatchList:r,hyperToken:s}=h.useContext(Qr),a=h.useRef(null),[o,l]=h.useState([]),[c,u]=h.useState(!1),f=localStorage.getItem("isDateTrackedWalletsFormat")||"date",[x,g]=h.useState(f),[y,v]=h.useState(null);function C({date:Q}){const[q,te]=h.useState(vo(Q));return h.useEffect(()=>{const fe=setInterval(()=>te(vo(Q)),1e3);return()=>clearInterval(fe)},[Q]),i.jsx("span",{className:"text-[11px] text-[#a5a5a5] font-normal",children:q.dateTime})}h.useEffect(()=>{localStorage.setItem("isDateTrackedWalletsFormat",x)},[x]);function S(Q){const q={};return Q.forEach(te=>{const{oid:fe,px:G,dir:ie,side:oe,crossed:K,feeToken:H,listen_user:ee,cloid:se,coin:pe,subs_address:Se,sz:ge,closedPnl:ve,fee:be,time:we,startPosition:je,insert_date:Fe,hash:Re}=te;q[fe]||(q[fe]={oid:fe,px:G,dir:ie,side:oe,crossed:K,feeToken:H,listen_user:ee,cloid:se,coin:pe,subs_address:Se,totalSize:0,totalClosedPnl:0,totalFee:0,earliestStartPosition:je,hasZeroStartPosition:!1,closestTime:we,insertDate:Fe,hashes:[]}),parseFloat(je)===0&&(q[fe].hasZeroStartPosition=!0),q[fe].totalSize+=parseFloat(ge),q[fe].totalClosedPnl+=parseFloat(ve),q[fe].totalFee+=parseFloat(be),new Date(we)>new Date(q[fe].closestTime)&&(q[fe].closestTime=we),new Date(we)>new Date(q[fe].insertDate)&&(q[fe].insertDate=Fe),q[fe].hashes.push(Re)}),Object.keys(q).map(te=>({oid:te,...q[te]}))}async function T(){const Q=window.localStorage.getItem("hyperToken");try{u(!0),Q||n(!0);const q=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:Q,offset:0})});if(!q.ok)throw new Error(`Server responded with status ${q.status}`);const te=await q.json();if(te.success){const fe=S(te==null?void 0:te.data);l(fe)}}catch(q){console.log("Error :>> ",q)}finally{u(!1)}}function I(Q,q){const te={};return Q.forEach(fe=>{te[fe.oid]={...fe}}),q.forEach(fe=>{const{oid:G,px:ie,dir:oe,side:K,crossed:H,feeToken:ee,listen_user:se,cloid:pe,coin:Se,subs_address:ge,sz:ve,closedPnl:be,fee:we,time:je,startPosition:Fe,insert_date:Re,hash:Qe}=fe;te[G]||(te[G]={oid:G,px:ie,dir:oe,side:K,crossed:H,feeToken:ee,listen_user:se,cloid:pe,coin:Se,subs_address:ge,totalSize:0,totalClosedPnl:0,totalFee:0,hasZeroStartPosition:!1,earliestStartPosition:Fe,closestTime:je,insertDate:Re,hashes:[]}),parseFloat(Fe)===0&&(te[G].hasZeroStartPosition=!0),te[G].totalSize+=parseFloat(ve),te[G].totalClosedPnl+=parseFloat(be),te[G].totalFee+=parseFloat(we),new Date(je)>new Date(te[G].closestTime)&&(te[G].closestTime=je),new Date(je)>new Date(te[G].insertDate)&&(te[G].insertDate=Re),te[G].hashes.push(Qe)}),Object.values(te).sort((fe,G)=>new Date(G.closestTime)-new Date(fe.closestTime))}h.useEffect(()=>{T()},[window.localStorage.getItem("hyperToken")]),h.useEffect(()=>{a.current=K0(mcn);const Q=window.localStorage.getItem("hyperToken");return a.current.on("connect",()=>{r==null||r.map(q=>q.wallet_address),a.current.emit("subscribe",{login:e.toLowerCase(),token:Q})}),a.current.on("hyper_get_message",q=>{if(q){const te=Array.isArray(q)?q:[q];l(fe=>{const G=I([],te);let ie=fe.filter(H=>te.some(ee=>ee.oid===H.oid)),oe=[];ie.length>0?oe=I(G,ie):oe=G;const K=fe.filter(H=>!te.some(ee=>ee.oid===H.oid));return[...oe,...K]})}}),()=>{a.current.disconnect()}},[s]);const L=Q=>Q?Q.includes("Long")?Q==="Short > Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":Q==="Long > Short"?"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#67ffbd]/20 text-[#67ffbd]":Q==="Buy"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#767676]/20 text-[#cccccc]",F=Q=>Q?Q.includes("Long")?Q==="Short > Long"?i.jsx(Us,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):Q==="Long > Short"?i.jsx(Us,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Us,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):Q==="Buy"?i.jsx(Us,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):i.jsx(Us,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Us,{className:"text-[#767676] w-3 h-3"}),$=Q=>{const q=Q==null?void 0:Q.hasZeroStartPosition,te=Q.dir==="Close Short"||Q.dir==="Close Long"||Q.dir==="Short > Long"||Q.dir==="Long > Short";return q||te?{text:"Closed",icon:aL}:{text:"Open",icon:oL}},O=Q=>v(Q),U=()=>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(ka,{}):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:Yl,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(Q=>($(Q),i.jsxs("div",{className:"border-2 border-[#232323] rounded-xl p-3 flex items-start gap-3 cursor-pointer",onClick:()=>O(Q),children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full flex items-center justify-center",children:i.jsx("img",{src:Hi,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:[Q!=null&&Q.listen_user?Q.listen_user.slice(0,5)+"..."+Q.listen_user.slice(-4):"-",i.jsx("img",{src:io,alt:"",className:"w-4 h-4 cursor-pointer",onClick:q=>{q.stopPropagation(),navigator.clipboard.writeText((Q==null?void 0:Q.listen_user)||""),fn.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:$c(Q==null?void 0:Q.closestTime)}),i.jsx(C,{date:Q==null?void 0:Q.closestTime})]}),i.jsxs("div",{className:"text-xs font-semibold",children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",Q!=null&&Q.totalSize?Ir(Q==null?void 0:Q.totalSize):"-"]}),i.jsxs("div",{className:"text-xs font-semibold",children:[i.jsx("span",{className:"text-white",children:"Price:"})," ",Q!=null&&Q.px?"$"+Ir(Q==null?void 0:Q.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/${Q==null?void 0:Q.coin}.svg`||Ha,alt:Q==null?void 0:Q.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:q=>Zi(q)})}),i.jsxs("div",{className:"text-[13px] text-white font-bold font-manrope leading-[13px] tracking-tight",children:[Q==null?void 0:Q.coin,"/",Q==null?void 0:Q.feeToken]})]}),i.jsxs("div",{className:`${L(Q==null?void 0:Q.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(Q==null?void 0:Q.dir)}),i.jsx("div",{className:"text-[11px] font-semibold",children:(Q==null?void 0:Q.dir)||"-"})]})]})]})]},Q.oid)))}),y&&i.jsx(yp,{isOpen:!!y,onClose:()=>U(),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:Hi,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:io,alt:"",className:"w-4 h-4 cursor-pointer",onClick:Q=>{Q.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}):$c(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:`${L(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?"$"+Ir(y==null?void 0:y.px):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",y!=null&&y.totalSize?Ir(y==null?void 0:y.totalSize):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"PnL:"})," ",y!=null&&y.totalClosedPnl?"$"+Ir(Math.abs(y==null?void 0:y.totalClosedPnl)):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Fee:"})," ",y!=null&&y.totalFee?"$"+Ir(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`||Ha,onError:Q=>Zi(Q),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:"})," ",(Y=y==null?void 0:y.hashes)!=null&&Y.length?((re=y==null?void 0:y.hashes)==null?void 0:re.length)+" fill(s)":"0"]})]})]})})]})}const gcn=({open:t,setOpen:e,handleTelegramClick:n})=>(h.useContext(Qr),ds(),z5(),i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Hi,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"})})]})})})})})]})),bcn=({open:t,setOpen:e,setIsfilterModal:n,handleTelegramClick:r})=>{const[s,a]=h.useState(!1),o=()=>{a(!1),n(!1),e(!1)};return i.jsxs(ha,{open:t,onClose:o,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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(k$e,{className:"w-4 h-4 text-black"})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Act,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"})})]})})})})})]})},ycn=({open:t,setOpen:e,handleTelegramClick:n})=>{const{setSignModalOpen:r}=h.useContext(Qr),{address:s}=ds(),[a,o]=h.useState([]),[l,c]=h.useState([]),[u,d]=h.useState(null),[f,x]=h.useState(!1),[g,y]=h.useState(!1),[v,C]=h.useState(!1),[S,T]=h.useState(""),[I,L]=h.useState(!1),[F]=h.useState(["Open Position","Increase","Decrease","Changed Position","Position Closed","Twaps"]),[$,O]=h.useState([]),[U,Y]=h.useState(!1),re=async()=>{var be;const ge=window.localStorage.getItem("hyperToken"),ve=window.localStorage.getItem("hyperAddress");if(!ge){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():ve,token:ge})})).json();if(je.success){const Fe=(je==null?void 0:je.data)||[],Re=u?((be=u==null?void 0:u.message_filters)==null?void 0:be.source)||[]:[],Qe=[...Fe].sort((Ye,dt)=>{const st=Re==null?void 0:Re.includes(Ye.wallet_address),at=Re==null?void 0:Re.includes(dt.wallet_address);return Number(at)-Number(st)});o(Qe),await Q(Qe)}else T((je==null?void 0:je.error_message)||"Failed to fetch source wallets"),console.error("API Error:",je==null?void 0:je.error_message)}catch(we){console.error("Fetch Error:",we),T("Failed to fetch source wallets")}finally{setTimeout(()=>{x(!1)},200)}},Q=async ge=>{var we;const ve=window.localStorage.getItem("hyperToken"),be=window.localStorage.getItem("hyperAddress");if(!ve){r(!0);return}try{y(!0);const Fe=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():be,token:ve})})).json();if(Fe.success){const Re=Fe==null?void 0:Fe.filters;if(d(Re),Re===null){const Qe=ge==null?void 0:ge.map(Ye=>`${Ye.wallet_address}::${Ye.tag}`);c(Qe),O([...F])}else{const Qe=((we=Re==null?void 0:Re.message_filters)==null?void 0:we.source)||[],Ye=[...ge].sort((dt,st)=>{const at=Qe==null?void 0:Qe.includes(dt.wallet_address),He=Qe==null?void 0:Qe.includes(st.wallet_address);return Number(He)-Number(at)});o(Ye)}}else T((Fe==null?void 0:Fe.error_message)||"Failed to fetch filter info"),console.error("API telegram filter info error:",Fe==null?void 0:Fe.error_message)}catch(je){console.error("Fetch Error:",je),T("Failed to fetch filter info")}finally{y(!1)}},q=async()=>{const ge=window.localStorage.getItem("hyperToken"),ve=window.localStorage.getItem("hyperAddress");if(!ge){r(!0);return}const be=[...new Set(l==null?void 0:l.map(Re=>Re.split("::")[0]))];let we={};be.length>0&&(we.source=be);const je=$.filter(Re=>!Re.includes("Spot"));je.length>0&&(we.type=je),be.length===0&&$.length===0&&(we={});const Fe={address:s?s==null?void 0:s.toLowerCase():ve,token:ge,filters:we};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(Fe)}),Qe=await Re.json();Re.ok&&Qe.success?(d(Qe.filters),pe(Qe.filters),L(!0),fn.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"}})):(T((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),T("Failed to save filter")}finally{C(!1)}};h.useEffect(()=>{a.length>0&&u&&pe(u)},[a,u]),h.useEffect(()=>{t&&re()},[t]);const te=ge=>{const{value:ve,checked:be}=ge.target;if(ve==="all"){const we=a.map(je=>`${je.wallet_address}::${je.tag}`);c(be?we:[])}else c(we=>be?[...we,ve]:we.filter(je=>je!==ve))},fe=a==null?void 0:a.map(ge=>`${ge.wallet_address}::${ge.tag}`),G=a.length>0&&(fe==null?void 0:fe.every(ge=>l==null?void 0:l.includes(ge))),ie=ge=>{const{value:ve,checked:be}=ge.target;if(ve==="all")if(be){const we=F==null?void 0:F.filter(je=>!(je!=null&&je.includes("Spot")));O(we)}else O([]);else O(we=>be?[...we,ve]:we.filter(je=>je!==ve))},K=(F==null?void 0:F.filter(ge=>!ge.includes("Spot"))).length,ee=$.filter(ge=>!ge.includes("Spot")).length,se=ee===K&&K>0,pe=ge=>{const ve=ge==null?void 0:ge.message_filters;if(ve&&(Array.isArray(ve.type)&&O(ve.type.filter(be=>!be.includes("Spot"))),Array.isArray(ve.source))){const be=a.filter(we=>{var je;return(je=ve.source)==null?void 0:je.includes(we.wallet_address)}).map(we=>`${we.wallet_address}::${we.tag}`);c(be)}},Se=()=>{e(!1),Y(!1),o([]),O([]),c([])};return i.jsxs(i.Fragment,{children:[i.jsx(bcn,{open:I,setOpen:L,handleTelegramClick:n,setIsfilterModal:e}),i.jsxs(ha,{open:t,onClose:Se,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:()=>Se(),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:Na,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:`${G?"text-white":"text-[#7C7C7C]"}`,children:"All"}),i.jsx("input",{type:"checkbox",value:"all",checked:G,onChange:te,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${G?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${G?"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((ge,ve)=>{var je,Fe,Re,Qe,Ye;const be=`${ge==null?void 0:ge.wallet_address}::${ge==null?void 0:ge.tag}`,we=l==null?void 0:l.includes(be);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:`${we?"text-white":"text-[#7C7C7C]"} text-[13px] font-semibold min-w-[88px]`,children:((je=ge.wallet_address)==null?void 0:je.slice(0,5))+"..."+((Fe=ge.wallet_address)==null?void 0:Fe.slice(-4))}),i.jsx("span",{className:`${we?"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=ge.tag)==null?void 0:Re.length)>10?`${(Qe=ge==null?void 0:ge.tag)==null?void 0:Qe.slice(0,10)}...`:`${ge==null?void 0:ge.tag}`}),i.jsx("span",{className:`${we?"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:((Ye=ge.tag)==null?void 0:Ye.length)>24?`${ge==null?void 0:ge.tag.slice(0,24)}...`:`${ge==null?void 0:ge.tag}`})]}),i.jsx("input",{type:"checkbox",value:`${ge==null?void 0:ge.wallet_address}::${ge==null?void 0:ge.tag}`,checked:we,onChange:te,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${we?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${we?"translate-x-[14px]":"translate-x-0"}`})})]},ve)})]})})})})]}),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 ${K} 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:`${se?"text-white":"text-[#7C7C7C]"}`,children:"All"}),i.jsx("input",{type:"checkbox",value:"all",checked:se,onChange:ie,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${se?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${se?"translate-x-[14px]":"translate-x-0"}`})})]}),i.jsx("div",{className:"h-[1px] w-full bg-[#353535] my-1"}),F==null?void 0:F.map((ge,ve)=>{const be=$==null?void 0:$.includes(ge);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:`${be?"text-white":"text-[#7C7C7C]"}`,children:ge}),i.jsx("input",{type:"checkbox",value:ge,checked:be,onChange:ie,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"}`})})]},ve)})]})})})]}),i.jsx("div",{onClick:ge=>{if(ge.preventDefault(),!f&&!g&&!v)if((l==null?void 0:l.length)===0||($==null?void 0:$.length)===0){fn.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 q()},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"})}),S&&i.jsx("p",{className:"mt-2 text-sm text-red-500",children:S})]})})})})]})]})},vcn=({isMenu:t})=>{const[e,n]=h.useState(!1),[r,s]=h.useState(!1),{setSignModalOpen:a,setTelegramChatId:o,setSubscriberRole:l,setIsReferralCode:c,setIsReferralCodeName:u,setMushboomerETH:d,setIsWhitelist:f,setMushboomerSOL:x,telegramChatId:g}=h.useContext(Qr);ds();const y=async()=>{var C,S;let v="";try{const T=window.localStorage.getItem("hyperToken"),I=window.localStorage.getItem("hyperAddress");if(!T){a(!0);return}if(I&&T){const L=await bi(I,T);if(!L.success){console.error("Account check failed:",L.message);return}if(o(L==null?void 0:L.telegram_chat_id),l(L==null?void 0:L.subscriber_role),d((C=L==null?void 0:L.mushboomer_counts)==null?void 0:C.eth),x((S=L==null?void 0:L.mushboomer_counts)==null?void 0:S.sol),c(L==null?void 0:L.referral_code),u(L==null?void 0:L.refcode),f(L==null?void 0:L.whitelist),L.telegram_chat_id==null||L.telegram_chat_id==""||L.telegram_chat_id=="0"){const F=await o3t(I,T);if(!F.success){console.error("Telegram-ID kunne ikke hentes:",L.message),fn.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"),fn.error("Failed to generate Telegram URL"))}catch(T){console.error("Error during Telegram handling:",T),fn.error(T.message)}};return i.jsxs(i.Fragment,{children:[i.jsx(gcn,{open:e,setOpen:n,handleTelegramClick:y}),i.jsx(ycn,{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 wcn(t){var Hn,ln,Nn,dn,rt,nt,Ut,wn,Jt,Vt,xt,We,Pt,Ke,ct,Nt,Ht,Rt,hn,yn,Cn,En,Rn,Mn,Yn,Zn,Vn,tr,Sn,ze,xe,Ge,_e,Be,qt,It,mt,Ft,Tn,kn,Gt,mn;const[e,n]=h.useState(!1),r=h.useRef(null),{isConnected:s,address:a}=ds(),[o,l]=h.useState([]);h.useEffect(()=>{var Wt,jn;const gt=(Wt=t.advancedFilters)==null?void 0:Wt.coinFeed;if(gt&&((jn=t.dataCoin)==null?void 0:jn.length)>0){const kt=gt.map(cn=>t.dataCoin.find(Ce=>Ce.value===cn)).filter(Boolean);t.setSelectedCoins(kt)}},[t.dataCoin]);const c=gt=>{if(!gt)return;const jn=Array.isArray(gt)?gt:[gt],kt=t.selectedCoins||[],cn=[...kt,...jn.filter(m=>!kt.some(p=>p.value===m.value))],Ce=cn.map(m=>m.value);Ce.join(","),t.setSelectedCoins(cn),t.setAdvancedFilters(m=>({...m,coinFeed:Ce}))},[u,d]=h.useState(!1),[f,x]=h.useState(!1),[g,y]=h.useState(!1),[v,C]=h.useState(!1),[S,T]=h.useState(!1),[I,L]=h.useState(!1),F=()=>{d(gt=>!gt)},$=()=>{x(gt=>!gt)},O=()=>{y(gt=>!gt)},U=()=>{C(gt=>!gt)},Y=()=>{T(gt=>!gt)},re=()=>{L(gt=>!gt)},Q=gt=>{const{value:Wt,checked:jn}=gt.target;t.setAdvancedFilters(kt=>{let cn=[...kt.positionFeed];return Wt==="all"?cn=jn?[...je]:[]:jn?cn.push(Wt):cn=cn.filter(Ce=>Ce!==Wt),localStorage.setItem("positionFeed",JSON.stringify(cn)),{...kt,positionFeed:cn}})},q=()=>{localStorage.setItem("positionFeed",JSON.stringify([])),t.setAdvancedFilters(gt=>({...gt,positionFeed:[]}))},te=gt=>{const{value:Wt,checked:jn}=gt.target;t.setAdvancedFilters(kt=>{let cn=[...kt.typeFeed];return Wt==="all"?cn=jn?[...Qe]:[]:jn?cn.push(Wt):cn=cn.filter(Ce=>Ce!==Wt),{...kt,typeFeed:cn}})},fe=()=>{t.setAdvancedFilters(gt=>({...gt,typeFeed:[]}))},G=gt=>{const{value:Wt,checked:jn}=gt.target;t.setAdvancedFilters(kt=>{let cn=[...kt.dexMarket];return Wt==="all"?cn=jn?[...Ye]:[]:jn?cn.push(Wt):cn=cn.filter(Ce=>Ce!==Wt),{...kt,dexMarket:cn}})},ie=()=>{t.setAdvancedFilters(gt=>({...gt,dexMarket:[]}))},oe=()=>{t.setSearchTagSellect([])},K=((Hn=t.selectTradeWalletData)==null?void 0:Hn.length)>0?o:t.walletTags,H=gt=>{const{value:Wt,checked:jn}=gt.target;t.setSearchTagSellect(kt=>{let cn=[...kt];return Wt==="all"?cn=jn?K==null?void 0:K.map(Ce=>Ce.tag):[]:jn?cn==null||cn.push(Wt):cn=cn==null?void 0:cn.filter(Ce=>Ce!==Wt),cn})},ee=gt=>{t.setAdvancedFilters(Wt=>({...Wt,directionFeed:gt})),L(!1)},se=()=>{t.setAdvancedFilters(gt=>({...gt,directionFeed:""})),L(!1)},pe=()=>{t.setSelectTradeWalletData([])},[Se,ge]=h.useState(!1),ve=async gt=>{const{value:Wt,checked:jn}=gt.target;let kt;t.setSelectTradeWalletData(cn=>{var Ce;return Wt==="all"?kt=jn?(Ce=t.tradeWalletData)==null?void 0:Ce.map(m=>m.wallet):[]:(kt=jn?[...cn,Wt]:cn==null?void 0:cn.filter(m=>m!==Wt),!jn&&cn.includes("all")&&(kt=kt==null?void 0:kt.filter(m=>m!=="all"))),kt}),t.setSearchTagSellect([]),setTimeout(async()=>{var cn;if((kt==null?void 0:kt.length)!==0)try{ge(!0);const Ce=window.localStorage.getItem("hyperToken");if(!Ce){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:Ce,trader_wallets:kt})});if(!p.ok)throw new Error(`Server responded with status ${p.status}`);const N=await p.json();if(N.success){const A=(cn=N==null?void 0:N.data)==null?void 0:cn.map(k=>({tag:k==null?void 0:k.tag,wallet:k==null?void 0:k.wallet_address}));l(A),ge(!1)}else console.log(N.error_message),ge(!1)}catch(Ce){console.log("Error :>> ",Ce),ge(!1)}},0)},be={control:(gt,{isFocused:Wt})=>{var jn,kt,cn,Ce;return{...gt,display:"flex",alignItems:"center",paddingLeft:"21px",backgroundColor:"#353535",minHeight:"32px",maxHeight:"32px",minWidth:"244px",maxWidth:"244px",border:((kt=(jn=t.advancedFilters)==null?void 0:jn.coinFeed)==null?void 0:kt.length)>0?"1px solid #8d67ff":"none",boxShadow:"none",borderRadius:"6px",":hover":{border:((Ce=(cn=t.advancedFilters)==null?void 0:cn.coinFeed)==null?void 0:Ce.length)>0?"1px solid #8d67ff":"none"}}},menu:gt=>({...gt,backgroundColor:"#353535",maxWidth:"244px"}),menuList:gt=>({...gt,backgroundColor:"#353535",maxHeight:"180px",zIndex:4}),clearIndicator:gt=>({...gt,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:gt=>({...gt,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:(gt,{data:Wt,isDisabled:jn,isFocused:kt,isSelected:cn})=>{const Ce=wi(Wt.color);return{...gt,fontSize:"14px",fontWeight:"600",backgroundColor:jn?void 0:cn?Wt.color:kt?Ce.alpha(.1).css():void 0,color:"white",cursor:jn?"not-allowed":"pointer",":active":{...gt[":active"],backgroundColor:jn?void 0:cn?Wt.color:Ce.alpha(.9).css()}}},multiValue:(gt,{data:Wt})=>{const jn=wi(Wt.color);return{...gt,backgroundColor:jn.alpha(.4).css()}},multiValueLabel:(gt,{data:Wt})=>({...gt,color:"white"}),multiValueRemove:(gt,{data:Wt})=>({...gt,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.3)",color:"white"}}),input:gt=>({...gt,color:"white"}),valueContainer:gt=>({...gt,paddingTop:"0px",fontSize:"14px",fontWeight:"600"})},we=(gt,Wt)=>{var kt;const jn=(kt=Wt.selectedCoins)==null?void 0:kt.filter(cn=>cn.value!==gt.value);jn.map(cn=>cn.value).join(","),Wt.setSelectedCoins(jn),Wt.setAdvancedFilters(cn=>({...cn,coinFeed:jn==null?void 0:jn.map(Ce=>Ce.value)}))};h.useEffect(()=>{const gt=Wt=>{r.current&&!r.current.contains(Wt.target)&&n(!1)};return document.addEventListener("mousedown",gt),()=>{document.removeEventListener("mousedown",gt)}},[]);const je=["Open Position","Increase","Decrease","Changed Position","Position Closed","Other"],Fe=(ln=t.advancedFilters.positionFeed)==null?void 0:ln.length,Re=je.length,Qe=["Open Position","Increase","Decrease","Changed Position","Position Closed","Spot","Twaps"],Ye=["HyperLiquid","Lighter"],dt=(Nn=t.advancedFilters.typeFeed)==null?void 0:Nn.length,st=Qe.length,at=(dn=t.advancedFilters.dexMarket)==null?void 0:dn.length,He=Ye.length,qe=(rt=t.searchTagSellect)==null?void 0:rt.length,vt=K==null?void 0:K.length,yt=(nt=t.selectTradeWalletData)==null?void 0:nt.length,Kt=(Ut=t.tradeWalletData)==null?void 0:Ut.length,jt=["Long","Short"],un=({src:gt,alt:Wt})=>{const[jn,kt]=ke.useState(!1);return jn?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:gt,alt:Wt,className:"rounded-full w-4 h-4 min-w-4 min-h-4 mr-1",loading:"lazy",onError:()=>kt(!0)})},vn=gt=>{const{data:Wt,innerRef:jn,innerProps:kt,selectProps:cn}=gt,Ce=cn.styles.option({},gt);return i.jsxs("div",{ref:jn,...kt,style:Ce,className:"flex items-center p-2",children:[i.jsx(un,{src:Wt.icon,alt:Wt.label}),Wt.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:ie,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:`${at>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:O,children:[i.jsx("span",{className:`${at>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:at>0?`${at} of ${He} 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:((Jt=(wn=t.advancedFilters)==null?void 0:wn.dexMarket)==null?void 0:Jt.length)===Ye.length,onChange:G,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((xt=(Vt=t.advancedFilters)==null?void 0:Vt.dexMarket)==null?void 0:xt.length)===Ye.length?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((Pt=(We=t.advancedFilters)==null?void 0:We.dexMarket)==null?void 0:Pt.length)===(Ye==null?void 0:Ye.length)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),"All"]}),i.jsx("div",{className:"h-[2px] w-full bg-[#404040]"}),Ye==null?void 0:Ye.map((gt,Wt)=>{var jn,kt,cn,Ce,m,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:gt,checked:(kt=(jn=t.advancedFilters)==null?void 0:jn.dexMarket)==null?void 0:kt.includes(gt),onChange:G,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Ce=(cn=t.advancedFilters)==null?void 0:cn.dexMarket)!=null&&Ce.includes(gt)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((p=(m=t.advancedFilters)==null?void 0:m.dexMarket)==null?void 0:p.includes(gt))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),gt==="HyperLiquid"?i.jsx("img",{src:O1,alt:"hyper",className:"w-4 h-4 rounded-sm"}):gt==="Lighter"?i.jsx(yf,{className:"w-4 h-4 text-[#fff]"}):null,gt]},Wt)})]})})]})]}),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:pe,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:`${yt>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:Y,children:[i.jsx("span",{className:`${yt>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:yt>0?`${yt} of ${Kt} selected`:"Select Wallet"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${S?"rotate-180":""}`})]}),S&&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:((Ke=t.selectTradeWalletData)==null?void 0:Ke.length)===((ct=t.tradeWalletData)==null?void 0:ct.length),onChange:ve,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((Nt=t.selectTradeWalletData)==null?void 0:Nt.length)===((Ht=t.tradeWalletData)==null?void 0:Ht.length)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((Rt=t.selectTradeWalletData)==null?void 0:Rt.length)===((hn=t.tradeWalletData)==null?void 0:hn.length)&&i.jsx("img",{src:Ec,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..."'}):(yn=t.tradeWalletData)==null?void 0:yn.map((gt,Wt)=>{var jn,kt,cn,Ce,m,p,N;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:gt==null?void 0:gt.wallet,checked:(jn=t.selectTradeWalletData)==null?void 0:jn.includes(gt==null?void 0:gt.wallet),onChange:ve,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(kt=t.selectTradeWalletData)!=null&&kt.includes(gt==null?void 0:gt.wallet)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((cn=t.selectTradeWalletData)==null?void 0:cn.includes(gt==null?void 0:gt.wallet))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),((Ce=gt==null?void 0:gt.wallet)==null?void 0:Ce.slice(0,5))+"..."+((m=gt==null?void 0:gt.wallet)==null?void 0:m.slice(-4)),` (${((p=gt==null?void 0:gt.name)==null?void 0:p.length)>10?((N=gt==null?void 0:gt.name)==null?void 0:N.slice(0,10))+"...":gt==null?void 0:gt.name})`]},Wt)})]})})]})]}),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: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:`${qe>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:U,children:[i.jsx("span",{className:`${qe>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:qe>0?`${qe} of ${vt} 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:Se?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:((Cn=t.searchTagSellect)==null?void 0:Cn.length)===(K==null?void 0:K.length),onChange:H,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((En=t.searchTagSellect)==null?void 0:En.length)===(K==null?void 0:K.length)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((Rn=t.searchTagSellect)==null?void 0:Rn.length)===(K==null?void 0:K.length)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),"All"]}),i.jsx("div",{className:"h-[2px] w-full bg-[#404040]"}),K==null?void 0:K.map((gt,Wt)=>{var jn,kt,cn,Ce,m,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:gt==null?void 0:gt.tag,checked:(jn=t.searchTagSellect)==null?void 0:jn.includes(gt==null?void 0:gt.tag),onChange:H,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(kt=t.searchTagSellect)!=null&&kt.includes(gt==null?void 0:gt.tag)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((cn=t.searchTagSellect)==null?void 0:cn.includes(gt==null?void 0:gt.tag))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),(gt==null?void 0:gt.wallet)&&((Ce=gt==null?void 0:gt.wallet)==null?void 0:Ce.slice(0,5))+"..."+((m=gt==null?void 0:gt.wallet)==null?void 0:m.slice(-4))," ",gt!=null&>.tag&&(gt==null?void 0:gt.tag.length)>10?`(${(p=gt==null?void 0:gt.tag)==null?void 0:p.slice(0,10)}...)`:`(${gt==null?void 0:gt.tag})`]},Wt)})]})})]})]}),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(gt=>({...gt,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(Vy,{className:"text-[#646464] absolute left-[6px] top-[6px] z-10"}),i.jsx(pl,{closeMenuOnSelect:!1,value:[],isMulti:!0,options:t.dataCoin.filter(gt=>Array.isArray(t.selectedCoins)&&!t.selectedCoins.some(Wt=>Wt.value===gt.value)),components:{Option:vn},styles:be,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&&((Mn=t.selectedCoins)==null?void 0:Mn.length)>0?"block":"hidden"}`,children:t.selectedCoins&&((Yn=t.selectedCoins)==null?void 0:Yn.map(gt=>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(un,{src:gt==null?void 0:gt.icon,alt:gt==null?void 0:gt.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:gt.label}),i.jsx("div",{onClick:Wt=>{Wt.stopPropagation(),we(gt,t)},className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(Aw,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},gt.value)))}),i.jsx("div",{className:`${((Zn=t.selectedCoins)==null?void 0:Zn.length)>0?"mt-2.5":""} flex flex-wrap gap-1 max-w-[244px]`,children:t.selectedCoins&&((Vn=t.selectedCoins)==null?void 0:Vn.map(gt=>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(un,{src:gt==null?void 0:gt.icon,alt:gt==null?void 0:gt.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:gt.label}),i.jsx("div",{onClick:()=>we(gt,t),className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(Aw,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},gt.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 ${st} 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:((Sn=(tr=t.advancedFilters)==null?void 0:tr.typeFeed)==null?void 0:Sn.length)===Qe.length,onChange:te,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((xe=(ze=t.advancedFilters)==null?void 0:ze.typeFeed)==null?void 0:xe.length)===Qe.length?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((_e=(Ge=t.advancedFilters)==null?void 0:Ge.typeFeed)==null?void 0:_e.length)===(Qe==null?void 0:Qe.length)&&i.jsx("img",{src:Ec,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((gt,Wt)=>{var jn,kt,cn,Ce,m,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:gt,checked:(kt=(jn=t.advancedFilters)==null?void 0:jn.typeFeed)==null?void 0:kt.includes(gt),onChange:te,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Ce=(cn=t.advancedFilters)==null?void 0:cn.typeFeed)!=null&&Ce.includes(gt)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((p=(m=t.advancedFilters)==null?void 0:m.typeFeed)==null?void 0:p.includes(gt))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),gt]},Wt)})]})})]})]}),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:q,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:`${Fe>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:`${Fe>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:Fe>0?`${Fe} 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:((qt=(Be=t.advancedFilters)==null?void 0:Be.positionFeed)==null?void 0:qt.length)===(je==null?void 0:je.length),onChange:Q,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((mt=(It=t.advancedFilters)==null?void 0:It.positionFeed)==null?void 0:mt.length)===(je==null?void 0:je.length)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((Tn=(Ft=t.advancedFilters)==null?void 0:Ft.positionFeed)==null?void 0:Tn.length)===(je==null?void 0:je.length)&&i.jsx("img",{src:Ec,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((gt,Wt)=>{var jn,kt,cn,Ce,m,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:gt,checked:(kt=(jn=t.advancedFilters)==null?void 0:jn.positionFeed)==null?void 0:kt.includes(gt),onChange:Q,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Ce=(cn=t.advancedFilters)==null?void 0:cn.positionFeed)!=null&&Ce.includes(gt)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((p=(m=t.advancedFilters)==null?void 0:m.positionFeed)==null?void 0:p.includes(gt))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),gt==="Other"?"System Message":gt]},Wt)})]})})]})]}),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: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:`${(kn=t.advancedFilters)!=null&&kn.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:re,children:[i.jsx("span",{className:`${(Gt=t.advancedFilters)!=null&&Gt.directionFeed?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:((mn=t.advancedFilters)==null?void 0:mn.directionFeed)||"Select Direction"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${I?"rotate-180":""}`})]}),I&&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:jt==null?void 0:jt.map((gt,Wt)=>i.jsx("div",{onClick:()=>ee(gt),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:gt},Wt))})})]})]})]})}const Ccn=({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:S,setSearchTagSellect:T,isWalletLoading:I})=>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(wcn,{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:S,setSearchTagSellect:T,walletTags:d,isWalletLoading:I})})}),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 Ncn={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 Scn(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 Ncn[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 Iw(t){var e=Scn(t);return"".concat(e.value).concat(e.unit)}var xse=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},tB=function(){return tB=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},tB.apply(this,arguments)},jcn=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},Acn=xse("BeatLoader","50% {transform: scale(0.75);opacity: 0.2} 100% {transform: scale(1);opacity: 1}","beat");function ZVe(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=jcn(t,["loading","color","speedMultiplier","cssOverride","size","margin"]),y=tB({display:"inherit"},c),v=function(C){return{display:"inline-block",backgroundColor:s,width:Iw(d),height:Iw(d),margin:Iw(x),borderRadius:"100%",animation:"".concat(Acn," ").concat(.7/o,"s ").concat(C%2?"0s":"".concat(.35/o,"s")," infinite linear"),animationFillMode:"both"}};return n?h.createElement("span",tB({style:y},g),h.createElement("span",{style:v(1)}),h.createElement("span",{style:v(2)}),h.createElement("span",{style:v(3)})):null}var nB=function(){return nB=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},nB.apply(this,arguments)},_cn=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},_Ne=[xse("PuffLoader","0% {transform: scale(0)} 100% {transform: scale(1.0)}","puff-1"),xse("PuffLoader","0% {opacity: 1} 100% {opacity: 0}","puff-2")];function JVe(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=_cn(t,["loading","color","speedMultiplier","cssOverride","size"]),x=nB({display:"inherit",position:"relative",width:Iw(d),height:Iw(d)},c),g=function(y){return{position:"absolute",height:Iw(d),width:Iw(d),border:"thick solid ".concat(s),borderRadius:"50%",opacity:"1",top:"0",left:"0",animationFillMode:"both",animation:"".concat(_Ne[0],", ").concat(_Ne[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?h.createElement("span",nB({style:x},f),h.createElement("span",{style:g(1)}),h.createElement("span",{style:g(2)})):null}function Ecn({feedData:t}){var l,c;const[e,n]=h.useState(null);function r({date:u}){const[d,f]=h.useState(vo(u));return h.useEffect(()=>{const x=setInterval(()=>{f(vo(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(JVe,{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:Hi,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:O1,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(yf,{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:io,alt:"",className:"w-4 h-4 cursor-pointer",onClick:S=>{S.stopPropagation(),navigator.clipboard.writeText((u==null?void 0:u.listen_user)||""),fn.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:$c(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?Ir(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?"$"+Ir(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`||Ha,onError:S=>Zi(S),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(Us,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(u==null?void 0:u.dir)==="Long > Short"?i.jsx(Us,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Us,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(u==null?void 0:u.dir)==="Buy"?i.jsx(Us,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):i.jsx(Us,{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:aL,alt:""}):i.jsx("img",{src:oL,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:Hi,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:io,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:$c(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?aL:oL,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(Us,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(e==null?void 0:e.dir)==="Long > Short"?i.jsx(Us,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Us,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(e==null?void 0:e.dir)==="Buy"?i.jsx(Us,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):i.jsx(Us,{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?"$"+Ir(e==null?void 0:e.px):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",e!=null&&e.sz?Ir(e==null?void 0:e.sz):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Entry Price:"})," ",e!=null&&e.markPrice?"$"+Ir(e==null?void 0:e.markPrice):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"PnL:"})," ",e!=null&&e.closedPnl?"$"+Ir(Math.abs(e==null?void 0:e.closedPnl)):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Fee:"})," ",e!=null&&e.fee?"$"+Ir(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`||Ha,onError:u=>Zi(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 kcn=()=>{var dn;const{isConnected:t,address:e}=ds(),{setSignModalOpen:n,copyTradeWatchList:r,hyperToken:s}=h.useContext(Qr),[a,o]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState([]),f=h.useRef(null),[x,g]=h.useState(0),[y,v]=h.useState(!1),[C,S]=h.useState(!0),[T,I]=h.useState([]),[L,F]=h.useState(!0),[$,O]=h.useState([]),[U,Y]=h.useState([]),[re,Q]=h.useState([]),[q,te]=h.useState([]),[fe,G]=h.useState([]),[ie,oe]=h.useState(!1),[K,H]=h.useState([]),[ee,se]=h.useState([]),Se=localStorage.getItem("isDateCopyTradeFormat")||"date",[ge,ve]=h.useState(Se),[be,we]=h.useState(!1);h.useEffect(()=>{localStorage.setItem("isDateCopyTradeFormat",ge)},[ge]),h.useEffect(()=>{(async()=>{var nt,Ut;try{const Jt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/")).json(),Vt=()=>wi.random().hex(),xt=(Ut=(nt=Jt.coins)==null?void 0:nt.filter(We=>!We.startsWith("@")&&!We.endsWith("/USDC")))==null?void 0:Ut.map(We=>({value:We,label:We.endsWith("/USDC")?We+" (Spot)":We,icon:`https://app.hyperliquid.xyz/coins/${We}.svg`,color:Vt()}));I(xt),F(!1)}catch(wn){console.error("Data extraction error:",wn),F(!1)}})()},[]);const[je,Fe]=h.useState({userWalletFeed:"",coinFeed:"",positionFeed:[],directionFeed:"",statusFeed:"",typeFeed:"",dexMarket:[]});h.useEffect(()=>{const rt=["Open Position","Increase","Decrease","Changed Position","Position Closed","Other"],nt=localStorage.getItem("positionFeed"),Ut=nt&&Array.isArray(JSON.parse(nt))?JSON.parse(nt):rt;Fe(wn=>({...wn,positionFeed:Ut}))},[]);const Re=h.useRef(je);h.useEffect(()=>{Re.current=je},[je]);const Qe=async(rt=!1)=>{var Ut,wn,Jt;g(0),v(!0),S(!0);const nt=window.localStorage.getItem("hyperToken");try{o(!0),c(!0);const Vt=window.localStorage.getItem("hyperAddress");if(!nt){n(!0);return}const xt={};(K==null?void 0:K.length)>0&&(xt.copy_trader=K),(re==null?void 0:re.length)>0&&(xt.trader=re),(ee==null?void 0:ee.length)>0&&(xt.tag=ee),((Ut=je==null?void 0:je.coinFeed)==null?void 0:Ut.length)>0&&(xt.coin=je.coinFeed.includes(",")?je.coinFeed.split(",").map(En=>En.trim()):je.coinFeed);const We=localStorage.getItem("positionFeed"),Pt=rt?We&&JSON.parse(We)||["Open Position","Increase","Decrease","Changed Position","Position Closed","Other"]:je.positionFeed;(Pt==null?void 0:Pt.length)>0&&(Pt==null?void 0:Pt.length)<6&&(xt.position=Pt),((wn=je==null?void 0:je.typeFeed)==null?void 0:wn.length)>0&&((Jt=je==null?void 0:je.typeFeed)==null?void 0:Jt.length)<7&&(xt.type=je.typeFeed),je!=null&&je.directionFeed&&(xt.direction=je.directionFeed),je!=null&&je.statusFeed&&(je.statusFeed==="On"?xt.status=!0:je.statusFeed==="Off"?xt.status=!1:je.statusFeed==="All"&&delete xt.status);const Ke=((je==null?void 0:je.dexMarket)||[]).map(En=>En.toLowerCase()),ct=Ke.includes("hyperliquid"),Nt=Ke.includes("lighter"),Ht=[];ct&&!Nt?Ht.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/"):Nt&&!ct?Ht.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/"):Ht.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/","https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/");const Rt=await Promise.all(Ht.map(En=>fetch(En,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Vt,token:nt,offset:0,...Object.keys(xt).length&&{filters:xt}})}))),yn=(await Promise.all(Rt.map(En=>En.json()))).filter(En=>En.success&&Array.isArray(En.data)).flatMap(En=>En.data).sort((En,Rn)=>new Date(Rn.time)-new Date(En.time));d(yn),g(En=>En+50),yn.length<50&&S(!1);const Cn=yn.map(En=>({wallet:En.trader_wallet,name:En.wallet_name}));Y(En=>{const Rn=new Map(En.map(Mn=>[Mn.wallet,Mn.name]));return Cn.forEach(Mn=>{Rn.has(Mn.wallet)||Rn.set(Mn.wallet,Mn.name)}),Array.from(Rn,([Mn,Yn])=>({wallet:Mn,name:Yn}))})}catch(Vt){console.log("Error :>> ",Vt)}finally{o(!1),c(!1),v(!1)}},Ye=async()=>{const rt=window.localStorage.getItem("hyperToken");try{oe(!0);const nt="https://dextrabothypev2.nftinit.io/api/hyper/trade/feed/tag_list/",Ut=window.localStorage.getItem("hyperAddress");if(!rt){n(!0);return}const wn=await fetch(nt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Ut,token:rt})});if(!wn.ok)throw new Error(`Server responded with status ${wn.status}`);const Jt=await wn.json();if(Jt.success){te(Jt==null?void 0:Jt.data);const Vt=Jt==null?void 0:Jt.data.map(xt=>xt.tag?{tag:xt.tag,wallet:xt.wallet_address}:null).filter(xt=>xt!==null);G(Vt)}else console.log(Jt.error_message)}catch(nt){console.log("Error :>> ",nt)}finally{oe(!1)}};h.useEffect(()=>{Qe(!0),Ye()},[s]);const dt=async()=>{g(0),v(!0),S(!0);const rt=window.localStorage.getItem("hyperToken");try{o(!0);const nt=window.localStorage.getItem("hyperAddress");if(!rt){n(!0);return}const Ut=((je==null?void 0:je.dexMarket)||[]).map(Ke=>Ke.toLowerCase()),wn=Ut.includes("hyperliquid"),Jt=Ut.includes("lighter"),Vt=[];wn&&!Jt?Vt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/"):Jt&&!wn?Vt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/"):Vt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/","https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/");const xt=await Promise.all(Vt.map(Ke=>fetch(Ke,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():nt,token:rt,offset:0})}))),Pt=(await Promise.all(xt.map(Ke=>Ke.json()))).filter(Ke=>Ke.success&&Array.isArray(Ke.data)).flatMap(Ke=>Ke.data).sort((Ke,ct)=>new Date(ct.time)-new Date(Ke.time));d(Pt),g(Ke=>Ke+50),Pt.length<50&&S(!1),localStorage.setItem("positionFeed",JSON.stringify([])),Fe({userWalletFeed:"",coinFeed:"",positionFeed:[],directionFeed:"",statusFeed:"",typeFeed:[],dexMarket:[]}),O([]),H([]),Q([]),se([])}catch(nt){console.log("Error :>> ",nt)}finally{o(!1),v(!1)}},st=async()=>{var nt,Ut,wn,Jt,Vt;if(y)return;v(!0);const rt=window.localStorage.getItem("hyperToken");try{const xt=window.localStorage.getItem("hyperAddress");if(!rt){n(!0);return}const We={};(K==null?void 0:K.length)>0&&(We.copy_trader=K),(re==null?void 0:re.length)>0&&(We.trader=re),(ee==null?void 0:ee.length)>0&&(We.tag=ee),je!=null&&je.coinFeed&&((nt=je==null?void 0:je.coinFeed)==null?void 0:nt.length)>0&&(We.coin=je.coinFeed.includes(",")?je.coinFeed.split(",").map(Cn=>Cn.trim()):je.coinFeed),((Ut=je==null?void 0:je.positionFeed)==null?void 0:Ut.length)>0&&((wn=je==null?void 0:je.positionFeed)==null?void 0:wn.length)<6&&(We.position=je.positionFeed),((Jt=je==null?void 0:je.typeFeed)==null?void 0:Jt.length)>0&&((Vt=je==null?void 0:je.typeFeed)==null?void 0:Vt.length)<7&&(We.type=je.typeFeed),je!=null&&je.directionFeed&&(We.direction=je.directionFeed),je!=null&&je.statusFeed&&(je.statusFeed==="On"?We.status=!0:je.statusFeed==="Off"?We.status=!1:je.statusFeed==="All"&&delete We.status);const Pt=((je==null?void 0:je.dexMarket)||[]).map(Cn=>Cn.toLowerCase()),Ke=Pt.includes("hyperliquid"),ct=Pt.includes("lighter"),Nt=[];Ke&&!ct?Nt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/"):ct&&!Ke?Nt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/"):Nt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/","https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/");const Ht=await Promise.all(Nt.map(Cn=>fetch(Cn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():xt,token:rt,offset:x,...Object.keys(We).length&&{filters:We}})}))),hn=(await Promise.all(Ht.map(Cn=>Cn.json()))).filter(Cn=>Cn.success&&Array.isArray(Cn.data)).flatMap(Cn=>Cn.data).sort((Cn,En)=>new Date(En.time)-new Date(Cn.time));d(Cn=>[...Cn,...hn].sort((Rn,Mn)=>new Date(Mn.time)-new Date(Rn.time))),g(Cn=>Cn+50),hn.length<50&&S(!1);const yn=hn.map(Cn=>({wallet:Cn.trader_wallet,name:Cn.wallet_name}));Y(Cn=>{const En=new Set(Cn.map(Mn=>Mn.wallet)),Rn=[...Cn];return yn.forEach(Mn=>{En.has(Mn.wallet)||(En.add(Mn.wallet),Rn.push(Mn))}),Rn})}catch(xt){console.log("Error :>> ",xt)}finally{v(!1)}},at=(rt,nt)=>{let Ut;return function(...wn){clearTimeout(Ut),Ut=setTimeout(()=>{rt.apply(this,wn)},nt)}},He=()=>{const rt=f.current;rt.scrollTop+rt.clientHeight>=rt.scrollHeight-10&&C&&!y&&st()};h.useEffect(()=>{const rt=at(He,300),nt=f.current;return nt.addEventListener("scroll",rt),()=>{nt.removeEventListener("scroll",rt)}},[x,C,y]);const qe=h.useRef(null),vt=h.useRef(!1),yt=h.useRef(e),Kt=h.useRef(r),jt=h.useRef(s);h.useEffect(()=>{yt.current=e},[e]),h.useEffect(()=>{Kt.current=r},[r]),h.useEffect(()=>{jt.current=s},[s]);const un="hyper_get_trade_message";h.useEffect(()=>{if(!s||vt.current)return;const rt=K0("https://dextrabothypesocketv2.nftinit.io/");return qe.current=rt,vt.current=!0,rt.on("connect",()=>{console.log("Socket connected");const nt=()=>{var Jt;const Ut=(Jt=yt.current)==null?void 0:Jt.toLowerCase(),wn=jt.current;Ut&&wn?rt.emit("subscribe",{login:Ut,token:wn}):setTimeout(nt,300)};nt()}),rt.on(un,function(nt){var Pt;const Ut=Re.current,wn=(Pt=(Ut==null?void 0:Ut.dexMarket)||[])==null?void 0:Pt.map(Ke=>Ke.toLowerCase()),Jt=wn.includes("hyperliquid"),Vt=wn.includes("lighter"),We=(Array.isArray(nt)?nt:[nt]).filter(Ke=>Ke!=null&&Ke.target_platform?Jt&&!Vt?Ke.target_platform==="hyper":Vt&&!Jt?Ke.target_platform==="lighter":!0:!1);d(Ke=>{const ct=[...We,...Ke],Nt=Re.current;return ct==null?void 0:ct.filter(Rt=>{var hn,yn,Cn,En,Rn,Mn,Yn,Zn,Vn;if(!Rt||(K==null?void 0:K.length)>0&&!(K!=null&&K.includes((hn=Rt==null?void 0:Rt.listen_user)==null?void 0:hn.toLowerCase()))||(re==null?void 0:re.length)>0&&!(re!=null&&re.includes((yn=Rt==null?void 0:Rt.trader_wallet)==null?void 0:yn.toLowerCase()))||(ee==null?void 0:ee.length)>0&&!(ee!=null&&ee.includes(Rt==null?void 0:Rt.tag))||((Cn=Nt.coinFeed)==null?void 0:Cn.length)>0&&!((En=Nt.coinFeed)!=null&&En.includes(Rt==null?void 0:Rt.coin)))return!1;if(((Rn=Nt==null?void 0:Nt.typeFeed)==null?void 0:Rn.length)>0){const Sn=((Mn=Nt==null?void 0:Nt.typeFeed)==null?void 0:Mn.includes("Twaps"))&&(Rt==null?void 0:Rt.is_twap)===!0,ze=(Rt==null?void 0:Rt.fill_direction_type)&&((Yn=Nt==null?void 0:Nt.typeFeed)==null?void 0:Yn.includes(Rt==null?void 0:Rt.fill_direction_type));if(!(Sn||ze))return!1}if(((Zn=Nt==null?void 0:Nt.positionFeed)==null?void 0:Zn.length)>0){const tr=Hn(Rt);if(!((Vn=Nt==null?void 0:Nt.positionFeed)!=null&&Vn.includes(tr)))return!1}else return!0;return!(Nt!=null&&Nt.directionFeed&&vn(Rt)!==(Nt==null?void 0:Nt.directionFeed))})})}),rt.io.on("reconnect_attempt",nt=>{console.log("reconnect_attempt",nt)}),rt.io.on("reconnect",nt=>{console.log("reconnect",nt),rt.emit("room",un)}),rt.io.on("reconnect_failed",()=>{console.log("reconnect_failed")}),rt.io.on("reconnect_error",nt=>{console.log("reconnect_error",nt)}),rt.io.on("error",nt=>{console.log("error",nt)}),rt.on("disconnect",()=>{console.log("Socket disconnected"),vt.current=!1}),()=>{rt.disconnect(),console.log("Socket cleanup on unmount")}},[s]);const vn=rt=>rt!=null&&rt.dir?["Sell","Close Short","Open Short"].includes(rt==null?void 0:rt.dir)?"Short":["Buy","Close Long","Open Long"].includes(rt==null?void 0:rt.dir)?"Long":(rt==null?void 0:rt.dir)||"--":"--",Hn=rt=>{var wn,Jt;const nt=(Jt=(wn=rt.message)==null?void 0:wn.split("-")[0])==null?void 0:Jt.trim();if(!nt)return"Other";const Ut=/^Position Changed \(/;return nt==="Close Position"?"Position Closed":nt==="Position Increase"?"Increase":nt==="Position Decreased"?"Decrease":Ut.test(nt)?"Changed Position":nt==="Open Position"?"Open Position":"Other"};function ln({date:rt}){const[nt,Ut]=h.useState(vo(rt));return h.useEffect(()=>{const wn=setInterval(()=>{Ut(vo(rt))},1e3);return()=>clearInterval(wn)},[rt]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:nt.dateTime})}const Nn={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:()=>we(!be),children:be?"Hide Filters":"Show Filters"})}),i.jsx("div",{className:`${be?"block":"hidden"} lg:block mx-auto`,children:i.jsx(Ccn,{advancedFilters:je,setAdvancedFilters:Fe,getFeedData:Qe,getFeedClearData:dt,dataCoin:T,selectedCoins:$,setSelectedCoins:O,isLoadingCoin:L,setIsLoadingCoin:F,walletTagData:q,walletTags:fe,searchWalletSellect:K,setSearchWalletSellect:H,walletTagLoading:ie,tradeWalletData:U,selectTradeWalletData:re,setSelectTradeWalletData:Q,searchTagSellect:ee,setSearchTagSellect:se,isWalletLoading:l})}),i.jsx(Ecn,{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(ka,{}):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:Yl,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&&((dn=u==null?void 0:u.map)==null?void 0:dn.call(u,(rt,nt)=>{var Ut,wn,Jt,Vt,xt,We,Pt,Ke,ct,Nt,Ht,Rt,hn,yn,Cn,En;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:`${(Ut=rt==null?void 0:rt.dir)!=null&&Ut.includes("Long")?(rt==null?void 0:rt.dir)==="Short > Long"?"bg-[#67ffbd]/20":(rt==null?void 0:rt.dir)==="Long > Short"?"bg-[#ff797c]/20":"bg-[#67ffbd]/20":(rt==null?void 0:rt.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:(wn=rt==null?void 0:rt.dir)!=null&&wn.includes("Long")?(rt==null?void 0:rt.dir)==="Short > Long"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(rt==null?void 0:rt.dir)==="Long > Short"?i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(rt==null?void 0:rt.dir)=="Buy"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Us,{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:Hi,alt:"",className:"w-8 h-8"})}),(rt==null?void 0:rt.target_platform)==="hyper"?i.jsxs("div",{className:"flex justify-start items-center gap-2 min-w-max",children:[i.jsx("img",{src:O1,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"})]}):(rt==null?void 0:rt.target_platform)==="lighter"?i.jsxs("div",{className:"flex justify-start items-center gap-2 min-w-max",children:[i.jsx(yf,{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/${rt==null?void 0:rt.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:(rt==null?void 0:rt.listen_user)&&((Jt=rt==null?void 0:rt.listen_user)==null?void 0:Jt.slice(0,5))+"..."+((Vt=rt==null?void 0:rt.listen_user)==null?void 0:Vt.slice(-4))}),i.jsx("img",{onClick:Rn=>{Rn.stopPropagation(),navigator.clipboard.writeText(rt==null?void 0:rt.listen_user),fn.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:io,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:(rt==null?void 0:rt.oid)&&(rt==null?void 0:rt.oid)})]}),i.jsx("span",{onClick:Rn=>{Rn.stopPropagation(),navigator.clipboard.writeText(rt==null?void 0:rt.oid),fn.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:io,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:()=>{ve(ge=="time"?"date":"time")},className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight cursor-pointer",children:ge=="time"?i.jsx(ln,{date:rt==null?void 0:rt.time}):$c(rt==null?void 0:rt.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"," ",(rt==null?void 0:rt.dir)=="Sell"?"spot sell":(rt==null?void 0:rt.dir)=="Buy"?"spot buy":(xt=rt==null?void 0:rt.dir)==null?void 0:xt.toLowerCase()," ","position for"," "]}),i.jsxs("span",{className:"pl-1 text-white text-[13px] font-normal font-manrope leading-[21px] tracking-tight",children:[rt==null?void 0:rt.coin,"/",(rt==null?void 0:rt.feeToken)==null?"USDC":rt==null?void 0:rt.feeToken]})]}),i.jsx("div",{className:"w-5 h-5 bg-transparent rounded-[256px]",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Nn[rt==null?void 0:rt.coin]||((We=rt==null?void 0:rt.coin)==null?void 0:We.split("/")[0])}.svg`||Ha,alt:rt==null?void 0:rt.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:Rn=>Zi(Rn)})})]})]})]}),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/${Nn[rt==null?void 0:rt.coin]||((Pt=rt==null?void 0:rt.coin)==null?void 0:Pt.split("/")[0])}.svg`||Ha,alt:rt==null?void 0:rt.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:Rn=>Zi(Rn)})}),i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:[rt==null?void 0:rt.coin,"/",(rt==null?void 0:rt.feeToken)==null?"USDC":rt==null?void 0:rt.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:`${(Ke=rt==null?void 0:rt.dir)!=null&&Ke.includes("Long")?(rt==null?void 0:rt.dir)==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":(rt==null?void 0:rt.dir)==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":(rt==null?void 0:rt.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:(ct=rt==null?void 0:rt.dir)!=null&&ct.includes("Long")?(rt==null?void 0:rt.dir)==="Short > Long"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(rt==null?void 0:rt.dir)==="Long > Short"?i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(rt==null?void 0:rt.dir)=="Buy"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsxs("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:[(rt==null?void 0:rt.dir)=="Sell"?"Sell":(rt==null?void 0:rt.dir)=="Buy"?"Buy":(rt==null?void 0:rt.dir)=="Close Short"?"Short":(rt==null?void 0:rt.dir)=="Close Long"?"Long":(rt==null?void 0:rt.dir)=="Open Short"?"Short":(rt==null?void 0:rt.dir)=="Open Long"?"Long":rt!=null&&rt.dir?rt==null?void 0:rt.dir:"--",rt!=null&&rt.leverage?" - "+(rt==null?void 0:rt.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(Ov,{title:"Type",value:rt!=null&&rt.fill_direction_type?rt!=null&&rt.is_twap?`${rt==null?void 0:rt.fill_direction_type} - Twap`:rt==null?void 0:rt.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(Ov,{title:"Price",value:Ir(rt==null?void 0:rt.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(Ov,{title:"Size",value:Ir(rt==null?void 0:rt.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(Ov,{title:"Entry Price",value:rt!=null&&rt.markPrice?`$${Ir(rt==null?void 0:rt.markPrice)}`:Ir(rt==null?void 0:rt.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(Ov,{title:"PnL",value:rt!=null&&rt.closedPnl?`$${Ir(Math.abs(rt==null?void 0:rt.closedPnl))}`:Ir(Math.abs(rt==null?void 0:rt.closedPnl)),color:`${(rt==null?void 0:rt.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(Ov,{title:"Fee",value:rt!=null&&rt.fee?`$${Ir(Math.abs(rt==null?void 0:rt.fee))}`:Ir(Math.abs(rt==null?void 0:rt.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(Ov,{title:"Margin Mode",value:(rt==null?void 0:rt.is_cross)==null||rt!=null&&rt.is_cross?"Cross":"Isolated",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-transparent"})]})]})})}),i.jsx("div",{className:`${rt!=null&&rt.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:[rt!=null&&rt.success?i.jsx("img",{src:aL,alt:""}):i.jsx("img",{src:oL,alt:""}),i.jsx("div",{className:`${rt!=null&&rt.success?"text-[#67ffbd]":"text-[#ff787b]"} text-xs font-semibold font-manrope leading-3 tracking-tight`,children:rt!=null&&rt.success?"Status:":"System Message:"}),i.jsxs("div",{className:"text-white text-xs font-semibold font-manrope leading-3 tracking-tight -ml-1",children:[rt!=null&&rt.message&&((Nt=rt==null?void 0:rt.message)==null?void 0:Nt.length)>100?`${(Ht=rt==null?void 0:rt.message)==null?void 0:Ht.slice(0,100)}...`:rt==null?void 0:rt.message," ","on"]}),i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${rt==null?void 0:rt.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:rt!=null&&rt.wallet_name?rt==null?void 0:rt.wallet_name:rt!=null&&rt.trader_wallet?((Rt=rt==null?void 0:rt.trader_wallet)==null?void 0:Rt.slice(0,5))+"..."+((hn=rt==null?void 0:rt.trader_wallet)==null?void 0:hn.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/${rt==null?void 0:rt.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:rt!=null&&rt.tag?rt==null?void 0:rt.tag:rt!=null&&rt.listen_user?((yn=rt==null?void 0:rt.listen_user)==null?void 0:yn.slice(0,5))+"..."+((Cn=rt==null?void 0:rt.listen_user)==null?void 0:Cn.slice(-4)):"--"})}),(rt==null?void 0:rt.message)&&((En=rt==null?void 0:rt.message)==null?void 0:En.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"})})]})})]})]})},nt)}))})})]})},Ov=({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})})]}),Tcn=({isMenu:t,setIsMenu:e,handleMenuChange:n})=>{const{trackedWatchList:r,getTrackedWatchList:s,copyTradeWatchList:a,getCopyTradeWatchList:o}=h.useContext(Qr);return h.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(ENe,{title:"My Activities",isMenu:t,setIsMenu:e,handleMenuChange:n,lengthInfo:a?a.length:0}),i.jsx(ENe,{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(vcn,{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(pcn,{})}),i.jsx("div",{className:"block lg:hidden",children:i.jsx(xcn,{})})]}):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(kcn,{})}):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."})})]})})},ENe=({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})})]}),Pcn=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setMushboomerSOL:s,isReferralCode:a,setIsReferralCode:o,setIsWhitelist:l,setHyperToken:c,setHyperAddress:u,setSignModalOpen:d}=h.useContext(Qr),f=Pl(),[x,g]=h.useState(null);h.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 h.useEffect(()=>{(async()=>{var T,I;const C=window.localStorage.getItem("hyperToken"),S=window.localStorage.getItem("hyperAddress");if(!(!C||!S))try{const L=await bi(S.toLowerCase(),C);L!=null&&L.success?(t(L==null?void 0:L.telegram_chat_id),e(L==null?void 0:L.subscriber_role),n(L==null?void 0:L.subs_expire_day),r((T=L==null?void 0:L.mushboomer_counts)==null?void 0:T.eth),s((I=L==null?void 0:L.mushboomer_counts)==null?void 0:I.sol),o(L==null?void 0:L.referral_code),l(L==null?void 0:L.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(L){console.error("Token verification error:",L),console.error(L.message||"An unknown error occurred.")}})()},[]),x?i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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(Tcn,{isMenu:x,setIsMenu:g,handleMenuChange:y})})})]}):null},Icn=({open:t,setOpen:e,handleEnterCode:n,inputValue:r,isEnterLoading:s})=>i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Hi,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]})})]})})})})})]}),Fcn=({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:S,setIsEnterLoading:T,isEnterLoading:I,divRef:L,isEnterModal:F,setIsEnterModal:$})=>{const{mushboomerETH:O,mushboomerSOL:U,isReferralCode:Y,isWhitelist:re}=h.useContext(Qr),Q=v?`https://app.dextrabot.com/referral/${v}`:"";return i.jsxs(i.Fragment,{children:[!l&&i.jsx(Icn,{open:F,setOpen:$,handleEnterCode:t,inputValue:u,isEnterLoading:I}),i.jsxs("div",{ref:L,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||!(re||O>0||U>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(us,{className:"text-[#7C7C7C]"}),i.jsx("span",{className:`${g=="Enter Code"?"ml-44":"ml-32"}`,children:i.jsx(Ra,{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})}),I?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:Hlt,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"})})}):re||O>0||U>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})}),S?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:q=>{q.preventDefault(),v&&(navigator.clipboard.writeText(v||""),fn.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:iL,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:q=>{q.preventDefault(),(v||o)&&(navigator.clipboard.writeText(v?`https://app.dextrabot.com/referral/${v}`:o&&o),fn.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:iL,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?Q.slice(0,36)+"...":o?o.slice(0,30)+"...":i.jsx("span",{className:"text-white",children:"-"})})]})]})]})]})]})},OC=({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(Sz,{sortKey:e,state:n,className:""})]})})};function Ocn({open:t,setOpen:e}){return i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Tae,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 Mcn=({data:t,dataLoading:e,dataError:n,height:r,handleRefTable:s,dataUsage:a,dataUsageLoading:o,dataUsageError:l,setIsOnTableTab:c,isOnTableTab:u})=>{var fe,G,ie,oe;const{isConnected:d,address:f}=ds(),{setSignModalOpen:x,hyperToken:g}=h.useContext(Qr),[y,v]=h.useState(!1),[C,S]=h.useState(!1),[T,I]=h.useState(!1),L=h.useMemo(()=>{var H;const K=new Map;return(H=t==null?void 0:t.claim_lists)==null||H.forEach(ee=>{var pe;const se=((pe=ee==null?void 0:ee.subscriber_address)==null?void 0:pe.toLowerCase())||"";if(!K.has(se))K.set(se,{...ee,total_ref_claimable:parseFloat(ee==null?void 0:ee.total_ref_claimable)||0});else{const Se=K.get(se);K.set(se,{...Se,total_ref_claimable:(Se==null?void 0:Se.total_ref_claimable)+(parseFloat(ee==null?void 0:ee.total_ref_claimable)||0)})}}),Array.from(K.values())},[t]),F="-total_ref_claimable",[$,O]=h.useState(F),U=K=>L==null?void 0:L.sort((H,ee)=>{const se=H.subscriber_address?H.subscriber_address.toLowerCase():"",pe=ee.subscriber_address?ee.subscriber_address.toLowerCase():"";return K==="-level"?ee.level-H.level:K==="level"?H.level-ee.level:K==="-subscriber_address"?se<pe?-1:se>pe?1:0:K==="subscriber_address"?se>pe?-1:se<pe?1:0:K==="-total_ref_claimable"?ee.total_ref_claimable-H.total_ref_claimable:K==="total_ref_claimable"?H.total_ref_claimable-ee.total_ref_claimable:K==="-last_active_date"?new Date(ee.last_active_date)-new Date(H.last_active_date):K==="last_active_date"?new Date(H.last_active_date)-new Date(ee.last_active_date):0}),Y="-created_at",[re,Q]=h.useState(Y),q=K=>{var H;return(H=a.claim_lists)==null?void 0:H.sort((ee,se)=>{const pe=ee.address?ee.address.toLowerCase():"",Se=se.address?se.address.toLowerCase():"";return K==="-level"?se.level-ee.level:K==="level"?ee.level-se.level:K==="-address"?pe<Se?-1:pe>Se?1:0:K==="address"?pe>Se?-1:pe<Se?1:0:K==="-created_at"?new Date(se.created_at)-new Date(ee.created_at):K==="created_at"?new Date(ee.created_at)-new Date(se.created_at):0})},te=async()=>{try{v(!0);const K=window.localStorage.getItem("hyperToken"),H="https://dextrabothypev2.nftinit.io/api/subscriber/claim/request/";if(!K){x(!0),v(!1);return}const ee=window.localStorage.getItem("hyperAddress"),pe=await(await fetch(H,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:f?f.toLowerCase():ee,token:K})})).json();pe.success?(s(),I(!0)):(console.log(pe.error_message),S(pe.error_message),fn.error(pe.error_message))}catch(K){console.error("Error in like function:",K),S(K.message||"An unknown error occurred.")}finally{v(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(Ocn,{open:T,setOpen:I}),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?`$${Ir(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?`$${Ir(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?`$${Ir(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?`$${Ir(t==null?void 0:t.total_claimable_fee)}`:"--"})]}),i.jsx("div",{onClick:K=>{K.preventDefault(),g?y||((t==null?void 0:t.total_claimable_fee)<50?fn.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(OC,{title:"Referred Wallet",sortKey:"subscriber_address",sortOption:$,setSortOption:O,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#242424] h-10 px-1 min-w-[100px] sm:min-w-[120px]",children:i.jsx(OC,{title:"Level",sortKey:"level",sortOption:$,setSortOption:O,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(OC,{title:"Earnings",sortKey:"total_ref_claimable",sortOption:$,setSortOption:O,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(ka,{})})})}):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(El,{})})})}):(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:Yl,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."]})]})]})]})})})})}):(G=U($))==null?void 0:G.map((K,H)=>i.jsxs("tr",{className:`${H%2===0,"bg-[#242424]"} relative group hover:bg-[#353535] h-[32px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${H%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(sa,{info1:`${(K==null?void 0:K.subscriber_address).slice(0,5)+"..."+(K==null?void 0:K.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:K!=null&&K.level?`L${K==null?void 0:K.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:K!=null&&K.total_ref_claimable?`$${Ir(K==null?void 0:K.total_ref_claimable)}`:"--"})})})]},H))})]}):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(OC,{title:"Referred Wallet",sortKey:"address",sortOption:re,setSortOption:Q,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#242424] h-10 px-1 min-w-[100px] sm:min-w-[120px]",children:i.jsx(OC,{title:"Level",sortKey:"level",sortOption:re,setSortOption:Q,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(OC,{title:"Join Date",sortKey:"created_at",sortOption:re,setSortOption:Q,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(ka,{})})})}):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(El,{})})})}):(a==null?void 0:a.length)==0||((ie=a==null?void 0:a.claim_lists)==null?void 0:ie.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:Yl,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."]})]})]})]})})})})}):(oe=q(re))==null?void 0:oe.map((K,H)=>i.jsxs("tr",{className:`${H%2===0,"bg-[#242424]"} relative group hover:bg-[#353535] h-[32px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${H%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(sa,{info1:`${(K==null?void 0:K.address).slice(0,5)+"..."+(K==null?void 0:K.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:K!=null&&K.level?`L${K==null?void 0:K.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:K!=null&&K.created_at?jht(K==null?void 0:K.created_at):"--"})})})]},H))})]})})]})]})},Lcn=({open:t,setOpen:e})=>i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:H9e,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"})})})]})]})})})})})]}),Rcn=()=>{const{isConnected:t,address:e}=ds(),{setSignModalOpen:n,hyperToken:r,setTelegramChatId:s,setSubscriberRole:a,setSubsExpireDay:o,setMushboomerETH:l,setMushboomerSOL:c,setIsReferralCode:u,setIsReferralCodeName:d,setIsWhitelist:f,setHyperToken:x,setHyperAddress:g}=h.useContext(Qr),[y,v]=h.useState("Enter Code"),[C,S]=h.useState("Earnings"),T=v2(),I=(T==null?void 0:T.code)||"",[L,F]=h.useState(""),[$,O]=h.useState(""),[U,Y]=h.useState(null),[re,Q]=h.useState(""),[q,te]=h.useState(""),[fe,G]=h.useState(""),[ie,oe]=h.useState(""),[K,H]=h.useState(!1),[ee,se]=h.useState(!1),[pe,Se]=h.useState([]),[ge,ve]=h.useState(!1),[be,we]=h.useState(!1),[je,Fe]=h.useState(!1),[Re,Qe]=h.useState([]),[Ye,dt]=h.useState(!1),[st,at]=h.useState(!1),[He,qe]=h.useState(!1),vt=h.useRef(null),[yt,Kt]=h.useState(0);h.useEffect(()=>{I&&(F(I),Fe(!0))},[I]);const jt=Ut=>{let wn=Ut.target.value.toUpperCase();/^[0-9A-Z_-]{0,10}$/.test(wn)&&(F(wn),O(""))},un=Ut=>{let wn=Ut.target.value.toUpperCase();/^[0-9A-Z_-]{0,10}$/.test(wn)&&(Q(wn),te(""))},vn=async()=>{var Ut,wn;try{const Jt=window.localStorage.getItem("hyperToken"),Vt="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/info/";if(!Jt){n(!0);return}const xt=window.localStorage.getItem("hyperAddress"),Pt=await(await fetch(Vt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():xt,token:Jt})})).json();Pt.success?(Y((Ut=Pt==null?void 0:Pt.data)==null?void 0:Ut.referrer_code),oe((wn=Pt==null?void 0:Pt.data)==null?void 0:wn.my_refcode)):console.log(Pt.error_message)}catch(Jt){console.error("Error referans request:",Jt)}};h.useEffect(()=>{vn(),rt(),nt()},[r]);const Hn=async Ut=>{try{H(!0);const wn=window.localStorage.getItem("hyperToken"),Jt="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/set/";wn||(n(!0),H(!1));const Vt=window.localStorage.getItem("hyperAddress"),We=await(await fetch(Jt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Vt,token:wn,refcode:Ut})})).json();We.success?(Y(Ut),H(!1),Fe(!1),fn.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"}}),We!=null&&We.trial_farming&&qe(!0)):(console.log(We.error_message),O(We.error_message),je&&fn.success(i.jsx(i.Fragment,{children:i.jsx("span",{children:We.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"}}),H(!1))}catch(wn){console.error("Error in like function:",wn),O(wn.message),je&&fn.error(wn.message),H(!1)}},ln=async Ut=>{try{se(!0);const wn=window.localStorage.getItem("hyperToken"),Jt="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/generate/";wn||(n(!0),se(!1));const Vt=window.localStorage.getItem("hyperAddress"),We=await(await fetch(Jt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Vt,token:wn,refcode:Ut})})).json();We.success?(G(`https://app.dextrabot.com/referral/${We==null?void 0:We.refcode}`),oe(We==null?void 0:We.refcode),se(!1)):(console.log(We.error_message),se(!1),te(We.error_message))}catch(wn){console.error("Error in like function:",wn),te(wn.message),se(!1)}},Nn=()=>{L.length<4?(O("You must enter at least 4 characters!"),je&&fn.error("This refcode is wrong")):(O(""),Hn(L))},dn=()=>{re.length<4?te(ie?"You have a generated code, you cannot generate it again.":"You must enter at least 4 characters!"):(te(""),ln(re))};h.useEffect(()=>{(async()=>{var Vt,xt;const wn=window.localStorage.getItem("hyperToken"),Jt=window.localStorage.getItem("hyperAddress");if(!(!wn||!Jt))try{const We=await bi(Jt.toLowerCase(),wn);We!=null&&We.success?(s(We==null?void 0:We.telegram_chat_id),a(We==null?void 0:We.subscriber_role),o(We==null?void 0:We.subs_expire_day),l((Vt=We==null?void 0:We.mushboomer_counts)==null?void 0:Vt.eth),c((xt=We==null?void 0:We.mushboomer_counts)==null?void 0:xt.sol),u(We==null?void 0:We.referral_code),d(We==null?void 0:We.refcode),f(We==null?void 0:We.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),x(""),g(""))}catch(We){console.error("Token verification error:",We),console.error(We.message||"An unknown error occurred.")}})()},[U]);const rt=async()=>{try{ve(!0);const Ut=window.localStorage.getItem("hyperToken"),wn="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/claims/";if(!Ut){n(!0),ve(!1);return}const Jt=window.localStorage.getItem("hyperAddress"),xt=await(await fetch(wn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Jt,token:Ut})})).json();xt.success?(Se(xt==null?void 0:xt.data),ve(!1)):(console.log(xt.error_message),we(xt.error_message),ve(!1))}catch(Ut){console.error("Error in like function:",Ut),we(Ut.message),ve(!1)}},nt=async()=>{try{dt(!0);const Ut=window.localStorage.getItem("hyperToken"),wn="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/usage/";if(!Ut){n(!0),dt(!1);return}const Jt=window.localStorage.getItem("hyperAddress"),xt=await(await fetch(wn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Jt,token:Ut})})).json();xt.success?(Qe(xt==null?void 0:xt.data),dt(!1)):(console.log(xt.error_message),at(xt.error_message),dt(!1))}catch(Ut){console.error("Error in like function:",Ut),at(Ut.message),dt(!1)}};return h.useEffect(()=>{const Ut=()=>{vt.current&&Kt(vt.current.clientHeight)},wn=new ResizeObserver(Ut);return vt.current&&wn.observe(vt.current),()=>{wn.disconnect()}},[]),i.jsxs(i.Fragment,{children:[i.jsx(Lcn,{open:He,setOpen:qe}),i.jsx(za,{children:i.jsxs(Va,{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(Fcn,{handleEnterCode:Nn,handleChange:jt,error:$,handleGenerateCode:dn,handleGenerateChange:un,generateError:q,generateData:fe,userReferansCode:U,setInputValue:F,setGenerateValue:Q,inputValue:L,generateValue:re,setIsMenu:v,isMenu:y,setGenerateCode:oe,generateCode:ie,setIsGenerateLoading:se,isGenerateLoading:ee,setIsEnterLoading:H,isEnterLoading:K,divRef:vt,isEnterModal:je,setIsEnterModal:Fe}),i.jsx(Mcn,{data:pe,dataLoading:ge,dataError:be,height:yt,handleRefTable:rt,dataUsage:Re,dataUsageLoading:Ye,dataUsageError:st,setIsOnTableTab:S,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:jm,alt:"Dextrabot - Referral",className:"w-3 h-3 mb-2"})]}),i.jsx("img",{src:zlt,alt:"",className:"text-center text-xs w-[900px] h-max sm:h-[450px] mb-10 lg:mb-0"})]})]})})})]})};function Ide({open:t,setOpen:e,data:n,walletData:r,withdrawableUsdc:s,setWithdrawableUsdc:a,modalWalletId:o,setModalWalletId:l}){const{setSignModalOpen:c}=h.useContext(Qr),{isConnected:u,address:d}=ds(),[f,x]=h.useState(""),[g,y]=h.useState(!1),[v,C]=h.useState("");h.useEffect(()=>{const I=n.find(L=>L.wallet_address===r);I&&a(I==null?void 0:I.withdrawableUsdc)},[n]);const S=async()=>{var I,L,F,$,O,U;try{y(!0);const Y=window.localStorage.getItem("hyperToken"),re="https://dextrabothypev2.nftinit.io/api/wallet/request-withdraw";Y||(c(!0),y(!1)),C("");const Q=window.localStorage.getItem("hyperAddress"),te=await(await fetch(re,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d.toLowerCase():Q,token:Y,wallet_id:o??null,amount:f??0,destination:d?d.toLowerCase():Q})})).json();te.success?(((L=(I=te==null?void 0:te.result)==null?void 0:I.result)==null?void 0:L.status)=="err"?(y(!1),C(($=(F=te==null?void 0:te.result)==null?void 0:F.result)==null?void 0:$.response)):((U=(O=te==null?void 0:te.result)==null?void 0:O.result)==null?void 0:U.status)=="ok"&&(y(!1),x(""),fn.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(Y){console.error("Error widthdraw amount:",Y),y(!1),C(Y.message)}},T=I=>{x(I.target.value)};return i.jsx(i.Fragment,{children:i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Hi,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:I=>{I.stopPropagation(),navigator.clipboard.writeText(d),fn.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:io,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:I=>{let L=I.target.value;L.includes("-")?L=L.replace("-",""):(L===""||parseFloat(L)>=0)&&T({...I,target:{...I.target,value:L}})},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)?`$${Ir(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:I=>{I.preventDefault(),f!=null&&f!==""?g||S():fn.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 Fde({open:t,setOpen:e,walletAddress:n}){return i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsxs("div",{className:"flex flex-col items-center justify-start gap-2.5",children:[i.jsx("div",{className:"pt-4",children:i.jsx(Yie,{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),fn.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:io,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 Ode=({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(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Hi,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:Ec,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:Ec,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"})})]})]})})})})})]})})},Mde=({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:B3(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:["$",Ir(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:["$",Ir(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:["$",Ir(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:["$",Ir(t.withdrawableUsdc)??0]})]})]}):null,Dcn=({data:t,loading:e,error:n,socketLoading:r,currentPage:s,handlePageChange:a,allWallets:o,handleListRequest:l})=>{var He;h.useState(!1);const{setSignModalOpen:c}=h.useContext(Qr),{isConnected:u,address:d}=ds(),f=5,[x,g]=h.useState(null),[y,v]=h.useState(null),[C,S]=h.useState(!1),[T,I]=h.useState(null),[L,F]=h.useState(!1),[$,O]=h.useState("");h.useState({});const[U,Y]=h.useState({}),[re,Q]=h.useState(!1),[q,te]=h.useState({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),[fe,G]=h.useState(!1),[ie,oe]=h.useState(!1),K="-perpEquity",[H,ee]=h.useState(K),se=qe=>t.sort((vt,yt)=>{if(vt.version===3&&yt.version!==3)return-1;if(yt.version===3&&vt.version!==3)return 1;const Kt=vt.wallet_name?vt.wallet_name.toUpperCase():"",jt=yt.wallet_name?yt.wallet_name.toUpperCase():"",un=vt.wallet_address?vt.wallet_address.toLowerCase():"",vn=yt.wallet_address?yt.wallet_address.toLowerCase():"";return qe==="wallet_name"?Kt<jt?-1:Kt>jt?1:0:qe==="-wallet_name"?Kt>jt?-1:Kt<jt?1:0:qe==="-wallet_address"?un<vn?-1:un>vn?1:0:qe==="wallet_address"?un>vn?-1:un<vn?1:0:qe==="-wallet_created_data"?new Date(yt.wallet_created_data)-new Date(vt.wallet_created_data):qe==="wallet_created_data"?new Date(vt.wallet_created_data)-new Date(yt.wallet_created_data):qe==="-perpEquity"?yt.perpEquity-vt.perpEquity:qe==="perpEquity"?vt.perpEquity-yt.perpEquity:qe==="-unrealizedPnl"?yt.unrealizedPnl-vt.unrealizedPnl:qe==="unrealizedPnl"?vt.unrealizedPnl-yt.unrealizedPnl:qe==="-marginUsed"?yt.marginUsed-vt.marginUsed:qe==="marginUsed"?vt.marginUsed-yt.marginUsed:qe==="-withdrawableUsdc"?yt.withdrawableUsdc-vt.withdrawableUsdc:qe==="withdrawableUsdc"?vt.withdrawableUsdc-yt.withdrawableUsdc:0}),pe=async(qe,vt,yt)=>{if(!qe||!vt||!yt){console.error("Delete order called with invalid parameters"),fn.error("Delete order called with invalid parameters");return}const Kt=`${qe}_${vt}`;try{Y(Nn=>({...Nn,[Kt]:!0}));const jt=window.localStorage.getItem("hyperToken"),un="https://dextrabothypev2.nftinit.io/api/wallet/delete";if(!jt){c(!0),Y(Nn=>({...Nn,[Kt]:!1}));return}const vn=window.localStorage.getItem("hyperAddress"),Hn=await fetch(un,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d.toLowerCase():vn,token:jt,wallet_id:qe.toString()})});if(!Hn.ok)throw new El(`Server responded with status ${Hn.status}`);const ln=await Hn.json();ln.success?(l(),te({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),G(!1),oe(!1),Q(!1),Y(Nn=>({...Nn,[Kt]:!1})),fn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:yt.slice(0,5)+"..."+yt.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(ln.error_message),fn.error(ln.error_message),Y(Nn=>({...Nn,[Kt]:!1})))}catch(jt){console.error("Error deleting wallet:",jt),fn.error(jt.message),Y(un=>({...un,[Kt]:!1}))}},Se=h.useRef(null),ge=()=>{Se.current&&(Se.current.scrollLeft-=100)},ve=()=>{Se.current&&(Se.current.scrollLeft+=100)},be=()=>{Se.current&&(Se.current.scrollTop+=200)},we=()=>{Se.current&&(Se.current.scrollTop-=200)},je=qe=>qe>=640&&qe<1024?4:qe>=1024&&qe<1240?7:qe>=1240&&qe<1540||qe>=1540?8:3,[Fe,Re]=h.useState(null),[Qe,Ye]=h.useState(!1),[dt,st]=h.useState(!1);h.useEffect(()=>{const qe=()=>{st(window.innerWidth<640)};return window.addEventListener("resize",qe),qe(),()=>window.removeEventListener("resize",qe)},[]);const at=qe=>{dt&&(Re(qe),Ye(!0))};return i.jsxs(i.Fragment,{children:[i.jsx(Ide,{open:C,setOpen:S,data:t,walletData:x,withdrawableUsdc:T,setWithdrawableUsdc:I,modalWalletId:y,setModalWalletId:v}),i.jsx(Fde,{open:L,setOpen:F,walletAddress:$}),i.jsx(Ode,{open:re,setOpen:Q,handleDeleteWallet:pe,deleteWalleInfo:q,confirmClosePositions:fe,setConfirmClosePositions:G,confirmWithdrawEquity:ie,setConfirmWithdrawEquity:oe}),i.jsx(yp,{isOpen:Qe,onClose:()=>Ye(!1),children:i.jsx(Mde,{rowData:Fe})}),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:ge,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(ro,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:ve,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(ro,{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(ro,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),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(ro,{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:Se,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(hi,{title:"Name",sortKey:"wallet_name",sortOption:H,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(hi,{title:"Follower Wallet",sortKey:"wallet_address",sortOption:H,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(hi,{title:"Creation Date",sortKey:"wallet_created_data",sortOption:H,setSortOption:ee,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[120px] sm:min-w-[120px] px-1",children:i.jsx(hi,{title:"Perp Equity",sortKey:"perpEquity",sortOption:H,setSortOption:ee,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[134px] sm:min-w-[134px] px-1",children:i.jsx(hi,{title:"uPnL",sortKey:"unrealizedPnl",sortOption:H,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(hi,{title:"Margin",sortKey:"marginUsed",sortOption:H,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(hi,{title:"Avail. Balance",sortKey:"withdrawableUsdc",sortOption:H,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(ka,{})})})}):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(El,{})})})}):(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:Yl,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."]})]})]})]})})})})}):(He=se(H))==null?void 0:He.map((qe,vt)=>{const yt=!isNaN(qe==null?void 0:qe.perpEquity)&&!isNaN(qe==null?void 0:qe.marginUsed)?(qe==null?void 0:qe.perpEquity)-(qe==null?void 0:qe.marginUsed):0,Kt=dt?{onClick:()=>at(qe),className:"cursor-pointer"}:{};return i.jsxs("tr",{...Kt,className:`${vt%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[44px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${vt%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:(qe==null?void 0:qe.version)==3?i.jsx(as,{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:(qe==null?void 0:qe.wallet_name.length)>=12?(qe==null?void 0:qe.wallet_name).slice(0,12)+"... (API-AGENT) Wallet":(qe==null?void 0:qe.wallet_name)+"(API-AGENT) Wallet"}),(qe==null?void 0:qe.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ra,{content:`${qe==null?void 0:qe.wallet_name}`,positionTop:!0,alignRight:!1})}),i.jsx(us,{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:(qe==null?void 0:qe.wallet_name.length)>=12?(qe==null?void 0:qe.wallet_name).slice(0,12)+"...":qe==null?void 0:qe.wallet_name}),(qe==null?void 0:qe.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ra,{content:`${qe==null?void 0:qe.wallet_name}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:`${vt%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/${qe==null?void 0:qe.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:Hi,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(sa,{info1:`${(qe==null?void 0:qe.wallet_address).slice(0,5)+"..."+(qe==null?void 0:qe.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:jt=>{jt.stopPropagation(),navigator.clipboard.writeText(qe==null?void 0:qe.wallet_address),fn.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:io,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:(qe==null?void 0:qe.wallet_created_data)&&B3(qe==null?void 0:qe.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...":(qe==null?void 0:qe.perpEquity)!=0&&!isNaN(qe==null?void 0:qe.perpEquity)?`$${Ir(qe==null?void 0:qe.perpEquity)}`:"$0"})})}),i.jsx("td",{children:i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${(qe==null?void 0:qe.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..."}):(qe==null?void 0:qe.unrealizedPnl)!=0&&!isNaN(qe==null?void 0:qe.unrealizedPnl)?`$${Ir(Math.abs(qe==null?void 0:qe.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..."}):(qe==null?void 0:qe.marginUsed)!=0&&!isNaN(qe==null?void 0:qe.marginUsed)?`$${Ir(qe==null?void 0:qe.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&&yt<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(yt)?"$0":`$${Ir(Math.abs(yt))}`})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsxs("div",{className:"flex items-center justify-end gap-2 pr-3",children:[(qe==null?void 0:qe.version)===3?i.jsx(as,{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(Iy,{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),O(qe==null?void 0:qe.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(Iy,{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"})]}),(qe==null?void 0:qe.version)===3?i.jsx(as,{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(Iy,{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:()=>{I(qe==null?void 0:qe.withdrawableUsdc),S(!0),g(qe==null?void 0:qe.wallet_address),v(qe==null?void 0:qe.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(Iy,{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"})]}),U[`${qe==null?void 0:qe.wallet_id}_${qe==null?void 0:qe.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..."})]}):(qe==null?void 0:qe.version)===3?i.jsx(as,{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:qe==null?void 0:qe.wallet_address,walletId:qe==null?void 0:qe.wallet_id,walletName:qe==null?void 0:qe.wallet_name.toLowerCase(),unrealizedPnL:qe==null?void 0:qe.unrealizedPnl,perpEquity:qe==null?void 0:qe.perpEquity}),Q(!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"})})]})})]},vt)})})]})})]}),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 eWe({open:t,setOpen:e,data:n,setShare:r,setTradeInfo:s}){const a=h.useRef(null),o=async()=>{if(a.current)try{await document.fonts.ready,await new Promise(y=>setTimeout(y,500));const x=await q1(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),fn.success("PNG successfully downloaded!")}catch(x){console.error("Error generating PNG:",x),fn.error("Failed to download PNG.")}},[l,c]=h.useState(),[u,d]=h.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 S=new FileReader;S.onloadend=()=>v(S.result),S.onerror=C,S.readAsDataURL(y)})}catch(g){throw console.error("Image conversion failed:",g),g}finally{d(!1)}};return h.useEffect(()=>{n!=null&&n.coin&&f(`https://app.hyperliquid.xyz/coins/${n==null?void 0:n.coin}.svg`).then(x=>c(x)).catch(()=>c(Ha))},[n==null?void 0:n.coin]),i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),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:Yj,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||Ha,alt:"",className:"rounded-full w-8 h-8",loading:"lazy",onError:x=>Zi(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?"+":"-",mo(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?`$${mo(Math.abs(n==null?void 0:n.pnl))}`:mo(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?`$${Ey(n==null?void 0:n.entryPrice)}`:Ey(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?`$${Ey(n==null?void 0:n.markPrice)}`:Ey(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:Gj,alt:"",className:"h-full"}):i.jsx("img",{src:Kj,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"),fn.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 Bcn=({data:t})=>{const{isConnected:e,address:n}=ds(),{setSignModalOpen:r,hyperToken:s,isReferralCodeName:a}=h.useContext(Qr),[o,l]=h.useState("");h.useState({});const[c,u]=h.useState(!1),[d,f]=h.useState(""),[x,g]=h.useState(!1),y=h.useRef(null),v=h.useRef(null),[C,S]=h.useState(!1),[T,I]=h.useState(!1),[L,F]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",pnl:0}),$="-unrealizedPnl",[O,U]=h.useState($),[Y,re]=h.useState([]),[Q,q]=h.useState(!1);h.useEffect(()=>{if(t.length===0||Q)return;const pe=t.reduce((Se,ge)=>parseFloat(ge.perpEquity||0)>parseFloat(Se.perpEquity||0)?ge:Se);pe.wallet_address&&l(pe.wallet_address)},[t,Q]);const te=(pe,Se,ge)=>{const ve=pe==null?void 0:pe.filter(be=>be&&be.walletAddress&&be.asset).filter(be=>{var we,je;return ge?(je=(we=be==null?void 0:be.asset)==null?void 0:we.toString())==null?void 0:je.toUpperCase().includes(ge.toUpperCase()):!0});return ve==null?void 0:ve.sort((be,we)=>{const je=be.wallet_name?be.wallet_name.toUpperCase():"",Fe=we.wallet_name?we.wallet_name.toUpperCase():"",Re=be.tag?be.tag.toUpperCase():"",Qe=we.tag?we.tag.toUpperCase():"",Ye=be.asset?be.asset.toUpperCase():"",dt=we.asset?we.asset.toUpperCase():"",st=be.type==="Long"?1:0,at=we.type==="Long"?1:0,He=be.type==="Short"?1:0,qe=we.type==="Short"?1:0;return Se==="wallet_name"?je<Fe?-1:je>Fe?1:0:Se==="-wallet_name"?je>Fe?-1:je<Fe?1:0:Se==="-unrealizedPnl"?we.unrealizedPnl-be.unrealizedPnl:Se==="unrealizedPnl"?be.unrealizedPnl-we.unrealizedPnl:Se==="-roe"?we.roe-be.roe:Se==="roe"?be.roe-we.roe:Se==="-size"?we.size-be.size:Se==="size"?be.size-we.size:Se==="-entryPrice"?we.entryPrice-be.entryPrice:Se==="entryPrice"?be.entryPrice-we.entryPrice:Se==="-currentPrice"?we.currentPrice-be.currentPrice:Se==="currentPrice"?be.currentPrice-we.currentPrice:Se==="-leverage"?we.leverage-be.leverage:Se==="leverage"?be.leverage-we.leverage:Se==="-positionValue"?we.positionValue-be.positionValue:Se==="positionValue"?be.positionValue-we.positionValue:Se==="-marginUsed"?we.marginUsed-be.marginUsed:Se==="marginUsed"?be.marginUsed-we.marginUsed:Se==="funding"?we.funding-be.funding:Se==="-funding"?be.funding-we.funding:Se==="-liquidationPrice"?we.liquidationPrice-be.liquidationPrice:Se==="liquidationPrice"?be.liquidationPrice-we.liquidationPrice:Se==="-tag"?Re<Qe?-1:Re>Qe?1:0:Se==="tag"?Re>Qe?-1:Re<Qe?1:0:Se==="-coin"?Ye<dt?-1:Ye>dt?1:0:Se==="coin"?Ye>dt?-1:Ye<dt?1:0:Se==="-type_leverage"?st!==at?at-st:we.leverage-be.leverage:Se==="type_leverage"?He!==qe?qe-He:we.leverage-be.leverage:0})},fe=async pe=>{if(pe===""&&Y.filter(Se=>Se!==void 0).length===0||pe===""&&te(Y,O,d).length===0||te(Y,O,d).length===0){fn.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(pe===""&&(t==null?void 0:t.length)>0){const Se=te(Y,O,d),ge=[...new Set(Se.map(ve=>ve.wallet_id))];if(ge.length===0){fn.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(ge.map(be=>G(be,!1))),fn.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(ve){console.error("Error closing all orders:",ve)}finally{u(!1)}return}await G(pe)},G=async(pe,Se=!0)=>{if(Y.filter(ge=>ge!==void 0).length===0){fn.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(!pe){console.error("Close order called with invalid parameters"),fn.error("Close order called with invalid parameters");return}try{u(!0);const ge=window.localStorage.getItem("hyperToken"),ve="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_all_new/";if(!ge){r(!0),u(!1);return}const be=window.localStorage.getItem("hyperAddress"),we=await fetch(ve,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():be,token:ge,wallet_id:pe.toString()})});if(!we.ok)throw new Error(`Server responded with status ${we.status}`);const je=await we.json();je.status=="ok"?(u(!1),Se&&fn.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),Se&&fn.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."),fn.error("Close order operation failed."),u(!1))}catch(ge){throw console.error("Something went wrong!"),fn.error("Something went wrong!"),u(!1),ge}},[ie,oe]=h.useState(!1);h.useEffect(()=>{const pe=()=>{(localStorage.getItem("walletManagementInfo")!==void 0||localStorage.getItem("walletManagementInfo")!==null)&&Date.now()-Number(localStorage.getItem("walletManagementInfo"))>=864e5&&oe(!0)};pe();const Se=setInterval(()=>{pe()},1e3*60*30);return()=>{clearInterval(Se)}},[]);const K=async pe=>{try{const Se=window.localStorage.getItem("hyperToken"),ge="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!Se){r(!0);return}const ve=pe==null?void 0:pe.filter(Fe=>Fe&&Fe.walletAddress&&Fe.asset).map(Fe=>({wallet:Fe.walletAddress,coin:Fe.asset})),be=window.localStorage.getItem("hyperAddress"),je=await(await fetch(ge,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():be,token:Se,positions:ve})})).json();je.success?re(Fe=>Fe.map(Re=>{const Qe=je==null?void 0:je.data.find(Ye=>(Ye==null?void 0:Ye.wallet)===(Re==null?void 0:Re.walletAddress)&&(Ye==null?void 0:Ye.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),fn.error(je.error_message))}catch(Se){console.error("Error tag request",Se),fn.error(Se.message)}},H=h.useRef(Y==null?void 0:Y.filter(pe=>(pe==null?void 0:pe.walletAddress)&&(pe==null?void 0:pe.asset)).length),ee=h.useRef(),se=h.useRef(!0);return h.useEffect(()=>{const pe=Y==null?void 0:Y.filter(ge=>ge!==void 0&&(ge==null?void 0:ge.walletAddress)&&(ge==null?void 0:ge.asset)),Se=pe==null?void 0:pe.length;if(Se>0&&Se>H.current){const ge=o===""?Y:Y.filter(ve=>(ve==null?void 0:ve.wallet_id)==o);se.current?(K(ge),se.current=!1):(ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{K(ge)},5e3))}H.current=Se},[Y]),h.useEffect(()=>{if((Y==null?void 0:Y.filter(pe=>pe!==void 0&&(pe==null?void 0:pe.walletAddress)&&(pe==null?void 0:pe.asset)).length)>0){const pe=o==""?Y:Y==null?void 0:Y.filter(Se=>(Se==null?void 0:Se.wallet_id)==o);(pe==null?void 0:pe.length)>0&&K(pe)}},[o]),h.useEffect(()=>{function pe(Se){y.current&&!y.current.contains(Se.target)&&setIsDropdownOpen(!1),v.current&&!v.current.contains(Se.target)&&g(!1)}return document.addEventListener("mousedown",pe),()=>document.removeEventListener("mousedown",pe)},[]),i.jsx(i.Fragment,{children:i.jsxs(i.Fragment,{children:[i.jsx(eWe,{open:C,setOpen:S,data:L,setShare:I,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:pe=>{pe.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:Pae,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:pe=>{l(pe.target.value),q(!0)},value:o,children:[i.jsx("option",{value:"",children:"All"}),t==null?void 0:t.map(pe=>i.jsx("option",{value:pe==null?void 0:pe.wallet_address,children:`${pe==null?void 0:pe.wallet_name} - (${(pe==null?void 0:pe.wallet_address.slice(0,5))+"..."+(pe==null?void 0:pe.wallet_address.slice(-4))})`},pe==null?void 0:pe.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]"})]})]}),ie&&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:pe=>{pe.stopPropagation(),localStorage.setItem("walletManagementInfo",`${Date.now()}`),oe(!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:Na})})}),i.jsx("img",{src:qlt,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(QVe,{initialAddress:o,wallets:o===""?t:void 0})})]})]})]})})},$cn=({initialAddress:t="",wallets:e,positions:n,setPositions:r,isWalletIndex:s,posLoading:a,setPosLoading:o,setGenerateWalletData:l})=>{var rt;const{getTrackedWatchList:c,hyperToken:u,copyTradeWatchList:d,getCopyTradeWatchList:f,setTelegramChatId:x,setSubscriberRole:g,setSubsExpireDay:y,setMushboomerETH:v,setMushboomerSOL:C,setIsReferralCode:S,isReferralCodeName:T,setIsReferralCodeName:I,setIsWhitelist:L,setHyperToken:F,setHyperAddress:$,setSignModalOpen:O,latestPnL:U}=h.useContext(Qr),{address:Y}=ds(),[re,Q]=h.useState(!1);h.useState({}),h.useState(!1),h.useEffect(()=>{if(!(s!=null&&s.index))return;const nt=new WebSocket("wss://mainnet.zklighter.elliot.ai/stream");let Ut;nt.onopen=()=>{console.log("Lighter WebSocket connected"),nt.send(JSON.stringify({type:"subscribe",channel:`account_all/${s.index}`})),Ut=setInterval(()=>{nt.readyState===WebSocket.OPEN&&nt.send(JSON.stringify({type:"subscribe",channel:`account_all/${s.index}`}))},5e3)},nt.onmessage=Jt=>{const Vt=JSON.parse(Jt==null?void 0:Jt.data);if(Vt!=null&&Vt.positions&&Object.keys(Vt.positions).length>0){const xt=Object.values(Vt.positions).filter(ct=>Number(ct.position)!==0).map(ct=>({funding:0,leverage:ct.initial_margin_fraction?Math.round(100/Number(ct.initial_margin_fraction)):0,positionValue:Number(ct.position_value??0),unrealizedPnl:Number(ct.unrealized_pnl??0),currentPrice:ct.avg_entry_price&&ct.unrealized_pnl&&ct.position&&ct.sign?Number(ct.avg_entry_price)+Number(ct.unrealized_pnl)/(Number(ct.position)*Number(ct.sign)):Number(ct.position_value)/Math.abs(Number(ct.position)),entryPrice:Number(ct.avg_entry_price??0),size:Number(ct.position??0),type:Number(ct.sign)>0?"Long":"Short",asset:ct.symbol??"",sign:Number(ct.sign??1)})),We=xt.reduce((ct,Nt)=>ct+Nt.unrealizedPnl,0),Pt=xt.reduce((ct,Nt)=>{const Ht=Nt.leverage>0?Nt.leverage:1,Rt=Nt.positionValue/Ht;return ct+(isFinite(Rt)?Rt:0)},0),Ke=Number(Vt.available_balance??0);l(ct=>ct==null?void 0:ct.map(Nt=>{var Ht;return((Ht=Nt.wallet_address)==null?void 0:Ht.toLowerCase())===(t==null?void 0:t.toLowerCase())?{...Nt,unrealizedPnl:We.toFixed(6),withdrawableUsdc:Ke.toFixed(6),marginUsed:Pt.toFixed(6),positions:xt}:Nt})),r(xt),(ge==null?void 0:ge.length)>0&&o(!1)}else r([]),a&&o(!1)},nt.onclose=Jt=>{console.log("🔌 ZkLighter WebSocket disconnected",Jt.code,Jt.reason),clearInterval(Ut)},nt.onerror=Jt=>{console.error("❌ ZkLighter WS error:",Jt),clearInterval(Ut)};const wn=()=>{nt.readyState===WebSocket.OPEN&&nt.send(JSON.stringify({type:"unsubscribe",channel:`account_all/${s.index}`})),clearInterval(Ut),nt.close()};return window.addEventListener("beforeunload",wn),()=>{wn(),window.removeEventListener("beforeunload",wn)}},[s]);const q=h.useRef(null),te=()=>{q.current&&(q.current.scrollLeft-=200)},fe=()=>{q.current&&(q.current.scrollLeft+=200)},G=()=>{q.current&&(q.current.scrollTop+=200)},ie=()=>{q.current&&(q.current.scrollTop-=200)};h.useEffect(()=>{(async()=>{var Jt,Vt;const Ut=window.localStorage.getItem("hyperToken"),wn=window.localStorage.getItem("hyperAddress");if(!(!Ut||!wn))try{const xt=await bi(wn.toLowerCase(),Ut);xt!=null&&xt.success?(x(xt==null?void 0:xt.telegram_chat_id),g(xt==null?void 0:xt.subscriber_role),y(xt==null?void 0:xt.subs_expire_day),v((Jt=xt==null?void 0:xt.mushboomer_counts)==null?void 0:Jt.eth),C((Vt=xt==null?void 0:xt.mushboomer_counts)==null?void 0:Vt.sol),S(xt==null?void 0:xt.referral_code),I(xt==null?void 0:xt.refcode),L(xt==null?void 0:xt.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),F(""),$(""))}catch(xt){console.error("Token verification error:",xt),console.error(xt.message||"An unknown error occurred.")}})()},[]);const[oe,K]=h.useState(""),[H,ee]=h.useState(!1),se=h.useRef(null);h.useEffect(()=>{function nt(Ut){se.current&&!se.current.contains(Ut.target)&&ee(!1)}return document.addEventListener("mousedown",nt),()=>document.removeEventListener("mousedown",nt)},[]);const[pe,Se]=h.useState([]),ge=n==null?void 0:n.filter(nt=>{var Ut;return oe?(Ut=nt.asset)==null?void 0:Ut.toLowerCase().includes(oe.toLowerCase()):!0}).map(nt=>{const Ut=pe.find(wn=>wn.coin===nt.asset&&(wn.wallet||"").toLowerCase()===(nt.wallet||"").toLowerCase());return{...nt,tagName:(Ut==null?void 0:Ut.tag)||null,tagWallet:(Ut==null?void 0:Ut.cp_wallet)||null}}),ve="-unrealizedPnl",[be,we]=h.useState(ve),je=nt=>{const xt=ge==null?void 0:ge.map(We=>{const Pt=We!=null&&We.positionValue&&(We!=null&&We.leverage)?We.unrealizedPnl*We.leverage*100/We.positionValue:0,Ke=.004+6e-4*We.leverage;let ct=0;(We==null?void 0:We.type)==="Long"?ct=We.entryPrice*(We.leverage/(We.leverage+1-We.leverage*Ke)):ct=We.entryPrice*(We.leverage/(We.leverage-1+We.leverage*Ke));const Nt=ct*5.05,Ht=We.leverage?We.positionValue/We.leverage:0,Rt=We.positionValue*1e-4*(We.sign??-1);return{...We,roe:Pt,liquidationPrice:Nt,marginUsed:Ht,funding:Rt}});return xt==null?void 0:xt.sort((We,Pt)=>{const Ke=We.tagName?We.tagName.toUpperCase():"",ct=Pt.tagName?Pt.tagName.toUpperCase():"",Nt=We.asset?We.asset.toUpperCase():"",Ht=Pt.asset?Pt.asset.toUpperCase():"",Rt=We.type==="Long"?1:0,hn=Pt.type==="Long"?1:0,yn=We.type==="Short"?1:0,Cn=Pt.type==="Short"?1:0;return nt==="-unrealizedPnl"?Pt.unrealizedPnl-We.unrealizedPnl:nt==="unrealizedPnl"?We.unrealizedPnl-Pt.unrealizedPnl:nt==="-roe"?Pt.roe-We.roe:nt==="roe"?We.roe-Pt.roe:nt==="-size"?Pt.size-We.size:nt==="size"?We.size-Pt.size:nt==="-entryPrice"?Pt.entryPrice-We.entryPrice:nt==="entryPrice"?We.entryPrice-Pt.entryPrice:nt==="-currentPrice"?Pt.currentPrice-We.currentPrice:nt==="currentPrice"?We.currentPrice-Pt.currentPrice:nt==="-leverage"?Pt.leverage-We.leverage:nt==="leverage"?We.leverage-Pt.leverage:nt==="-positionValue"?Pt.positionValue-We.positionValue:nt==="positionValue"?We.positionValue-Pt.positionValue:nt==="-marginUsed"?Pt.marginUsed-We.marginUsed:nt==="marginUsed"?We.marginUsed-Pt.marginUsed:nt==="-funding"?Pt.funding-We.funding:nt==="funding"?We.funding-Pt.funding:nt==="-liquidationPrice"?Pt.liquidationPrice-We.liquidationPrice:nt==="liquidationPrice"?We.liquidationPrice-Pt.liquidationPrice:nt==="-entryTime"?new Date(Pt.latestFill)-new Date(We.latestFill):nt==="entryTime"?new Date(We.latestFill)-new Date(Pt.latestFill):nt==="-source_tag"?Ke<ct?-1:Ke>ct?1:0:nt==="source_tag"?Ke>ct?-1:Ke<ct?1:0:nt==="-type_leverage"?Rt!==hn?hn-Rt:Pt.leverage-We.leverage:nt==="type_leverage"?yn!==Cn?Cn-yn:Pt.leverage-We.leverage:nt==="-asset"?Nt<Ht?-1:Nt>Ht?1:0:nt==="asset"?Nt>Ht?-1:Nt<Ht?1:0:0})};n.length,n.filter(nt=>nt.unrealizedPnl>=0).length;const[Fe,Re]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),Ye=localStorage.getItem("isDateOpenPositionsLighterFormat")||"date",[dt,st]=h.useState(Ye);h.useEffect(()=>{localStorage.setItem("isDateOpenPositionsLighterFormat",dt)},[dt]);const[at,He]=h.useState([]),qe=async()=>{try{const nt=window.localStorage.getItem("hyperToken");if(!nt){O(!0);return}const Ut="https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",wn=window.localStorage.getItem("hyperAddress"),Vt=await(await fetch(Ut,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Y?Y.toLowerCase():wn,token:nt,balance:"false"})})).json();Vt!=null&&Vt.success?(He(Vt.data||[]),Hn(Vt.data)):console.log(Vt.error_message)}catch(nt){console.error("Error fetching generate wallet list:",nt)}};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&qe()},[u]);const[vt,yt]=h.useState([]),[Kt,jt]=h.useState(!0),[un,vn]=h.useState(!1);h.useEffect(()=>{ge&&ge.length>0&&(ln(),at.length>0&&Kt&&Hn())},[ge]);const Hn=()=>{vt.length!==0&&(Nn(vt),Kt&&jt(!1))};h.useEffect(()=>{const nt=window.localStorage.getItem("hyperToken");vt.length&&nt&&Nn(vt)},[vt]);const ln=()=>{const nt=window.localStorage.getItem("hyperToken");let Ut=!1;const wn=[...vt];ge.forEach(Jt=>{var Pt;const Vt=Jt.asset,xt=(Pt=Jt.wallet||t)==null?void 0:Pt.toLowerCase();wn.some(Ke=>Ke.coin===Vt&&(Ke.wallet||"").toLowerCase()===xt)||(wn.push({coin:Vt,wallet:xt}),Ut=!0)}),Ut&&(yt(wn),at.some(Vt=>Vt.wallet_address===(t==null?void 0:t.toLowerCase()))&&nt&&Nn(wn))},Nn=async nt=>{if(!un)try{vn(!0);const Ut=window.localStorage.getItem("hyperToken"),wn="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!Ut||!nt){vn(!1);return}Ut||O(!0);const Jt=window.localStorage.getItem("hyperAddress"),xt=await(await fetch(wn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Y?Y.toLowerCase():Jt,token:Ut,positions:nt})})).json();xt.success?Se(xt==null?void 0:xt.data):(console.log(xt.error_message),fn.error(xt.error_message))}catch(Ut){console.error("Error tag request",Ut),fn.error(Ut.message)}finally{vn(!1)}};(e==null?void 0:e.length)>1||at.some(nt=>nt.wallet_address===(t==null?void 0:t.toLowerCase()));const dn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("div",{className:"w-full",children:[i.jsx(cP,{open:re,setOpen:Q,data:Fe,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(Vl,{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(Vl,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:ie,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(Vl,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:G,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(Vl,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:q,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(hi,{title:"Coin",sortKey:"asset",sortOption:be,setSortOption:we,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>ee(!H),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(xd,{className:`w-4 h-4 ${oe?"text-blue-500":"text-white"}`})}),H&&i.jsxs("div",{ref:se,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:()=>K(""),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:nt=>K(nt.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(Ucn,{className:"min-w-[100px] sm:min-w-[120px] px-1",title:"Type",sortKey:"type_leverage",sortOption:be,setSortOption:we}),i.jsx(Mv,{className:"min-w-[80px] sm:min-w-[80px] px-1",title:"Size",sortKey:"size",sortOption:be,setSortOption:we}),i.jsx(Mv,{className:"min-w-[130px] sm:min-w-[145px] px-1",title:"Position Value",sortKey:"positionValue",sortOption:be,setSortOption:we}),i.jsx(Mv,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Entry Price",sortKey:"entryPrice",sortOption:be,setSortOption:we}),i.jsx(Mv,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Mark Price",sortKey:"currentPrice",sortOption:be,setSortOption:we}),i.jsx(Mv,{className:"min-w-[100px] sm:min-w-[160px] px-1",title:"PnL(ROE%)",sortKey:"unrealizedPnl",sortOption:be,setSortOption:we}),i.jsx(Mv,{className:"min-w-[120px] sm:min-w-[130px] px-1",title:"Margin",sortKey:"marginUsed",sortOption:be,setSortOption:we}),i.jsx(Mv,{className:"min-w-[110px] sm:min-w-[130px] px-1",title:"Funding",sortKey:"funding",sortOption:be,setSortOption:we})]})}),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(ka,{})})})})}):(ge==null?void 0:ge.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:Yl,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."]})]})]})]})})})})}):(rt=je(be))==null?void 0:rt.map((nt,Ut)=>{var Pt;const wn=nt!=null&&nt.positionValue&&(nt!=null&&nt.leverage)?(nt==null?void 0:nt.unrealizedPnl)*(nt==null?void 0:nt.leverage)*100/(nt==null?void 0:nt.positionValue):0,Jt=.004+6e-4*nt.leverage;nt.entryPrice*(nt.leverage/(nt.sign===1?nt.leverage+1-nt.leverage*Jt:nt.leverage-1+nt.leverage*Jt));const Vt=nt!=null&&nt.leverage?(nt==null?void 0:nt.positionValue)/(nt==null?void 0:nt.leverage):0,We=(nt==null?void 0:nt.positionValue)*1e-4*(nt==null?void 0:nt.sign);return i.jsxs(ke.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/${nt==null?void 0:nt.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/${dn[nt.asset]||((Pt=nt.asset)==null?void 0:Pt.split("/")[0])}.svg`||Ha,alt:nt==null?void 0:nt.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:Ke=>Zi(Ke)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:nt.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:`${nt.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:nt.type==="Long"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsxs("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase",children:[nt.type," - ",nt==null?void 0:nt.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:mo(Math.abs(nt.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:nt.positionValue?`$${mo(nt.positionValue)}`:mo(nt.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:nt.entryPrice?`$${Ir(nt.entryPrice)}`:Ir(nt.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:nt.currentPrice?`$${Ir(nt.currentPrice)}`:Ir(nt.currentPrice)})})}),i.jsx("td",{children:i.jsxs("div",{onClick:()=>{Re(Ke=>({...Ke,coin:nt.asset,type:nt.type,leverage:nt.leverage,roe:wn,entryPrice:nt.entryPrice,markPrice:nt.currentPrice,pnl:nt.unrealizedPnl,referral:window.localStorage.getItem("hyperToken")?T:null})),Q(!0)},className:"pl-1 pr-2 flex justify-end gap-2 font-manrope cursor-pointer min-w-max",children:[i.jsxs("div",{className:`${nt.unrealizedPnl>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:[nt.unrealizedPnl?`$${mo(Math.abs(nt.unrealizedPnl))}`:mo(Math.abs(nt.unrealizedPnl)),` (${mo(Math.abs(wn.toFixed(2)))}%)`]}),i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:jm,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:Vt?`$${mo(Vt)}`:mo(Vt)})})}),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(We))&&Number(We)<=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:isNaN(Number(We))?"$0.00":`$${Math.abs(Number(We)).toFixed(4)}`})})})]}),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},Ut)})})]})})]})]})},Mv=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(hi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!0})}),Ucn=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(hi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!1})}),zcn=({initialAddress:t="",wallets:e,isWalletIndex:n,posLoading:r,setPosLoading:s,setGenerateWalletData:a})=>{const[o,l]=h.useState("positions"),[c,u]=h.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($cn,{initialAddress:t,wallets:e,positions:c,setPositions:u,isWalletIndex:n,posLoading:r,setPosLoading:s,setGenerateWalletData:a}):""]})},Hcn=({data:t,isWalletIndex:e,fetchAllIndex:n,setGenerateWalletData:r})=>{const{isConnected:s,address:a}=ds(),{setSignModalOpen:o,hyperToken:l,isReferralCodeName:c}=h.useContext(Qr),[u,d]=h.useState(""),[f,x]=h.useState(!0);h.useState({});const[g,y]=h.useState(!1),[v,C]=h.useState(""),[S,T]=h.useState(!1),I=h.useRef(null),L=h.useRef(null),[F,$]=h.useState(!1),[O,U]=h.useState(!1),[Y,re]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",pnl:0}),Q="-unrealizedPnl",[q,te]=h.useState(Q),[fe,G]=h.useState([]),[ie,oe]=h.useState(!1);h.useEffect(()=>{if(t.length===0||ie)return;const we=t.reduce((je,Fe)=>parseFloat(Fe.perpEquity||0)>parseFloat(je.perpEquity||0)?Fe:je);we.wallet_address&&d(we.wallet_address)},[t,ie]);const K=(we,je,Fe)=>{const Re=we==null?void 0:we.filter(Qe=>Qe&&Qe.walletAddress&&Qe.asset).filter(Qe=>{var Ye,dt;return Fe?(dt=(Ye=Qe==null?void 0:Qe.asset)==null?void 0:Ye.toString())==null?void 0:dt.toUpperCase().includes(Fe.toUpperCase()):!0});return Re==null?void 0:Re.sort((Qe,Ye)=>{const dt=Qe.wallet_name?Qe.wallet_name.toUpperCase():"",st=Ye.wallet_name?Ye.wallet_name.toUpperCase():"",at=Qe.tag?Qe.tag.toUpperCase():"",He=Ye.tag?Ye.tag.toUpperCase():"",qe=Qe.asset?Qe.asset.toUpperCase():"",vt=Ye.asset?Ye.asset.toUpperCase():"",yt=Qe.type==="Long"?1:0,Kt=Ye.type==="Long"?1:0,jt=Qe.type==="Short"?1:0,un=Ye.type==="Short"?1:0;return je==="wallet_name"?dt<st?-1:dt>st?1:0:je==="-wallet_name"?dt>st?-1:dt<st?1:0:je==="-unrealizedPnl"?Ye.unrealizedPnl-Qe.unrealizedPnl:je==="unrealizedPnl"?Qe.unrealizedPnl-Ye.unrealizedPnl:je==="-roe"?Ye.roe-Qe.roe:je==="roe"?Qe.roe-Ye.roe:je==="-size"?Ye.size-Qe.size:je==="size"?Qe.size-Ye.size:je==="-entryPrice"?Ye.entryPrice-Qe.entryPrice:je==="entryPrice"?Qe.entryPrice-Ye.entryPrice:je==="-currentPrice"?Ye.currentPrice-Qe.currentPrice:je==="currentPrice"?Qe.currentPrice-Ye.currentPrice:je==="-leverage"?Ye.leverage-Qe.leverage:je==="leverage"?Qe.leverage-Ye.leverage:je==="-positionValue"?Ye.positionValue-Qe.positionValue:je==="positionValue"?Qe.positionValue-Ye.positionValue:je==="-marginUsed"?Ye.marginUsed-Qe.marginUsed:je==="marginUsed"?Qe.marginUsed-Ye.marginUsed:je==="funding"?Ye.funding-Qe.funding:je==="-funding"?Qe.funding-Ye.funding:je==="-liquidationPrice"?Ye.liquidationPrice-Qe.liquidationPrice:je==="liquidationPrice"?Qe.liquidationPrice-Ye.liquidationPrice:je==="-tag"?at<He?-1:at>He?1:0:je==="tag"?at>He?-1:at<He?1:0:je==="-coin"?qe<vt?-1:qe>vt?1:0:je==="coin"?qe>vt?-1:qe<vt?1:0:je==="-type_leverage"?yt!==Kt?Kt-yt:Ye.leverage-Qe.leverage:je==="type_leverage"?jt!==un?un-jt:Ye.leverage-Qe.leverage:0})},H=async we=>{if(we===""&&fe.filter(je=>je!==void 0).length===0||we===""&&K(fe,q,v).length===0||K(fe,q,v).length===0){fn.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(we===""&&(t==null?void 0:t.length)>0){const je=K(fe,q,v),Fe=[...new Set(je.map(Re=>Re.wallet_id))];if(Fe.length===0){fn.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(Fe.map(Qe=>ee(Qe,!1))),fn.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(we)},ee=async(we,je=!0)=>{if(fe.filter(Fe=>Fe!==void 0).length===0){fn.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(!we){console.error("Close order called with invalid parameters"),fn.error("Close order called with invalid parameters");return}try{y(!0);const Fe=window.localStorage.getItem("hyperToken"),Re="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_all_new/";if(!Fe){o(!0),y(!1);return}const Qe=window.localStorage.getItem("hyperAddress"),Ye=await fetch(Re,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a?a.toLowerCase():Qe,token:Fe,wallet_id:we.toString()})});if(!Ye.ok)throw new Error(`Server responded with status ${Ye.status}`);const dt=await Ye.json();dt.status=="ok"?(y(!1),je&&fn.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&&fn.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."),fn.error("Close order operation failed."),y(!1))}catch(Fe){throw console.error("Something went wrong!"),fn.error("Something went wrong!"),y(!1),Fe}},[se,pe]=h.useState(!1);h.useEffect(()=>{const we=()=>{(localStorage.getItem("walletManagementInfo")!==void 0||localStorage.getItem("walletManagementInfo")!==null)&&Date.now()-Number(localStorage.getItem("walletManagementInfo"))>=864e5&&pe(!0)};we();const je=setInterval(()=>{we()},1e3*60*30);return()=>{clearInterval(je)}},[]);const Se=async we=>{try{const je=window.localStorage.getItem("hyperToken"),Fe="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!je){o(!0);return}const Re=we==null?void 0:we.filter(st=>st&&st.walletAddress&&st.asset).map(st=>({wallet:st.walletAddress,coin:st.asset})),Qe=window.localStorage.getItem("hyperAddress"),dt=await(await fetch(Fe,{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?G(st=>st.map(at=>{const He=dt==null?void 0:dt.data.find(qe=>(qe==null?void 0:qe.wallet)===(at==null?void 0:at.walletAddress)&&(qe==null?void 0:qe.coin)===(at==null?void 0:at.asset));return{...at,tag:He==null?void 0:He.tag,tagWallet:He==null?void 0:He.cp_wallet}})):(console.log(dt.error_message),fn.error(dt.error_message))}catch(je){console.error("Error tag request",je),fn.error(je.message)}},ge=h.useRef(fe==null?void 0:fe.filter(we=>(we==null?void 0:we.walletAddress)&&(we==null?void 0:we.asset)).length),ve=h.useRef(),be=h.useRef(!0);return h.useEffect(()=>{const we=fe==null?void 0:fe.filter(Fe=>Fe!==void 0&&(Fe==null?void 0:Fe.walletAddress)&&(Fe==null?void 0:Fe.asset)),je=we==null?void 0:we.length;if(je>0&&je>ge.current){const Fe=u===""?fe:fe.filter(Re=>(Re==null?void 0:Re.wallet_id)==u);be.current?(Se(Fe),be.current=!1):(ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Se(Fe)},5e3))}ge.current=je},[fe]),h.useEffect(()=>{if((fe==null?void 0:fe.filter(we=>we!==void 0&&(we==null?void 0:we.walletAddress)&&(we==null?void 0:we.asset)).length)>0){const we=u==""?fe:fe==null?void 0:fe.filter(je=>(je==null?void 0:je.wallet_id)==u);(we==null?void 0:we.length)>0&&Se(we)}},[u]),h.useEffect(()=>{function we(je){I.current&&!I.current.contains(je.target)&&setIsDropdownOpen(!1),L.current&&!L.current.contains(je.target)&&T(!1)}return document.addEventListener("mousedown",we),()=>document.removeEventListener("mousedown",we)},[]),i.jsx(i.Fragment,{children:i.jsxs(i.Fragment,{children:[i.jsx(eWe,{open:F,setOpen:$,data:Y,setShare:U,setTradeInfo:re}),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:we=>{we.preventDefault(),g||H(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:Pae,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:we=>{d(we.target.value),oe(!0),n(we.target.value),x(!0),r(je=>je==null?void 0:je.map(Fe=>({...Fe,unrealizedPnl:0,marginUsed:0})))},value:u,children:t==null?void 0:t.map(we=>i.jsx("option",{value:we==null?void 0:we.wallet_address,children:`${we==null?void 0:we.wallet_name} - (${(we==null?void 0:we.wallet_address).slice(0,5)+"..."+(we==null?void 0:we.wallet_address).slice(-4)})`},we==null?void 0:we.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(zcn,{initialAddress:u,wallets:u===""?t:void 0,isWalletIndex:e,posLoading:f,setPosLoading:x,setGenerateWalletData:r})})]})]})]})})},Vcn=({data:t,loading:e,error:n,currentPage:r,handlePageChange:s,allWallets:a,handleListRequest:o})=>{var at;h.useState(!1);const{setSignModalOpen:l}=h.useContext(Qr),{isConnected:c,address:u}=ds(),d=5,[f,x]=h.useState(null),[g,y]=h.useState(null),[v,C]=h.useState(!1),[S,T]=h.useState(null),[I,L]=h.useState(!1),[F,$]=h.useState("");h.useState({});const[O,U]=h.useState({}),[Y,re]=h.useState(!1),[Q,q]=h.useState({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),[te,fe]=h.useState(!1),[G,ie]=h.useState(!1),oe="-perpEquity",[K,H]=h.useState(oe),ee=He=>t.sort((qe,vt)=>{if(qe.version===3&&vt.version!==3)return-1;if(vt.version===3&&qe.version!==3)return 1;const yt=qe.wallet_name?qe.wallet_name.toUpperCase():"",Kt=vt.wallet_name?vt.wallet_name.toUpperCase():"",jt=qe.wallet_address?qe.wallet_address.toLowerCase():"",un=vt.wallet_address?vt.wallet_address.toLowerCase():"";return He==="wallet_name"?yt<Kt?-1:yt>Kt?1:0:He==="-wallet_name"?yt>Kt?-1:yt<Kt?1:0:He==="-wallet_address"?jt<un?-1:jt>un?1:0:He==="wallet_address"?jt>un?-1:jt<un?1:0:He==="-wallet_created_data"?new Date(vt.wallet_created_data)-new Date(qe.wallet_created_data):He==="wallet_created_data"?new Date(qe.wallet_created_data)-new Date(vt.wallet_created_data):He==="-perpEquity"?vt.perpEquity-qe.perpEquity:He==="perpEquity"?qe.perpEquity-vt.perpEquity:He==="-unrealizedPnl"?vt.unrealizedPnl-qe.unrealizedPnl:He==="unrealizedPnl"?qe.unrealizedPnl-vt.unrealizedPnl:He==="-marginUsed"?vt.marginUsed-qe.marginUsed:He==="marginUsed"?qe.marginUsed-vt.marginUsed:He==="-withdrawableUsdc"?vt.withdrawableUsdc-qe.withdrawableUsdc:He==="withdrawableUsdc"?qe.withdrawableUsdc-vt.withdrawableUsdc:0}),se=async(He,qe,vt)=>{if(!He||!qe||!vt){console.error("Delete order called with invalid parameters"),fn.error("Delete order called with invalid parameters");return}const yt=`${He}_${qe}`;try{U(ln=>({...ln,[yt]:!0}));const Kt=window.localStorage.getItem("hyperToken"),jt="https://dextrabothypev2.nftinit.io/api/wallet/delete-lighter";if(!Kt){l(!0),U(ln=>({...ln,[yt]:!1}));return}const un=window.localStorage.getItem("hyperAddress"),vn=await fetch(jt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:u?u.toLowerCase():un,token:Kt,wallet_id:He})});if(!vn.ok)throw new El(`Server responded with status ${vn.status}`);const Hn=await vn.json();Hn.success?(o(),q({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),fe(!1),ie(!1),re(!1),U(ln=>({...ln,[yt]:!1})),fn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:vt.slice(0,5)+"..."+vt.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(Hn.error_message),fn.error(Hn.error_message),U(ln=>({...ln,[yt]:!1})))}catch(Kt){console.error("Error deleting wallet:",Kt),fn.error(Kt.message),U(jt=>({...jt,[yt]:!1}))}},pe=h.useRef(null),Se=()=>{pe.current&&(pe.current.scrollLeft-=100)},ge=()=>{pe.current&&(pe.current.scrollLeft+=100)},ve=()=>{pe.current&&(pe.current.scrollTop+=200)},be=()=>{pe.current&&(pe.current.scrollTop-=200)},we=He=>He>=640&&He<1024?4:He>=1024&&He<1240?7:He>=1240&&He<1540||He>=1540?8:3,[je,Fe]=h.useState(null),[Re,Qe]=h.useState(!1),[Ye,dt]=h.useState(!1);h.useEffect(()=>{const He=()=>{dt(window.innerWidth<640)};return window.addEventListener("resize",He),He(),()=>window.removeEventListener("resize",He)},[]);const st=He=>{Ye&&(Fe(He),Qe(!0))};return i.jsxs(i.Fragment,{children:[i.jsx(Ide,{open:v,setOpen:C,data:t,walletData:f,withdrawableUsdc:S,setWithdrawableUsdc:T,modalWalletId:g,setModalWalletId:y}),i.jsx(Fde,{open:I,setOpen:L,walletAddress:F}),i.jsx(Ode,{open:Y,setOpen:re,handleDeleteWallet:se,deleteWalleInfo:Q,confirmClosePositions:te,setConfirmClosePositions:fe,confirmWithdrawEquity:G,setConfirmWithdrawEquity:ie}),i.jsx(yp,{isOpen:Re,onClose:()=>Qe(!1),children:i.jsx(Mde,{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: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(ro,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:ge,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(ro,{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(ro,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:ve,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(ro,{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:pe,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(hi,{title:"Name",sortKey:"wallet_name",sortOption:K,setSortOption:H,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(hi,{title:"Follower Wallet",sortKey:"wallet_address",sortOption:K,setSortOption:H,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[110px] sm:min-w-[110px] px-1 hidden sm:table-cell",children:i.jsx(hi,{title:"Creation Date",sortKey:"wallet_created_data",sortOption:K,setSortOption:H,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:we(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(ka,{})})})}):n&&!t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:we(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(El,{})})})}):(t==null?void 0:t.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:we(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:Yl,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."]})]})]})]})})})})}):(at=ee(K))==null?void 0:at.map((He,qe)=>{!isNaN(He==null?void 0:He.perpEquity)&&!isNaN(He==null?void 0:He.marginUsed)&&(He==null?void 0:He.perpEquity)-(He==null?void 0:He.marginUsed);const vt=Ye?{onClick:()=>st(He),className:"cursor-pointer"}:{};return i.jsxs("tr",{...vt,className:`${qe%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[44px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${qe%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:(He==null?void 0:He.version)==3?i.jsx(as,{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:(He==null?void 0:He.wallet_name.length)>=12?(He==null?void 0:He.wallet_name).slice(0,12)+"... (API-AGENT) Wallet":(He==null?void 0:He.wallet_name)+"(API-AGENT) Wallet"}),(He==null?void 0:He.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ra,{content:`${He==null?void 0:He.wallet_name}`,positionTop:!0,alignRight:!1})}),i.jsx(us,{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:(He==null?void 0:He.wallet_name.length)>=12?(He==null?void 0:He.wallet_name).slice(0,12)+"...":He==null?void 0:He.wallet_name}),(He==null?void 0:He.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ra,{content:`${He==null?void 0:He.wallet_name}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:`${qe%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/${He==null?void 0:He.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:Hi,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(sa,{info1:`${(He==null?void 0:He.wallet_address).slice(0,5)+"..."+(He==null?void 0:He.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:yt=>{yt.stopPropagation(),navigator.clipboard.writeText(He==null?void 0:He.wallet_address),fn.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:io,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:(He==null?void 0:He.wallet_created_data)&&B3(He==null?void 0:He.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(as,{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(Iy,{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(as,{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(Iy,{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"})]})}),O[`${He==null?void 0:He.wallet_id}_${He==null?void 0:He.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..."})]}):(He==null?void 0:He.version)===3?i.jsx(as,{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:()=>{q({wallet:He==null?void 0:He.wallet_address,walletId:He==null?void 0:He.wallet_id,walletName:He==null?void 0:He.wallet_name.toLowerCase(),unrealizedPnL:He==null?void 0:He.unrealizedPnl,perpEquity:He==null?void 0:He.perpEquity}),re(!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"})})]})})]},qe)})})]})})]}),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"})})]})]})]})},Wcn=({lighterWalletList:t})=>{const{isConnected:e,address:n}=ds(),{setSignModalOpen:r,hyperToken:s}=h.useContext(Qr),[a,o]=h.useState([]),[l,c]=h.useState(!1),[u,d]=h.useState(null),[f,x]=h.useState(!0),[g,y]=h.useState(null),[v,C]=h.useState([]),[S,T]=h.useState(()=>parseInt(localStorage.getItem("walletManagementLighterPage"))||1),I=5,[L,F]=h.useState(!1),[$,O]=h.useState(!1);h.useEffect(()=>{window.localStorage.getItem("hyperToken")?U():(r(!0),o([]),window.localStorage.setItem("walletManagementLighterPage",1))},[e,s]);const U=async()=>{var q;try{c(!0);const te=window.localStorage.getItem("hyperToken");if(!te){r(!0);return}const fe="https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",G=window.localStorage.getItem("hyperAddress"),oe=await(await fetch(fe,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():G,token:te})})).json();if(oe.success){t(),C(oe.data||[]),F(!0);const K=parseInt(localStorage.getItem("walletManagementLighterPage"))||1,H=Math.max(Math.ceil(((oe==null?void 0:oe.data)||[]).length/I),1),ee=Math.min(K,H);T(ee),localStorage.setItem("walletManagementLighterPage",ee),re(ee,oe.data||[]);const se=(ee-1)*I,pe=(q=oe.data)==null?void 0:q[se];pe&&Y(pe==null?void 0:pe.wallet_address)}else console.log(oe.error_message),c(!1),d(oe.error_message)}catch(te){console.error("Error fetching lighter wallet list:",te),c(!1),d(te.message)}},Y=async q=>{try{const fe=`https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${Pc(q)}`,ie=await(await fetch(fe,{method:"GET",headers:{accept:"application/json"}})).json();if(ie.sub_accounts&&ie.sub_accounts.length>0){const oe=ie.sub_accounts[0],K=(oe==null?void 0:oe.collateral)??oe.collateral??"",H=(oe==null?void 0:oe.margin_used)??"",ee=(oe==null?void 0:oe.available_balance)??"",se=(oe==null?void 0:oe.unrealized_pnl)??"",pe=(oe==null?void 0:oe.positions)??[];o(Se=>Se==null?void 0:Se.map(ge=>ge.wallet_address.toLowerCase()===q.toLowerCase()?{...ge,perpEquity:K,unrealizedPnl:se,withdrawableUsdc:ee,marginUsed:H,positions:pe}:ge)),y(oe),O(!0),c(!1),x(!1)}}catch(te){console.error("Error fetching lighter index:",te)}};h.useEffect(()=>{const q=()=>{const te=parseInt(localStorage.getItem("walletManagementLighterPage"))||1;te!==S&&L&&$&&(T(te),re(te,v))};return window.addEventListener("storage",q),()=>{window.removeEventListener("storage",q)}},[S,v,L,$]);const re=(q,te)=>{if(!te||te.length===0){c(!1);return}c(!0);const fe=(q-1)*I,G=fe+I,ie=te.slice(fe,G);o(ie)},Q=q=>{q<1||q>Math.ceil(v.length/I)||(c(!0),T(q),localStorage.setItem("walletManagementLighterPage",q),re(q,v))};return i.jsxs(i.Fragment,{children:[i.jsx(Vcn,{data:a,loading:l,error:u,handlePageChange:Q,handleListRequest:U,currentPage:S,allWallets:v}),i.jsx(Hcn,{data:a,setGenerateWalletData:o,isWalletIndex:g,fetchAllIndex:Y})]})},qcn=({data:t,loading:e,error:n,currentPage:r,handlePageChange:s,allWallets:a,handleListRequest:o})=>{var at;h.useState(!1);const{setSignModalOpen:l}=h.useContext(Qr),{isConnected:c,address:u}=ds(),d=5,[f,x]=h.useState(null),[g,y]=h.useState(null),[v,C]=h.useState(!1),[S,T]=h.useState(null),[I,L]=h.useState(!1),[F,$]=h.useState("");h.useState({});const[O,U]=h.useState({}),[Y,re]=h.useState(!1),[Q,q]=h.useState({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),[te,fe]=h.useState(!1),[G,ie]=h.useState(!1),oe="-perpEquity",[K,H]=h.useState(oe),ee=He=>t.sort((qe,vt)=>{if(qe.version===3&&vt.version!==3)return-1;if(vt.version===3&&qe.version!==3)return 1;const yt=qe.wallet_name?qe.wallet_name.toUpperCase():"",Kt=vt.wallet_name?vt.wallet_name.toUpperCase():"",jt=qe.wallet_address?qe.wallet_address.toLowerCase():"",un=vt.wallet_address?vt.wallet_address.toLowerCase():"";return He==="wallet_name"?yt<Kt?-1:yt>Kt?1:0:He==="-wallet_name"?yt>Kt?-1:yt<Kt?1:0:He==="-wallet_address"?jt<un?-1:jt>un?1:0:He==="wallet_address"?jt>un?-1:jt<un?1:0:He==="-wallet_created_data"?new Date(vt.wallet_created_data)-new Date(qe.wallet_created_data):He==="wallet_created_data"?new Date(qe.wallet_created_data)-new Date(vt.wallet_created_data):He==="-perpEquity"?vt.perpEquity-qe.perpEquity:He==="perpEquity"?qe.perpEquity-vt.perpEquity:He==="-unrealizedPnl"?vt.unrealizedPnl-qe.unrealizedPnl:He==="unrealizedPnl"?qe.unrealizedPnl-vt.unrealizedPnl:He==="-marginUsed"?vt.marginUsed-qe.marginUsed:He==="marginUsed"?qe.marginUsed-vt.marginUsed:He==="-withdrawableUsdc"?vt.withdrawableUsdc-qe.withdrawableUsdc:He==="withdrawableUsdc"?qe.withdrawableUsdc-vt.withdrawableUsdc:0}),se=async(He,qe,vt)=>{if(!He||!qe||!vt){console.error("Delete order called with invalid parameters"),fn.error("Delete order called with invalid parameters");return}const yt=`${He}_${qe}`;try{U(ln=>({...ln,[yt]:!0}));const Kt=window.localStorage.getItem("hyperToken"),jt="https://dextrabothypev2.nftinit.io/api/wallet/delete-extended";if(!Kt){l(!0),U(ln=>({...ln,[yt]:!1}));return}const un=window.localStorage.getItem("hyperAddress"),vn=await fetch(jt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:u?u.toLowerCase():un,token:Kt,wallet_id:He})});if(!vn.ok)throw new El(`Server responded with status ${vn.status}`);const Hn=await vn.json();Hn.success?(o(),q({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),fe(!1),ie(!1),re(!1),U(ln=>({...ln,[yt]:!1})),fn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:vt.slice(0,5)+"..."+vt.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(Hn.error_message),fn.error(Hn.error_message),U(ln=>({...ln,[yt]:!1})))}catch(Kt){console.error("Error deleting wallet:",Kt),fn.error(Kt.message),U(jt=>({...jt,[yt]:!1}))}},pe=h.useRef(null),Se=()=>{pe.current&&(pe.current.scrollLeft-=100)},ge=()=>{pe.current&&(pe.current.scrollLeft+=100)},ve=()=>{pe.current&&(pe.current.scrollTop+=200)},be=()=>{pe.current&&(pe.current.scrollTop-=200)},we=He=>He>=640&&He<1024?4:He>=1024&&He<1240?7:He>=1240&&He<1540||He>=1540?8:3,[je,Fe]=h.useState(null),[Re,Qe]=h.useState(!1),[Ye,dt]=h.useState(!1);h.useEffect(()=>{const He=()=>{dt(window.innerWidth<640)};return window.addEventListener("resize",He),He(),()=>window.removeEventListener("resize",He)},[]);const st=He=>{Ye&&(Fe(He),Qe(!0))};return i.jsxs(i.Fragment,{children:[i.jsx(Ide,{open:v,setOpen:C,data:t,walletData:f,withdrawableUsdc:S,setWithdrawableUsdc:T,modalWalletId:g,setModalWalletId:y}),i.jsx(Fde,{open:I,setOpen:L,walletAddress:F}),i.jsx(Ode,{open:Y,setOpen:re,handleDeleteWallet:se,deleteWalleInfo:Q,confirmClosePositions:te,setConfirmClosePositions:fe,confirmWithdrawEquity:G,setConfirmWithdrawEquity:ie}),i.jsx(yp,{isOpen:Re,onClose:()=>Qe(!1),children:i.jsx(Mde,{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: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(ro,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:ge,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(ro,{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(ro,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:ve,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(ro,{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:pe,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(hi,{title:"Name",sortKey:"wallet_name",sortOption:K,setSortOption:H,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(hi,{title:"Follower Wallet",sortKey:"wallet_address",sortOption:K,setSortOption:H,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[110px] sm:min-w-[110px] px-1 hidden sm:table-cell",children:i.jsx(hi,{title:"Creation Date",sortKey:"wallet_created_data",sortOption:K,setSortOption:H,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:we(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(ka,{})})})}):n&&!t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:we(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(El,{})})})}):(t==null?void 0:t.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:we(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:Yl,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."]})]})]})]})})})})}):(at=ee(K))==null?void 0:at.map((He,qe)=>{!isNaN(He==null?void 0:He.perpEquity)&&!isNaN(He==null?void 0:He.marginUsed)&&(He==null?void 0:He.perpEquity)-(He==null?void 0:He.marginUsed);const vt=Ye?{onClick:()=>st(He),className:"cursor-pointer"}:{};return i.jsxs("tr",{...vt,className:`${qe%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[44px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${qe%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:(He==null?void 0:He.version)==3?i.jsx(as,{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:(He==null?void 0:He.wallet_name.length)>=12?(He==null?void 0:He.wallet_name).slice(0,12)+"... (API-AGENT) Wallet":(He==null?void 0:He.wallet_name)+"(API-AGENT) Wallet"}),(He==null?void 0:He.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ra,{content:`${He==null?void 0:He.wallet_name}`,positionTop:!0,alignRight:!1})}),i.jsx(us,{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:(He==null?void 0:He.wallet_name.length)>=12?(He==null?void 0:He.wallet_name).slice(0,12)+"...":He==null?void 0:He.wallet_name}),(He==null?void 0:He.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ra,{content:`${He==null?void 0:He.wallet_name}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:`${qe%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/${He==null?void 0:He.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:Hi,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(sa,{info1:`${(He==null?void 0:He.wallet_address).slice(0,5)+"..."+(He==null?void 0:He.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:yt=>{yt.stopPropagation(),navigator.clipboard.writeText(He==null?void 0:He.wallet_address),fn.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:io,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:(He==null?void 0:He.wallet_created_data)&&B3(He==null?void 0:He.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(as,{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(Iy,{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(as,{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(Iy,{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"})]})}),O[`${He==null?void 0:He.wallet_id}_${He==null?void 0:He.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..."})]}):(He==null?void 0:He.version)===3?i.jsx(as,{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:()=>{q({wallet:He==null?void 0:He.wallet_address,walletId:He==null?void 0:He.wallet_id,walletName:He==null?void 0:He.wallet_name.toLowerCase(),unrealizedPnL:He==null?void 0:He.unrealizedPnl,perpEquity:He==null?void 0:He.perpEquity}),re(!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"})})]})})]},qe)})})]})})]}),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"})})]})]})]})},kNe=({fetchAllWalletList:t})=>{const{isConnected:e,address:n}=ds(),{setSignModalOpen:r,hyperToken:s}=h.useContext(Qr),[a,o]=h.useState([]),[l,c]=h.useState(!1),[u,d]=h.useState(null);h.useState(null);const[f,x]=h.useState([]),[g,y]=h.useState(()=>parseInt(localStorage.getItem("walletManagementExtendedPage"))||1),v=5,[C,S]=h.useState(!1),[T,I]=h.useState(!1);h.useEffect(()=>{window.localStorage.getItem("hyperToken")?L():(r(!0),o([]),window.localStorage.setItem("walletManagementExtendedPage",1))},[e,s]);const L=async()=>{var O,U;try{c(!0);const Y=window.localStorage.getItem("hyperToken");if(!Y){r(!0);return}const re="https://dextrabothypev2.nftinit.io/api/wallet/list-extended",Q=window.localStorage.getItem("hyperAddress"),te=await(await fetch(re,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():Q,token:Y})})).json();if(te.success&&((O=te==null?void 0:te.data)==null?void 0:O.length)>0){t(),x(te.data||[]),S(!0);const fe=parseInt(localStorage.getItem("walletManagementExtendedPage"))||1,G=Math.max(Math.ceil(((te==null?void 0:te.data)||[]).length/v),1),ie=Math.min(fe,G);y(ie),localStorage.setItem("walletManagementExtendedPage",ie),F(ie,te.data||[]);const oe=(ie-1)*v,K=(U=te.data)==null?void 0:U[oe];c(!1)}else console.log(te.error_message),c(!1),d(te.error_message),o([])}catch(Y){console.error("Error fetching lighter wallet list:",Y),c(!1),d(Y.message)}};h.useEffect(()=>{const O=()=>{const U=parseInt(localStorage.getItem("walletManagementExtendedPage"))||1;U!==g&&C&&T&&(y(U),F(U,f))};return window.addEventListener("storage",O),()=>{window.removeEventListener("storage",O)}},[g,f,C,T]);const F=(O,U)=>{if(!U||U.length===0){c(!1);return}c(!0);const Y=(O-1)*v,re=Y+v,Q=U.slice(Y,re);o(Q)},$=O=>{O<1||O>Math.ceil(f.length/v)||(c(!0),y(O),localStorage.setItem("walletManagementExtendedPage",O),F(O,f))};return i.jsx(i.Fragment,{children:i.jsx(qcn,{data:a,loading:l,error:u,handlePageChange:$,handleListRequest:L,currentPage:g,allWallets:f})})},Gcn=({handleListRequest:t,handlePageChange:e,isGenWalletModal:n,setIsGenWalletModal:r})=>{const{setSignModalOpen:s}=h.useContext(Qr);return i.jsxs(i.Fragment,{children:[i.jsx(M5,{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"})]})})]})},Kcn=({value:t,onChange:e,allWallets:n,lighterWallet:r,extendedWallet:s,pacificaWallet:a})=>{const[o,l]=h.useState(!1),c=[{key:"HYPER",label:"HyperLiquid",icon:i.jsx("img",{src:O1,className:"w-4 h-4"}),count:(n==null?void 0:n.length)||0},{key:"LIGHTER",label:"Lighter",icon:i.jsx(yf,{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))})})]})},Ycn=({isSelectMenu:t,setIsSelectMenu:e,handlePageChange:n,handleListRequest:r,allWallets:s,lighterWallet:a,extendedWallet:o,pacificaWallet:l})=>{const[c,u]=h.useState(!1);h.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(Gcn,{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(hQ,{title:"HYPER",label:"HYPERLIQUID",walletLength:s,handleSelectMenuChange:d,isSelectMenu:t}),i.jsx(hQ,{title:"LIGHTER",label:"LIGHTER",walletLength:a,handleSelectMenuChange:d,isSelectMenu:t}),i.jsx(hQ,{title:"EXTENDED",label:"EXTENDED",walletLength:o,handleSelectMenuChange:d,isSelectMenu:t})]}),i.jsx("div",{className:"flex lg:hidden items-center justify-start",children:i.jsx(Kcn,{value:t,onChange:d,allWallets:s,lighterWallet:a,extendedWallet:o,pacificaWallet:l})})]})]})},hQ=({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:O1,alt:"hyper",className:"w-4 h-4 rounded-sm"}):t==="LIGHTER"?i.jsx(yf,{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"}) `]}),Xcn="wss://api.hyperliquid.xyz/ws",Qcn=()=>{const t=Pl(),{isConnected:e,address:n}=ds(),{setSignModalOpen:r,hyperToken:s,setTelegramChatId:a,setSubscriberRole:o,setSubsExpireDay:l,setMushboomerETH:c,setMushboomerSOL:u,setIsReferralCode:d,setIsReferralCodeName:f,setIsWhitelist:x,setHyperToken:g,setHyperAddress:y}=h.useContext(Qr),v=h.useRef(null),C=h.useRef(null),S=h.useRef(null),[T,I]=h.useState([]),[L,F]=h.useState(!1),[$,O]=h.useState(null),[U,Y]=h.useState(!0),[re,Q]=h.useState("null");h.useEffect(()=>{const st=t.hash;if(st){const at=st.split("#").filter(Boolean);at[0]==="hyperliquid"?(Q("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER")):at[0]==="lighter"?(Q("LIGHTER"),localStorage.setItem("isWalletSelectMenu","LIGHTER")):at[0]==="extended"?(Q("EXTENDED"),localStorage.setItem("isWalletSelectMenu","EXTENDED")):at[0]==="pacifica"?(Q("PACIFICA"),localStorage.setItem("isWalletSelectMenu","PACIFICA")):(window.history.replaceState(null,"",`${window.location.pathname}#hyperliquid`),Q("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER"))}else window.history.replaceState(null,"",`${window.location.pathname}#hyperliquid`),Q("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER")},[t.hash]);const[q,te]=h.useState([]),[fe,G]=h.useState([]),[ie,oe]=h.useState([]),[K,H]=h.useState([]),[ee,se]=h.useState(()=>parseInt(localStorage.getItem("walletManagementPage"))||1),pe=5,[Se,ge]=h.useState(!1);h.useEffect(()=>{window.localStorage.getItem("hyperToken")?(ve(),be(),we()):(r(!0),I([]),window.localStorage.setItem("walletManagementPage",1))},[e,s]);const ve=async()=>{try{F(!0);const st=window.localStorage.getItem("hyperToken");if(!st){r(!0);return}const at="https://dextrabothypev2.nftinit.io/api/wallet/list",He=window.localStorage.getItem("hyperAddress"),vt=await(await fetch(at,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():He,token:st,balance:"false"})})).json();if(vt.success){H(vt.data||[]),ge(!0);const yt=parseInt(localStorage.getItem("walletManagementPage"))||1,Kt=Math.max(Math.ceil(((vt==null?void 0:vt.data)||[]).length/pe),1),jt=Math.min(yt,Kt);se(jt),localStorage.setItem("walletManagementPage",jt),Ye(jt,vt.data||[])}else console.log(vt.error_message),F(!1),O(vt.error_message)}catch(st){console.error("Error fetching wallet list:",st),F(!1),O(st.message)}},be=async()=>{try{F(!0);const st=window.localStorage.getItem("hyperToken");if(!st){r(!0);return}const at="https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",He=window.localStorage.getItem("hyperAddress"),vt=await(await fetch(at,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():He,token:st})})).json();vt.success&&te(vt.data||[])}catch(st){console.error("Error fetching wallet list:",st)}},we=async()=>{try{F(!0);const st=window.localStorage.getItem("hyperToken");if(!st){r(!0);return}const at="https://dextrabothypev2.nftinit.io/api/wallet/list-extended",He=window.localStorage.getItem("hyperAddress"),vt=await(await fetch(at,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():He,token:st})})).json();vt.success&&G(vt.data||[])}catch(st){console.error("Error fetching wallet list:",st)}},je=st=>st!=null&&st.assetPositions?st.assetPositions.filter(at=>{if(!at.position||!at.position.szi)return!1;const He=parseFloat(at.position.szi);return!isNaN(He)&&He!==0}).map(at=>{const He=at.position,qe=parseFloat(He.szi),vt=parseFloat(He.entryPx),yt=parseFloat(He.positionValue),Kt=parseFloat(He.unrealizedPnl),jt=parseFloat(He.returnOnEquity)*100,un=parseFloat(He.marginUsed),vn=He.leverage.value,Hn=He.leverage.type,ln=parseFloat(He.cumFunding.sinceOpen),Nn=qe>0?"Long":"Short";return{asset:He.coin,type:Nn,size:qe,entryPrice:vt.toFixed(4),currentPrice:(yt/Math.abs(qe)).toFixed(4),leverage:vn,leverageType:Hn,positionValue:yt.toFixed(2),marginUsed:un.toFixed(2),unrealizedPnl:Kt.toFixed(2),roe:jt.toFixed(2),funding:ln.toFixed(4),liquidationPrice:He.liquidationPx?parseFloat(He.liquidationPx).toFixed(2):"N/A"}}):[],Fe=()=>{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),S.current&&(clearInterval(S.current),S.current=null),C.current&&(clearTimeout(C.current),C.current=null)},Re=st=>{v.current=new WebSocket(Xcn),v.current.onopen=()=>{console.log("WebSocket Connected"),st.forEach(at=>{let He={method:"subscribe",subscription:{type:"webData2",user:at==null?void 0:at.wallet_address}};v.current.send(JSON.stringify(He))}),S.current=setInterval(()=>{var at;if(((at=v.current)==null?void 0:at.readyState)===WebSocket.OPEN){const He={id:99,method:"ping"};v.current.send(JSON.stringify(He))}},3e4)},v.current.onclose=at=>{console.log("WebSocket Disconnected",at.code,at.reason),S.current&&(clearInterval(S.current),S.current=null),at.code!==1e3&&(C.current||(C.current=setTimeout(()=>{C.current=null,Re(st)},5e3)))},v.current.onerror=at=>{console.error("WebSocket Error:",at)},v.current.onmessage=at=>{try{const He=JSON.parse(at.data);if(He.method==="pong")return;if(He.result==="success"){console.log("Successfully subscribed to channel");return}He.channel==="webData2"&&Qe(He)}catch(He){console.error("Error processing WebSocket message:",He),console.error("Raw message that caused error:",at.data),Y(!1)}}},Qe=st=>{I(at=>{let He=!1;const qe=at.map(vt=>{var yt,Kt,jt,un,vn,Hn,ln,Nn,dn,rt,nt,Ut,wn;if((vt==null?void 0:vt.wallet_address.toLowerCase())===((yt=st==null?void 0:st.data)==null?void 0:yt.user.toLowerCase())){const Jt=(un=(jt=(Kt=st==null?void 0:st.data)==null?void 0:Kt.clearinghouseState)==null?void 0:jt.assetPositions)==null?void 0:un.reduce((We,Pt)=>{var Ke;return We+(parseFloat((Ke=Pt==null?void 0:Pt.position)==null?void 0:Ke.unrealizedPnl)||0)},0),Vt=je((vn=st==null?void 0:st.data)==null?void 0:vn.clearinghouseState),xt={...vt,perpEquity:(Nn=(ln=(Hn=st==null?void 0:st.data)==null?void 0:Hn.clearinghouseState)==null?void 0:ln.marginSummary)==null?void 0:Nn.accountValue,unrealizedPnl:Jt,withdrawableUsdc:(rt=(dn=st==null?void 0:st.data)==null?void 0:dn.clearinghouseState)==null?void 0:rt.withdrawable,marginUsed:(wn=(Ut=(nt=st==null?void 0:st.data)==null?void 0:nt.clearinghouseState)==null?void 0:Ut.marginSummary)==null?void 0:wn.totalMarginUsed,positions:Vt};if(JSON.stringify(vt)!==JSON.stringify(xt))return He=!0,xt}return vt});return He?qe:at}),setTimeout(()=>{F(!1),Y(!1)},3e3)};h.useEffect(()=>{const st=()=>{const at=parseInt(localStorage.getItem("walletManagementPage"))||1;at!==ee&&Se&&(Fe(),se(at),Ye(at,K))};return window.addEventListener("storage",st),()=>{window.removeEventListener("storage",st)}},[ee,K,Se]);const Ye=(st,at)=>{if(!at||at.length===0){F(!1);return}F(!0);const He=(st-1)*pe,qe=He+pe,vt=at.slice(He,qe);I(vt),Fe(),Re(vt)},dt=st=>{st<1||st>Math.ceil(K.length/pe)||(F(!0),se(st),localStorage.setItem("walletManagementPage",st),Ye(st,K))};return h.useEffect(()=>()=>{Fe()},[t.pathname]),h.useEffect(()=>{(async()=>{var qe,vt;const at=window.localStorage.getItem("hyperToken"),He=window.localStorage.getItem("hyperAddress");if(!(!at||!He))try{const yt=await bi(He.toLowerCase(),at);yt!=null&&yt.success?(a(yt==null?void 0:yt.telegram_chat_id),o(yt==null?void 0:yt.subscriber_role),l(yt==null?void 0:yt.subs_expire_day),c((qe=yt==null?void 0:yt.mushboomer_counts)==null?void 0:qe.eth),u((vt=yt==null?void 0:yt.mushboomer_counts)==null?void 0:vt.sol),d(yt==null?void 0:yt.referral_code),f(yt==null?void 0:yt.refcode),x(yt==null?void 0:yt.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),g(""),y(""))}catch(yt){console.error("Token verification error:",yt),console.error(yt.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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(Ycn,{handlePageChange:dt,handleListRequest:ve,isSelectMenu:re,setIsSelectMenu:Q,allWallets:K,lighterWallet:q,extendedWallet:fe,pacificaWallet:ie}),re==="HYPER"?i.jsxs(i.Fragment,{children:[i.jsx(Dcn,{data:T,loading:L,error:$,socketLoading:U,handlePageChange:dt,handleListRequest:ve,currentPage:ee,allWallets:K}),i.jsx(Bcn,{data:T,loading:L,error:$,socketLoading:U,handlePageChange:dt,currentPage:ee,allWallets:K})]}):re==="LIGHTER"?i.jsx(i.Fragment,{children:i.jsx(Wcn,{lighterWalletList:be})}):re==="EXTENDED"?i.jsx(i.Fragment,{children:i.jsx(kNe,{fetchAllWalletList:we})}):i.jsx(i.Fragment,{children:i.jsx(kNe,{fetchAllWalletList:we})})]})})]})};function Zcn({open:t,setOpen:e,copyTradeDelete:n,isDeleteWallet:r}){return i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Hi,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 tWe=({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}=h.useContext(Qr),{address:v}=ds(),[C,S]=h.useState(!1),[T,I]=h.useState(!1),[L,F]=h.useState(""),[$,O]=h.useState(""),[U,Y]=h.useState(""),re=async()=>{var ie,oe;const fe=window.localStorage.getItem("hyperToken"),G=window.localStorage.getItem("hyperAddress");if(!(!fe||!G))try{setLoadingCheckAccount(!0);const K=await bi(G.toLowerCase(),fe);K!=null&&K.success?(a(K==null?void 0:K.telegram_chat_id),o(K==null?void 0:K.subscriber_role),l(K==null?void 0:K.subs_expire_day),c((ie=K==null?void 0:K.mushboomer_counts)==null?void 0:ie.eth),u((oe=K==null?void 0:K.mushboomer_counts)==null?void 0:oe.sol),d(K==null?void 0:K.referral_code),f(K==null?void 0:K.refcode),x(K==null?void 0:K.whitelist),g(fe),y(G),Y(K==null?void 0:K.farming_tools),setLoadingCheckAccount(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),g(""),y(""),setLoadingCheckAccount(!1))}catch(K){console.error("Token verification error:",K),console.error(K.message||"An unknown error occurred."),setLoadingCheckAccount(!1)}},Q=async()=>new Tl(window.ethereum).eth.getAccounts(G=>G),q=async(fe="farming",G=24,ie=5e3)=>{G<=0||(await new Promise(oe=>setTimeout(oe,ie)),await re(),fe==="farming"&&!U?q(fe,G-1,ie):n())},te=async()=>{O("");const fe=window.localStorage.getItem("hyperToken"),G=window.localStorage.getItem("hyperAddress");if(!fe||!v){s(!0);return}I(!0),S(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(K){console.error("Failed to switch network",K),S(!1);return}const ie=new Tl(window.ethereum);var oe=await Q();if(oe.length>0?oe=oe[0]:oe=void 0,oe){const H={from:oe,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:"120000000000000000"};await ie.eth.sendTransaction(H).then(ee=>{console.log("txHash :>> ",ee),S(!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():G,token:fe,payment_tx:ee.transactionHash,payment_role:r==="bots_extra_slot"?"bots_extra_slot":"farming_tools"})}),re(),q(r)}).catch(ee=>{console.log(ee),ee.code===-32003||ee.message.includes("insufficient funds")?O("Insufficient funds."):ee.message==="MetaMask Tx Signature: User denied transaction signature."&&I(!1)})}else await ie.eth.requestAccounts()};return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:T,setOpen:I,transactionHash:L,transactionLoading:C,paymentPresaleRole:U,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:Xj,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"})]})})]})]})},Jcn=({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}=h.useContext(Qr),{isConnected:S,address:T}=ds(),[I,L]=h.useState(!1),[F,$]=h.useState(null),[O,U]=h.useState(""),[Y,re]=h.useState(""),[Q,q]=h.useState([]),[te,fe]=h.useState(!1),[G,ie]=h.useState({}),[oe,K]=h.useState({}),[H,ee]=h.useState([]),[se,pe]=h.useState([]),[Se,ge]=h.useState(null),[ve,be]=h.useState(!1),[we,je]=h.useState(!1),[Fe,Re]=h.useState(!1),[Qe,Ye]=h.useState([]),dt=h.useRef(null),[st,at]=h.useState([]),He=h.useRef(!1);h.useEffect(()=>{const We={};n==null||n.forEach(Pt=>{const Ke=`${Pt==null?void 0:Pt.wm_address}_${Pt==null?void 0:Pt.wallet_address}_${Pt==null?void 0:Pt.wallet_id}`;We[Ke]=Pt==null?void 0:Pt.copy_trait_mode}),ie(We),!He.current&&(n==null?void 0:n.length)>0&&(vt(),He.current=!0)},[n]),h.useEffect(()=>{if((n==null?void 0:n.length)>0){const We=[...n];(H==null?void 0:H.length)>0&&H.forEach(Pt=>{var Ke;((Ke=Pt.openPositionCoinList)==null?void 0:Ke.length)>0&&Pt.generated_wallet_public&&!We.some(ct=>ct.wallet_address.toLowerCase()===Pt.generated_wallet_public.toLowerCase())&&We.push({wallet_address:Pt.generated_wallet_public})}),pe(Pt=>{const Ke=Pt.map(Nt=>Nt.wallet_address).sort().join(","),ct=We.map(Nt=>Nt.wallet_address).sort().join(",");return Ke!==ct?We:Pt})}},[n,H]);const qe=async(We,Pt,Ke,ct,Nt)=>{const Ht=`${We}_${Pt}_${Nt}`;try{const Rt=window.localStorage.getItem("hyperToken"),hn="https://dextrabothypev2.nftinit.io/api/test_app/following/status/";Rt||C(!0),K(Rn=>({...Rn,[Ht]:!0}));const yn=window.localStorage.getItem("hyperAddress"),En=await(await fetch(hn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:T?T.toLowerCase():yn,token:Rt,follow_address:Pt==null?void 0:Pt.toLowerCase(),copy_trait_mode:Ke,target_platform:ct,wallet_id:Nt})})).json();En.success?(ie(Rn=>({...Rn,[Ht]:Ke})),f()):(console.log(En.error_message),fn.error(En.error_message))}catch(Rt){console.error("Error status mode:",Rt),fn.error(Rt.message||"Something went wrong!")}finally{K(Rt=>({...Rt,[Ht]:!1}))}},vt=async()=>{try{const We=window.localStorage.getItem("hyperToken"),Pt=window.localStorage.getItem("hyperAddress"),Ke="https://dextrabothypev2.nftinit.io/api/wallet/generated_wallet_summary";We||C(!0);const ct=await fetch(Ke,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:T?T.toLowerCase():Pt,token:We})});if(!ct.ok)throw new El(`Server responded with status ${ct.status}`);const Nt=await ct.json();Nt.success?ee(Nt.data):(console.log(Nt.error_message),fn.error(Nt.error_message))}catch(We){console.error("Error in like function:",We),fn.error(We.message||"Something went wrong!")}},yt="tag",[Kt,jt]=h.useState(yt),un=(We,Pt,Ke,ct)=>We!=null&&We.length?[...We].sort((Nt,Ht)=>{var kn,Gt,mn,gt;if(!G||Object.keys(G).length===0)return 0;const Rt=`${Nt.wm_address}_${Nt.wallet_address}_${Nt.wallet_id}`,hn=`${Ht.wm_address}_${Ht.wallet_address}_${Ht.wallet_id}`;if(G!=null&&G[Rt]&&!(G!=null&&G[hn]))return-1;if(!(G!=null&&G[Rt])&&(G!=null&&G[hn]))return 1;const yn=Ke.find(Wt=>Wt.wallet_address===Nt.wallet_address)||{},Cn=Ke.find(Wt=>Wt.wallet_address===Ht.wallet_address)||{},En=Ke.find(Wt=>{var jn,kt;return((jn=Wt.wallet_address)==null?void 0:jn.toLowerCase())===((kt=Nt==null?void 0:Nt.wm_address)==null?void 0:kt.toLowerCase())})||{},Rn=Ke.find(Wt=>{var jn,kt;return((jn=Wt.wallet_address)==null?void 0:jn.toLowerCase())===((kt=Ht==null?void 0:Ht.wm_address)==null?void 0:kt.toLowerCase())})||{},Mn=yn.data?yn.data.reduce((Wt,jn)=>Wt+parseFloat(jn.unrealizedPnl||0),0):0,Yn=Cn.data?Cn.data.reduce((Wt,jn)=>Wt+parseFloat(jn.unrealizedPnl||0),0):0,Zn=ct==null?void 0:ct.find(Wt=>{var jn,kt,cn,Ce;return((jn=Wt==null?void 0:Wt.generated_wallet_public)==null?void 0:jn.toLowerCase())===((kt=Nt==null?void 0:Nt.wm_address)==null?void 0:kt.toLowerCase())&&((cn=Wt==null?void 0:Wt.copy_trader_wallet)==null?void 0:cn.toLowerCase())===((Ce=Nt==null?void 0:Nt.wallet_address)==null?void 0:Ce.toLowerCase())}),Vn=ct==null?void 0:ct.find(Wt=>{var jn,kt,cn,Ce;return((jn=Wt==null?void 0:Wt.generated_wallet_public)==null?void 0:jn.toLowerCase())===((kt=Ht==null?void 0:Ht.wm_address)==null?void 0:kt.toLowerCase())&&((cn=Wt==null?void 0:Wt.copy_trader_wallet)==null?void 0:cn.toLowerCase())===((Ce=Ht==null?void 0:Ht.wallet_address)==null?void 0:Ce.toLowerCase())}),tr=Zn?Zn.total_pnl:0,Sn=Vn?Vn.total_pnl:0,ze=Zn&&((kn=Zn.openPositionCoinList)==null?void 0:kn.length)>0&&((Gt=En.data)==null?void 0:Gt.length)>0?Zn.openPositionCoinList.reduce((Wt,jn)=>{const kt=En.data.find(cn=>cn.asset===jn);return kt!=null&&kt.unrealizedPnl?Wt+parseFloat(kt.unrealizedPnl):Wt},0):0,xe=Vn&&((mn=Vn.openPositionCoinList)==null?void 0:mn.length)>0&&((gt=Rn.data)==null?void 0:gt.length)>0?Vn.openPositionCoinList.reduce((Wt,jn)=>{const kt=Rn.data.find(cn=>cn.asset===jn);return kt!=null&&kt.unrealizedPnl?Wt+parseFloat(kt.unrealizedPnl):Wt},0):0,Ge=Nt.tag?Nt.tag.toUpperCase():"",_e=Ht.tag?Ht.tag.toUpperCase():"",Be=Nt.wm_name?Nt.wm_name.toUpperCase():"",qt=Ht.wm_name?Ht.wm_name.toUpperCase():"",It=Nt.wallet_address?Nt.wallet_address.toLowerCase():"",mt=Ht.wallet_address?Ht.wallet_address.toLowerCase():"",Ft=Nt.wm_address?Nt.wm_address.toLowerCase():"",Tn=Ht.wm_address?Ht.wm_address.toLowerCase():"";return Pt==="tag"?Ge<_e?-1:Ge>_e?1:0:Pt==="-tag"?Ge>_e?-1:Ge<_e?1:0:Pt==="-wallet_address"?It<mt?-1:It>mt?1:0:Pt==="wallet_address"?It>mt?-1:It<mt?1:0:Pt==="-wm_address"?Ft<Tn?-1:Ft>Tn?1:0:Pt==="wm_address"?Ft>Tn?-1:Ft<Tn?1:0:Pt==="perp_equity"?(yn.perp_equity||0)-(Cn.perp_equity||0):Pt==="-perp_equity"?(Cn.perp_equity||0)-(yn.perp_equity||0):Pt==="margin_usage"?(yn.margin_usage||0)-(Cn.margin_usage||0):Pt==="-margin_usage"?(Cn.margin_usage||0)-(yn.margin_usage||0):Pt==="unrealizedPnl"?Mn-Yn:Pt==="-unrealizedPnl"?Yn-Mn:Pt==="-wm_name"?Be<qt?-1:Be>qt?1:0:Pt==="wm_name"?Be>qt?-1:Be<qt?1:0:Pt==="total_pnl"?tr-Sn:Pt==="-total_pnl"?Sn-tr:Pt==="totalUnrealizedPnl"?ze-xe:Pt==="-totalUnrealizedPnl"?xe-ze:Pt==="-created_at"?new Date(Ht.created_at)-new Date(Nt.created_at):Pt==="created_at"?new Date(Nt.created_at)-new Date(Ht.created_at):0}):[];h.useEffect(()=>{if(!(n!=null&&n.length))return;const We=n.filter(Pt=>!!(!(Qe!=null&&Qe.length)||Qe.includes("HyperLiquid")&&Pt.target_platform==="hyper"||Qe.includes("Lighter")&&Pt.target_platform==="lighter"));at(un(We,Kt,Q,H))},[Kt,n,Qe]);const vn=async(We,Pt)=>{try{U(We),re(Pt);const Ke=window.localStorage.getItem("hyperToken"),ct=window.localStorage.getItem("hyperAddress"),Nt="https://dextrabothypev2.nftinit.io/api/test_app/following/info/";Ke||C(!0);const Ht=await fetch(Nt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:T?T.toLowerCase():ct,token:Ke,follow_address:We.toLowerCase()})});if(!Ht.ok)throw new El(`Server responded with status ${Ht.status}`);const Rt=await Ht.json();Rt.success?($(Array.isArray(Rt==null?void 0:Rt.data)?[...Rt.data].sort((hn,yn)=>new Date(yn.created_at||0)-new Date(hn.created_at||0)):Rt==null?void 0:Rt.data),L(!0)):(console.log(Rt.error_message),fn.error(Rt.error_message))}catch(Ke){console.error("Error in like function:",Ke),fn.error(Ke.message||"Something went wrong!")}},Hn=We=>We!=null&&We.assetPositions?We.assetPositions.filter(Pt=>{if(!Pt.position||!Pt.position.szi)return!1;const Ke=parseFloat(Pt.position.szi);return!isNaN(Ke)&&Ke!==0}).map(Pt=>{const Ke=Pt.position,ct=parseFloat(Ke.szi),Nt=parseFloat(Ke.entryPx),Ht=parseFloat(Ke.positionValue),Rt=parseFloat(Ke.unrealizedPnl),hn=parseFloat(Ke.returnOnEquity)*100,yn=parseFloat(Ke.marginUsed),Cn=Ke.leverage.value,En=parseFloat(Ke.cumFunding.sinceOpen),Rn=ct>0?"Long":"Short";return{asset:Ke.coin,type:Rn,size:Math.abs(ct),entryPrice:Nt.toFixed(2),currentPrice:(Ht/Math.abs(ct)).toFixed(2),leverage:Cn,positionValue:Ht.toFixed(2),marginUsed:yn.toFixed(2),unrealizedPnl:Rt.toFixed(2),roe:hn.toFixed(2),funding:En.toFixed(4),liquidationPrice:Ke.liquidationPx?parseFloat(Ke.liquidationPx).toFixed(2):"N/A"}}):[],ln=async We=>{try{const Ke=await Ns.post("https://api-ui.hyperliquid.xyz/info",{type:"clearinghouseState",user:We});if(Ke.data){const ct=Hn(Ke.data);q(Nt=>{var Ht,Rt,hn,yn;return[...Nt,{wallet_address:We,perp_equity:(Rt=(Ht=Ke==null?void 0:Ke.data)==null?void 0:Ht.marginSummary)==null?void 0:Rt.accountValue,margin_usage:parseFloat((hn=Ke==null?void 0:Ke.data)==null?void 0:hn.marginSummary.totalMarginUsed)/parseFloat((yn=Ke==null?void 0:Ke.data)==null?void 0:yn.marginSummary.accountValue),data:ct}]})}}catch(Pt){console.error("Error fetching user state from HyperState:",Pt)}},Nn=async We=>{try{const Pt=window.localStorage.getItem("hyperToken"),Ke=window.localStorage.getItem("hyperAddress"),Nt=await fetch("https://dextrabothypev2.nftinit.io/api/hyper/trade/getclearinghousestate/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:T?T.toLowerCase():Ke,token:Pt,follow_address:We.toLowerCase()})});if(Nt.ok){const Ht=await Nt.json();if(Ht.success){const Rt=Hn(Ht==null?void 0:Ht.data);q(hn=>{var yn;return[...hn,{wallet_address:We,perp_equity:(yn=Ht==null?void 0:Ht.data.marginSummary)==null?void 0:yn.accountValue,margin_usage:parseFloat(Ht==null?void 0:Ht.data.marginSummary.totalMarginUsed)/parseFloat(Ht==null?void 0:Ht.data.marginSummary.accountValue),data:Rt}]})}}else if(Nt.status===500)console.warn(`Received 500 error for ${We}, retrying with getUserHyperState`),await ln(We);else throw new El(`Request failed with status ${Nt.status}`)}catch(Pt){console.error("Error fetching user state:",Pt)}},dn=h.useRef(new Set);h.useEffect(()=>{!t&&r&&(se==null?void 0:se.length)>0&&(async()=>{var Ke;const Pt=new Set;for(let ct=0;ct<se.length;ct++){const Nt=se[ct],Ht=(Ke=Nt==null?void 0:Nt.wallet_address)==null?void 0:Ke.toLowerCase();if(!(!Ht||dn.current.has(Ht))){Pt.add(Ht),dn.current.add(Ht);try{await Nn(Ht)}catch(Rt){console.error(`Error fetching user state for wallet ${Ht}:`,Rt)}await new Promise(Rt=>setTimeout(Rt,500))}}})()},[r,t,se]),h.useEffect(()=>{I||f()},[I]);const rt=h.useRef(null),nt=()=>{rt.current&&(rt.current.scrollLeft-=100)},Ut=()=>{rt.current&&(rt.current.scrollLeft+=100)},wn=()=>{rt.current&&(rt.current.scrollTop+=200)},Jt=()=>{rt.current&&(rt.current.scrollTop-=200)},Vt=["HyperLiquid","Lighter"],xt=We=>{Ye(Pt=>Pt.includes(We)?Pt.filter(Ke=>Ke!==We):[...Pt,We])};return h.useEffect(()=>{function We(Pt){dt.current&&!dt.current.contains(Pt.target)&&Re(!1)}return document.addEventListener("mousedown",We),()=>document.removeEventListener("mousedown",We)},[]),i.jsxs(i.Fragment,{children:[i.jsx(V5,{open:I,setOpen:L,copyTradeData:F,copyTradeWallet:O,setCopyTradeWallet:U,setCopyTradeData:$,sourcePage:Y}),i.jsx(Zcn,{open:o,setOpen:l,copyTradeDelete:s,isDeleteWallet:c}),ve&&Ea.createPortal(i.jsx(vue,{open:ve,setOpen:be,oldSlotCount:Se,checkAccountTrade:f,tradeMarket:"copyTrade"}),document.body),we&&Ea.createPortal(i.jsx(tWe,{open:we,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:nt,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(ro,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:Ut,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(ro,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:Jt,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(ro,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:wn,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(ro,{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:rt,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(!Fe)},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(xd,{className:`w-4 h-4 ${Qe.length>0?"text-blue-500":"text-white"}`})}),Fe&&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:()=>Ye(""),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"})})]}),Vt==null?void 0:Vt.map(We=>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(We),onChange:()=>xt(We),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(We)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:Qe.includes(We)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),We]},We))]})]})]})}),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(hi,{title:"Follower Name",sortKey:"wm_name",sortOption:Kt,setSortOption:jt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#161616] h-10 px-1 min-w-[145px] z-[8]",children:i.jsx(hi,{title:"Follower Wallet",sortKey:"wm_address",sortOption:Kt,setSortOption:jt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#161616] h-10 px-1 min-w-[130px]",children:i.jsx(hi,{title:"Source Tag",sortKey:"tag",sortOption:Kt,setSortOption:jt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#161616] h-10 px-1 min-w-[140px] z-[8]",children:i.jsx(hi,{title:"Source Wallet",sortKey:"wallet_address",sortOption:Kt,setSortOption:jt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[110px] pl-1",children:i.jsx(hi,{title:"Follower PnL",sortKey:"total_pnl",sortOption:Kt,setSortOption:jt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] pl-1",children:i.jsx(hi,{title:"Follower uPnL",sortKey:"totalUnrealizedPnl",sortOption:Kt,setSortOption:jt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[115px] sm:min-w-[115px] pl-1",children:i.jsx(hi,{title:"Perp Equity",sortKey:"perp_equity",sortOption:Kt,setSortOption:jt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] sm:min-w-[130px] pl-1",children:i.jsx(hi,{title:"Margin Usage",sortKey:"margin_usage",sortOption:Kt,setSortOption:jt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[114px] sm:min-w-[114px] pl-1",children:i.jsx(hi,{title:"uPnL",sortKey:"unrealizedPnl",sortOption:Kt,setSortOption:jt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[124px] sm:min-w-[124px] pl-1",children:i.jsx(hi,{title:"Created Date",sortKey:"created_at",sortOption:Kt,setSortOption:jt,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(ka,{})})})}):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(El,{})})})}):(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:Yl,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."]})]})]})]})})})})}):st==null?void 0:st.map((We,Pt)=>{var yn,Cn,En,Rn,Mn;const Ke=Q.find(Yn=>Yn.wallet_address===We.wallet_address),ct=Q.find(Yn=>Yn.wallet_address===(We==null?void 0:We.wm_address)),Nt=H==null?void 0:H.find(Yn=>{var Zn,Vn,tr,Sn;return((Zn=Yn==null?void 0:Yn.generated_wallet_public)==null?void 0:Zn.toLowerCase())===((Vn=We==null?void 0:We.wm_address)==null?void 0:Vn.toLowerCase())&&((tr=Yn==null?void 0:Yn.copy_trader_wallet)==null?void 0:tr.toLowerCase())===((Sn=We==null?void 0:We.wallet_address)==null?void 0:Sn.toLowerCase())}),Ht=Nt?Nt.total_pnl:null;let Rt=0;Nt&&((yn=Nt==null?void 0:Nt.openPositionCoinList)==null?void 0:yn.length)>0&&((Cn=ct==null?void 0:ct.data)==null?void 0:Cn.length)>0&&((En=Nt==null?void 0:Nt.openPositionCoinList)==null||En.forEach(Yn=>{var Vn;const Zn=(Vn=ct==null?void 0:ct.data)==null?void 0:Vn.find(tr=>{var Sn;return((Sn=tr==null?void 0:tr.asset)==null?void 0:Sn.toLowerCase().trim())===(Yn==null?void 0:Yn.toLowerCase().trim())});Zn&&(Zn!=null&&Zn.unrealizedPnl)&&(Rt+=parseFloat(Zn==null?void 0:Zn.unrealizedPnl))}));const hn=`${We.follower_wallet}_${We.wallet_address}_${We.wallet_id}`;return i.jsxs("tr",{className:`${Pt%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[56px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${Pt%2==0,"bg-[#161616]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222]`,children:(()=>{const Yn=x==null?void 0:x.includes(We.wallet_id),Zn=`${We==null?void 0:We.wm_address}_${We==null?void 0:We.wallet_address}_${We==null?void 0:We.wallet_id}`,Vn=d===0&&!G[Zn]&&!Yn,tr=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(Oo,{checked:!!G[Zn],onChange:()=>{if(!tr&&(We==null?void 0:We.target_platform)==="lighter"){je(!0);return}if(Vn&&(We==null?void 0:We.target_platform)==="lighter"){ge(y),be(!0);return}qe(We==null?void 0:We.wm_address,We.wallet_address,!G[Zn],We==null?void 0:We.target_platform,We==null?void 0:We.wallet_id)},disabled:oe[Zn],className:`${G[Zn]?"bg-[#1DE674]":"bg-[#353535]"} ${oe[Zn]?"cursor-not-allowed":"cursor-pointer"} flex h-[18px] w-[28px] rounded-[256px] p-1 transition-colors`,children:i.jsx("span",{"aria-hidden":"true",className:`${G[Zn]?"translate-x-1.5 bg-white":"-translate-x-[1px] bg-[#D5D5D5]"} inline-block size-[14px] -mt-[3px] rounded-full shadow-lg transition`})}),!tr&&(We==null?void 0:We.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"}):Vn&&(We==null?void 0:We.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"})]}),oe[Zn]?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..."})]}):G[Zn]?"On":"Off"]})})()}),i.jsx("td",{scope:"row",className:`${Pt%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:()=>{vn(We==null?void 0:We.wallet_address,We==null?void 0:We.wallet_id)},className:`${n!=null&&n.some(Yn=>Yn.wallet_address===(We==null?void 0:We.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(H5,{walletAddress:We==null?void 0:We.wallet_address,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:v.some(Yn=>Yn.wallet_address===(We==null?void 0:We.wallet_address))?i.jsx("img",{src:k5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:qj,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})})}),i.jsx("td",{scope:"row",className:`${Pt%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:(We==null?void 0:We.target_platform)==="lighter"?i.jsx(as,{content:"Lighter",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(yf,{className:"w-4 h-4 text-[#fff]"})})}):(We==null?void 0:We.target_platform)==="hyper"?i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(as,{content:"Hyperliquid",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx("img",{src:O1,alt:"",className:"w-4 h-4 text-[#fff]"})})})}):i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(as,{content:"Dextrabot",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx("img",{src:Hi,alt:"",className:"w-4 h-4 text-[#fff]"})})})})})})}),i.jsx("td",{scope:"row",className:`${Pt%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(sa,{info1:We!=null&&We.wm_name?(We==null?void 0:We.wm_name.length)>=13?(We==null?void 0:We.wm_name).slice(0,13)+"...":We==null?void 0:We.wm_name:"--",info1_Color:"text-white",rowTwo:!1}),(We==null?void 0:We.wm_name)&&(We==null?void 0:We.wm_name.length)>=13&&i.jsx("span",{className:"-ml-[9px]",children:i.jsx(Ra,{content:`${We==null?void 0:We.wm_name}`,positionTop:!0,alignRight:!1})})]})})})}),i.jsx("td",{scope:"row",className:`${Pt%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/${We==null?void 0:We.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(sa,{info1:`${(We==null?void 0:We.wm_address).slice(0,5)+"..."+(We==null?void 0:We.wm_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:Yn=>{Yn.stopPropagation(),navigator.clipboard.writeText(We==null?void 0:We.wm_address),fn.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:io,alt:"",className:"cursor-pointer"})]})})})}),i.jsx("td",{scope:"row",className:`${Pt%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(sa,{info1:We!=null&&We.tag?(We==null?void 0:We.tag.length)>=10?(We==null?void 0:We.tag).slice(0,10)+"...":We==null?void 0:We.tag:"--",info1_Color:"text-white",rowTwo:!1}),(We==null?void 0:We.tag)&&(We==null?void 0:We.tag.length)>=10&&i.jsx("span",{className:"-ml-[9px]",children:i.jsx(Ra,{content:`${We==null?void 0:We.tag}`,positionTop:!0,alignRight:!1})})]})})})}),i.jsx("td",{scope:"row",className:`${Pt%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/${We==null?void 0:We.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(sa,{info1:`${(We==null?void 0:We.wallet_address).slice(0,5)+"..."+(We==null?void 0:We.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:Yn=>{Yn.stopPropagation(),navigator.clipboard.writeText(We==null?void 0:We.wallet_address),fn.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:io,alt:"",className:"cursor-pointer"})]})})})}),i.jsx("td",{children:i.jsx(Fh,{info:Ht!==null?`$${Ir(Math.abs(Ht))}`:"--",textColor:`${Ht>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`})}),i.jsx("td",{children:i.jsx(Fh,{info:Nt?`$${Ir(Math.abs(Rt))}`:"--",textColor:`${Rt>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`})}),i.jsx("td",{children:te?i.jsx(Fh,{info:"Loading...",textColor:"text-white"}):Ke?i.jsx(Fh,{info:(Ke==null?void 0:Ke.perp_equity)!=0?`$${Ir(Ke==null?void 0:Ke.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"}):Ke?i.jsx(Fh,{info:isNaN(Ke==null?void 0:Ke.margin_usage)?"0%":`${((Ke==null?void 0:Ke.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"}):Ke?i.jsx(Fh,{info:(Ke==null?void 0:Ke.data)!=0?`$${Ir(Math.abs((Rn=Ke==null?void 0:Ke.data)==null?void 0:Rn.reduce((Yn,Zn)=>Yn+parseFloat(Zn.unrealizedPnl||0),0)))}`:"$0",textColor:`${((Mn=Ke==null?void 0:Ke.data)==null?void 0:Mn.reduce((Yn,Zn)=>Yn+parseFloat(Zn.unrealizedPnl),0))>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`}):i.jsx(Fh,{info:"Loading...",textColor:"text-white"})}),i.jsx("td",{children:i.jsx(Fh,{info:(We==null?void 0:We.created_at)&&B3(We==null?void 0:We.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[hn]?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:We==null?void 0:We.wm_address,sourceWallet:We==null?void 0:We.wallet_address,platform:We==null?void 0:We.target_platform,id:We==null?void 0:We.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"})})})})]},Pt)})})]})})]})]})]})},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})}),eun=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState(!1),{isConnected:s,address:a}=ds(),{copyTradeWatchList:o,getCopyTradeWatchList:l,trackedWatchList:c,getTrackedWatchList:u,copyWatchListLoading:d,copyWatchListError:f,setTelegramChatId:x,setSubscriberRole:g,setSubsExpireDay:y,setMushboomerETH:v,setIsWhitelist:C,setMushboomerSOL:S,setIsReferralCode:T,setIsReferralCodeName:I,setHyperToken:L,setHyperAddress:F,hyperToken:$}=h.useContext(Qr),[O,U]=h.useState({}),[Y,re]=h.useState(!1),[Q,q]=h.useState({followerWallet:"",sourceWallet:"",platform:"",id:null}),[te,fe]=h.useState(0),[G,ie]=h.useState([]),[oe,K]=h.useState(""),[H,ee]=h.useState(0);h.useEffect(()=>{$&&(l(),u(),e(!0),r(!0))},[$]);const se=async()=>{var be,we,je,Fe;const ge=window.localStorage.getItem("hyperToken"),ve=window.localStorage.getItem("hyperAddress");if(!(!ge||!ve))try{const Re=await bi(ve.toLowerCase(),ge);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((be=Re==null?void 0:Re.mushboomer_counts)==null?void 0:be.eth),S((we=Re==null?void 0:Re.mushboomer_counts)==null?void 0:we.sol),T(Re==null?void 0:Re.referral_code),I(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),ie(Re==null?void 0:Re.copy_trade_slots_wallets),K(Re==null?void 0:Re.farming_tools),ee((Fe=Re==null?void 0:Re.copy_trade_slots_info)==null?void 0:Fe.extra_slot_count)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),L(""),F(""))}catch(Re){console.error("Token verification error:",Re)}};h.useEffect(()=>{se()},[]);const pe=async(ge,ve,be,we)=>{const je=`${ge}_${ve}_${we}`;try{const Fe=window.localStorage.getItem("hyperToken"),Re="https://dextrabothypev2.nftinit.io/api/test_app/following/unfollow/";if(!Fe||!ve||!be||!we||!ge)throw new Error("Required information is missing. Please log in or connect your wallet.");U(st=>({...st,[je]:!0}));const Qe=window.localStorage.getItem("hyperAddress"),Ye=await fetch(Re,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a?a.toLowerCase():Qe,token:Fe,follow_address:ve.toLowerCase(),target_platform:be,wallet_id:we})});if(!Ye.ok)throw new Error(`Failed to unlike: ${Ye.status} ${Ye.statusText}`);const dt=await Ye.json();dt.success?(U(st=>({...st,[je]:!1})),l(),re(!1),q({followerWallet:"",sourceWallet:"",platform:"",id:null}),se(),fn.success(`${ve==null?void 0:ve.slice(0,5)}...${ve==null?void 0:ve.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"}})):(fn.error(dt.error_message),U(st=>({...st,[je]:!1})),re(!1))}catch(Fe){fn.error(Fe.message||"Something went wrong!"),U(Re=>({...Re,[je]:!1})),re(!1)}},Se=!!window.localStorage.getItem("hyperToken");return i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsx(Va,{children:Se?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:Se?i.jsx(Jcn,{loading:d,error:f,trackerData:o,isRequest:t,handleCopyDelete:pe,deleteLoading:O,isDeleteModalOpen:Y,setIsDeleteModalOpen:re,isDeleteWallet:Q,setIsDeleteWallet:q,slotTotalCount:te,checkSlotAccount:se,slotCountWallets:G,subsRole:oe,slotCount:H}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(Az,{})})})})]})},tun=({volumeLeaderboardData:t,userData:e,currentPage:n=1,rowsPerPage:r=25})=>{const[s,a]=h.useState([]),[o,l]=h.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"):"")||"";h.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,S)=>{const T=parseFloat(C[x])||0,I=parseFloat(S[x])||0;return T<I?y==="asc"?-1:1:T>I?y==="asc"?1:-1:0});a(v),l({key:x,direction:y})},f=x=>o.key!==x?i.jsx(l2,{className:"inline ml-2 text-white"}):o.direction==="asc"?i.jsx(o2,{className:"inline ml-2 text-white"}):i.jsx(a2,{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:l$(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:Ir(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:Ir(x.referral_xp??x.calculated_xp??0)})})]},y)})})]})})},nun=({pnlLeaderboardData:t,userData:e,currentPage:n=1,rowsPerPage:r=25})=>{var x,g,y,v;const[s,a]=h.useState([]),o=localStorage.getItem("hyperAddress"),l=localStorage.getItem("hyperToken"),[c,u]=h.useState({key:null,direction:"asc"});h.useEffect(()=>{a(t)},[t]);const d=C=>{let S="asc";c.key===C&&c.direction==="asc"&&(S="desc");const T=[...s].sort((I,L)=>{const F=parseFloat(I[C])||0,$=parseFloat(L[C])||0;return F<$?S==="asc"?-1:1:F>$?S==="asc"?1:-1:0});a(T),u({key:C,direction:S})},f=C=>c.key!==C?i.jsx(l2,{className:"inline ml-2 text-white"}):c.direction==="asc"?i.jsx(o2,{className:"inline ml-2 text-white"}):i.jsx(a2,{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:Klt,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:Ylt,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:vme,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:wme,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:Ir(e.daily_point_result)}),i.jsx("td",{className:"px-4 py-3 font-semibold rounded-br-2xl rounded-tr-2xl text-right",children:Ir(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,S)=>{const T=(n-1)*r+S,I=T%2===0?"bg-[#1b1b1b]":"bg-[#1f1f1f]",L=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] ${I} ${L} 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:l$(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:vme,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:wme,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:Ir(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:Ir(C.total_pnl)})]},T)})]})]})})},run="/assets/bg_-D6bvhHQD.png",sun=({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"})})})]}),iun=({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"})})})]}),aun=()=>{const[t,e]=h.useState([]),[n,r]=h.useState([]),[s,a]=h.useState(null),[o,l]=h.useState(null),[c,u]=h.useState("volume"),[d,f]=h.useState(!1),[x,g]=h.useState(!1),[y,v]=h.useState(!1),[C,S]=h.useState(1),T=25,I=h.useRef(null),L=h.useRef(null),{isConnected:F,address:$}=ds(),{openConnectModal:O}=z5(),{walletLogin:U,signIn:Y,hyperToken:re,hyperAddress:Q,setSignInConnectButtonOpen:q,isReferralCodeName:te}=h.useContext(Qr),fe=()=>{F?window.localStorage.getItem("hyperToken")&&re?U():Y(1):(O(),q(!0))},G=te||window.localStorage.getItem("refcode")||"",ie=G?`https://app.dextrabot.com/referral/${G}`:"",oe=()=>{if(!Q||!re){fe();return}f(!0)},K=()=>{if(!Q||!re){fe();return}g(!0)},H=qe=>{qe&&(navigator.clipboard.writeText(qe),fn.success("Copied to clipboard"))},ee=async()=>{var qe;if(I.current)try{(qe=document==null?void 0:document.fonts)!=null&&qe.ready&&await document.fonts.ready;const vt=await q1(I.current,{cacheBust:!0,backgroundColor:"#040707",pixelRatio:2}),yt=document.createElement("a");yt.href=vt,yt.download="dextrabot-leaderboard-rank.png",document.body.appendChild(yt),yt.click(),document.body.removeChild(yt),fn.success("Image downloaded")}catch(vt){console.error("Share card download error",vt),fn.error("Failed to download image")}};h.useCallback(()=>{Ns.get("https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/").then(vt=>{const yt=(vt.data.data||[]).map(Kt=>({ranking:Kt.rank_position,out_subscriber_address:Kt.address,overall_pos_value:Kt.total_volume,calculated_xp:Kt.total_xp,overall_point_result:Kt.total_xp,referral_xp:Kt.ref_bf_xp,refCode:Kt.refCode??null,daily_pos_value:null,generated_wallets:[],owner:!!Kt.owner}));e(yt)}).catch(vt=>{console.error("Error fetching volume data:",vt)})},[]),h.useEffect(()=>{const qe="https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/",vt=yt=>(yt||[]).map(Kt=>({ranking:Kt.rank_position,out_subscriber_address:Kt.address,overall_pos_value:Kt.total_volume,calculated_xp:Kt.total_xp,overall_point_result:Kt.total_xp,referral_xp:Kt.ref_bf_xp,refCode:Kt.refCode??null,daily_pos_value:null,generated_wallets:[],owner:!!Kt.owner}));Ns.get(qe).then(yt=>{const Kt=vt(yt.data.data);e(Kt),r(Kt)}).catch(yt=>{console.error("Error fetching leaderboard data:",yt),e([]),r([])})},[]);const se=h.useCallback(()=>{L.current&&L.current.abort();const qe=Q||typeof window<"u"&&window.localStorage.getItem("hyperAddress"),vt=re||typeof window<"u"&&window.localStorage.getItem("hyperToken");if(qe&&vt){v(!0);const yt="https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/",Kt=new AbortController;L.current=Kt,Ns.post(yt,{address:qe,token:vt},{headers:{"Content-Type":"application/json"},signal:Kt.signal}).then(jt=>{if(!Kt.signal.aborted){if(jt.data.ownerRank)a(jt.data.ownerRank);else if(jt.data.data){const un=jt.data.data.find(vn=>{var Hn;return((Hn=vn.address)==null?void 0:Hn.toLowerCase())===(qe==null?void 0:qe.toLowerCase())});a(un?{ranking:un.rank_position,rank_position:un.rank_position,overall_pos_value:un.total_volume,total_volume:un.total_volume,calculated_xp:un.total_xp,total_xp:un.total_xp,overall_point_result:un.total_xp,referral_xp:un.ref_bf_xp,refCode:un.refCode}:null)}else a(null);v(!1)}}).catch(jt=>{jt.name!=="CanceledError"&&!Kt.signal.aborted&&(console.error("API Error (Volume):",jt),v(!1))})}else a(null),v(!1)},[Q,re]),pe=h.useCallback(()=>{const qe=Q||typeof window<"u"&&window.localStorage.getItem("hyperAddress"),vt=re||typeof window<"u"&&window.localStorage.getItem("hyperToken");qe&&vt?Ns.post("https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/",{address:qe,token:vt},{headers:{"Content-Type":"application/json"}}).then(yt=>{if(yt.data.ownerRanks)l(yt.data.ownerRanks[0]);else if(yt.data.ownerRank)l(yt.data.ownerRank);else if(yt.data.data){const Kt=yt.data.data.find(jt=>{var un;return((un=jt.address)==null?void 0:un.toLowerCase())===(qe==null?void 0:qe.toLowerCase())});l(Kt?{ranked:Kt.rank_position,rank_position:Kt.rank_position,subscriber_address:Kt.address,total_pnl:Kt.total_xp,daily_point_result:Kt.daily_point_result||0,mushInfo:Kt.mushInfo||{eth:0,sol:0}}:null)}else l(null)}).catch(yt=>console.error("API Error (PnL):",yt)):l(null)},[Q,re]);h.useEffect(()=>{se(),c==="pnl"&&pe();const qe=()=>{se(),c==="pnl"&&pe()};return window.addEventListener("localStorageUpdated",qe),()=>{window.removeEventListener("localStorageUpdated",qe),L.current&&L.current.abort()}},[Q,re,c,se,pe]);const Se=h.useMemo(()=>c==="volume"?s:o,[c,s,o]),ge=h.useMemo(()=>(Se==null?void 0:Se.ranking)??"--",[Se==null?void 0:Se.ranking]),ve=h.useMemo(()=>(Se==null?void 0:Se.overall_pos_value)??(Se==null?void 0:Se.total_volume)??0,[Se==null?void 0:Se.overall_pos_value,Se==null?void 0:Se.total_volume]),be=h.useMemo(()=>(Se==null?void 0:Se.calculated_xp)??(Se==null?void 0:Se.total_xp)??0,[Se==null?void 0:Se.calculated_xp,Se==null?void 0:Se.total_xp]),we=h.useMemo(()=>s?s.overall_point_result??s.total_xp??s.calculated_xp??(s.calculated_xp||0)+(s.referral_xp||0):0,[s]),je=h.useMemo(()=>s?s.overall_pos_value??s.total_volume??0:0,[s]),Fe=h.useMemo(()=>s?s.rank_position??s.ranking??"Unranked":"Unranked",[s]),Re=h.useMemo(()=>c==="volume"?t:n,[c,t,n]),Qe=h.useMemo(()=>Math.ceil(Re.length/T),[Re.length,T]),Ye=Re.length;h.useEffect(()=>{S(1)},[c]);const dt=h.useCallback(qe=>{qe>=1&&qe<=Qe&&(S(qe),window.scrollTo({top:0,behavior:"smooth"}))},[Qe]),st=Se?`Here’s my @Dextrabot rank #${ge}. Volume (All Time): $${Ir(ve)} · XP: ${Ir(be)}. Farming points and stacking profit at the same time.`:"Here’s my @Dextrabot rank. Farming points and stacking profit at the same time.",at=ie||"https://app.dextrabot.com/leaderboard",He=`https://x.com/intent/post?text=${encodeURIComponent(st)}&url=${encodeURIComponent(at)}`;return i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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(${run})`}}),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:Q&&re?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:l$(Q)})]}):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&&Q&&re?"...":Q&&re&&s?Ir(we):"0"}),i.jsx(sun,{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&&Q&&re?"...":Q&&re&&s?Ir(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&&Q&&re?"...":Q&&re&&s?Fe:"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:K,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(iun,{className:"w-3 h-3"})]})]}),i.jsx("button",{onClick:oe,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(us,{className:"text-white hidden sm:block"}),i.jsx("span",{className:"text-white",children:Ye}),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(tun,{volumeLeaderboardData:t,userData:s,currentPage:C,rowsPerPage:T}):c==="pnl"?i.jsx(nun,{pnlLeaderboardData:n,userData:o,currentPage:C,rowsPerPage:T}):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."})]}),G?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:G})]}),i.jsx("button",{className:"p-2 rounded-xl border border-white/10 transition hover:bg-white/10",onClick:()=>H(G),children:i.jsx("img",{src:iL,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:ie})]}),i.jsx("button",{className:"p-2 rounded-xl border border-white/10 transition hover:bg-white/10",onClick:()=>H(ie),children:i.jsx("img",{src:iL,alt:"Copy referral url",className:"w-4 h-4"})})]})]}):null,!G&&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:I,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:Xj,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:(Se==null?void 0:Se.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:["$",Ir((Se==null?void 0:Se.overall_pos_value)??(Se==null?void 0:Se.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:Ir((Se==null?void 0:Se.calculated_xp)??(Se==null?void 0:Se.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"})})]})]}),!Se&&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:!Se,children:"Download image"}),i.jsx("a",{href:He,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 oun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const lun=h.forwardRef(oun);function cun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 uun=h.forwardRef(cun);function dun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"}))}const fun=h.forwardRef(dun);function hun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const Z_=h.forwardRef(hun);function pun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const mun=h.forwardRef(pun);function xun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const pQ=h.forwardRef(xun);function gun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const bun=h.forwardRef(gun);function yun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 nWe=h.forwardRef(yun);function vun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.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 wun=h.forwardRef(vun);function Cun({title:t,titleId:e,...n},r){return h.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?h.createElement("title",{id:e},t):null,h.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const Lde=h.forwardRef(Cun),TNe=[{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 Nun(...t){return t.filter(Boolean).join(" ")}const Rde=({scrollToFeatures:t,scrollToHowItWorks:e,scrollToFAQ:n})=>i.jsxs(h_e,{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(YB,{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:dct,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(Wie,{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(fun,{"aria-hidden":"true",className:"block size-6 group-data-[open]:hidden"}),i.jsx(Lde,{"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:TNe.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:Nun(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(qie,{className:"sm:hidden",children:i.jsx("div",{className:"space-y-1 px-2 pb-3 pt-2",children:TNe.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))})})]}),Sun=()=>{const[t,e]=h.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(Vy,{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)fn.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{fn.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:uct,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:tct,alt:"Copy trade Hyperliquid wallets with Dextrabot platform and customizable risk settings",className:"w-full h-auto max-w-[728px] mx-auto"})})})})]})})})})},jun=()=>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(P7,{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:nct,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute bottom-0 left-0"}),i.jsx(P7,{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:sct,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(P7,{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:ict,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute bottom-[20px] w-[294px] h-[204px]"}),i.jsx(P7,{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:rct,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute bottom-0 -left-1"})]})]}),i.jsx(P7,{title:"Analyze Wallet",description:"Track performance metrics, open positions, and trading patterns",icon:act,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"})]})]})}),P7=({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})]}),Aun=()=>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(mQ,{title:"Discover",description:"Find profitable wallets using our advanced filters",icon:oct,altInfo:"Discover profitable Hyperliquid wallets using Dextrabot's advanced filtering system"}),i.jsx(mQ,{title:"Analyze",description:"Examine detailed metrics and trading patterns",icon:lct,altInfo:"Examine detailed PnL metrics and win rate statistics for Hyperliquid trading strategies"}),i.jsx(mQ,{title:"Copy Trade",description:"Set your risk parameters and start automating",icon:cct,altInfo:"Set custom take profit and stop loss parameters for automated copy trading on Hyperliquid"})]})]})}),mQ=({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]"})]}),PNe=({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"})}),_un=()=>{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(h_e,{as:"div",className:"my-4 first:pt-0 last:pb-0 rounded-2xl bg-[#161616]",children:i.jsxs("dt",{children:[i.jsxs(Wie,{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(PNe,{"aria-hidden":"true",className:"size-6 group-data-[open]:hidden"}),i.jsx(PNe,{"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(qie,{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))})]})})},Eun=({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"})})})]}),kun=({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"})})})]}),Tun=({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"})}),Dde=()=>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(kun,{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(Tun,{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(Eun,{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."]})]}),Pun=()=>{const t=h.useRef(null),e=h.useRef(null),n=h.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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(Rde,{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(Sun,{}),i.jsx("div",{ref:t,children:i.jsx(jun,{})}),i.jsx("div",{ref:e,children:i.jsx(Aun,{})}),i.jsx("div",{ref:n,children:i.jsx(_un,{})}),i.jsx(Dde,{})]})]})};var ag={},INe;function Iun(){if(INe)return ag;INe=1;var t=ag.__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=ag.__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=ag.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=ag.__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=ag.__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(ag,"__esModule",{value:!0});var a=r(bx()),o=qVe(),l=GVe(),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,S=d.cssOverride,T=S===void 0?{}:S,I=d.size,L=I===void 0?25:I,F=d.margin,$=F===void 0?2:F,O=s(d,["loading","color","speedMultiplier","cssOverride","size","margin"]),U=(0,o.parseLengthAndUnit)(L),Y=U.value,re=U.unit,Q=t({display:"inherit",position:"relative",fontSize:0,height:"".concat(Y*2).concat(re),width:"".concat(Y*2).concat(re)},T),q=(0,l.createAnimation)("PacmanLoader",`75% {opacity: 0.7}
100% {transform: translate(`.concat("".concat(-4*Y).concat(re),", ").concat("".concat(-Y/4).concat(re),")}"),"ball"),te=function(H){return{width:"".concat(Y/3).concat(re),height:"".concat(Y/3).concat(re),backgroundColor:y,margin:(0,o.cssValue)($),borderRadius:"100%",transform:"translate(0, ".concat("".concat(-Y/4).concat(re),")"),position:"absolute",top:"".concat(Y).concat(re),left:"".concat(Y*4).concat(re),animation:"".concat(q," ").concat(1/C,"s ").concat(H*.25,"s infinite linear"),animationFillMode:"both"}},fe="".concat((0,o.cssValue)(L)," solid transparent"),G="".concat((0,o.cssValue)(L)," solid ").concat(y),ie=function(H){return{width:0,height:0,borderRight:fe,borderTop:H===0?fe:G,borderLeft:G,borderBottom:H===0?G:fe,borderRadius:(0,o.cssValue)(L),position:"absolute",animation:"".concat(c[H]," ").concat(.8/C,"s infinite ease-in-out"),animationFillMode:"both"}},oe=ie(0),K=ie(1);return x?a.createElement("span",t({style:Q},O),a.createElement("span",{style:oe}),a.createElement("span",{style:K}),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 ag.default=u,ag}var Fun=Iun();const Oun=Pi(Fun),Mun=()=>{const{setHyperToken:t,setHyperAddress:e}=h.useContext(Qr),[n]=YAe(),r=yo(),s=n.get("temp_mobile_password");return h.useEffect(()=>{s?(async()=>{try{const o=await Ns.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),fn.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{fn.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:Hi,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(Oun,{color:"#46eda1",size:30})]})},Lun=()=>i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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(Rde,{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(Dde,{})]})]}),Run=()=>{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(za,{children:i.jsxs(Va,{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(Rde,{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(Dde,{})]})]})},RF=(t,e=2)=>Number(t).toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:e}),xQ=(t,e=2)=>Number(t).toLocaleString("en-US",{maximumFractionDigits:e}),FNe=t=>`${(t*100).toFixed(2)}%`,gQ=t=>Math.floor((Date.now()-t)/864e5);function Dun(){const[t,e]=h.useState([]),[n,r]=h.useState(!0),[s,a]=h.useState(""),[o,l]=h.useState(""),[c,u]=h.useState(""),[d,f]=h.useState(""),[x,g]=h.useState(""),[y,v]=h.useState(!1),[C,S]=h.useState(""),[T,I]=h.useState("tvl"),[L,F]=h.useState("desc"),[$,O]=h.useState(20),[U,Y]=h.useState(1),re=ee=>(ee.summary.name||"").trim()==="Hyperliquidity Provider (HLP)",Q=()=>{r(!0),Ns.get("https://stats-data.hyperliquid.xyz/Mainnet/vaults").then(ee=>e(Array.isArray(ee.data)?ee.data:[])).finally(()=>r(!1))};h.useEffect(()=>Q(),[]);const q=(ee,se)=>{var Se;const pe=(Se=ee.pnls)==null?void 0:Se.find(([ge])=>ge===se);return pe?parseFloat(pe[1].slice(-1)[0]||0):0},te=h.useMemo(()=>{if(!t.length)return null;const ee=t.reduce((pe,Se)=>pe+ +Se.summary.tvl,0),se=t.reduce((pe,Se)=>pe+(Se.apr||0),0)/t.length;return{total:t.length,active:t.filter(pe=>!pe.summary.isClosed).length,tvl:ee,avgApr:se,profitable:t.filter(pe=>q(pe,"allTime")>0).length}},[t]),fe=h.useMemo(()=>t.filter(ee=>{const se=+ee.summary.tvl,pe=ee.apr||0,Se=q(ee,"month"),ge=q(ee,"allTime"),ve=gQ(ee.summary.createTimeMillis),be=(ee.summary.name||"").toLowerCase()+(ee.summary.vaultAddress||"").toLowerCase();return!(s&&se<+s||o&&pe*100<+o||c&&Se<+c||d&&ge<+d||x&&ve<+x||!y&&ee.summary.isClosed||C&&!be.includes(C.toLowerCase()))}),[t,s,o,c,d,x,y,C]),G=(ee,se)=>{var pe;switch(se){case"name":return((pe=ee.summary.name)==null?void 0:pe.toLowerCase())||"";case"apr":return ee.apr||0;case"tvl":return+ee.summary.tvl;case"p30":return q(ee,"month");case"pAll":return q(ee,"allTime");case"days":return gQ(ee.summary.createTimeMillis);default:return 0}},ie=h.useMemo(()=>[...fe].sort((ee,se)=>{const pe=G(ee,T),Se=G(se,T);return pe===Se?0:L==="asc"?pe>Se?1:-1:pe<Se?1:-1}),[fe,T,L]),oe=Math.max(1,Math.ceil(ie.length/$)),K=ie.slice((U-1)*$,U*$),H=(ee,se)=>i.jsx("th",{onClick:()=>I(ee)||F(T===ee?L==="asc"?"desc":"asc":"desc"),className:`px-3 py-2 cursor-pointer whitespace-nowrap ${T===ee?"text-[#67FFBD]":""}`,children:se},ee);return n?i.jsx("div",{className:"flex justify-center items-center w-full py-10",children:i.jsx(JVe,{color:"#ffffff",size:40})}):i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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:()=>{Q(),Y(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",xQ(te.total,0)],["Active Vaults",xQ(te.active,0)],["Total TVL",RF(te.tvl,0)],["Average APR",FNe(te.avgApr)],["Profitable Vaults",xQ(te.profitable,0)]].map(([ee,se])=>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:se})]},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,se,pe])=>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:se===0?"":se,placeholder:"0",onChange:Se=>pe(Se.target.value===""?"":+Se.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=>S(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),S("")},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:[H("name","Vault"),H("tvl","TVL"),H("apr","APR"),H("p30","30d PNL"),H("pAll","All-Time PNL"),H("days","Days")]})}),i.jsx("tbody",{children:K.map((ee,se)=>{const pe=+ee.summary.tvl,Se=ee.apr||0,ge=q(ee,"month"),ve=q(ee,"allTime"),be=gQ(ee.summary.createTimeMillis),we=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/${we}`,target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#67FFBD] font-bold text-white",children:ee.summary.name||"Unnamed"}),i.jsx("a",{href:`/wallet-details/${we}`,target:"_blank",rel:"noopener noreferrer",children:i.jsx("img",{src:Hi,className:"w-4 h-4"})}),re(ee)&&i.jsx("span",{className:"text-[#FF7173] ml-1",children:"(Protocol Vault)"})]}),i.jsx("td",{className:"px-3 py-2",children:RF(pe)}),i.jsx("td",{className:"px-3 py-2",children:FNe(Se)}),i.jsx("td",{className:`px-3 py-2 ${ge>=0?"text-[#67FFBD]":"text-[#FF7173]"}`,children:RF(ge)}),i.jsx("td",{className:`px-3 py-2 ${ve>=0?"text-[#67FFBD]":"text-[#FF7173]"}`,children:RF(ve)}),i.jsx("td",{className:"px-3 py-2",children:be})]},we)})})]})}),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=>{O(+ee.target.value),Y(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:()=>Y(ee=>Math.max(1,ee-1)),disabled:U===1,className:"px-2 py-1 bg-[#1c1c1c] rounded disabled:opacity-40",children:"‹"}),i.jsxs("span",{className:"text-sm",children:[U,"/",oe]}),i.jsx("button",{onClick:()=>Y(ee=>Math.min(oe,ee+1)),disabled:U===oe,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(Sz,{sortKey:e,state:n,className:""})]})})},Bun=({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(h.Fragment,{children:[i.jsx(Pb,{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:Nme,period:e}),i.jsx(Pb,{title:"Long Positions",value:n!=null&&n.long_exposure?n==null?void 0:n.long_exposure:"--",info:"Long exposure",icon:OJ,period:e}),i.jsx(Pb,{title:"Short Positions",value:n!=null&&n.short_exposure?n==null?void 0:n.short_exposure:"--",info:"Short exposure",icon:MJ,period:e}),i.jsx(Pb,{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(Pb,{title:"Total Notional",value:"--",info:"--",icon:Nme,period:e}),i.jsx(Pb,{title:"Long Positions",value:"--",info:"Long exposure",icon:OJ,period:e}),i.jsx(Pb,{title:"Short Positions",value:"--",info:"Short exposure",icon:MJ,period:e}),i.jsx(Pb,{title:"Global Bias",value:"--",info:"L/S: --",icon:4,period:e})]})}),Pb=({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(l$t,{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:`$${Y7(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`})]}),gse=({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"})]})})]}),$un=({data:t,loading:e,error:n,period:r,periods:s,handlePeriodChange:a})=>{var re,Q;const o="-total_notional",[l,c]=h.useState(o),[u,d]=h.useState("All"),f=h.useRef({}),[x,g]=h.useState(""),y=h.useRef(null),v=q=>{var fe;const te=(fe=t.data)==null?void 0:fe.filter(G=>{var oe,K,H,ee,se;if(u!=="All"&&G.majority_side!==u)return!1;const ie=(oe=x==null?void 0:x.trim())==null?void 0:oe.toLowerCase();return!(ie!==""&&!((H=(K=G==null?void 0:G.asset)==null?void 0:K.toLowerCase())!=null&&H.includes(ie)||(se=(ee=G==null?void 0:G.coin_name)==null?void 0:ee.toLowerCase())!=null&&se.includes(ie)))});return te==null?void 0:te.sort((G,ie)=>{const oe=G.asset?G.asset.toUpperCase():"",K=ie.asset?ie.asset.toUpperCase():"",H=G.majority_side==="LONG"?1:0,ee=ie.majority_side==="LONG"?1:0,se=G.majority_side==="SHORT"?1:0,pe=ie.majority_side==="SHORT"?1:0,Se=G.maj_side_pnl==="Profit"?1:0,ge=ie.maj_side_pnl==="Profit"?1:0,ve=G.maj_side_pnl==="Loss"?1:0,be=ie.maj_side_pnl==="Loss"?1:0,we=Ye=>{if(!Ye||typeof Ye!="string"||!Ye.includes("/"))return 0;const[dt,st]=Ye.split("/").map(at=>Number(at.trim()));return st!==0?dt/st:0},je=we(G.traders_l_s),Fe=we(ie.traders_l_s),Re=Ye=>{var at,He;const dt=parseFloat((at=Ye==null?void 0:Ye.asset_change24h)==null?void 0:at.markPx),st=parseFloat((He=Ye==null?void 0:Ye.asset_change24h)==null?void 0:He.prevDayPx);return!dt||!st||isNaN(dt)||isNaN(st)||st===0?-1/0:(dt-st)/st*100},Qe=Ye=>{var st;const dt=parseFloat((st=Ye==null?void 0:Ye.asset_change24h)==null?void 0:st.markPx);return isNaN(dt)?0:dt};return q==="asset"?oe<K?-1:oe>K?1:0:q==="-asset"?oe>K?-1:oe<K?1:0:q==="-total_notional"?ie.total_notional-G.total_notional:q==="total_notional"?G.total_notional-ie.total_notional:q==="-price"?Qe(ie)-Qe(G):q==="price"?Qe(G)-Qe(ie):q==="-long_notional"?ie.long_notional-G.long_notional:q==="long_notional"?G.long_notional-ie.long_notional:q==="-short_notional"?ie.short_notional-G.short_notional:q==="short_notional"?G.short_notional-ie.short_notional:q==="-total_long_pnl"?ie.total_long_pnl-G.total_long_pnl:q==="total_long_pnl"?G.total_long_pnl-ie.total_long_pnl:q==="-total_short_pnl"?ie.total_short_pnl-G.total_short_pnl:q==="total_short_pnl"?G.total_short_pnl-ie.total_short_pnl:q==="-majority_side"?ee-H:q==="majority_side"?pe-se:q==="-l_s_ratio"?ie.l_s_ratio-G.l_s_ratio:q==="l_s_ratio"?G.l_s_ratio-ie.l_s_ratio:q==="-long_ratio"?ie.long_ratio-G.long_ratio:q==="long_ratio"?G.long_ratio-ie.long_ratio:q==="-short_ratio"?ie.short_ratio-G.short_ratio:q==="short_ratio"?G.short_ratio-ie.short_ratio:q==="-maj_side_notional"?ie.maj_side_notional-G.maj_side_notional:q==="maj_side_notional"?G.maj_side_notional-ie.maj_side_notional:q==="-maj_side_pnl"?ge-Se:q==="maj_side_pnl"?be-ve:q==="-traders_l_s"?Fe-je:q==="traders_l_s"?je-Fe:q==="-open_interest"?ie.open_interest-G.open_interest:q==="open_interest"?G.open_interest-ie.open_interest:q==="-change_24h"?Re(ie)-Re(G):q==="change_24h"?Re(G)-Re(ie):0})},C=h.useRef(null),S=()=>{C.current&&(C.current.scrollLeft-=100)},T=()=>{C.current&&(C.current.scrollLeft+=100)},I=()=>{C.current&&(C.current.scrollTop+=200)},L=()=>{C.current&&(C.current.scrollTop-=200)},F=q=>{var te;q.key==="Escape"&&(g(""),(te=y.current)==null||te.blur())},$=({coin:q,price:te,prevPricesRef:fe})=>{const[G,ie]=h.useState("text-white");return h.useEffect(()=>{if(!q||te==null||isNaN(te))return;const oe=parseFloat(te),K=fe.current[q]??0;oe>K?ie("text-[#1DE6A3]"):oe<K&&ie("text-[#FF7173]"),fe.current[q]=oe;const H=setTimeout(()=>{ie("text-white")},800);return()=>clearTimeout(H)},[te,q]),i.jsx(og,{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?m3(te):te}`,textColor:G})},O={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},U=()=>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"})}),Y=q=>q>=376&&q<500?4:q>=500&&q<640?5:q>=640&&q<768?6:q>=768&&q<1024?7:q>=1024&&q<1280?9:q>=1280&&q<1540?11:q>=1540&&q<1700||q>=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(Bun,{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:q=>g(q.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:Na,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(bQ,{title:"All",set_click:()=>d("All"),tableSortButton:u}),i.jsx(bQ,{title:"LONG",set_click:()=>d("LONG"),tableSortButton:u}),i.jsx(bQ,{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:S,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(ro,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),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 block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(ro,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:L,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(ro,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:I,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(ro,{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:Y(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(ka,{})})})}):n&&!t.data?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Y(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(El,{})})})}):((re=t.data)==null?void 0:re.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Y(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(EVe,{})})})}):(Q=v(l))==null?void 0:Q.map((q,te)=>{var fe,G,ie,oe,K,H,ee,se,pe,Se,ge,ve,be,we,je,Fe,Re,Qe;return i.jsx(ke.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/${q==null?void 0:q.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/${O[q==null?void 0:q.asset]||((fe=q==null?void 0:q.asset)==null?void 0:fe.split("/")[0])}.svg`||dummyImage,alt:q==null?void 0:q.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5 bg-gray-700",loading:"lazy",onError:Ye=>wm(Ye)}),i.jsx(og,{info:q!=null&&q.asset?q==null?void 0:q.asset:"--",textColor:"text-white"}),i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:jm,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:`${q.majority_side=="LONG"?"text-[#67ffbd] bg-[#67ffbd]/20":q.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:q.majority_side=="LONG"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):q.majority_side=="SHORT"?i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"})})}),i.jsx("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:q.majority_side?q.majority_side:"--"})]})})}),i.jsx("td",{className:"px-1",children:i.jsx($,{coin:q==null?void 0:q.asset,price:(G=q==null?void 0:q.asset_change24h)==null?void 0:G.markPx,prevPricesRef:f})}),i.jsx("td",{className:"px-1",children:i.jsx(Uun,{info:((ie=q==null?void 0:q.asset_change24h)==null?void 0:ie.markPx)-((oe=q==null?void 0:q.asset_change24h)==null?void 0:oe.prevDayPx)?((K=q==null?void 0:q.asset_change24h)==null?void 0:K.markPx)-((H=q==null?void 0:q.asset_change24h)==null?void 0:H.prevDayPx)>0?"+"+Math.abs(parseFloat(((ee=q==null?void 0:q.asset_change24h)==null?void 0:ee.markPx)-((se=q==null?void 0:q.asset_change24h)==null?void 0:se.prevDayPx)).toFixed(5)):"-"+Math.abs(parseFloat(((pe=q==null?void 0:q.asset_change24h)==null?void 0:pe.markPx)-((Se=q==null?void 0:q.asset_change24h)==null?void 0:Se.prevDayPx)).toFixed(5)):U(),info_2:(((ge=q==null?void 0:q.asset_change24h)==null?void 0:ge.markPx)-((ve=q==null?void 0:q.asset_change24h)==null?void 0:ve.prevDayPx))/((be=q==null?void 0:q.asset_change24h)==null?void 0:be.prevDayPx)*100,color_1:`${((we=q==null?void 0:q.asset_change24h)==null?void 0:we.markPx)-((je=q==null?void 0:q.asset_change24h)==null?void 0:je.prevDayPx)>=0?"text-[#1DE6A3]":"text-[#FF7173]"}`,color_2:`${(((Fe=q==null?void 0:q.asset_change24h)==null?void 0:Fe.markPx)-((Re=q==null?void 0:q.asset_change24h)==null?void 0:Re.prevDayPx))/((Qe=q==null?void 0:q.asset_change24h)==null?void 0:Qe.prevDayPx)*100>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})}),i.jsx("td",{className:"px-1",children:i.jsx(og,{info:(q==null?void 0:q.total_long_pnl)==null||isNaN(parseFloat(q==null?void 0:q.total_long_pnl))?"--":`$${ad(Math.abs(q==null?void 0:q.total_long_pnl))}`,textColor:`${(q==null?void 0:q.total_long_pnl)==null||isNaN(parseFloat(q==null?void 0:q.total_long_pnl))||(q==null?void 0:q.total_long_pnl)==0?"text-white":(q==null?void 0:q.total_long_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})}),i.jsx("td",{className:"px-1",children:i.jsx(og,{info:(q==null?void 0:q.total_short_pnl)==null||isNaN(parseFloat(q==null?void 0:q.total_short_pnl))?"--":`$${ad(Math.abs(q==null?void 0:q.total_short_pnl))}`,textColor:`${(q==null?void 0:q.total_short_pnl)==null||isNaN(parseFloat(q==null?void 0:q.total_short_pnl))||(q==null?void 0:q.total_short_pnl)==0?"text-white":(q==null?void 0:q.total_short_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})}),i.jsx("td",{className:"px-1",children:i.jsx(og,{info:(q==null?void 0:q.long_notional)==null||isNaN(parseFloat(q==null?void 0:q.long_notional))?"--":`$${ad(q==null?void 0:q.long_notional)}`,textColor:"text-white"})}),i.jsx("td",{className:"px-1",children:i.jsx(og,{info:(q==null?void 0:q.short_notional)==null||isNaN(parseFloat(q==null?void 0:q.short_notional))?"--":`$${ad(q==null?void 0:q.short_notional)}`,textColor:"text-white"})}),i.jsx("td",{className:"px-1",children:i.jsx(og,{info:(q==null?void 0:q.total_notional)==null||isNaN(parseFloat(q==null?void 0:q.total_notional))?"--":`$${ad(q==null?void 0:q.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(gse,{data_1:q!=null&&q.long_ratio?parseFloat(q==null?void 0:q.long_ratio).toFixed(2):0,data_2:q!=null&&q.short_ratio?parseFloat(q==null?void 0:q.short_ratio).toFixed(2):0,margin:"false"})})})}),i.jsx("td",{className:"px-1",children:i.jsx(og,{info:q!=null&&q.traders_l_s?q==null?void 0:q.traders_l_s:"--",textColor:"text-white"})}),i.jsx("td",{className:"pr-4",children:i.jsx(og,{info:(q==null?void 0:q.open_interest)==null||isNaN(parseFloat(q==null?void 0:q.open_interest))?"--":`$${ad(q==null?void 0:q.open_interest)}`,textColor:"text-white"})})]})},te)})})]})})]})]})})},og=({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})}),Uun=({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})}),bQ=({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}),zun=()=>{ds();const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setIsWhitelist:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setHyperToken:c,setHyperAddress:u,hyperToken:d}=h.useContext(Qr),[f,x]=h.useState([]),[g,y]=h.useState(!1),[v,C]=h.useState(null),S=[{index:0,name:"1D",value:1},{index:1,name:"7D",value:7},{index:2,name:"30D",value:30},{index:3,name:"90D",value:90}],T=parseInt(localStorage.getItem("ticker_period")),I=!isNaN(T)&&S[T]?S[T].value:S[1].value,[L,F]=h.useState(I),$=U=>{F(Number(U)),localStorage.setItem("ticker_period",S.findIndex(Y=>Y.value===Number(U)).toFixed(0))},O=async()=>{try{y(!0);const Y=await fetch("https://dextradata.nftinit.io/api/hyper/analytics_v2/",{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}});if(!Y.ok)throw new Error("Network response was not ok");const re=await Y.json();re!=null&&re.success?(x(re),y(!1)):(y(!1),C(re==null?void 0:re.error_message),console.error("Error fetching analytics data:",re==null?void 0:re.error_message))}catch(U){setError(U.message),y(!1),console.error("Error fetching analytics data:",U)}finally{y(!1)}};return h.useEffect(()=>{O()},[]),h.useEffect(()=>{const U=new WebSocket("wss://api-ui.hyperliquid.xyz/ws");U.onopen=()=>{U.send(JSON.stringify({method:"subscribe",subscription:{type:"webData2",user:"0x0000000000000000000000000000000000000000"}}))},U.onmessage=Q=>{var te;const q=JSON.parse(Q==null?void 0:Q.data);if(q.channel==="webData2"){const fe=q.data,G=fe.assetCtxs,ie=(te=fe.meta)==null?void 0:te.universe;if(Array.isArray(G)&&Array.isArray(ie)){const oe=G.map((K,H)=>{var ee;return{...K,name:((ee=ie[H])==null?void 0:ee.name)??null}});x(K=>{if(!K||!Array.isArray(K.data))return K;const H=K.data.map(ee=>{const se=oe.find(pe=>pe.name===ee.asset);return se?{...ee,asset_change24h:se}:ee});return{...K,data:H}})}else console.error("missing assetCtxs or universe:",{assetCtxs:G,universe:ie})}};const Y=()=>{U.readyState===WebSocket.OPEN&&U.send(JSON.stringify({method:"unsubscribe",subscription:{type:"webData2",user:"0x0000000000000000000000000000000000000000"}})),U.close()},re=()=>{Y(),window.removeEventListener("beforeunload",Y)};return window.addEventListener("beforeunload",Y),re},[]),h.useEffect(()=>{(async()=>{var Q,q;const Y=window.localStorage.getItem("hyperToken"),re=window.localStorage.getItem("hyperAddress");if(!(!Y||!re))try{const te=await bi(re.toLowerCase(),Y);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((Q=te==null?void 0:te.mushboomer_counts)==null?void 0:Q.eth),a((q=te==null?void 0:te.mushboomer_counts)==null?void 0:q.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(za,{children:i.jsx(Va,{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($un,{data:f,loading:g,error:v,period:L,periods:S,handlePeriodChange:$})})})]})},Bde=h.createContext({});function $de(t){const e=h.useRef(null);return e.current===null&&(e.current=t()),e.current}const Ude=typeof window<"u",rWe=Ude?h.useLayoutEffect:h.useEffect,_z=h.createContext(null),DF=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Hun(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 Vun=40;function sWe(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=DF.reduce((I,L)=>(I[L]=Hun(a),I),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:x,render:g,postRender:y}=o,v=()=>{const I=Bc.useManualTiming?s.timestamp:performance.now();n=!1,Bc.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(I-s.timestamp,Vun),1)),s.timestamp=I,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:DF.reduce((I,L)=>{const F=o[L];return I[L]=($,O=!1,U=!1)=>(n||C(),F.schedule($,O,U)),I},{}),cancel:I=>{for(let L=0;L<DF.length;L++)o[DF[L]].cancel(I)},state:s,steps:o}}const{schedule:Uo,cancel:m2,state:tu,steps:yQ}=sWe(typeof requestAnimationFrame<"u"?requestAnimationFrame:fl,!0);let PM;function Wun(){PM=void 0}const cf={now:()=>(PM===void 0&&cf.set(tu.isProcessing||Bc.useManualTiming?tu.timestamp:performance.now()),PM),set:t=>{PM=t,queueMicrotask(Wun)}},iWe=t=>e=>typeof e=="string"&&e.startsWith(t),zde=iWe("--"),qun=iWe("var(--"),Hde=t=>qun(t)?Gun.test(t.split("/*")[0].trim()):!1,Gun=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,$8={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ik={...$8,transform:t=>Dc(0,1,t)},BF={...$8,default:1},J_=t=>Math.round(t*1e5)/1e5,Vde=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Kun(t){return t==null}const Yun=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Wde=(t,e)=>n=>!!(typeof n=="string"&&Yun.test(n)&&n.startsWith(t)||e&&!Kun(n)&&Object.prototype.hasOwnProperty.call(n,e)),aWe=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,a,o,l]=r.match(Vde);return{[t]:parseFloat(s),[e]:parseFloat(a),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},Xun=t=>Dc(0,255,t),vQ={...$8,transform:t=>Math.round(Xun(t))},Fw={test:Wde("rgb","red"),parse:aWe("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+vQ.transform(t)+", "+vQ.transform(e)+", "+vQ.transform(n)+", "+J_(Ik.transform(r))+")"};function Qun(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 bse={test:Wde("#"),parse:Qun,transform:Fw.transform},uP=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Hb=uP("deg"),nx=uP("%"),fi=uP("px"),Zun=uP("vh"),Jun=uP("vw"),ONe={...nx,parse:t=>nx.parse(t)/100,transform:t=>nx.transform(t*100)},x4={test:Wde("hsl","hue"),parse:aWe("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+nx.transform(J_(e))+", "+nx.transform(J_(n))+", "+J_(Ik.transform(r))+")"},Hl={test:t=>Fw.test(t)||bse.test(t)||x4.test(t),parse:t=>Fw.test(t)?Fw.parse(t):x4.test(t)?x4.parse(t):bse.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Fw.transform(t):x4.transform(t),getAnimatableNone:t=>{const e=Hl.parse(t);return e.alpha=0,Hl.transform(e)}},edn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function tdn(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Vde))==null?void 0:e.length)||0)+(((n=t.match(edn))==null?void 0:n.length)||0)>0}const oWe="number",lWe="color",ndn="var",rdn="var(",MNe="${}",sdn=/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 Fk(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let a=0;const l=e.replace(sdn,c=>(Hl.test(c)?(r.color.push(a),s.push(lWe),n.push(Hl.parse(c))):c.startsWith(rdn)?(r.var.push(a),s.push(ndn),n.push(c)):(r.number.push(a),s.push(oWe),n.push(parseFloat(c))),++a,MNe)).split(MNe);return{values:n,split:l,indexes:r,types:s}}function cWe(t){return Fk(t).values}function uWe(t){const{split:e,types:n}=Fk(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===oWe?a+=J_(s[o]):l===lWe?a+=Hl.transform(s[o]):a+=s[o]}return a}}const idn=t=>typeof t=="number"?0:Hl.test(t)?Hl.getAnimatableNone(t):t;function adn(t){const e=cWe(t);return uWe(t)(e.map(idn))}const x2={test:tdn,parse:cWe,createTransformer:uWe,getAnimatableNone:adn};function wQ(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 odn({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=wQ(c,l,t+1/3),a=wQ(c,l,t),o=wQ(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function rB(t,e){return n=>n>0?e:t}const Ko=(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)},ldn=[bse,Fw,x4],cdn=t=>ldn.find(e=>e.test(t));function LNe(t){const e=cdn(t);if(!e)return!1;let n=e.parse(t);return e===x4&&(n=odn(n)),n}const RNe=(t,e)=>{const n=LNe(t),r=LNe(e);if(!n||!r)return rB(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=Ko(n.alpha,r.alpha,a),Fw.transform(s))},yse=new Set(["none","hidden"]);function udn(t,e){return yse.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function ddn(t,e){return n=>Ko(t,e,n)}function qde(t){return typeof t=="number"?ddn:typeof t=="string"?Hde(t)?rB:Hl.test(t)?RNe:pdn:Array.isArray(t)?dWe:typeof t=="object"?Hl.test(t)?RNe:fdn:rB}function dWe(t,e){const n=[...t],r=n.length,s=t.map((a,o)=>qde(a)(a,e[o]));return a=>{for(let o=0;o<r;o++)n[o]=s[o](a);return n}}function fdn(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=qde(t[s])(t[s],e[s]));return s=>{for(const a in r)n[a]=r[a](s);return n}}function hdn(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 pdn=(t,e)=>{const n=x2.createTransformer(e),r=Fk(t),s=Fk(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?yse.has(t)&&!s.values.length||yse.has(e)&&!r.values.length?udn(t,e):Cx(dWe(hdn(r,s),s.values),n):rB(t,e)};function fWe(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Ko(t,e,n):qde(t)(t,e)}const mdn=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Uo.update(e,n),stop:()=>m2(e),now:()=>tu.isProcessing?tu.timestamp:cf.now()}},hWe=(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)})`},sB=2e4;function Gde(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<sB;)e+=n,r=t.next(e);return e>=sB?1/0:e}function xdn(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(Gde(r),sB);return{type:"keyframes",ease:a=>r.next(s*a).value/e,duration:cl(s)}}const gdn=5;function pWe(t,e,n){const r=Math.max(e-gdn,0);return JB(n-t(r),e-r)}const al={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},DNe=.001;function bdn({duration:t=al.duration,bounce:e=al.bounce,velocity:n=al.velocity,mass:r=al.mass}){let s,a,o=1-e;o=Dc(al.minDamping,al.maxDamping,o),t=Dc(al.minDuration,al.maxDuration,cl(t)),o<1?(s=u=>{const d=u*o,f=d*t,x=d-n,g=vse(u,o),y=Math.exp(-f);return DNe-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=vse(Math.pow(u,2),o);return(-s(u)+DNe>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=vdn(s,a,l);if(t=Gl(t),isNaN(c))return{stiffness:al.stiffness,damping:al.damping,duration:t};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const ydn=12;function vdn(t,e,n){let r=n;for(let s=1;s<ydn;s++)r=r-t(r)/e(r);return r}function vse(t,e){return t*Math.sqrt(1-e*e)}const wdn=["duration","bounce"],Cdn=["stiffness","damping","mass"];function BNe(t,e){return e.some(n=>t[n]!==void 0)}function Ndn(t){let e={velocity:al.velocity,stiffness:al.stiffness,damping:al.damping,mass:al.mass,isResolvedFromDuration:!1,...t};if(!BNe(t,Cdn)&&BNe(t,wdn))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,a=2*Dc(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:al.mass,stiffness:s,damping:a}}else{const n=bdn(t);e={...e,...n,mass:al.mass},e.isResolvedFromDuration=!0}return e}function iB(t=al.visualDuration,e=al.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}=Ndn({...n,velocity:-cl(n.velocity||0)}),y=x||0,v=u/(2*Math.sqrt(c*d)),C=o-a,S=cl(Math.sqrt(c/d)),T=Math.abs(C)<5;r||(r=T?al.restSpeed.granular:al.restSpeed.default),s||(s=T?al.restDelta.granular:al.restDelta.default);let I;if(v<1){const F=vse(S,v);I=$=>{const O=Math.exp(-v*S*$);return o-O*((y+v*S*C)/F*Math.sin(F*$)+C*Math.cos(F*$))}}else if(v===1)I=F=>o-Math.exp(-S*F)*(C+(y+S*C)*F);else{const F=S*Math.sqrt(v*v-1);I=$=>{const O=Math.exp(-v*S*$),U=Math.min(F*$,300);return o-O*((y+v*S*C)*Math.sinh(U)+F*C*Math.cosh(U))/F}}const L={calculatedDuration:g&&f||null,next:F=>{const $=I(F);if(g)l.done=F>=f;else{let O=F===0?y:0;v<1&&(O=F===0?Gl(y):pWe(I,F,$));const U=Math.abs(O)<=r,Y=Math.abs(o-$)<=s;l.done=U&&Y}return l.value=l.done?o:$,l},toString:()=>{const F=Math.min(Gde(L),sB),$=hWe(O=>L.next(F*O).value,F,30);return F+"ms "+$},toTransition:()=>{}};return L}iB.applyToOptions=t=>{const e=xdn(t,100,iB);return t.ease=e.ease,t.duration=Gl(e.duration),t.type="keyframes",t};function wse({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=U=>l!==void 0&&U<l||c!==void 0&&U>c,y=U=>l===void 0?c:c===void 0||Math.abs(l-U)<Math.abs(c-U)?l:c;let v=n*e;const C=f+v,S=o===void 0?C:o(C);S!==C&&(v=S-f);const T=U=>-v*Math.exp(-U/r),I=U=>S+T(U),L=U=>{const Y=T(U),re=I(U);x.done=Math.abs(Y)<=u,x.value=x.done?S:re};let F,$;const O=U=>{g(x.value)&&(F=U,$=iB({keyframes:[x.value,y(x.value)],velocity:pWe(I,U,x.value),damping:s,stiffness:a,restDelta:u,restSpeed:d}))};return O(0),{calculatedDuration:null,next:U=>{let Y=!1;return!$&&F===void 0&&(Y=!0,L(U),O(U)),F!==void 0&&U>=F?$.next(U-F):(!Y&&L(U),x)}}}function Sdn(t,e,n){const r=[],s=n||Bc.mix||fWe,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]||fl:e;l=Cx(c,l)}r.push(l)}return r}function jdn(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const a=t.length;if(nS(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=Sdn(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=ax(t[f],t[f+1],d);return l[f](x)};return n?d=>u(Dc(t[0],t[a-1],d)):u}function Adn(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=ax(0,e,r);t.push(Ko(n,1,s))}}function _dn(t){const e=[0];return Adn(e,t.length-1),e}function Edn(t,e){return t.map(n=>n*e)}function kdn(t,e){return t.map(()=>e||iae).splice(0,t.length-1)}function e9({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=C_e(r)?r.map(JM):JM(r),a={done:!1,value:e[0]},o=Edn(n&&n.length===e.length?n:_dn(e),t),l=jdn(o,e,{ease:Array.isArray(s)?s:kdn(e,s)});return{calculatedDuration:t,next:c=>(a.value=l(c),a.done=c>=t,a)}}const Tdn=t=>t!==null;function Kde(t,{repeat:e,repeatType:n="loop"},r,s=1){const a=t.filter(Tdn),l=s<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!l||r===void 0?a[l]:r}const Pdn={decay:wse,inertia:wse,tween:e9,keyframes:e9,spring:iB};function mWe(t){typeof t.type=="string"&&(t.type=Pdn[t.type])}class Yde{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 Idn=t=>t/100;class Xde extends Yde{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!==cf.now()&&this.tick(cf.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;mWe(e);const{type:n=e9,repeat:r=0,repeatDelay:s=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const c=n||e9;c!==e9&&typeof l[0]!="number"&&(this.mixKeyframes=Cx(Idn,fWe(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=Gde(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 S=this.currentTime-u*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?S<0:S>s;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let I=this.currentTime,L=r;if(f){const U=Math.min(this.currentTime,s)/l;let Y=Math.floor(U),re=U%1;!re&&U>=1&&(re=1),re===1&&Y--,Y=Math.min(Y,f+1),!!(Y%2)&&(x==="reverse"?(re=1-re,g&&(re-=g/l)):x==="mirror"&&(L=o)),I=Dc(0,1,re)*l}const F=T?{done:!1,value:d[0]}:L.next(I);a&&(F.value=a(F.value));let{done:$}=F;!T&&c!==null&&($=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return O&&y!==wse&&(F.value=Kde(d,this.options,C,this.speed)),v&&v(F.value),O&&this.finish(),F}then(e,n){return this.finished.then(e,n)}get duration(){return cl(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+cl(e)}get time(){return cl(this.currentTime)}set time(e){var n;e=Gl(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(cf.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=cl(this.currentTime))}play(){var s,a;if(this.isStopped)return;const{driver:e=mdn,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(cf.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 Fdn(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Ow=t=>t*180/Math.PI,Cse=t=>{const e=Ow(Math.atan2(t[1],t[0]));return Nse(e)},Odn={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Cse,rotateZ:Cse,skewX:t=>Ow(Math.atan(t[1])),skewY:t=>Ow(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Nse=t=>(t=t%360,t<0&&(t+=360),t),$Ne=Cse,UNe=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),zNe=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Mdn={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:UNe,scaleY:zNe,scale:t=>(UNe(t)+zNe(t))/2,rotateX:t=>Nse(Ow(Math.atan2(t[6],t[5]))),rotateY:t=>Nse(Ow(Math.atan2(-t[2],t[0]))),rotateZ:$Ne,rotate:$Ne,skewX:t=>Ow(Math.atan(t[4])),skewY:t=>Ow(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Sse(t){return t.includes("scale")?1:0}function jse(t,e){if(!t||t==="none")return Sse(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=Mdn,s=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Odn,s=l}if(!s)return Sse(e);const a=r[e],o=s[1].split(",").map(Rdn);return typeof a=="function"?a(o):o[a]}const Ldn=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return jse(n,e)};function Rdn(t){return parseFloat(t.trim())}const U8=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],z8=new Set(U8),HNe=t=>t===$8||t===fi,Ddn=new Set(["x","y","z"]),Bdn=U8.filter(t=>!Ddn.has(t));function $dn(t){const e=[];return Bdn.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const F3={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})=>jse(e,"x"),y:(t,{transform:e})=>jse(e,"y")};F3.translateX=F3.x;F3.translateY=F3.y;const O3=new Set;let Ase=!1,_se=!1,Ese=!1;function xWe(){if(_se){const t=Array.from(O3).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=$dn(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)})}_se=!1,Ase=!1,O3.forEach(t=>t.complete(Ese)),O3.clear()}function gWe(){O3.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(_se=!0)})}function Udn(){Ese=!0,gWe(),xWe(),Ese=!1}class Qde{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?(O3.add(this),Ase||(Ase=!0,Uo.read(gWe),Uo.resolveKeyframes(xWe))):(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])}Fdn(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),O3.delete(this)}cancel(){this.state==="scheduled"&&(O3.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const zdn=t=>t.startsWith("--");function Hdn(t,e,n){zdn(e)?t.style.setProperty(e,n):t.style[e]=n}const Vdn=$j(()=>window.ScrollTimeline!==void 0),Wdn={};function qdn(t,e){const n=$j(t);return()=>Wdn[e]??n()}const bWe=qdn(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),b_=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,VNe={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:b_([0,.65,.55,1]),circOut:b_([.55,0,1,.45]),backIn:b_([.31,.01,.66,-.59]),backOut:b_([.33,1.53,.69,.99])};function yWe(t,e){if(t)return typeof t=="function"?bWe()?hWe(t,e):"ease-out":aae(t)?b_(t):Array.isArray(t)?t.map(n=>yWe(n,e)||VNe.easeOut):VNe[t]}function Gdn(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=yWe(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 vWe(t){return typeof t=="function"&&"applyToOptions"in t}function Kdn({type:t,...e}){return vWe(t)&&bWe()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Ydn extends Yde{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,nS(typeof e.type!="string");const u=Kdn(e);this.animation=Gdn(n,r,s,u,a),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const d=Kde(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):Hdn(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 cl(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+cl(e)}get time(){return cl(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Gl(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&&Vdn()?(this.animation.timeline=e,fl):n(this)}}const wWe={anticipate:tae,backInOut:eae,circInOut:sae};function Xdn(t){return t in wWe}function Qdn(t){typeof t.ease=="string"&&Xdn(t.ease)&&(t.ease=wWe[t.ease])}const WNe=10;class Zdn extends Ydn{constructor(e){Qdn(e),mWe(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 Xde({...o,autoplay:!1}),c=Gl(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-WNe).value,l.sample(c).value,WNe),l.stop()}}const qNe=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(x2.test(t)||t==="0")&&!t.startsWith("url("));function Jdn(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 efn(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=qNe(s,e),l=qNe(a,e);return!o||!l?!1:Jdn(t)||(n==="spring"||vWe(n))&&r}function kse(t){t.duration=0,t.type="keyframes"}const tfn=new Set(["opacity","clipPath","filter","transform"]),nfn=$j(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function rfn(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 nfn()&&n&&tfn.has(n)&&(n!=="transform"||!u)&&!c&&!r&&s!=="mirror"&&a!==0&&o!=="inertia"}const sfn=40;class ifn extends Yde{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=cf.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)||Qde;this.keyframeResolver=new g(l,(v,C,S)=>this.onKeyframesResolved(v,C,x,!S),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=cf.now(),efn(e,a,o,l)||((Bc.instantAnimations||!c)&&(d==null||d(Kde(e,r,n))),e[0]=e[e.length-1],kse(r),r.repeat=0);const x={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>sfn?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},g=!u&&rfn(x)?new Zdn({...x,element:x.motionValue.owner.current}):new Xde(x);g.finished.then(()=>this.notifyFinished()).catch(fl),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(),Udn()),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 afn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ofn(t){const e=afn.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function CWe(t,e,n=1){const[r,s]=ofn(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const o=a.trim();return XB(o)?parseFloat(o):o}return Hde(s)?CWe(s,e,n+1):s}function Zde(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const NWe=new Set(["width","height","top","left","right","bottom",...U8]),lfn={test:t=>t==="auto",parse:t=>t},SWe=t=>e=>e.test(t),jWe=[$8,fi,nx,Hb,Jun,Zun,lfn],GNe=t=>jWe.find(SWe(t));function cfn(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||ZB(t):!0}const ufn=new Set(["brightness","contrast","saturate","opacity"]);function dfn(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Vde)||[];if(!r)return t;const s=n.replace(r,"");let a=ufn.has(e)?1:0;return r!==n&&(a*=100),e+"("+a+s+")"}const ffn=/\b([a-z-]*)\(.*?\)/gu,Tse={...x2,getAnimatableNone:t=>{const e=t.match(ffn);return e?e.map(dfn).join(" "):t}},KNe={...$8,transform:Math.round},hfn={rotate:Hb,rotateX:Hb,rotateY:Hb,rotateZ:Hb,scale:BF,scaleX:BF,scaleY:BF,scaleZ:BF,skew:Hb,skewX:Hb,skewY:Hb,distance:fi,translateX:fi,translateY:fi,translateZ:fi,x:fi,y:fi,z:fi,perspective:fi,transformPerspective:fi,opacity:Ik,originX:ONe,originY:ONe,originZ:fi},Jde={borderWidth:fi,borderTopWidth:fi,borderRightWidth:fi,borderBottomWidth:fi,borderLeftWidth:fi,borderRadius:fi,radius:fi,borderTopLeftRadius:fi,borderTopRightRadius:fi,borderBottomRightRadius:fi,borderBottomLeftRadius:fi,width:fi,maxWidth:fi,height:fi,maxHeight:fi,top:fi,right:fi,bottom:fi,left:fi,padding:fi,paddingTop:fi,paddingRight:fi,paddingBottom:fi,paddingLeft:fi,margin:fi,marginTop:fi,marginRight:fi,marginBottom:fi,marginLeft:fi,backgroundPositionX:fi,backgroundPositionY:fi,...hfn,zIndex:KNe,fillOpacity:Ik,strokeOpacity:Ik,numOctaves:KNe},pfn={...Jde,color:Hl,backgroundColor:Hl,outlineColor:Hl,fill:Hl,stroke:Hl,borderColor:Hl,borderTopColor:Hl,borderRightColor:Hl,borderBottomColor:Hl,borderLeftColor:Hl,filter:Tse,WebkitFilter:Tse},AWe=t=>pfn[t];function _We(t,e){let n=AWe(t);return n!==Tse&&(n=x2),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const mfn=new Set(["auto","none","0"]);function xfn(t,e,n){let r=0,s;for(;r<t.length&&!s;){const a=t[r];typeof a=="string"&&!mfn.has(a)&&Fk(a).values.length&&(s=t[r]),r++}if(s&&n)for(const a of e)t[a]=_We(n,s)}class gfn extends Qde{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(),Hde(u))){const d=CWe(u,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!NWe.has(r)||e.length!==2)return;const[s,a]=e,o=GNe(s),l=GNe(a);if(o!==l)if(HNe(o)&&HNe(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else F3[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||cfn(e[s]))&&r.push(s);r.length&&xfn(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=F3[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]=F3[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 bfn(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 EWe=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function kWe(t){return QB(t)&&"offsetHeight"in t}const YNe=30,yfn=t=>!isNaN(parseFloat(t));class vfn{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var a;const s=cf.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=cf.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=yfn(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 Uj);const r=this.events[e].add(n);return e==="change"?()=>{r(),Uo.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=cf.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>YNe)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,YNe);return JB(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 Nj(t,e){return new vfn(t,e)}const{schedule:efe,cancel:uNn}=sWe(queueMicrotask,!1),Vp={x:!1,y:!1};function TWe(){return Vp.x||Vp.y}function wfn(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 PWe(t,e){const n=bfn(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function XNe(t){return!(t.pointerType==="touch"||TWe())}function Cfn(t,e,n={}){const[r,s,a]=PWe(t,n),o=l=>{if(!XNe(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=f=>{XNe(f)&&(u(f),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),a}const IWe=(t,e)=>e?t===e?!0:IWe(t,e.parentElement):!1,tfe=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Nfn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Sfn(t){return Nfn.has(t.tagName)||t.tabIndex!==-1}const IM=new WeakSet;function QNe(t){return e=>{e.key==="Enter"&&t(e)}}function NQ(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const jfn=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=QNe(()=>{if(IM.has(n))return;NQ(n,"down");const s=QNe(()=>{NQ(n,"up")}),a=()=>NQ(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 ZNe(t){return tfe(t)&&!TWe()}function Afn(t,e,n={}){const[r,s,a]=PWe(t,n),o=l=>{const c=l.currentTarget;if(!ZNe(l))return;IM.add(c);const u=e(c,l),d=(g,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",x),IM.has(c)&&IM.delete(c),ZNe(g)&&typeof u=="function"&&u(g,{success:y})},f=g=>{d(g,c===window||c===document||n.useGlobalTarget||IWe(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),kWe(l)&&(l.addEventListener("focus",u=>jfn(u,s)),!Sfn(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),a}function FWe(t){return QB(t)&&"ownerSVGElement"in t}function _fn(t){return FWe(t)&&t.tagName==="svg"}const $u=t=>!!(t&&t.getVelocity),Efn=[...jWe,Hl,x2],kfn=t=>Efn.find(SWe(t)),nfe=h.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function JNe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Tfn(...t){return e=>{let n=!1;const r=t.map(s=>{const a=JNe(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():JNe(t[s],null)}}}}function Pfn(...t){return h.useCallback(Tfn(...t),t)}class Ifn extends h.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=n.offsetParent,s=kWe(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 Ffn({children:t,isPresent:e,anchorX:n,root:r}){const s=h.useId(),a=h.useRef(null),o=h.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=h.useContext(nfe),c=Pfn(a,t==null?void 0:t.ref);return h.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(Ifn,{isPresent:e,childRef:a,sizeRef:o,children:h.cloneElement(t,{ref:c})})}const Ofn=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:a,mode:o,anchorX:l,root:c})=>{const u=$de(Mfn),d=h.useId();let f=!0,x=h.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}),h.useMemo(()=>{u.forEach((g,y)=>u.set(y,!1))},[n]),h.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),o==="popLayout"&&(t=i.jsx(Ffn,{isPresent:n,anchorX:l,root:c,children:t})),i.jsx(_z.Provider,{value:x,children:t})};function Mfn(){return new Map}function OWe(t=!0){const e=h.useContext(_z);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,a=h.useId();h.useEffect(()=>{if(t)return s(a)},[t]);const o=h.useCallback(()=>t&&r&&r(a),[a,r,t]);return!n&&r?[!1,o]:[!0]}const $F=t=>t.key||"";function eSe(t){const e=[];return h.Children.forEach(t,n=>{h.isValidElement(n)&&e.push(n)}),e}const dP=({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]=OWe(o),f=h.useMemo(()=>eSe(t),[t]),x=o&&!u?[]:f.map($F),g=h.useRef(!0),y=h.useRef(f),v=$de(()=>new Map),[C,S]=h.useState(f),[T,I]=h.useState(f);rWe(()=>{g.current=!1,y.current=f;for(let $=0;$<T.length;$++){const O=$F(T[$]);x.includes(O)?v.delete(O):v.get(O)!==!0&&v.set(O,!1)}},[T,x.length,x.join("-")]);const L=[];if(f!==C){let $=[...f];for(let O=0;O<T.length;O++){const U=T[O],Y=$F(U);x.includes(Y)||($.splice(O,0,U),L.push(U))}return a==="wait"&&L.length&&($=L),I(eSe($)),S(f),null}const{forceRender:F}=h.useContext(Bde);return i.jsx(i.Fragment,{children:T.map($=>{const O=$F($),U=o&&!u?!1:f===T||x.includes(O),Y=()=>{if(v.has(O))v.set(O,!0);else return;let re=!0;v.forEach(Q=>{Q||(re=!1)}),re&&(F==null||F(),I(y.current),o&&(d==null||d()),r&&r())};return i.jsx(Ofn,{isPresent:U,initial:!g.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:a,root:c,onExitComplete:U?void 0:Y,anchorX:l,children:$},O)})})},MWe=h.createContext({strict:!1}),tSe={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"]},Sj={};for(const t in tSe)Sj[t]={isEnabled:e=>tSe[t].some(n=>!!e[n])};function Lfn(t){for(const e in t)Sj[e]={...Sj[e],...t[e]}}const Rfn=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 aB(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Rfn.has(t)}let LWe=t=>!aB(t);function Dfn(t){typeof t=="function"&&(LWe=e=>e.startsWith("on")?!aB(e):t(e))}try{Dfn(require("@emotion/is-prop-valid").default)}catch{}function Bfn(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(LWe(s)||n===!0&&aB(s)||!e&&!aB(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const Ez=h.createContext({});function kz(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Ok(t){return typeof t=="string"||Array.isArray(t)}const rfe=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],sfe=["initial",...rfe];function Tz(t){return kz(t.animate)||sfe.some(e=>Ok(t[e]))}function RWe(t){return!!(Tz(t)||t.variants)}function $fn(t,e){if(Tz(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Ok(n)?n:void 0,animate:Ok(r)?r:void 0}}return t.inherit!==!1?e:{}}function Ufn(t){const{initial:e,animate:n}=$fn(t,h.useContext(Ez));return h.useMemo(()=>({initial:e,animate:n}),[nSe(e),nSe(n)])}function nSe(t){return Array.isArray(t)?t.join(" "):t}const Mk={};function zfn(t){for(const e in t)Mk[e]=t[e],zde(e)&&(Mk[e].isCSSVariable=!0)}function DWe(t,{layout:e,layoutId:n}){return z8.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Mk[t]||t==="opacity")}const Hfn={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Vfn=U8.length;function Wfn(t,e,n){let r="",s=!0;for(let a=0;a<Vfn;a++){const o=U8[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=EWe(l,Jde[o]);if(!c){s=!1;const d=Hfn[o]||o;r+=`${d}(${u}) `}n&&(e[o]=u)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function ife(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(z8.has(c)){o=!0;continue}else if(zde(c)){s[c]=u;continue}else{const d=EWe(u,Jde[c]);c.startsWith("origin")?(l=!0,a[c]=d):r[c]=d}}if(e.transform||(o||n?r.transform=Wfn(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 afe=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function BWe(t,e,n){for(const r in e)!$u(e[r])&&!DWe(r,n)&&(t[r]=e[r])}function qfn({transformTemplate:t},e){return h.useMemo(()=>{const n=afe();return ife(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Gfn(t,e){const n=t.style||{},r={};return BWe(r,n,t),Object.assign(r,qfn(t,e)),r}function Kfn(t,e){const n={},r=Gfn(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 Yfn={offset:"stroke-dashoffset",array:"stroke-dasharray"},Xfn={offset:"strokeDashoffset",array:"strokeDasharray"};function Qfn(t,e,n=1,r=0,s=!0){t.pathLength=1;const a=s?Yfn:Xfn;t[a.offset]=fi.transform(-r);const o=fi.transform(e),l=fi.transform(n);t[a.array]=`${o} ${l}`}function $We(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:a=1,pathOffset:o=0,...l},c,u,d){if(ife(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&&Qfn(f,s,a,o,!1)}const UWe=()=>({...afe(),attrs:{}}),zWe=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Zfn(t,e,n,r){const s=h.useMemo(()=>{const a=UWe();return $We(a,e,zWe(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};BWe(a,t.style,t),s.style={...a,...s.style}}return s}const Jfn=["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 ofe(t){return typeof t!="string"||t.includes("-")?!1:!!(Jfn.indexOf(t)>-1||/[A-Z]/u.test(t))}function ehn(t,e,n,{latestValues:r},s,a=!1){const l=(ofe(t)?Zfn:Kfn)(e,r,s,t),c=Bfn(e,typeof t=="string",a),u=t!==h.Fragment?{...c,...l,ref:n}:{},{children:d}=e,f=h.useMemo(()=>$u(d)?d.get():d,[d]);return h.createElement(t,{...u,children:f})}function rSe(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function lfe(t,e,n,r){if(typeof e=="function"){const[s,a]=rSe(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]=rSe(r);e=e(n!==void 0?n:t.custom,s,a)}return e}function FM(t){return $u(t)?t.get():t}function thn({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:nhn(n,r,s,t),renderState:e()}}function nhn(t,e,n,r){const s={},a=r(t,{});for(const x in a)s[x]=FM(a[x]);let{initial:o,animate:l}=t;const c=Tz(t),u=RWe(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"&&!kz(f)){const x=Array.isArray(f)?f:[f];for(let g=0;g<x.length;g++){const y=lfe(t,x[g]);if(y){const{transitionEnd:v,transition:C,...S}=y;for(const T in S){let I=S[T];if(Array.isArray(I)){const L=d?I.length-1:0;I=I[L]}I!==null&&(s[T]=I)}for(const T in v)s[T]=v[T]}}}return s}const HWe=t=>(e,n)=>{const r=h.useContext(Ez),s=h.useContext(_z),a=()=>thn(t,e,r,s);return n?a():$de(a)};function cfe(t,e,n){var a;const{style:r}=t,s={};for(const o in r)($u(r[o])||e.style&&$u(e.style[o])||DWe(o,t)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(s[o]=r[o]);return s}const rhn=HWe({scrapeMotionValuesFromProps:cfe,createRenderState:afe});function VWe(t,e,n){const r=cfe(t,e,n);for(const s in t)if($u(t[s])||$u(e[s])){const a=U8.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[a]=t[s]}return r}const shn=HWe({scrapeMotionValuesFromProps:VWe,createRenderState:UWe}),ihn=Symbol.for("motionComponentSymbol");function g4(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function ahn(t,e,n){return h.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):g4(n)&&(n.current=r))},[e])}const ufe=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ohn="framerAppearId",WWe="data-"+ufe(ohn),qWe=h.createContext({});function lhn(t,e,n,r,s){var v,C;const{visualElement:a}=h.useContext(Ez),o=h.useContext(MWe),l=h.useContext(_z),c=h.useContext(nfe).reducedMotion,u=h.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=h.useContext(qWe);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&chn(u.current,n,s,f);const x=h.useRef(!1);h.useInsertionEffect(()=>{d&&x.current&&d.update(n,l)});const g=n[WWe],y=h.useRef(!!g&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,g))&&((C=window.MotionHasOptimisedAnimation)==null?void 0:C.call(window,g)));return rWe(()=>{d&&(x.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),y.current&&d.animationState&&d.animationState.animateChanges())}),h.useEffect(()=>{d&&(!y.current&&d.animationState&&d.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var S;(S=window.MotionHandoffMarkAsComplete)==null||S.call(window,g)}),y.current=!1),d.enteringChildren=void 0)}),d}function chn(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:GWe(t.parent)),t.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!o||l&&g4(l),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:u})}function GWe(t){if(t)return t.options.allowProjection!==!1?t.projection:GWe(t.parent)}function SQ(t,{forwardMotionProps:e=!1}={},n,r){n&&Lfn(n);const s=ofe(t)?shn:rhn;function a(l,c){let u;const d={...h.useContext(nfe),...l,layoutId:uhn(l)},{isStatic:f}=d,x=Ufn(l),g=s(l,f);if(!f&&Ude){dhn();const y=fhn(d);u=y.MeasureLayout,x.visualElement=lhn(t,g,d,r,y.ProjectionNode)}return i.jsxs(Ez.Provider,{value:x,children:[u&&x.visualElement?i.jsx(u,{visualElement:x.visualElement,...d}):null,ehn(t,l,ahn(g,x.visualElement,c),g,f,e)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=h.forwardRef(a);return o[ihn]=t,o}function uhn({layoutId:t}){const e=h.useContext(Bde).id;return e&&t!==void 0?e+"-"+t:t}function dhn(t,e){h.useContext(MWe).strict}function fhn(t){const{drag:e,layout:n}=Sj;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 hhn(t,e){if(typeof Proxy>"u")return SQ;const n=new Map,r=(a,o)=>SQ(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,SQ(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 phn({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function mhn(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 jQ(t){return t===void 0||t===1}function Pse({scale:t,scaleX:e,scaleY:n}){return!jQ(t)||!jQ(e)||!jQ(n)}function tw(t){return Pse(t)||YWe(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function YWe(t){return sSe(t.x)||sSe(t.y)}function sSe(t){return t&&t!=="0%"}function oB(t,e,n){const r=t-n,s=e*r;return n+s}function iSe(t,e,n,r,s){return s!==void 0&&(t=oB(t,s,r)),oB(t,n,r)+e}function Ise(t,e=0,n=1,r,s){t.min=iSe(t.min,e,n,r,s),t.max=iSe(t.max,e,n,r,s)}function XWe(t,{x:e,y:n}){Ise(t.x,e.translate,e.scale,e.originPoint),Ise(t.y,n.translate,n.scale,n.originPoint)}const aSe=.999999999999,oSe=1.0000000000001;function xhn(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&&y4(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,XWe(t,o)),r&&tw(a.latestValues)&&y4(t,a.latestValues))}e.x<oSe&&e.x>aSe&&(e.x=1),e.y<oSe&&e.y>aSe&&(e.y=1)}function b4(t,e){t.min=t.min+e,t.max=t.max+e}function lSe(t,e,n,r,s=.5){const a=Ko(t.min,t.max,s);Ise(t,e,n,a,r)}function y4(t,e){lSe(t.x,e.x,e.scaleX,e.scale,e.originX),lSe(t.y,e.y,e.scaleY,e.scale,e.originY)}function QWe(t,e){return KWe(mhn(t.getBoundingClientRect(),e))}function ghn(t,e,n){const r=QWe(t,n),{scroll:s}=e;return s&&(b4(r.x,s.offset.x),b4(r.y,s.offset.y)),r}const cSe=()=>({translate:0,scale:1,origin:0,originPoint:0}),v4=()=>({x:cSe(),y:cSe()}),uSe=()=>({min:0,max:0}),wl=()=>({x:uSe(),y:uSe()}),Fse={current:null},ZWe={current:!1};function bhn(){if(ZWe.current=!0,!!Ude)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Fse.current=t.matches;t.addEventListener("change",e),e()}else Fse.current=!1}const yhn=new WeakMap;function vhn(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,Nj(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,Nj(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const dSe=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class whn{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=Qde,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=cf.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,Uo.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=Tz(n),this.isVariantNode=RWe(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,yhn.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)),ZWe.current||bhn(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Fse.current,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),m2(this.notifyUpdate),m2(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=z8.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Uo.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 Sj){const n=Sj[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):wl()}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<dSe.length;r++){const s=dSe[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=vhn(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=Nj(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"&&(XB(r)||ZB(r))?r=parseFloat(r):!kfn(r)&&x2.test(n)&&(r=_We(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=lfe(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 Uj),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){efe.render(this.render)}}class JWe extends whn{constructor(){super(...arguments),this.KeyframeResolver=gfn}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 eqe(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 Chn(t){return window.getComputedStyle(t)}class Nhn extends JWe{constructor(){super(...arguments),this.type="html",this.renderInstance=eqe}readValueFromInstance(e,n){var r;if(z8.has(n))return(r=this.projection)!=null&&r.isProjecting?Sse(n):Ldn(e,n);{const s=Chn(e),a=(zde(n)?s.getPropertyValue(n):s[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:n}){return QWe(e,n)}build(e,n,r){ife(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return cfe(e,n,r)}}const tqe=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 Shn(t,e,n,r){eqe(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(tqe.has(s)?s:ufe(s),e.attrs[s])}class jhn extends JWe{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=wl}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(z8.has(n)){const r=AWe(n);return r&&r.default||0}return n=tqe.has(n)?n:ufe(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return VWe(e,n,r)}build(e,n,r){$We(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){Shn(e,n,r,s)}mount(e){this.isSVGTag=zWe(e.tagName),super.mount(e)}}const Ahn=(t,e)=>ofe(t)?new jhn(e):new Nhn(e,{allowProjection:t!==h.Fragment});function G4(t,e,n){const r=t.getProps();return lfe(r,e,n!==void 0?n:r.custom,t)}const Ose=t=>Array.isArray(t);function _hn(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Nj(n))}function Ehn(t){return Ose(t)?t[t.length-1]||0:t}function khn(t,e){const n=G4(t,e);let{transitionEnd:r={},transition:s={},...a}=n||{};a={...a,...r};for(const o in a){const l=Ehn(a[o]);_hn(t,o,l)}}function Thn(t){return!!($u(t)&&t.add)}function Mse(t,e){const n=t.getValue("willChange");if(Thn(n))return n.add(e);if(!n&&Bc.WillChange){const r=new Bc.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function nqe(t){return t.props[WWe]}const Phn=t=>t!==null;function Ihn(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(Phn),a=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[a]}const Fhn={type:"spring",stiffness:500,damping:25,restSpeed:10},Ohn=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Mhn={type:"keyframes",duration:.8},Lhn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Rhn=(t,{keyframes:e})=>e.length>2?Mhn:z8.has(t)?t.startsWith("scale")?Ohn(e[1]):Fhn:Lhn;function Dhn({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 dfe=(t,e,n,r={},s,a)=>o=>{const l=Zde(r,t)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Gl(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};Dhn(l)||Object.assign(d,Rhn(t,d)),d.duration&&(d.duration=Gl(d.duration)),d.repeatDelay&&(d.repeatDelay=Gl(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(kse(d),d.delay===0&&(f=!0)),(Bc.instantAnimations||Bc.skipAnimations)&&(f=!0,kse(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!a&&e.get()!==void 0){const x=Ihn(d.keyframes,l);if(x!==void 0){Uo.update(()=>{d.onUpdate(x),d.onComplete()});return}}return l.isSync?new Xde(d):new ifn(d)};function Bhn({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function rqe(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&&Bhn(u,d))continue;const g={delay:n,...Zde(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 S=nqe(t);if(S){const T=window.MotionHandoffAnimation(S,d,Uo);T!==null&&(g.startTime=T,v=!0)}}Mse(t,d),f.start(dfe(d,f,x,t.shouldReduceMotion&&NWe.has(d)?{type:!1}:g,t,v));const C=f.animation;C&&c.push(C)}return o&&Promise.all(c).then(()=>{Uo.update(()=>{o&&khn(t,o)})}),c}function sqe(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 Lse(t,e,n={}){var c;const r=G4(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(rqe(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:x}=s;return $hn(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 $hn(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(Lse(c,e,{...o,delay:n+(typeof r=="function"?0:r)+sqe(t.variantChildren,c,r,s,a)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function Uhn(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(a=>Lse(t,a,n));r=Promise.all(s)}else if(typeof e=="string")r=Lse(t,e,n);else{const s=typeof e=="function"?G4(t,e,n.custom):e;r=Promise.all(rqe(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function iqe(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 zhn=sfe.length;function aqe(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?aqe(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<zhn;n++){const r=sfe[n],s=t.props[r];(Ok(s)||s===!1)&&(e[r]=s)}return e}const Hhn=[...rfe].reverse(),Vhn=rfe.length;function Whn(t){return e=>Promise.all(e.map(({animation:n,options:r})=>Uhn(t,n,r)))}function qhn(t){let e=Whn(t),n=fSe(),r=!0;const s=c=>(u,d)=>{var x;const f=G4(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=aqe(t.parent)||{},f=[],x=new Set;let g={},y=1/0;for(let C=0;C<Vhn;C++){const S=Hhn[C],T=n[S],I=u[S]!==void 0?u[S]:d[S],L=Ok(I),F=S===c?T.isActive:null;F===!1&&(y=C);let $=I===d[S]&&I!==u[S]&&L;if($&&r&&t.manuallyAnimateOnMount&&($=!1),T.protectedKeys={...g},!T.isActive&&F===null||!I&&!T.prevProp||kz(I)||typeof I=="boolean")continue;const O=Ghn(T.prevProp,I);let U=O||S===c&&T.isActive&&!$&&L||C>y&&L,Y=!1;const re=Array.isArray(I)?I:[I];let Q=re.reduce(s(S),{});F===!1&&(Q={});const{prevResolvedValues:q={}}=T,te={...q,...Q},fe=oe=>{U=!0,x.has(oe)&&(Y=!0,x.delete(oe)),T.needsAnimating[oe]=!0;const K=t.getValue(oe);K&&(K.liveStyle=!1)};for(const oe in te){const K=Q[oe],H=q[oe];if(g.hasOwnProperty(oe))continue;let ee=!1;Ose(K)&&Ose(H)?ee=!iqe(K,H):ee=K!==H,ee?K!=null?fe(oe):x.add(oe):K!==void 0&&x.has(oe)?fe(oe):T.protectedKeys[oe]=!0}T.prevProp=I,T.prevResolvedValues=Q,T.isActive&&(g={...g,...Q}),r&&t.blockInitialAnimation&&(U=!1);const G=$&&O;U&&(!G||Y)&&f.push(...re.map(oe=>{const K={type:S};if(typeof oe=="string"&&r&&!G&&t.manuallyAnimateOnMount&&t.parent){const{parent:H}=t,ee=G4(H,oe);if(H.enteringChildren&&ee){const{delayChildren:se}=ee.transition||{};K.delay=sqe(H.enteringChildren,t,se)}}return{animation:oe,options:K}}))}if(x.size){const C={};if(typeof u.initial!="boolean"){const S=G4(t,Array.isArray(u.initial)?u.initial[0]:u.initial);S&&S.transition&&(C.transition=S.transition)}x.forEach(S=>{const T=t.getBaseTarget(S),I=t.getValue(S);I&&(I.liveStyle=!0),C[S]=T??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=fSe()}}}function Ghn(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!iqe(e,t):!1}function Lv(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function fSe(){return{animate:Lv(!0),whileInView:Lv(),whileHover:Lv(),whileTap:Lv(),whileDrag:Lv(),whileFocus:Lv(),exit:Lv()}}class z2{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Khn extends z2{constructor(e){super(e),e.animationState||(e.animationState=qhn(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();kz(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 Yhn=0;class Xhn extends z2{constructor(){super(...arguments),this.id=Yhn++}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 Qhn={animation:{Feature:Khn},exit:{Feature:Xhn}};function Lk(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function fP(t){return{point:{x:t.pageX,y:t.pageY}}}const Zhn=t=>e=>tfe(e)&&t(e,fP(e));function t9(t,e,n,r){return Lk(t,e,Zhn(n),r)}const oqe=1e-4,Jhn=1-oqe,epn=1+oqe,lqe=.01,tpn=0-lqe,npn=0+lqe;function gd(t){return t.max-t.min}function rpn(t,e,n){return Math.abs(t-e)<=n}function hSe(t,e,n,r=.5){t.origin=r,t.originPoint=Ko(e.min,e.max,t.origin),t.scale=gd(n)/gd(e),t.translate=Ko(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Jhn&&t.scale<=epn||isNaN(t.scale))&&(t.scale=1),(t.translate>=tpn&&t.translate<=npn||isNaN(t.translate))&&(t.translate=0)}function n9(t,e,n,r){hSe(t.x,e.x,n.x,r?r.originX:void 0),hSe(t.y,e.y,n.y,r?r.originY:void 0)}function pSe(t,e,n){t.min=n.min+e.min,t.max=t.min+gd(e)}function spn(t,e,n){pSe(t.x,e.x,n.x),pSe(t.y,e.y,n.y)}function mSe(t,e,n){t.min=e.min-n.min,t.max=t.min+gd(e)}function r9(t,e,n){mSe(t.x,e.x,n.x),mSe(t.y,e.y,n.y)}function $h(t){return[t("x"),t("y")]}const cqe=({current:t})=>t?t.ownerDocument.defaultView:null,xSe=(t,e)=>Math.abs(t-e);function ipn(t,e){const n=xSe(t.x,e.x),r=xSe(t.y,e.y);return Math.sqrt(n**2+r**2)}class uqe{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=_Q(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,y=ipn(x.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!y)return;const{point:v}=x,{timestamp:C}=tu;this.history.push({...v,timestamp:C});const{onStart:S,onMove:T}=this.handlers;g||(S&&S(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,x)},this.handlePointerMove=(x,g)=>{this.lastMoveEvent=x,this.lastMoveEventInfo=AQ(g,this.transformPagePoint),Uo.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 S=_Q(x.type==="pointercancel"?this.lastMoveEventInfo:AQ(g,this.transformPagePoint),this.history);this.startEvent&&y&&y(x,S),v&&v(x,S)},!tfe(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=fP(e),c=AQ(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=tu;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(e,_Q(c,this.history)),this.removeListeners=Cx(t9(this.contextWindow,"pointermove",this.handlePointerMove),t9(this.contextWindow,"pointerup",this.handlePointerUp),t9(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),m2(this.updatePoint)}}function AQ(t,e){return e?{point:e(t.point)}:t}function gSe(t,e){return{x:t.x-e.x,y:t.y-e.y}}function _Q({point:t},e){return{point:t,delta:gSe(t,dqe(e)),offset:gSe(t,apn(e)),velocity:opn(e,.1)}}function apn(t){return t[0]}function dqe(t){return t[t.length-1]}function opn(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=dqe(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Gl(e)));)n--;if(!r)return{x:0,y:0};const a=cl(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 lpn(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Ko(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Ko(n,t,r.max):Math.min(t,n)),t}function bSe(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 cpn(t,{top:e,left:n,bottom:r,right:s}){return{x:bSe(t.x,n,s),y:bSe(t.y,e,r)}}function ySe(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 upn(t,e){return{x:ySe(t.x,e.x),y:ySe(t.y,e.y)}}function dpn(t,e){let n=.5;const r=gd(t),s=gd(e);return s>r?n=ax(e.min,e.max-r,t.min):r>s&&(n=ax(t.min,t.max-s,e.min)),Dc(0,1,n)}function fpn(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 Rse=.35;function hpn(t=Rse){return t===!1?t=0:t===!0&&(t=Rse),{x:vSe(t,"left","right"),y:vSe(t,"top","bottom")}}function vSe(t,e,n){return{min:wSe(t,e),max:wSe(t,n)}}function wSe(t,e){return typeof t=="number"?t:t[e]||0}const ppn=new WeakMap;class mpn{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=wl(),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(fP(f).point)},o=(f,x)=>{const{drag:g,dragPropagation:y,onDragStart:v}=this.getProps();if(g&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=wfn(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(S=>{let T=this.getAxisMotionValue(S).get()||0;if(nx.test(T)){const{projection:I}=this.visualElement;if(I&&I.layout){const L=I.layout.layoutBox[S];L&&(T=gd(L)*(parseFloat(T)/100))}}this.originPoint[S]=T}),v&&Uo.postRender(()=>v(f,x)),Mse(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:S}=x;if(y&&this.currentDirection===null){this.currentDirection=xpn(S),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",x.point,S),this.updateAxis("y",x.point,S),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 uqe(e,{onSessionStart:a,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:cqe(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&&Uo.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||!UF(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=lpn(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&&g4(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=cpn(r.layoutBox,e):this.constraints=!1,this.elastic=hpn(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&$h(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=fpn(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!g4(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=ghn(r,s.root,this.visualElement.getTransformPagePoint());let o=upn(s.layout.layoutBox,a);if(n){const l=n(phn(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(!UF(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 Mse(this.visualElement,e),r.start(dfe(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(!UF(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]-Ko(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!g4(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]=dpn({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(!UF(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Ko(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;ppn.set(this.visualElement,this);const e=this.visualElement.current,n=t9(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();g4(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()),Uo.read(r);const o=Lk(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=Rse,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:a,dragElastic:o,dragMomentum:l}}}function UF(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function xpn(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class gpn extends z2{constructor(e){super(e),this.removeGroupControls=fl,this.removeListeners=fl,this.controls=new mpn(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||fl}unmount(){this.removeGroupControls(),this.removeListeners()}}const CSe=t=>(e,n)=>{t&&Uo.postRender(()=>t(e,n))};class bpn extends z2{constructor(){super(...arguments),this.removePointerDownListener=fl}onPointerDown(e){this.session=new uqe(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cqe(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:CSe(e),onStart:CSe(n),onMove:r,onEnd:(a,o)=>{delete this.session,s&&Uo.postRender(()=>s(a,o))}}}mount(){this.removePointerDownListener=t9(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 OM={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function NSe(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const I7={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(fi.test(t))t=parseFloat(t);else return t;const n=NSe(t,e.target.x),r=NSe(t,e.target.y);return`${n}% ${r}%`}},ypn={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=x2.parse(t);if(s.length>5)return r;const a=x2.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=Ko(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 EQ=!1;class vpn extends h.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:a}=e;zfn(wpn),a&&(n.group&&n.group.add(a),r&&r.register&&s&&r.register(a),EQ&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),OM.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,EQ=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||Uo.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),efe.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;EQ=!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 fqe(t){const[e,n]=OWe(),r=h.useContext(Bde);return i.jsx(vpn,{...t,layoutGroup:r,switchLayoutGroup:h.useContext(qWe),isPresent:e,safeToRemove:n})}const wpn={borderRadius:{...I7,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:I7,borderTopRightRadius:I7,borderBottomLeftRadius:I7,borderBottomRightRadius:I7,boxShadow:ypn};function Cpn(t,e,n){const r=$u(t)?t:Nj(t);return r.start(dfe("",r,e,n)),r.animation}const Npn=(t,e)=>t.depth-e.depth;class Spn{constructor(){this.children=[],this.isDirty=!1}add(e){hT(this.children,e),this.isDirty=!0}remove(e){pT(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Npn),this.isDirty=!1,this.children.forEach(e)}}function jpn(t,e){const n=cf.now(),r=({timestamp:s})=>{const a=s-n;a>=e&&(m2(r),t(a-e))};return Uo.setup(r,!0),()=>m2(r)}const hqe=["TopLeft","TopRight","BottomLeft","BottomRight"],Apn=hqe.length,SSe=t=>typeof t=="string"?parseFloat(t):t,jSe=t=>typeof t=="number"||fi.test(t);function _pn(t,e,n,r,s,a){s?(t.opacity=Ko(0,n.opacity??1,Epn(r)),t.opacityExit=Ko(e.opacity??1,0,kpn(r))):a&&(t.opacity=Ko(e.opacity??1,n.opacity??1,r));for(let o=0;o<Apn;o++){const l=`border${hqe[o]}Radius`;let c=ASe(e,l),u=ASe(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||jSe(c)===jSe(u)?(t[l]=Math.max(Ko(SSe(c),SSe(u),r),0),(nx.test(u)||nx.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||n.rotate)&&(t.rotate=Ko(e.rotate||0,n.rotate||0,r))}function ASe(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Epn=pqe(0,.5,rae),kpn=pqe(.5,.95,fl);function pqe(t,e,n){return r=>r<t?0:r>e?1:n(ax(t,e,r))}function _Se(t,e){t.min=e.min,t.max=e.max}function Mh(t,e){_Se(t.x,e.x),_Se(t.y,e.y)}function ESe(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function kSe(t,e,n,r,s){return t-=e,t=oB(t,1/n,r),s!==void 0&&(t=oB(t,1/s,r)),t}function Tpn(t,e=0,n=1,r=.5,s,a=t,o=t){if(nx.test(e)&&(e=parseFloat(e),e=Ko(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=Ko(a.min,a.max,r);t===a&&(l-=e),t.min=kSe(t.min,e,n,l,s),t.max=kSe(t.max,e,n,l,s)}function TSe(t,e,[n,r,s],a,o){Tpn(t,e[n],e[r],e[s],e.scale,a,o)}const Ppn=["x","scaleX","originX"],Ipn=["y","scaleY","originY"];function PSe(t,e,n,r){TSe(t.x,e,Ppn,n?n.x:void 0,r?r.x:void 0),TSe(t.y,e,Ipn,n?n.y:void 0,r?r.y:void 0)}function ISe(t){return t.translate===0&&t.scale===1}function mqe(t){return ISe(t.x)&&ISe(t.y)}function FSe(t,e){return t.min===e.min&&t.max===e.max}function Fpn(t,e){return FSe(t.x,e.x)&&FSe(t.y,e.y)}function OSe(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function xqe(t,e){return OSe(t.x,e.x)&&OSe(t.y,e.y)}function MSe(t){return gd(t.x)/gd(t.y)}function LSe(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Opn{constructor(){this.members=[]}add(e){hT(this.members,e),e.scheduleRender()}remove(e){if(pT(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 Mpn(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 kQ=["","X","Y","Z"],Lpn=1e3;let Rpn=0;function TQ(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function gqe(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=nqe(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Uo,!(s||a))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&gqe(r)}function bqe({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=Rpn++,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($pn),this.nodes.forEach(Vpn),this.nodes.forEach(Wpn),this.nodes.forEach(Upn)},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 Spn)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Uj),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=FWe(o)&&!_fn(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;Uo.read(()=>{f=window.innerWidth}),t(o,()=>{const g=window.innerWidth;g!==f&&(f=g,this.root.updateBlockedByResize=!0,d&&d(),d=jpn(x,250),OM.hasAnimatedSinceResize&&(OM.hasAnimatedSinceResize=!1,this.nodes.forEach(BSe)))})}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()||Xpn,{onLayoutAnimationStart:v,onLayoutAnimationComplete:C}=u.getProps(),S=!this.targetLayout||!xqe(this.targetLayout,g),T=!f&&x;if(this.options.layoutRoot||this.resumeFrom||T||f&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const I={...Zde(y,"layout"),onPlay:v,onComplete:C};(u.shouldReduceMotion||this.options.layoutRoot)&&(I.delay=0,I.type=!1),this.startAnimation(I),this.setAnimationOrigin(d,T)}else f||BSe(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(),m2(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(qpn),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&&gqe(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(RSe);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(DSe);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Hpn),this.nodes.forEach(Dpn),this.nodes.forEach(Bpn)):this.nodes.forEach(DSe),this.clearAllSnapshots();const l=cf.now();tu.delta=Dc(0,1e3/60,l-tu.timestamp),tu.timestamp=l,tu.isProcessing=!0,yQ.update.process(tu),yQ.preRender.process(tu),yQ.render.process(tu),tu.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,efe.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(zpn),this.sharedNodes.forEach(Gpn)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Uo.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Uo.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!gd(this.snapshot.measuredBox.x)&&!gd(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=wl(),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&&!mqe(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||tw(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)),Qpn(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return wl();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(Zpn))){const{scroll:d}=this.root;d&&(b4(l.x,d.offset.x),b4(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=wl();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),b4(l.x,f.offset.x),b4(l.y,f.offset.y))}return l}applyTransform(o,l=!1){const c=wl();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&&y4(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),tw(d.latestValues)&&y4(c,d.latestValues)}return tw(this.latestValues)&&y4(c,this.latestValues),c}removeTransform(o){const l=wl();Mh(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!tw(u.latestValues))continue;Pse(u.latestValues)&&u.updateSnapshot();const d=wl(),f=u.measurePageBox();Mh(d,f),PSe(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return tw(this.latestValues)&&PSe(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!==tu.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=tu.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=wl(),this.relativeTargetOrigin=wl(),r9(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=wl(),this.targetWithTransforms=wl()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),spn(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Mh(this.target,this.layout.layoutBox),XWe(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=wl(),this.relativeTargetOrigin=wl(),r9(this.relativeTargetOrigin,this.target,g.target),Mh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Pse(this.parent.latestValues)||YWe(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===tu.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;xhn(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=wl());const{target:g}=o;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ESe(this.prevProjectionDelta.x,this.projectionDelta.x),ESe(this.prevProjectionDelta.y,this.projectionDelta.y)),n9(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==x||!LSe(this.projectionDelta.x,this.prevProjectionDelta.x)||!LSe(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=v4(),this.projectionDelta=v4(),this.projectionDeltaWithTransform=v4()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=v4();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const x=wl(),g=c?c.source:void 0,y=this.layout?this.layout.source:void 0,v=g!==y,C=this.getStack(),S=!C||C.members.length<=1,T=!!(v&&!S&&this.options.crossfade===!0&&!this.path.some(Ypn));this.animationProgress=0;let I;this.mixTargetDelta=L=>{const F=L/1e3;$Se(f.x,o.x,F),$Se(f.y,o.y,F),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(r9(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Kpn(this.relativeTarget,this.relativeTargetOrigin,x,F),I&&Fpn(this.relativeTarget,I)&&(this.isProjectionDirty=!1),I||(I=wl()),Mh(I,this.relativeTarget)),v&&(this.animationValues=d,_pn(d,u,this.latestValues,F,T,S)),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&&(m2(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Uo.update(()=>{OM.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Nj(0)),this.currentAnimation=Cpn(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(Lpn),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&&yqe(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||wl();const f=gd(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const x=gd(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+x}Mh(l,c),y4(l,d),n9(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Opn),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&&TQ("z",o,u,this.animationValues);for(let d=0;d<kQ.length;d++)TQ(`rotate${kQ[d]}`,o,u,this.animationValues),TQ(`skew${kQ[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=FM(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=FM(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!tw(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=Mpn(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 Mk){if(d[y]===void 0)continue;const{correct:v,applyTo:C,isCSSVariable:S}=Mk[y],T=f==="none"?d[y]:v(d[y],u);if(C){const I=C.length;for(let L=0;L<I;L++)o[C[L]]=T}else S?this.options.visualElement.renderState.vars[y]=T:o[y]=T}this.options.layoutId&&(o.pointerEvents=u===this?FM(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(RSe),this.root.sharedNodes.clear()}}}function Dpn(t){t.updateLayout()}function Bpn(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=gd(x);x.min=r[f].min,x.max=x.min+g}):yqe(a,e.layoutBox,r)&&$h(f=>{const x=o?e.measuredBox[f]:e.layoutBox[f],g=gd(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=v4();n9(l,r,e.layoutBox);const c=v4();o?n9(c,t.applyTransform(s,!0),e.measuredBox):n9(c,r,e.layoutBox);const u=!mqe(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=wl();r9(y,e.layoutBox,x.layoutBox);const v=wl();r9(v,r,g.layoutBox),xqe(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 $pn(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 Upn(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function zpn(t){t.clearSnapshot()}function RSe(t){t.clearMeasurements()}function DSe(t){t.isLayoutDirty=!1}function Hpn(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function BSe(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Vpn(t){t.resolveTargetDelta()}function Wpn(t){t.calcProjection()}function qpn(t){t.resetSkewAndRotation()}function Gpn(t){t.removeLeadSnapshot()}function $Se(t,e,n){t.translate=Ko(e.translate,0,n),t.scale=Ko(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function USe(t,e,n,r){t.min=Ko(e.min,n.min,r),t.max=Ko(e.max,n.max,r)}function Kpn(t,e,n,r){USe(t.x,e.x,n.x,r),USe(t.y,e.y,n.y,r)}function Ypn(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Xpn={duration:.45,ease:[.4,0,.1,1]},zSe=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),HSe=zSe("applewebkit/")&&!zSe("chrome/")?Math.round:fl;function VSe(t){t.min=HSe(t.min),t.max=HSe(t.max)}function Qpn(t){VSe(t.x),VSe(t.y)}function yqe(t,e,n){return t==="position"||t==="preserve-aspect"&&!rpn(MSe(e),MSe(n),.2)}function Zpn(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const Jpn=bqe({attachResizeListener:(t,e)=>Lk(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),PQ={current:void 0},vqe=bqe({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!PQ.current){const t=new Jpn({});t.mount(window),t.setOptions({layoutScroll:!0}),PQ.current=t}return PQ.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),emn={pan:{Feature:bpn},drag:{Feature:gpn,ProjectionNode:vqe,MeasureLayout:fqe}};function WSe(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&&Uo.postRender(()=>a(e,fP(e)))}class tmn extends z2{mount(){const{current:e}=this.node;e&&(this.unmount=Cfn(e,(n,r)=>(WSe(this.node,r,"Start"),s=>WSe(this.node,s,"End"))))}unmount(){}}class nmn extends z2{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=Cx(Lk(this.node.current,"focus",()=>this.onFocus()),Lk(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function qSe(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&&Uo.postRender(()=>a(e,fP(e)))}class rmn extends z2{mount(){const{current:e}=this.node;e&&(this.unmount=Afn(e,(n,r)=>(qSe(this.node,r,"Start"),(s,{success:a})=>qSe(this.node,s,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Dse=new WeakMap,IQ=new WeakMap,smn=t=>{const e=Dse.get(t.target);e&&e(t)},imn=t=>{t.forEach(smn)};function amn({root:t,...e}){const n=t||document;IQ.has(n)||IQ.set(n,{});const r=IQ.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(imn,{root:t,...e})),r[s]}function omn(t,e,n){const r=amn(e);return Dse.set(t,n),r.observe(t),()=>{Dse.delete(t),r.unobserve(t)}}const lmn={some:0,all:1};class cmn extends z2{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:lmn[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 omn(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(umn(e,n))&&this.startObserver()}unmount(){}}function umn({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const dmn={inView:{Feature:cmn},tap:{Feature:rmn},focus:{Feature:nmn},hover:{Feature:tmn}},fmn={layout:{ProjectionNode:vqe,MeasureLayout:fqe}},hmn={...Qhn,...dmn,...emn,...fmn},Ya=hhn(hmn,Ahn);function ffe({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]=h.useState(!1),[f,x]=h.useState(!1),[g,y]=h.useState(""),[v,C]=h.useState(0),[S,T]=h.useState(0),[I,L]=h.useState(320),[F,$]=h.useState("vol"),[O,U]=h.useState("desc"),[Y,re]=h.useState("all"),[Q,q]=h.useState(()=>{try{const at=localStorage.getItem("favCoins");return at?new Set(JSON.parse(at)):new Set}catch{return new Set}}),te=h.useRef(null),fe=h.useRef(null),G=150,ie={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},oe=at=>{var qe;const He=(qe=at==null?void 0:at.split("/")[0])==null?void 0:qe.replace("-USD","").replace("/USD","");return ie[He]||He},K=at=>at==null||isNaN(at)?"--":Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:2}).format(Number(at)),H=(at,He=6)=>at==null||isNaN(at)?"--":Number(at).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:He}),ee=at=>{const He=new Set(Q);He.has(at)?He.delete(at):He.add(at),q(He),localStorage.setItem("favCoins",JSON.stringify([...He]))},se=at=>{F===at?U(He=>He==="asc"?"desc":"asc"):($(at),U("desc"))},pe=h.useMemo(()=>((t==null?void 0:t.map(He=>{const qe=He.rawSymbol||He.symbol||He.coin||He.ticker||"";let vt=He.symbol||He.coin||He.ticker||qe,yt=He.builder||He.dex||"";if(He.kind==="hip3"){const nt=qe.indexOf(":");!yt&&nt>=0&&(yt=qe.slice(0,nt),vt=qe.slice(nt+1))}const Kt=He.lastPrice??He.last??He.markPrice??null,jt=He.change24hPct??He.chg24??null,un=He.volume??He.vol??He.dayNtlVlm??null,vn=He.fundingRate??He.funding??null,Hn=He.openInterest??He.oi??null,ln=He.openInterestUsd??He.oiUsd??(Hn!=null&&Kt!=null?Number(Hn)*Number(Kt):null),Nn=He.leverage!=null?He.leverage:He.lev!=null?He.lev:null,dn=He.kind||(yt?"hip3":"perp"),rt=He.coin||vt.replace(/-USDH$/,"").replace(/-USDC$/,"").replace(/-USD$/,"").replace(/\/USD$/,"");return{kind:dn,builder:yt,dex:He.dex||"",symbol:vt,rawSymbol:qe,last:Kt,chg24:jt,vol:un,funding:vn,openInterest:ln,leverage:Nn!=null&&isFinite(Nn)?Math.floor(Nn):null,coinForChange:rt}}))??[]).filter(He=>He.symbol),[t]),Se=h.useMemo(()=>{const at=new Map;for(const He of pe){const qe=He.symbol.replace("-USD","").replace("/USD","");at.set(qe,He)}return at},[pe]),ge=h.useMemo(()=>{if(a!=="pair")return[];const at=pe.filter(un=>un.kind!=="hip3"),He=at.map(un=>un.symbol.replace("-USD","").replace("/USD","")),qe=Array.from(new Set(He)),vt=Array.isArray(o)?new Set(o):null;let yt=Array.isArray(l)&&l.length?l:at.slice().sort((un,vn)=>Number(vn.vol||0)-Number(un.vol||0)).slice(0,30).map(un=>un.symbol.replace("-USD","").replace("/USD",""));yt=yt.filter(un=>qe.includes(un));const Kt=[],jt=new Set;for(let un=0;un<yt.length;un++){const vn=yt[un];for(let Hn=0;Hn<qe.length;Hn++){const ln=qe[Hn];if(!vn||!ln||vn===ln)continue;const Nn=`${vn}/${ln}`;if(jt.has(Nn)||vt&&!vt.has(Nn))continue;jt.add(Nn);const dn=Se.get(vn),rt=Se.get(ln),nt=dn&&rt&&Number(dn.last)>0&&Number(rt.last)>0?Number(dn.last)/Number(rt.last):null,Ut=dn&&rt?Math.min(Number(dn.vol||0),Number(rt.vol||0)):null;if(Kt.push({kind:"pair",builder:"",dex:"",symbol:Nn,rawSymbol:Nn,last:nt,chg24:null,vol:Ut,funding:null,openInterest:null,leverage:null,coinForChange:Nn}),Kt.length>=300)return Kt}}return Kt},[a,pe,o,l,Se]),ve=h.useMemo(()=>pe.some(at=>at.kind==="hip3"),[pe]);h.useEffect(()=>{a==="pair"&&($("vol"),U("desc"),re("perps"))},[a]),h.useEffect(()=>{!ve&&Y==="hip3"&&re("all")},[ve,Y]),h.useEffect(()=>{a==="pair"&&($("vol"),U("desc"),re("perps"))},[a]);const be=h.useMemo(()=>{const at=g.trim().toLowerCase();let qe=a==="pair"?ge.slice():pe.slice();a!=="pair"&&(Y==="perps"?qe=qe.filter(yt=>yt.kind!=="hip3"):Y==="hip3"&&(qe=qe.filter(yt=>yt.kind==="hip3"))),at&&(qe=qe.filter(yt=>yt.symbol.toLowerCase().includes(at)));const vt=yt=>yt==null||isNaN(Number(yt))?NaN:Number(yt);return qe.sort((yt,Kt)=>{const jt=Q.has(yt.symbol)?1:0,un=Q.has(Kt.symbol)?1:0;if(jt!==un)return un-jt;const vn=vt(yt[F]),Hn=vt(Kt[F]),ln=isNaN(vn),Nn=isNaN(Hn);return ln&&Nn?yt.symbol.localeCompare(Kt.symbol):ln?1:Nn?-1:vn===Hn?yt.symbol.localeCompare(Kt.symbol):O==="asc"?vn-Hn:Hn-vn}),qe},[a,pe,ge,g,Q,F,O,Y]),we=()=>{const at=fe.current;if(!at)return;const He=at.getBoundingClientRect(),qe=getComputedStyle(at),vt=parseFloat(qe.paddingLeft)||0,yt=document.documentElement.clientWidth,Kt=16,un=Math.min(740,yt-Kt*2);let vn=He.left+vt;vn+un>yt-Kt&&(vn=yt-Kt-un),vn<Kt&&(vn=Kt),L(un),T(vn),C(He.bottom+8)},je=()=>{we(),d(!0),requestAnimationFrame(()=>x(!0))},Fe=()=>{x(!1),setTimeout(()=>d(!1),G)};h.useEffect(()=>{const at=qe=>qe.key==="Escape"&&u&&Fe(),He=qe=>{var vt;return u&&!((vt=te.current)!=null&&vt.contains(qe.target))&&Fe()};return document.addEventListener("keydown",at),document.addEventListener("mousedown",He),document.addEventListener("touchstart",He,{passive:!0}),()=>{document.removeEventListener("keydown",at),document.removeEventListener("mousedown",He),document.removeEventListener("touchstart",He)}},[u]),h.useLayoutEffect(()=>{if(!u)return;we();const at=()=>we(),He=()=>we();return window.addEventListener("scroll",at,!0),window.addEventListener("resize",He),()=>{window.removeEventListener("scroll",at,!0),window.removeEventListener("resize",He)}},[u]);const Re=e&&e.length>8?"min-w-[120px]":e&&e.length>6?"min-w-[108px]":"min-w-[96px]",Qe=at=>{at.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>")},Ye=({active:at,dir:He})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 ml-1 ${at?"text-white":"text-[#6a6a6a]"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:He==="asc"?i.jsx("path",{d:"M7 14l5-5 5 5"}):i.jsx("path",{d:"M7 10l5 5 5-5"})}),dt=h.useMemo(()=>a!=="pair"?e||"Select":e||"Select Pair",[a,e]),st=({children:at})=>i.jsx("span",{className:"tabular-nums whitespace-nowrap",children:at});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?Fe():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 at=pe.find(He=>a==="pair"?He.symbol===e:He.rawSymbol===e||He.symbol===e||He.coinForChange===e);return at&&at.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-[${G}ms] ${f?"opacity-100":"opacity-0"}`,"aria-hidden":!0,onClick:Fe}),u&&i.jsx("div",{className:`fixed z-[60] transition-all duration-[${G}ms] ease-out ${f?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-1 scale-[0.99]"}`,style:{top:v,left:S,width:I,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"&&ve&&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(([at,He])=>i.jsx("button",{className:`px-2 py-1 rounded-md font-bold ${Y===at?"bg-[#262626] text-white":"text-[#8a8a8a]"}`,onClick:()=>re(at),children:He},at))}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:g,onChange:at=>y(at.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:()=>se("last"),children:["Last Price",i.jsx("span",{className:"ml-1",children:i.jsx(Ye,{active:F==="last",dir:F==="last"?O:"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:()=>se("chg24"),children:["24h Change",i.jsx("span",{className:"ml-1",children:i.jsx(Ye,{active:F==="chg24",dir:F==="chg24"?O:"desc"})})]})}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>se("vol"),children:["Vol",i.jsx("span",{className:"ml-1",children:i.jsx(Ye,{active:F==="vol",dir:F==="vol"?O:"desc"})})]})}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>se("funding"),children:["Funding",i.jsx("span",{className:"ml-1",children:i.jsx(Ye,{active:F==="funding",dir:F==="funding"?O:"desc"})})]})}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>se("openInterest"),children:["Open Int.",i.jsx("span",{className:"ml-1",children:i.jsx(Ye,{active:F==="openInterest",dir:F==="openInterest"?O:"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..."})}):be.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"})}):be.map(at=>{const He=Q.has(at.symbol),qe=a==="pair"&&at.symbol.includes("/"),[vt,yt]=qe?at.symbol.split("/"):[null,null],Kt=`${at.kind||"perp"}:${at.builder||""}:${at.rawSymbol||at.symbol}`;return i.jsxs("tr",{className:"hover:bg-[#1b1b1b]/70 cursor-pointer",onClick:()=>{const jt=a==="pair"?at.symbol:at.kind==="hip3"&&at.rawSymbol?at.rawSymbol:at.coinForChange;n(jt),Fe()},children:[i.jsx("td",{className:"align-middle",children:i.jsx("button",{onClick:jt=>{jt.stopPropagation(),ee(at.symbol)},className:`shrink-0 bg-transparent ${He?"text-yellow-400":"text-[#9b9b9b]"} hover:text-yellow-400`,title:He?"Unfavorite":"Favorite",children:He?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:qe?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:`${s}/${vt}.svg`,alt:vt,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}/${yt}.svg`,alt:yt,className:"rounded-full w-4 h-4 bg-gray-700",loading:"lazy",onError:Qe})]}):i.jsx("img",{src:at.kind==="hip3"?`${s}/${at.builder}:${at.symbol.replace(/-USDC$/,"").replace(/-USDH$/,"")}.svg`:`${s}/${oe(at.symbol)}.svg`,alt:at.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"||at.kind==="hip3"?at.symbol:at.symbol.replace(/-USD$/,"").replace(/\/USD$/,"")}),a!=="pair"&&i.jsxs("span",{className:"ml-1 inline-flex items-center gap-1",children:[at.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:[at.leverage,"x"]}),at.kind==="hip3"&&at.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:at.builder})]})]})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(st,{children:at.last==null||at.last===0?"--":H(at.last)})}),a!=="pair"&&i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"text-right font-medium align-middle",children:i.jsx(st,{children:at.chg24==null||isNaN(Number(at.chg24))||at.last==null||at.last===0?"--":(()=>{const jt=Number(at.chg24),un=Number(at.last),vn=un/(1+jt/100||1),Hn=un-vn,ln=Math.abs(Hn);let Nn;ln>=1e3?Nn=0:ln>=100?Nn=2:Nn=4;const dn=Hn>=0?"+":"-",rt=ln.toLocaleString(void 0,{minimumFractionDigits:Nn,maximumFractionDigits:Nn}),nt=`${jt>0?"+":""}${jt.toFixed(2)}%`,Ut=jt>0?"#67FFBD":"#FF7173";return i.jsx("span",{style:{color:Ut},children:`${dn}${rt} / ${nt}`})})()})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(st,{children:K(at.vol)})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(st,{children:at.funding==null||isNaN(Number(at.funding))?"--":(Number(at.funding)*100).toFixed(4)+"%"})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(st,{children:at.openInterest==null||isNaN(Number(at.openInterest))?"--":"$"+K(at.openInterest)})})]})]},Kt)})})]})})]})})]})}let zF=null;function pmn(){return typeof window>"u"?null:(zF||(zF=new Audio("/success.mp3"),zF.volume=.9),zF)}function mmn(){const t=pmn();if(t)try{t.currentTime=0;const e=t.play();e&&typeof e.then=="function"&&e.catch(function(){})}catch{}}function xmn(){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 Bse=null;function gmn(t){typeof t=="object"&&!Array.isArray(t)?Bse=t:Bse=null}async function bmn(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 GSe(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 KSe(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 FQ(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 hfe(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 ymn(t){return hfe(t).some(e=>{const n=String(e.status||e.s||"").toLowerCase();return n.includes("placed")||n.includes("resting")})}function vmn(t){return hfe(t).some(n=>{const r=String(n.status||n.s||"").toLowerCase();return r.includes("filled")||r.includes("success")||!!n.filled})}function HF(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 jj({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 S=null;const T={"Content-Type":"application/json"},I=6,L=o?"Mainnet":"Testnet",F=async(Ke,ct)=>{const Nt=t+Ke,Ht=await fetch(Nt,{method:"POST",headers:T,body:JSON.stringify(ct)});if(!Ht.ok)throw new Error(`HTTP ${Ht.status} on ${Ke}`);return Ht.json()},$=(Ke,ct)=>{if(!Ke||typeof Ke!="object")return NaN;const Nt=String(ct||"").trim();if(!Nt)return NaN;const Ht=Nt.toUpperCase();if(Ke[Nt]!=null){const yn=Number(Ke[Nt]);if(Number.isFinite(yn))return yn}if(Ke[Ht]!=null){const yn=Number(Ke[Ht]);if(Number.isFinite(yn))return yn}const Rt=Ht.indexOf("-");if(Rt>0){const yn=Ht.slice(0,Rt);if(Ht.slice(Rt+1)==="PERP"&&Ke[yn]!=null){const En=Number(Ke[yn]);if(Number.isFinite(En))return En}}const hn=Object.keys(Ke).find(yn=>String(yn).toUpperCase()===Ht);if(hn){const yn=Number(Ke[hn]);if(Number.isFinite(yn))return yn}return NaN},O={allMids:async()=>F("/info",{type:"allMids",dex:s}),openOrders:async(Ke=e)=>F("/info",{type:"openOrders",user:Ke,dex:s}),frontendOpenOrders:async(Ke=e)=>F("/info",{type:"frontendOpenOrders",user:Ke,dex:s}),clearinghouseState:async(Ke=e)=>F("/info",{type:"clearinghouseState",user:Ke,dex:s}),meta:async()=>{if(S)return S;const Ke=await F("/info",{type:"allPerpMetas"});return S=Ke,Ke},metaAndAssetCtxs:async()=>F("/info",{type:"metaAndAssetCtxs",dex:s}),twapHistory:async(Ke=e)=>F("/info",{type:"twapHistory",user:Ke,dex:s}),userTwapSliceFills:async(Ke=e)=>F("/info",{type:"userTwapSliceFills",user:Ke,dex:s}),userTwapSliceFillsByTime:async({user:Ke=e,startTime:ct,endTime:Nt,aggregateByTime:Ht}={})=>{const Rt={type:"userTwapSliceFillsByTime",user:Ke,startTime:ct,dex:s};return Nt!=null&&(Rt.endTime=Nt),Ht!=null&&(Rt.aggregateByTime=!!Ht),F("/info",Rt)}};async function U(Ke){const ct=await Y(),Nt=String(Ke).toUpperCase();for(let Ht=0;Ht<ct.length;Ht++){const Rt=ct[Ht];if(Array.isArray(Rt.universe)){const hn=Rt.universe.findIndex(yn=>yn.name.toUpperCase()===Nt);if(hn!==-1){let yn;return Ht===0?yn=hn:yn=1e5+Ht*1e4+hn,{entry:Rt.universe[hn],index:yn,block:Rt}}}}throw new Error(`Unknown perp symbol: ${Ke}`)}const Y=async()=>{if(S)return S;const Ke=await O.meta();return S=Ke,Ke},re=async Ke=>(await U(Ke)).index,Q=async Ke=>(await U(Ke)).entry.szDecimals,q=Ke=>{const[ct,Nt=""]=String(Ke).split(".");if(!Nt)return ct;const Ht=Nt.replace(/0+$/,"");return Ht.length?`${ct}.${Ht}`:ct},te=async(Ke,ct)=>{const Nt=await Q(Ke),Ht=Math.max(0,I-Number(Nt)),Rt=Math.abs(Number(ct));if(!(Rt>0)||!Number.isFinite(Rt))return Ht;const hn=Rt>=1?Math.floor(Math.log10(Rt))+1:0,yn=Math.max(0,5-hn);return Math.min(Ht,yn)},fe=async(Ke,ct)=>{const Nt=await te(Ke,ct);return Number((1/10**Nt).toFixed(Nt))},G=async(Ke,ct,Nt)=>{const Ht=await te(Ke,ct),Rt=10**-Ht,hn=Number(ct),yn=Nt?Math.floor(hn/Rt)*Rt:Math.ceil(hn/Rt)*Rt;return q(Number(yn).toFixed(Ht))},ie=async(Ke,ct)=>{if(ct==null||!Number.isFinite(Number(ct)))throw new Error("price required");const Nt=await te(Ke,ct),Ht=Number(ct),Rt=Nt===0?Math.round(Ht):Math.round(Ht*10**Nt)/10**Nt;return q(Rt.toFixed(Nt))},oe=async(Ke,ct)=>{if(ct==null||!Number.isFinite(Number(ct)))throw new Error("size required");const Nt=await Q(Ke);return q(Number(ct).toFixed(Number(Nt)))},K=async(Ke,ct,Nt,Ht=a)=>{let Rt=Nt;if(Rt==null){let yn=$(Bse,Ke);if(!Number.isFinite(yn)){const Cn=await O.allMids();yn=$(Cn,Ke)}if(Rt=yn,!Number.isFinite(Rt))throw new Error(`Mid price not available for ${Ke}`)}const hn=ct?Rt*(1+Ht):Rt*(1-Ht);return G(Ke,hn,ct)},H=new Set(["usdSend","spotSend","usdClassTransfer","withdraw3","cDeposit","cWithdraw","approveBuilderFee"]),ee=()=>({name:"HyperliquidSignTransaction",version:"1",chainId:parseInt(l,16),verifyingContract:"0x0000000000000000000000000000000000000000"}),se=(Ke,ct)=>{switch(Ke.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:L,destination:String(Ke.destination).toLowerCase(),amount:String(Ke.amount),time:ct}};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:L,destination:String(Ke.destination).toLowerCase(),token:Ke.token,amount:String(Ke.amount),time:ct}};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:L,amount:String(Ke.amount),toPerp:!!Ke.toPerp,nonce:ct}};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:L,destination:String(Ke.destination).toLowerCase(),amount:String(Ke.amount),time:ct}};case"cDeposit":return{primaryType:"HyperliquidTransaction:CDeposit",types:{"HyperliquidTransaction:CDeposit":[{name:"hyperliquidChain",type:"string"},{name:"wei",type:"string"},{name:"nonce",type:"uint64"}]},message:{hyperliquidChain:L,wei:String(Ke.wei),nonce:ct}};case"cWithdraw":return{primaryType:"HyperliquidTransaction:CWithdraw",types:{"HyperliquidTransaction:CWithdraw":[{name:"hyperliquidChain",type:"string"},{name:"wei",type:"string"},{name:"nonce",type:"uint64"}]},message:{hyperliquidChain:L,wei:String(Ke.wei),nonce:ct}};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:L,maxFeeRate:Ke.maxFeeRate.endsWith("%")?Ke.maxFeeRate:`${Ke.maxFeeRate}%`,builder:Ke.builder.toLowerCase(),nonce:ct}};default:return null}},pe=Ke=>{const ct=lu.from(Ke),Nt=ct.v>=27?ct.v:ct.v+27;return{r:ct.r,s:ct.s,v:Nt}},Se=async(Ke,ct)=>{const Nt=se(Ke,ct);if(!Nt)throw new Error("Unsupported typed action");const Ht=ee(),Rt=Object.assign({},Nt.types,{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}]}),hn=(c()||"").trim();if(hn){const En=await new fE(hn).signTypedData(Ht,Nt.types,Nt.message);return pe(En)}const yn=xmn();if(yn){await bmn(yn,l);let Cn=await yn.request({method:"eth_accounts"});(!Cn||!Cn.length)&&(Cn=await yn.request({method:"eth_requestAccounts"}));const En=Cn[0];if(!En)throw new Error("No connected account in wallet");if(String(En).toLowerCase()!==String(e).toLowerCase())throw new Error(`Connected wallet ${En} does not match HL address ${e}.`);const Rn={domain:Ht,types:Rt,primaryType:Nt.primaryType,message:Nt.message},Mn=await yn.request({method:"eth_signTypedData_v4",params:[En,JSON.stringify(Rn)]});return pe(Mn)}throw new Error("No signer for typed action")};let ge={ts:0,fee:null};async function ve(Ke=!1){const ct=Date.now();if(!Ke&&ge.fee!=null&&ct-ge.ts<C)return{builder_fee:ge.fee};const{address:Nt,token:Ht}=KSe(f);if(!Nt||!Ht)return{builder_fee:null};const Rt=u+"/api/subscriber/check_account/",hn=await GSe(Rt,{address:Nt,token:Ht}),yn=(hn==null?void 0:hn.builder_fee)!=null?Number(hn.builder_fee):null;return ge={ts:ct,fee:yn},{builder_fee:yn}}async function be(Ke){if(Ke.type!=="order")return Ke;const{builder_fee:ct}=await ve();return ct==null?Ke:{...Ke,builder:{b:d,f:Number(ct)}}}function we(Ke){return Ke!=null&&Ke.fromStart?Ke.fromStart:FQ(["dextra_from_start","from_start"])||x||null}function je(Ke){return Ke!=null&&Ke.appType?Ke.appType:FQ(["dextra_app_type","app_type"])||g||null}async function Fe(Ke,ct){if((ct==null?void 0:ct.leverage)!=null)return Number(ct.leverage);if(typeof v=="function"){const Ht=await v(Ke);if(Ht!=null)return Number(Ht)}const Nt=FQ([`leverage:${Ke}`,`${Ke}_leverage`,"dextra_leverage","hl_leverage","leverage"])||y;return Nt!=null?Number(Nt):null}async function Re(Ke){const ct=await O.clearinghouseState(e),Nt=((ct==null?void 0:ct.assetPositions)||[]).find(Rt=>{var hn,yn;return((yn=(hn=Rt==null?void 0:Rt.position)==null?void 0:hn.coin)==null?void 0:yn.toUpperCase())===String(Ke).toUpperCase()});if(!Nt)return null;const Ht=Number(Nt.position.szi||0);return{side:Ht>=0?"long":"short",size:Math.abs(Ht)}}async function Qe({symbol:Ke,isBuy:ct,usePosSide:Nt,size:Ht,price:Rt,telemetry:hn,oid:yn}){var Sn;if(!yn&&yn!==0)return;const{address:Cn,token:En}=KSe(f);if(!Cn||!En)return;const Rn=typeof window<"u"?window.localStorage.getItem("hl:wallet_id"):null,Mn=Ke?await Fe(Ke,hn):null,Yn=Nt&&((Sn=await Re(Ke))==null?void 0:Sn.side)||(ct?"long":"short"),{builder_fee:Zn}=await ve(),Vn={address:Cn,token:En,order_params:{coin:String(Ke),wallet_id:Rn!=null?Number(Rn):null,leverage:Mn!=null?Number(Mn):null,size:Ht!=null?Number(Ht):null,from_start:we(hn),app_type:je(hn),price:Rt!=null?Number(Rt):null,fee_amount:Zn!=null?Number(Zn):null,side:String(Yn),oid:Number(yn)}},tr=u+"/api/hyper/order_save/";try{await GSe(tr,Vn)}catch{}}async function Ye(Ke,ct){const Nt=ct??Date.now(),Ht=Ke.type==="order"?await be(Ke):Ke,Rt=H.has(Ht.type)?await Se(Ht,Nt):await n.sign(Ht,Nt),hn={action:Ht,nonce:Nt,signature:Rt,...r?{vaultAddress:r}:{}};return F("/exchange",hn)}async function dt(Ke,ct){var yn;const Nt=await Ye(Ke),Ht=hfe(Nt),Rt=vmn(Nt)||ymn(Nt)||(Nt==null?void 0:Nt.status)==="ok"||((yn=Nt==null?void 0:Nt.response)==null?void 0:yn.status)==="ok";let hn=null;return Rt&&(mmn(),hn=HF(Nt),hn==null&&Ht&&Ht.length&&(hn=HF(Ht))),await Qe({symbol:ct.symbol,isBuy:ct.isBuy,usePosSide:!!ct.usePosSide,size:ct.size,price:ct.price,telemetry:ct.telemetry,oid:hn}),Nt}const st=async({symbol:Ke,isBuy:ct,size:Nt,price:Ht,tif:Rt="Gtc",reduceOnly:hn=!1,cloid:yn,builder:Cn,telemetry:En}={})=>{const Rn=await re(Ke),Mn=await oe(Ke,Nt),Yn=await G(Ke,Ht,!!ct),Vn={type:"order",orders:[{a:Rn,b:!!ct,p:Yn,s:Mn,r:!!hn,t:{limit:{tif:Rt}},...yn?{c:yn}:{}}],grouping:"na",...Cn?{builder:Cn}:{}};return dt(Vn,{symbol:Ke,isBuy:ct,size:Mn,price:Yn,telemetry:En,usePosSide:!1})},at=async({symbol:Ke,isBuy:ct,size:Nt,price:Ht,tif:Rt="Gtc",reduceOnly:hn=!1,tpPrice:yn=null,slPrice:Cn=null,triggerSlippage:En=.08,cloid:Rn,builder:Mn,telemetry:Yn}={})=>{const Zn=await re(Ke),Vn=await oe(Ke,Nt),tr=[],Sn=await G(Ke,Ht,!!ct);tr.push({a:Zn,b:!!ct,p:Sn,s:Vn,r:!!hn,t:{limit:{tif:Rt}},...Rn?{c:Rn}:{}});const ze=!ct;if(Cn!=null&&Cn!==""&&Number(Cn)>0){const Ge=await ie(Ke,Cn),_e=await K(Ke,ze,Number(Ge),En);tr.push({a:Zn,b:ze,p:_e,s:Vn,r:!0,t:{trigger:{isMarket:!0,triggerPx:Ge,tpsl:"sl"}}})}if(yn!=null&&yn!==""&&Number(yn)>0){const Ge=await ie(Ke,yn),_e=await K(Ke,ze,Number(Ge),En);tr.push({a:Zn,b:ze,p:_e,s:Vn,r:!0,t:{trigger:{isMarket:!0,triggerPx:Ge,tpsl:"tp"}}})}const xe={type:"order",orders:tr,grouping:tr.length>1?"normalTpsl":"na",...Mn?{builder:Mn}:{}};return dt(xe,{symbol:Ke,isBuy:ct,size:Vn,price:Sn,telemetry:Yn,usePosSide:!1})},He=async({symbol:Ke,tpPrice:ct=null,slPrice:Nt=null,size:Ht=null,useLimitPx:Rt=!1,triggerSlippage:hn=.1,telemetry:yn}={})=>{const Cn=await Re(Ke);if(!Cn)throw new Error(`No open position for ${Ke}`);const En=await re(Ke),Rn=await oe(Ke,Ht??Cn.size),Mn=Cn.side==="short",Yn=[];let Zn=null;if(Nt!=null&&Number(Nt)>0){const tr=await ie(Ke,Nt),Sn=Rt?tr:await K(Ke,Mn,Number(tr),hn);Yn.push({a:En,b:Mn,p:Sn,s:Rn,r:!0,t:{trigger:{isMarket:!Rt,triggerPx:tr,tpsl:"sl"}}}),Zn=Zn??tr}if(ct!=null&&Number(ct)>0){const tr=await ie(Ke,ct),Sn=Rt?tr:await K(Ke,Mn,Number(tr),hn);Yn.push({a:En,b:Mn,p:Sn,s:Rn,r:!0,t:{trigger:{isMarket:!Rt,triggerPx:tr,tpsl:"tp"}}}),Zn=Zn??tr}if(!Yn.length)throw new Error("TP/SL price required");return dt({type:"order",orders:Yn,grouping:"normalTpsl"},{symbol:Ke,isBuy:Mn,size:Rn,price:Zn??0,telemetry:yn,usePosSide:!0})},qe=async(Ke={})=>(await ln({filter:"tpsl",symbol:Ke.symbol}),He(Ke)),vt=async(Ke,ct,Nt,{price:Ht,slippage:Rt=a,cloid:hn,tif:yn="Ioc",reduceOnly:Cn=!1,builder:En,telemetry:Rn}={})=>{const Mn=await K(Ke,ct,Ht,Rt);return st({symbol:Ke,isBuy:ct,size:Nt,price:Mn,tif:"FrontendMarket",reduceOnly:Cn,cloid:hn,builder:En,telemetry:Rn})},yt=async(Ke,ct,{price:Nt,slippage:Ht=a,cloid:Rt,tif:hn="Ioc",reduceOnly:yn=!0,builder:Cn,telemetry:En}={})=>{let Rn,Mn=ct;if(Mn==null){const ze=await O.clearinghouseState(e),xe=((ze==null?void 0:ze.assetPositions)||[]).find(_e=>{var Be,qt;return((qt=(Be=_e==null?void 0:_e.position)==null?void 0:Be.coin)==null?void 0:qt.toUpperCase())===String(Ke).toUpperCase()});if(!xe)throw new Error(`No position found for ${Ke}`);const Ge=parseFloat(xe.position.szi);if(!Ge)throw new Error(`No open size on ${Ke}`);Mn=Math.abs(Ge),Rn=Ge<0}else try{const ze=await O.clearinghouseState(e),xe=((ze==null?void 0:ze.assetPositions)||[]).find(_e=>{var Be,qt;return((qt=(Be=_e==null?void 0:_e.position)==null?void 0:Be.coin)==null?void 0:qt.toUpperCase())===String(Ke).toUpperCase()});Rn=(xe?parseFloat(xe.position.szi):0)<0}catch{Rn=!1}const Yn=await K(Ke,Rn,Nt,Ht),Zn=await re(Ke),Vn=await oe(Ke,Mn),Sn={type:"order",orders:[{a:Zn,b:Rn,p:Yn,s:Vn,r:!0,t:{limit:{tif:"FrontendMarket"}},...Rt?{c:Rt}:{}}],grouping:"na",...Cn?{builder:Cn}:{}};return dt(Sn,{symbol:Ke,isBuy:Rn,size:Vn,price:Yn,telemetry:En,usePosSide:!0})},Kt=async Ke=>{const ct=await O.openOrders(e),Nt=Ke?ct.filter(yn=>yn.coin.toUpperCase()===String(Ke).toUpperCase()):ct;if(!Nt.length)return{status:"ok",response:{type:"cancel",data:{count:0}}};const Ht=new Map;for(const yn of Nt)Ht.has(yn.coin)||Ht.set(yn.coin,await re(yn.coin));const hn={type:"cancel",cancels:Nt.map(yn=>({a:Ht.get(yn.coin),o:Number(yn.oid)}))};return Ye(hn)},jt=async Ke=>{const ct=Ke==null?{type:"scheduleCancel"}:{type:"scheduleCancel",time:Date.now()+Math.max(5e3,Number(Ke))};return Ye(ct)},un=async({symbol:Ke,isBuy:ct,size:Nt,minutes:Ht,randomize:Rt=!1,reduceOnly:hn=!1}={})=>{var Zn,Vn,tr,Sn,ze,xe,Ge,_e;const yn=await re(Ke),Cn=await oe(Ke,Nt),Rn={type:"twapOrder",twap:{a:yn,b:!!ct,s:Cn,r:!!hn,m:Number(Ht),t:!!Rt}},Mn=await Ye(Rn),Yn=((tr=(Vn=(Zn=Mn==null?void 0:Mn.response)==null?void 0:Zn.data)==null?void 0:Vn.status)==null?void 0:tr.error)||((ze=(Sn=Mn==null?void 0:Mn.response)==null?void 0:Sn.data)==null?void 0:ze.error)||((Ge=(xe=Mn==null?void 0:Mn.data)==null?void 0:xe.status)==null?void 0:Ge.error)||((_e=Mn==null?void 0:Mn.data)==null?void 0:_e.error);if(Yn)throw new Error(Yn);return Mn},vn=async({symbol:Ke,twapId:ct}={})=>{const Ht={type:"twapCancel",a:await re(Ke),t:Number(ct)};return Ye(Ht)},Hn=async({symbol:Ke,oid:ct,cloid:Nt}={})=>{const Ht=await re(Ke);if(ct!=null&&/^\d+$/.test(String(ct)))return Ye({type:"cancel",cancels:[{a:Ht,o:Number(ct)}]});if(Nt)return Ye({type:"cancelByCloid",cancels:[{asset:Ht,cloid:String(Nt)}]});throw new Error("cancelOrder requires a numeric oid or a cloid")},ln=async({filter:Ke="all",symbol:ct=null}={})=>{const Nt=await O.openOrders(e),Ht=Array.isArray(Nt)?Nt:[],Rt=Rn=>{const Mn=String(Rn.orderType||Rn.type||"").toLowerCase();return Ke==="all"?!0:Ke==="limit"?Mn==="limit":Ke==="tpsl"?Mn.includes("take profit")||Mn.includes("stop"):Ke==="reduceOnly"?!!Rn.reduceOnly:Ke==="nonReduce"?!Rn.reduceOnly:!1},hn=Ht.filter(Rn=>(!ct||String(Rn.coin).toUpperCase()===String(ct).toUpperCase())&&Rt(Rn));if(!hn.length)return{ok:!0,count:0};const yn=new Map,Cn=[];for(const Rn of hn){let Mn=yn.get(Rn.coin);Mn||(Mn=await re(Rn.coin),yn.set(Rn.coin,Mn)),Cn.push({a:Mn,o:Number(Rn.oid)})}return Ye({type:"cancel",cancels:Cn})},Nn=async()=>{const Ke=await O.clearinghouseState(e),Nt=(Array.isArray(Ke==null?void 0:Ke.assetPositions)?Ke.assetPositions:[]).map(Ht=>Ht==null?void 0:Ht.position).filter(Ht=>Math.abs(Number((Ht==null?void 0:Ht.szi)||0))>0);for(const Ht of Nt){const Rt=Ht.coin,hn=Math.abs(Number(Ht.szi));await yt(Rt,hn,{tif:"FrontendMarket",reduceOnly:!0})}return!0},dn={usdTransfer:async(Ke,ct)=>{const Nt=Date.now(),Ht={type:"usdSend",hyperliquidChain:L,signatureChainId:l,destination:String(Ke).toLowerCase(),amount:String(ct),time:Nt};return Ye(Ht)},spotTransfer:async(Ke,ct,Nt)=>{const Ht=Date.now(),Rt={type:"spotSend",hyperliquidChain:L,signatureChainId:l,destination:String(Ke).toLowerCase(),token:ct,amount:String(Nt),time:Ht};return Ye(Rt)},usdClassTransfer:async(Ke,ct)=>{const Nt=Date.now(),Ht={type:"usdClassTransfer",hyperliquidChain:L,signatureChainId:l,amount:String(Ke),toPerp:!!ct,nonce:Nt};return Ye(Ht,Nt)},withdraw:async(Ke,ct)=>{const Nt=Date.now(),Ht={type:"withdraw3",hyperliquidChain:L,signatureChainId:l,destination:String(Ke).toLowerCase(),amount:String(ct),time:Nt};return Ye(Ht,Nt)},cDeposit:async Ke=>{const ct=Date.now(),Nt={type:"cDeposit",hyperliquidChain:L,signatureChainId:l,wei:String(Ke),nonce:ct};return Ye(Nt,ct)},cWithdraw:async Ke=>{const ct=Date.now(),Nt={type:"cWithdraw",hyperliquidChain:L,signatureChainId:l,wei:String(Ke),nonce:ct};return Ye(Nt,ct)},approveBuilderFee:async({builder:Ke,maxFeeRate:ct})=>{const Nt=Date.now(),Ht={type:"approveBuilderFee",hyperliquidChain:L,signatureChainId:l,builder:String(Ke).toLowerCase(),maxFeeRate:String(ct),nonce:Nt};return Ye(Ht,Nt)}},rt=(()=>{const Ke="hl:pairs",ct=()=>{try{return JSON.parse(localStorage.getItem(Ke)||"[]")}catch{return[]}},Nt=Cn=>{try{localStorage.setItem(Ke,JSON.stringify(Cn))}catch{}};return{read:ct,write:Nt,get:Cn=>ct().find(En=>En.id===Cn)||null,add:Cn=>{const En=ct();En.push(Cn),Nt(En)},upsert:Cn=>{const En=ct().filter(Rn=>Rn.id!==Cn.id);En.push(Cn),Nt(En)},remove:Cn=>Nt(ct().filter(En=>En.id!==Cn))}})(),nt=(Ke="PAIR")=>`${Ke}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;async function Ut(Ke,ct,Nt,Ht,Rt){const hn=[{symbol:ct.symbol,side:"long",size:Number(ct.size),oid:HF(Ht)??null},{symbol:Nt.symbol,side:"short",size:Number(Nt.size),oid:HF(Rt)??null}];return rt.add({id:Ke,createdAt:Date.now(),legs:hn}),{pairId:Ke,long:{oid:hn[0].oid},short:{oid:hn[1].oid}}}const wn=async({long:Ke,short:ct,entrySlippage:Nt=a,triggerSlippage:Ht=.1,telemetry:Rt,pairId:hn}={})=>{if(!(Ke!=null&&Ke.symbol)||!(ct!=null&&ct.symbol))throw new Error("pair requires long.symbol and short.symbol");if(!(Number(Ke.size)>0)||!(Number(ct.size)>0))throw new Error("pair sizes must be > 0");const yn=hn||nt(),[Cn,En]=await Promise.all([placeMarketWithTPSL({symbol:Ke.symbol,isBuy:!0,size:Number(Ke.size),entrySlippage:Nt,tpPrice:Ke.tpPrice??null,slPrice:Ke.slPrice??null,triggerSlippage:Ht,telemetry:Rt,cloid:`${yn}:L`}),placeMarketWithTPSL({symbol:ct.symbol,isBuy:!1,size:Number(ct.size),entrySlippage:Nt,tpPrice:ct.tpPrice??null,slPrice:ct.slPrice??null,triggerSlippage:Ht,telemetry:Rt,cloid:`${yn}:S`})]);return Ut(yn,Ke,ct,Cn,En)},Jt=async({long:Ke,short:ct,triggerSlippage:Nt=a,telemetry:Ht,pairId:Rt}={})=>{if(!(Ke!=null&&Ke.symbol)||!(ct!=null&&ct.symbol))throw new Error("pair requires long.symbol and short.symbol");const hn=Rt||nt(),[yn,Cn]=await Promise.all([Ke.tpPrice||Ke.slPrice?at({symbol:Ke.symbol,isBuy:!0,size:Number(Ke.size),price:Number(Ke.price),tif:String(Ke.tif||"Gtc"),reduceOnly:!!Ke.reduceOnly,tpPrice:Ke.tpPrice??null,slPrice:Ke.slPrice??null,triggerSlippage:Nt,telemetry:Ht,cloid:`${hn}:L`}):st({symbol:Ke.symbol,isBuy:!0,size:Number(Ke.size),price:Number(Ke.price),tif:String(Ke.tif||"Gtc"),reduceOnly:!!Ke.reduceOnly,telemetry:Ht,cloid:`${hn}:L`}),ct.tpPrice||ct.slPrice?at({symbol:ct.symbol,isBuy:!1,size:Number(ct.size),price:Number(ct.price),tif:String(ct.tif||"Gtc"),reduceOnly:!!ct.reduceOnly,tpPrice:ct.tpPrice??null,slPrice:ct.slPrice??null,triggerSlippage:Nt,telemetry:Ht,cloid:`${hn}:S`}):st({symbol:ct.symbol,isBuy:!1,size:Number(ct.size),price:Number(ct.price),tif:String(ct.tif||"Gtc"),reduceOnly:!!ct.reduceOnly,telemetry:Ht,cloid:`${hn}:S`})]);return Ut(hn,Ke,ct,yn,Cn)},Vt=async({long:Ke,short:ct,telemetry:Nt,pairId:Ht}={})=>{if(!(Ke!=null&&Ke.symbol)||!(ct!=null&&ct.symbol))throw new Error("pair requires long.symbol and short.symbol");const Rt=Ht||nt(),[hn,yn]=await Promise.all([un({symbol:Ke.symbol,isBuy:!0,size:Number(Ke.size),minutes:Number(Ke.minutes),randomize:!!Ke.randomize,reduceOnly:!!Ke.reduceOnly}),un({symbol:ct.symbol,isBuy:!1,size:Number(ct.size),minutes:Number(ct.minutes),randomize:!!ct.randomize,reduceOnly:!!ct.reduceOnly})]);return Ut(Rt,Ke,ct,hn,yn)};async function xt(Ke){var Rt;const ct=await O.clearinghouseState(e),Nt=((ct==null?void 0:ct.assetPositions)||[]).find(hn=>{var yn,Cn;return((Cn=(yn=hn==null?void 0:hn.position)==null?void 0:yn.coin)==null?void 0:Cn.toUpperCase())===String(Ke).toUpperCase()}),Ht=Number(((Rt=Nt==null?void 0:Nt.position)==null?void 0:Rt.szi)||0);return{size:Math.abs(Ht),side:Ht>=0?"long":"short"}}return{updateLeverage:async(Ke,ct,Nt)=>{var Cn,En,Rn,Mn,Yn,Zn,Vn,tr;const Rt={type:"updateLeverage",asset:await re(Ke),isCross:String(ct||"").toLowerCase()==="cross",leverage:Number(Nt)},hn=await Ye(Rt),yn=((Rn=(En=(Cn=hn==null?void 0:hn.response)==null?void 0:Cn.data)==null?void 0:En.status)==null?void 0:Rn.error)||((Yn=(Mn=hn==null?void 0:hn.response)==null?void 0:Mn.data)==null?void 0:Yn.error)||((Vn=(Zn=hn==null?void 0:hn.data)==null?void 0:Zn.status)==null?void 0:Vn.error)||((tr=hn==null?void 0:hn.data)==null?void 0:tr.error)||((hn==null?void 0:hn.status)==="err"?hn==null?void 0:hn.response:null);if(yn)throw new Error(String(yn));return hn},placeOrder:st,placeLimitWithTPSL:at,placeTPSLForPosition:He,replaceTPSLForPosition:qe,cancelAllOrders:Kt,scheduleCancel:jt,marketOpen:vt,marketClose:yt,placeMarketWithTPSL:async Ke=>{const ct=await K(Ke.symbol,Ke.isBuy,null,Ke.entrySlippage??a);return at({...Ke,price:Number(ct),tif:"FrontendMarket"})},placeTwapOrder:un,cancelTwapOrder:vn,cancelOrder:Hn,cancelOrdersFiltered:ln,closeAllPositions:Nn,marketOpenPair:wn,limitOpenPair:Jt,twapOpenPair:Vt,marketClosePair:async({pairId:Ke,slippage:ct=a,fraction:Nt=1,telemetry:Ht}={})=>{const Rt=rt.get(Ke);if(!Rt)throw new Error("Unknown pairId");const[hn]=Rt.legs.filter(Sn=>Sn.side==="long"),[yn]=Rt.legs.filter(Sn=>Sn.side==="short");if(!hn||!yn)throw new Error("Pair legs corrupted");const[Cn,En]=await Promise.all([xt(hn.symbol),xt(yn.symbol)]),Rn=Math.max(0,Math.min(Cn.size,hn.size)*Number(Nt||1)),Mn=Math.max(0,Math.min(En.size,yn.size)*Number(Nt||1)),Yn=[];if(Rn>0&&Yn.push(yt(hn.symbol,Rn,{slippage:ct,reduceOnly:!0,telemetry:Ht,cloid:`${Ke}:L:CLOSE`})),Mn>0&&Yn.push(yt(yn.symbol,Mn,{slippage:ct,reduceOnly:!0,telemetry:Ht,cloid:`${Ke}:S:CLOSE`})),!Yn.length)return{pairId:Ke,message:"Nothing to close"};const Zn=await Promise.all(Yn),[Vn,tr]=await Promise.all([xt(hn.symbol),xt(yn.symbol)]);return Vn.size===0&&tr.size===0&&rt.remove(Ke),{pairId:Ke,results:Zn}},pairs:{list:()=>rt.read(),get:Ke=>rt.get(Ke),remove:Ke=>rt.remove(Ke)},info:O,transfers:dn,utils:{getPerpAssetId:re,getSzDecimals:Q,toPxString:ie,toSzString:oe,withSlippagePx:K,trimZeros:q,getPxDecimalsAt:te,getTickSize:fe,quantizePx:G}}}const $se="https://api.hyperliquid.xyz/info",wmn="wss://api.hyperliquid.xyz/ws";function Cmn(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 Jd={rows:[],subs:new Set,started:!1,ws:null,timer:null};function wqe(){for(const t of Jd.subs)try{t(Jd.rows)}catch{}}async function Nmn(){const e=await(await fetch($se,{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,sizeDecimalsInfo:o.szDecimals??null,openInterest:Number(c.openInterest??0)}})}async function Smn(){try{const e=await(await fetch($se,{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($se,{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=Cmn(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,sizeDecimalsInfo:x.szDecimals??null,openInterest:Number(g.openInterest??0)})}}catch{}return s}catch{return[]}}async function YSe(){try{const[t,e]=await Promise.all([Nmn(),Smn()]);Jd.rows=[...t,...e],wqe()}catch{}}function jmn(){if(!Jd.started){Jd.started=!0,YSe(),Jd.timer=setInterval(YSe,6e4);try{const t=new WebSocket(wmn);Jd.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||{};gmn(r);const s=Jd.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}});Jd.rows=s,wqe()},t.onclose=()=>{Jd.ws=null}}catch{}}}function hP(){const[t,e]=h.useState(Jd.rows);return h.useEffect(()=>{jmn(),e(Jd.rows);const n=r=>{e(r)};return Jd.subs.add(n),()=>{Jd.subs.delete(n)}},[]),t}const OQ=({children:t,text:e})=>{const[n,r]=h.useState({x:0,y:0}),[s,a]=h.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(dP,{children:s&&i.jsx(Ya.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})})]})},Amn=({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]=h.useState(O(u)),[x,g]=h.useState((n==null?void 0:n.markPx)||0),[y,v]=h.useState("text-white"),[C,S]=h.useState({last:null,mark:null,oracle:null}),T=h.useRef((n==null?void 0:n.markPx)||0),I=hP(),L=l.length?l:I,F=c==="hyperliquid"&&s==="pair",$={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};h.useEffect(()=>{if(!F&&(n==null?void 0:n.markPx)!=null){const pe=n.markPx.toString(),Se=pe.includes(".")?pe.split(".")[1].length:0;r(Se)}},[F,n==null?void 0:n.markPx]),h.useEffect(()=>{if(!F)return;let pe=!1;const Se=async()=>{var ge;try{const be=await(await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"allMids"})})).json(),we=((ge=be==null?void 0:be.data)==null?void 0:ge.universe)||[],[je,Fe]=String(a).split("/"),Re=we.find(He=>(He==null?void 0:He.name)===je),Qe=we.find(He=>(He==null?void 0:He.name)===Fe),Ye=Number((Re==null?void 0:Re.markPx)||0),dt=Number((Qe==null?void 0:Qe.markPx)||0),st=Number((Re==null?void 0:Re.oraclePx)||0),at=Number((Qe==null?void 0:Qe.oraclePx)||0);if(Ye>0&&dt>0){const He=Ye/dt,qe=st>0&&at>0?st/at:null;S({last:He,mark:He,oracle:qe});const vt=He.toString().includes(".")?He.toString().split(".")[1].length:0;r(vt)}}catch{}pe||setTimeout(Se,1500)};return Se(),()=>{pe=!0}},[F,a]);function O(pe){const Se=new Date,ge=Se.getTime(),ve=Number(pe);if(Number.isFinite(ve)&&ve>ge){const dt=Math.max(0,Math.floor((ve-ge)/1e3)),st=String(Math.floor(dt/3600)).padStart(2,"0"),at=String(Math.floor(dt%3600/60)).padStart(2,"0"),He=String(dt%60).padStart(2,"0");return`${st}:${at}:${He}`}Se.setSeconds(Se.getSeconds()+1);const be=Date.UTC(Se.getUTCFullYear(),Se.getUTCMonth(),Se.getUTCDate(),Se.getUTCHours(),Se.getUTCMinutes(),Se.getUTCSeconds()),je=new Date(Date.UTC(Se.getUTCFullYear(),Se.getUTCMonth(),Se.getUTCDate(),Se.getUTCHours()+1,0,0,0)).getTime()-be,Fe=Math.floor(je/1e3),Re=String(Math.floor(Fe/3600)).padStart(2,"0"),Qe=String(Math.floor(Fe%3600/60)).padStart(2,"0"),Ye=String(Fe%60).padStart(2,"0");return`${Re}:${Qe}:${Ye}`}h.useEffect(()=>{f(O(u));const pe=setInterval(()=>f(O(u)),1e3);return()=>clearInterval(pe)},[u]),h.useEffect(()=>{if(F){const pe=C.mark;if(!pe)return;const Se=T.current;pe>Se?v("text-[#1DE6A3]"):pe<Se&&v("text-[#FF7173]"),g(pe);const ge=setTimeout(()=>v("text-white"),800);return T.current=pe,()=>clearTimeout(ge)}else{if(!(n!=null&&n.markPx))return;const pe=n.markPx,Se=T.current;pe>Se?v("text-[#1DE6A3]"):pe<Se&&v("text-[#FF7173]"),g(pe);const ge=setTimeout(()=>v("text-white"),800);return T.current=pe,()=>clearTimeout(ge)}},[F,C.mark,n==null?void 0:n.markPx]);const U=()=>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"})}),Y=(n==null?void 0:n.source)==="extended",re=pe=>{const Se=Number(pe);if(!Number.isFinite(Se))return U();const ge=Math.abs(Se);let ve=1;return ge>=1e3?ve=1:ge>=100?ve=2:ge>=1?ve=3:ge>=.1?ve=4:ve=6,Se.toLocaleString(void 0,{maximumFractionDigits:ve})},Q=pe=>pe==null||isNaN(pe)?U():pe>=1e3?m3(pe):pe,q=pe=>{const Se=Number(pe);if(!Number.isFinite(Se))return U();const ge=Math.abs(Se),ve=Se>=0?"+":"-";if(!Y)return`${ve}${ge.toFixed(5)}`;let be=0;ge<.1?be=6:ge<1?be=4:ge<10?be=2:ge<100&&(be=1);const we=ge.toFixed(be),je=be>0?we.replace(/\.?0+$/,""):we;return`${ve}${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,G=te!=null?q(te):null,ie=te==null?"text-white":te>=0?"text-[#1DE6A3]":"text-[#FF7173]",oe=fe==null?"text-white":fe>=0?"text-[#1DE6A3]":"text-[#FF7173]",K=()=>{const[pe,Se]=String(a).split("/");return i.jsxs("div",{className:"flex -space-x-2 items-center",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${pe||""}.svg`||Ha,alt:"pair_a",className:"w-8 h-8 min-w-8 min-h-8 rounded-full bg-[#2a2a2a]",loading:"lazy",onError:ge=>wm(ge)}),i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Se||""}.svg`||Ha,alt:"pair_b",className:"w-8 h-8 min-w-8 min-h-8 rounded-full bg-[#2a2a2a] border border-[#0f0f0f]",loading:"lazy",onError:ge=>wm(ge)})]})},H=F?"pair":"single",ee=F?a:t,se=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(K,{}):i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${$[t]||(t==null?void 0:t.split("/")[0])}.svg`||Ha,alt:"token_image",className:"w-8 h-8 min-w-8 min-h-8 rounded-full",loading:"lazy",onError:pe=>wm(pe)})}),i.jsx(ffe,{markets:L,value:ee,onChange:se,loading:!L.length,showIcon:!0,mode:H})]}),i.jsx("div",{className:"hidden lg:flex bg-[#101010]",children:F?i.jsx(i.Fragment,{}):i.jsxs(i.Fragment,{children:[i.jsx(MC,{title:i.jsx(OQ,{text:"Used for margining, computing unrealized PnL, liquidations and triggering TP/SL orders.",children:"Mark"}),widthValue:"70px",info:Y?re(x):Q(x),color_1:y}),i.jsx(MC,{title:i.jsx(OQ,{text:"Median price from external sources reported by validators; used to calculate funding rates.",children:"Oracle"}),widthValue:"80px",info:Y?re(n==null?void 0:n.oraclePx):Q(n==null?void 0:n.oraclePx),color_1:"text-white"}),i.jsx(MC,{title:"24h Change",widthValue:"120px",info:G??U(),info_2:fe,color_1:ie,color_2:oe}),i.jsx(MC,{title:"24h Volume",widthValue:"130px",info:n!=null&&n.dayNtlVlm?`$${Ir(parseFloat(n==null?void 0:n.dayNtlVlm))}`:U(),color_1:"text-white"}),i.jsx(MC,{title:"Open Interest",widthValue:"130px",info:n!=null&&n.oraclePx?`$${Ir(parseFloat((n==null?void 0:n.oraclePx)*(n==null?void 0:n.openInterest)))}`:U(),color_1:"text-white"}),i.jsx(MC,{title:i.jsx(OQ,{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)+"%":U(),info_2:(n==null?void 0:n.funding)!=null?d:U(),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"})]})})},MC=({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}})]}),_mn="wss://api.hyperliquid.xyz/ws",MQ=new Map;function XSe(t){const e=(t||"").toLowerCase();return e?(MQ.has(e)||MQ.set(e,{key:e,ws:null,ping:null,subs:new Set,connected:!1,connecting:!1}),MQ.get(e)):null}function Cqe(t){if(!t||t.connecting||t.connected)return;t.connecting=!0;const e=new WebSocket(_mn);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(()=>Cqe(t),1500)};e.onclose=n,e.onerror=n}function Nqe(t,e){const n=XSe(t);return n?(n.subs.add(e),Cqe(n),()=>{const r=XSe(t);if(r&&(r.subs.delete(e),!r.subs.size&&r.ws))try{r.ws.close()}catch{}}):()=>{}}const Emn="https://api.hyperliquid.xyz/info",LQ=new Map,kmn=["xyz"];function Tmn(t){const e=(t==null?void 0:t.toLowerCase())||"";return e?(LQ.has(e)||LQ.set(e,{key:e,rows:[],count:void 0,loading:!0,emptyTimer:null,tpslByCoin:{},viewOrdersOnly:new Set,subs:new Set}),LQ.get(e)):null}function Sqe(t){t.subs.forEach(e=>{try{e({rows:t.rows,count:t.count,loading:t.loading,tpslByCoin:t.tpslByCoin,viewOrdersOnly:t.viewOrdersOnly})}catch{}})}function Pmn(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 QSe(t,e){const n=Pmn(e);t.rows=n,t.count=n.length,t.loading=!1,Sqe(t)}function VF(t,e){if(Array.isArray(e)&&e.length>0){t.emptyTimer&&(clearTimeout(t.emptyTimer),t.emptyTimer=null),QSe(t,e);return}t.emptyTimer||(t.emptyTimer=setTimeout(()=>{t.emptyTimer=null,QSe(t,[])},1e3))}function WF(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,Sqe(t)}function jqe(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 Aqe(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=jqe(t),s=r.length>0;return{hasAssetPositions:n,assetPositions:e,hasOpenOrders:s,openOrders:r}}function Imn(t){if(!t||typeof t!="object")return{assetPositions:[],openOrders:[]};const{hasAssetPositions:e,assetPositions:n,hasOpenOrders:r,openOrders:s}=Aqe(t);return{assetPositions:e?n:[],openOrders:r?s:[]}}function pfe(t){const[e,n]=h.useState({rows:[],count:void 0,loading:!0,tpslByCoin:{},viewOrdersOnly:new Set});return h.useEffect(()=>{const r=t==null?void 0:t.toLowerCase();if(!r)return;const s=Tmn(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=Nqe(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)&&VF(s,u.assetPositions);const d=jqe(u);d.length&&WF(s,d);return}if(c==="webData2"||c==="webData3"){const u=l.data||{},{hasAssetPositions:d,assetPositions:f,hasOpenOrders:x,openOrders:g}=Aqe(u);d&&VF(s,f),x&&WF(s,g)}});return(async()=>{try{const l=kmn.map(f=>{const x={type:"clearinghouseState",user:r};return f&&(x.dex=f),x}),c=await Promise.all(l.map(f=>fetch(Emn,{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}=Imn(f);Array.isArray(x)&&x.length&&u.push(...x),Array.isArray(g)&&g.length&&d.push(...g)}VF(s,u),WF(s,d)}catch{VF(s,[]),WF(s,[])}})(),()=>{s.subs.delete(a),o()}},[t]),e}function _qe(t){const{count:e}=pfe(t);return e}const RQ=new Map;function Fmn(t){const e=(t==null?void 0:t.toLowerCase())||"";return e?(RQ.has(e)||RQ.set(e,{key:e,rows:[],count:void 0,loading:!0,subs:new Set,emptyTimer:null}),RQ.get(e)):null}function Omn(t){t.subs.forEach(e=>{try{e({rows:t.rows,count:t.count,loading:t.loading})}catch{}})}function Mmn(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 DQ(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 ZSe(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 BQ(t,e){const n=Mmn(e);t.rows=n,t.count=n.length,t.loading=!1,Omn(t)}function $Q(t,e,n){if(e.length>0){t.emptyTimer&&(clearTimeout(t.emptyTimer),t.emptyTimer=null),BQ(t,e);return}if(n===0){t.emptyTimer&&(clearTimeout(t.emptyTimer),t.emptyTimer=null),BQ(t,[]);return}t.emptyTimer||(t.emptyTimer=setTimeout(()=>{t.emptyTimer=null,!(n>0)&&BQ(t,[])},2e3))}function mfe(t){const e=(t==null?void 0:t.toLowerCase())||"",n=_qe(t),[r,s]=h.useState({rows:[],count:void 0,loading:!0});return h.useEffect(()=>{if(!e){s({rows:[],count:0,loading:!1});return}const a=Fmn(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=Nqe(e,c=>{if(!c)return;const u=c.channel,d=c.data||{};if(u==="openOrders"){const f=DQ(d);$Q(a,f,n);return}if(u==="user"){const f=d.state;if(!f||!ZSe(f))return;const x=DQ(f);$Q(a,x,n);return}if(u==="webData2"||u==="webData3"){if(!ZSe(d))return;const f=DQ(d);$Q(a,f,n);return}});return()=>{a.subs.delete(o),l()}},[e,n]),r}function Lmn(t){const{count:e}=mfe(t);return e}const Rv={"1m":"1","5m":"5","15m":"15","30m":"30","1h":"60","4h":"240","12h":"720","1d":"1D","1w":"1W","1M":"1M"},y_={"1m":60,"5m":300,"15m":900,"30m":1800,"1h":3600,"4h":14400,"12h":43200,"1d":86400,"1w":604800,"1M":2592e3},qF={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"},Rmn="wss://api.starknet.extended.exchange",UQ="https://api.starknet.extended.exchange/api/v1",zQ="https://express-proxy-delta.vercel.app/proxy?url=",Dmn={"1m":"PT1M","5m":"PT5M","15m":"PT15M","30m":"PT30M","1h":"PT1H","4h":"PT4H","12h":"PT12H","1d":"PT24H","1w":"P7D","1M":"P30D"},Bmn="https://mainnet.zklighter.elliot.ai/api/v1/candles",$mn="https://mainnet.zklighter.elliot.ai/api/v1/candlesticks",Umn=["tv.js","charting_library.standalone.js","charting_library.js"];let GF=null;function zmn(t="/charting_library/"){return typeof window>"u"?Promise.resolve(null):window.TradingView&&window.TradingView.widget?Promise.resolve(window.TradingView):GF||(GF=(async()=>{for(const e of Umn){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})(),GF)}const Hmn="#133024",Eqe="#67FFBD",Vmn="#311621",kqe="#FF79AD",Wmn={background:Hmn,border:Eqe},qmn={background:Vmn,border:kqe},Gmn="#67FFBD",Kmn="rgba(103,255,189,0.12)",Ymn="#67FFBD",Xmn="#FF797C",Qmn="rgba(255,121,124,0.12)",Zmn="#FF79AD",Jmn="#67FFBD",e0n="rgba(103,255,189,0.08)",t0n="#67FFBD",JSe="#FF79AD",eje="rgba(255,121,173,0.08)",tje="#FF79AD",s9=t=>{const e=String(t||"").trim().toUpperCase();return e==="SELL"||e==="SHORT"||e==="S"?"S":e==="BUY"||e==="LONG"||e==="B"?"B":""},MM="",nje="tv_chart_layout_v3",Ib=t=>typeof t=="string"&&t.includes("/");function n0n(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 Tqe(t){const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function r0n(t){const e=new Date(t),n=Tqe(t),r=e.getUTCDay();return n-r*864e5}function s0n(t){const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)}function Dv(t,e){if(e==="1d")return Tqe(t);if(e==="1w")return r0n(t);if(e==="1M")return s0n(t);const n=y_[e]||60;return Math.floor(t/1e3/n)*n*1e3}function xfe(t){return/limit/i.test(String(t.type||""))?Number(t.limitPx)||0:Number(t.triggerPx)||0}function Pqe(t){return Number(t.sz??t.size??t.sizeCoin??t.coinSize??t.baseSize??t.qty??t.quantity??0)||0}function i0n(t,e){const n=s9(t.sideRaw||t.side),r=/take\s*profit/i.test(String(t.type||"")),s=/stop/i.test(String(t.type||"")),a=xfe(t),o=Pqe(t),l=t.coin||e||"",c=o>0?` (${o.toLocaleString(void 0,{maximumFractionDigits:6})}${l?" "+l:""})`:"";return r?MM+`TP ${n==="S"?">":"<"} ${a}${c}`:s?MM+`SL ${n==="S"?"<":">"} ${a}${c}`:MM+`Limit ${a}${c}`}function a0n(t){const e=/take\s*profit/i.test(String(t.type||"")),n=/stop/i.test(String(t.type||"")),r=s9(t.sideRaw||t.side),s=r==="S"||r==="A";return n?{txt:Xmn,bg:Qmn,br:Zmn}:e?s?{txt:JSe,bg:eje,br:tje}:{txt:Gmn,bg:Kmn,br:Ymn}:s?{txt:JSe,bg:eje,br:tje}:{txt:Jmn,bg:e0n,br:t0n}}function rje(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]===MM)});return{...r,sources:s}})})}}function o0n(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}|${xfe(t)}`)}function sje(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 KF(t,e,n){t.forEach(r=>{r&&(typeof r.then=="function"?r.then(s=>{s!=null&&sje(e,n,s)}).catch(()=>{}):sje(e,n,r))})}const l0n=(()=>{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 HQ({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=h.useRef(null),x=h.useRef(null),g=h.useRef(null),y=h.useRef(new Map),[v,C]=h.useState(!1),S=h.useRef([]),T=h.useRef([]),I=mfe(s||"").rows,L=h.useRef(null),F=h.useRef(e),$=h.useRef(new Map),O=h.useRef(0),[U,Y]=h.useState([]);h.useEffect(()=>{I.length>0&&(S.current=I)},[I]);let re;I.length===0?(O.current+=1,O.current<=1?re=S.current:re=I):(O.current=0,re=I);const Q=h.useMemo(()=>o!=="hyperliquid"?[]:re.filter(K=>K&&K.coin===t),[re,t,o]);h.useEffect(()=>{if(o!=="extended"||!d){Y([]);return}let K=!1;const H=async()=>{try{const se=`${UQ}/user/orders`,pe=`${zQ}${encodeURIComponent(se)}`,ge=await(await fetch(pe,{headers:{"X-Api-Key":d}})).json().catch(()=>null);if(K)return;const be=((ge==null?void 0:ge.data)&&Array.isArray(ge.data)&&ge.data||(Array.isArray(ge)?ge:[])).map((we,je)=>{var Fe;return{id:we.id??je,market:(we.market||"").toUpperCase(),type:(we.type||"").toUpperCase(),side:s9(we.side)||(we.side||"").toUpperCase(),sideRaw:s9(we.side)||"B",status:(we.status||"").toUpperCase(),limitPx:Number(we.price)||null,triggerPx:((Fe=we.trigger)==null?void 0:Fe.triggerPrice)!=null?Number(we.trigger.triggerPrice):null,qty:Number(we.qty)||null,takeProfit:we.takeProfit||null,stopLoss:we.stopLoss||null,reduceOnly:!!we.reduceOnly,createdTime:we.createdTime||null,updatedTime:we.updatedTime||null}}).filter(we=>we.status==="NEW"||we.status==="PARTIALLY_FILLED");Y(be)}catch{K||Y([])}};H();const ee=setInterval(H,1e4);return()=>{K=!0,clearInterval(ee)}},[o,d]);const q=h.useMemo(()=>{if(o==="hyperliquid")return Q;if(o==="extended"){const K=String(c||t||"").toUpperCase();return U.filter(H=>String(H.market||"").toUpperCase()===K)}return[]},[o,Q,U,c,t]);let te=l0n;try{const K=typeof window<"u"?JSON.parse(window.localStorage.getItem("tradingview.chartproperties")||"null"):null;K&&K.timezone&&(te=K.timezone)}catch{}const fe=typeof window<"u"?window.localStorage.getItem("tranding_chart_interval_time"):null,G=fe&&Rv[fe]?fe:e,ie=Rv[G]||"60";h.useEffect(()=>{I.length>0&&(T.current=I)},[I]),h.useEffect(()=>{if(!v)return;const K=x.current,H=K&&K.activeChart&&K.activeChart();if(!H)return;const ee=Rv[e]?Rv[e]:Object.values(Rv).includes(e)?e:ie,se=L.current!==t,pe=F.current!==e;if(se){L.current=t,F.current=e;const Se=g.current;if(Se&&typeof Se.clearMarksCache=="function")try{Se.clearMarksCache()}catch{}try{H.setSymbol(t,ee,()=>{var ge;try{H.requestMarksRefresh&&H.requestMarksRefresh(),(ge=H.autoScaleAllSeries)==null||ge.call(H)}catch{}})}catch{}}else if(pe){F.current=e;try{H.setResolution(ee,()=>{var Se;try{H.requestMarksRefresh&&H.requestMarksRefresh(),(Se=H.autoScaleAllSeries)==null||Se.call(H)}catch{}})}catch{}}},[t,e,v,ie]),h.useEffect(()=>{let K=!0;return(async()=>{const H=await zmn(r);if(!K||!H||!H.widget||!f.current)return;f.current.innerHTML="";let ee=5;function se(be,we,je,Fe,Re,Qe,Ye){let dt=be||null,st=Ye||null,at=null,He=null,qe=null,vt=null,yt=null,Kt=null;const jt={},un={},vn={},Hn={};let ln=!0,Nn=Qe,dn=null,rt=0;const nt=ze=>+String(ze).slice(0,13);let Ut="1h",wn="",Jt=[],Vt=null,xt=null,We=null;const Pt=ze=>Dmn[ze]||"PT1M",Ke=ze=>{if(Re)return Re;const xe=String(ze||"");return!xe||xe.includes("/")?"":xe.includes("-")?xe:`${xe}-USD`},ct=(ze,xe)=>{if(!xe)return;const Ge=Hn[xe]||[],_e=Ge[Ge.length-1];_e&&_e.time===ze.time?Ge[Ge.length-1]=ze:Ge.push(ze),Ge.length>2e3&&Ge.splice(0,Ge.length-2e3),Hn[xe]=Ge},Nt=(ze,xe,Ge)=>{const _e=Hn[ze]||[];return _e.length?_e.filter(Be=>Number.isFinite(Be.time)&&Be.time/1e3>=xe&&Be.time/1e3<=Ge):[]},Ht=(ze,xe,Ge)=>{const _e=Number(Nn);if(!Number.isFinite(_e)||_e<=0)return[];const Be=Dv(Ge*1e3,ze);return Math.floor(Be/1e3)<xe?[]:[{time:Be,open:_e,high:_e,low:_e,close:_e,volume:0}]};function Rt(){je==="hyperliquid"&&(at||(at=new WebSocket("wss://api-ui.hyperliquid.xyz/ws"),at.onopen=()=>{yt&&at&&at.send(JSON.stringify({method:"subscribe",subscription:yt}))},at.onmessage=ze=>{var _e;const xe=(_e=JSON.parse(ze.data))==null?void 0:_e.data;if(!xe||!xe.c)return;const Ge={time:nt(xe.t),open:+xe.o,high:+xe.h,low:+xe.l,close:+xe.c,volume:xe.v??0};Object.values(jt).forEach(Be=>Be(Ge))},at.onclose=()=>{at=null}))}function hn(){je==="extended"&&(!Kt||He||(He=new WebSocket(Kt),He.onmessage=ze=>{let xe;try{xe=JSON.parse(ze.data)}catch{return}const Ge=Array.isArray(xe==null?void 0:xe.data)?xe.data:[];Ge.length&&Ge.forEach(_e=>{const Be={time:nt(_e.T),open:+_e.o,high:+_e.h,low:+_e.l,close:+_e.c,volume:_e.v!=null?Number(_e.v):0};!Number.isFinite(Be.time)||!Number.isFinite(Be.open)||(ct(Be,Ut),Object.values(jt).forEach(qt=>qt(Be)))})},He.onclose=()=>{He=null}))}function yn(ze,xe,Ge){if(je!=="hyperliquid")return;if(qe)try{qe.close()}catch{}if(vt)try{vt.close()}catch{}xt=null,We=null,qe=new WebSocket("wss://api-ui.hyperliquid.xyz/ws"),vt=new WebSocket("wss://api-ui.hyperliquid.xyz/ws"),qe.onopen=()=>{qe&&qe.send(JSON.stringify({method:"subscribe",subscription:{type:"candle",coin:ze,interval:Ge}}))},vt.onopen=()=>{vt&&vt.send(JSON.stringify({method:"subscribe",subscription:{type:"candle",coin:xe,interval:Ge}}))};const _e=Be=>qt=>{var Gt;const It=(Gt=JSON.parse(qt.data))==null?void 0:Gt.data;if(!It||!It.c)return;const mt={time:nt(It.t),open:+It.o,high:+It.h,low:+It.l,close:+It.c,volume:It.v??0};if(Be==="A"?xt=mt:We=mt,!xt||!We)return;const Ft=Dv(xt.time,Ut),Tn=Dv(We.time,Ut);if(Ft!==Tn)return;const kn={time:Math.max(xt.time,We.time),open:xt.open/We.open,high:xt.high/We.high,low:xt.low/We.low,close:xt.close/We.close,volume:0};Object.values(jt).forEach(mn=>mn(kn))};qe.onmessage=_e("A"),vt.onmessage=_e("B"),qe.onclose=()=>{qe=null},vt.onclose=()=>{vt=null}}function Cn(ze){const xe=String(ze||"");return xe==="BTC"||xe==="ETH"?2:xe.startsWith("1000")||xe.includes("/")?4:3}async function En(ze,xe,Ge,_e){const It=(y_[xe]||60)*1e4,mt=Math.max(Ge*1e3,_e*1e3-It*1e3),{data:Ft}=await Ns.post("https://api-ui.hyperliquid.xyz/info",{type:"candleSnapshot",req:{coin:ze,interval:xe,startTime:mt,endTime:_e*1e3}});return(Array.isArray(Ft)?Ft:Ft&&Ft.data?Ft.data:[]).map(kn=>({time:nt(kn.t),open:+kn.o,high:+kn.h,low:+kn.l,close:+kn.c,volume:kn.v??0})).sort((kn,Gt)=>kn.time-Gt.time)}async function Rn(ze,xe,Ge,_e,Be){const[qt,It]=await Promise.all([En(ze,Ge,_e,Be),En(xe,Ge,_e,Be)]),mt=[];let Ft=0,Tn=0;for(;Ft<qt.length&&Tn<It.length;){const kn=Dv(qt[Ft].time,Ut),Gt=Dv(It[Tn].time,Ut);kn===Gt?(mt.push({time:Math.max(qt[Ft].time,It[Tn].time),open:qt[Ft].open/It[Tn].open,high:qt[Ft].high/It[Tn].high,low:qt[Ft].low/It[Tn].low,close:qt[Ft].close/It[Tn].close,volume:0}),Ft++,Tn++):kn<Gt?Ft++:Tn++}return mt}async function Mn(ze,xe,Ge,_e){if(ze==null)return[];const Be=y_[xe]||60,qt=Math.max(Be,_e-Ge),It=Math.max(1,Math.ceil(qt/Be)),mt={market_id:ze,resolution:xe,r:xe,start_timestamp:Ge*1e3,end_timestamp:_e*1e3,start:Ge*1e3,end:_e*1e3,count_back:It,limit:It,set_timestamp_to_end:!0},Ft=mn=>{if(!mn)return null;if(Array.isArray(mn)){const[m,p,N,A,k,P]=mn;return{time:nt(m),open:+p,high:+N,low:+A,close:+k,volume:Number(P??0)||0}}const gt=mn.t??mn.time??mn.timestamp??mn.start_timestamp??mn.startTime??mn.start_time??0,Wt=mn.o??mn.open,jn=mn.h??mn.high,kt=mn.l??mn.low,cn=mn.c??mn.close,Ce=mn.v??mn.volume??mn.V??0;return{time:nt(gt),open:+Wt,high:+jn,low:+kt,close:+cn,volume:Number(Ce??0)||0}},Tn=mn=>mn.map(gt=>Ft(gt)).filter(gt=>gt&&Number.isFinite(gt.time)&&Number.isFinite(gt.open)&>.time/1e3>=Ge&>.time/1e3<=_e).sort((gt,Wt)=>gt.time-Wt.time),kn=async mn=>{const{data:gt}=await Ns.get(mn,{params:mt});return gt?Array.isArray(gt.c)?gt.c:Array.isArray(gt.data)?gt.data:Array.isArray(gt.candlesticks)?gt.candlesticks:Array.isArray(gt.candles)?gt.candles:Array.isArray(gt)?gt:[]:[]};let Gt=[];try{Gt=await kn(Bmn)}catch{}if(!Gt.length)try{Gt=await kn($mn)}catch{}return Tn(Gt)}async function Yn(ze,xe,Ge,_e){if(!ze)return[];const Be=y_[xe]||60,qt=Math.max(Be,_e-Ge),It=Math.min(1e4,Math.max(1,Math.ceil(qt/Be))),mt=Pt(xe),Ft=`${UQ}/info/candles/${ze}/trades?interval=${mt}&limit=${It}&endTime=${_e*1e3}`,Tn=`${zQ}${encodeURIComponent(Ft)}`,{data:kn}=await Ns.get(Tn);return(Array.isArray(kn==null?void 0:kn.data)?kn.data:[]).map(mn=>({time:nt(mn.T),open:+mn.o,high:+mn.h,low:+mn.l,close:+mn.c,volume:mn.v!=null?Number(mn.v):0})).filter(mn=>Number.isFinite(mn.time)&&Number.isFinite(mn.open)&&mn.time/1e3>=Ge&&mn.time/1e3<=_e).sort((mn,gt)=>mn.time-gt.time)}async function Zn(ze,xe,Ge){if(!dt)return[];if(Ib(ze))return[];const{data:_e}=await Ns.post("https://api.hyperliquid.xyz/info",{type:"userFills",user:dt,coin:ze,startTime:xe*1e3,endTime:Ge*1e3});return(Array.isArray(_e)?_e:_e&&_e.data?_e.data:[]).filter(It=>{const mt=It.coin||It.asset||It.symbol;return mt?String(mt).toUpperCase()===String(ze).toUpperCase():!0}).map(It=>({t:+String(It.time).slice(0,13),b:n0n(It),px:Number(It.px||It.price),sz:Number(It.sz||It.size)})).filter(It=>It.t/1e3>=xe&&It.t/1e3<=Ge&&Number.isFinite(It.px)&&It.px>0)}async function Vn(ze,xe,Ge){if(!st)return[];if(!ze)return[];const _e=`${UQ}/user/trades`,Be=`${zQ}${encodeURIComponent(_e)}`,{data:qt}=await Ns.get(Be,{headers:{"X-Api-Key":st}}),It=Array.isArray(qt==null?void 0:qt.data)?qt.data:Array.isArray(qt)?qt:[],mt=String(ze||"").toUpperCase();return It.filter(Ft=>String(Ft.market||"").toUpperCase()===mt).map(Ft=>({t:+String(Ft.createdTime||Ft.time||Ft.paidTime||0).slice(0,13),b:s9(Ft.side)!=="S"})).filter(Ft=>Ft.t/1e3>=xe&&Ft.t/1e3<=Ge&&Number.isFinite(Ft.t))}function tr(ze){un[ze]&&(clearInterval(un[ze]),delete un[ze])}function Sn(){Object.keys(un).forEach(ze=>{tr(ze)})}return{setWallet:ze=>{dt=ze||null,wn="",Jt=[],Vt=null},setExtendedApiKey:ze=>{st=ze||null,wn="",Jt=[],Vt=null},setExtendedFallbackPrice:ze=>{Nn=ze},clearMarksCache:()=>{wn="",Jt=[],Vt=null},onReady:ze=>ze({supported_resolutions:Object.values(Rv),supports_group_request:!1,supports_marks:!0,supports_timescale_marks:!1,supports_time:!0}),resolveSymbol:(ze,xe)=>{dn=ze;const Ge=vn[ze]??Cn(ze);vn[ze]=Ge,typeof we=="function"&&we(Ge),xe({name:ze,ticker:ze,full_name:ze,description:Ib(ze)?ze:ze+"/USD",type:"crypto",session:"24x7",timezone:te,exchange:je==="lighter"?"Lighter":je==="extended"?"Extended":"Hyperliquid",pricescale:Math.pow(10,Ge),minmov:1,has_intraday:!0,supported_resolutions:Object.values(Rv),data_status:"streaming"})},getServerTime:ze=>ze(Math.floor(Date.now()/1e3)),getBars:async(ze,xe,{from:Ge,to:_e},Be,qt)=>{const It=ze.ticker||ze.name,mt=++rt;try{const Ft=qF[xe]||"1m";Ft&&(Ut=Ft);let Tn=[];if(je==="lighter")Ib(It)||(Tn=await Mn(Fe,Ft,Ge,_e));else if(je==="extended"){if(!Ib(It)){const kn=Ke(It);if(kn&&ln)try{Tn=await Yn(kn,Ft,Ge,_e)}catch{ln=!1}Tn.length||(Tn=Nt(Ft,Ge,_e)),Tn.length||(Tn=Ht(Ft,Ge,_e))}}else if(Ib(It)){const kn=String(It).split("/"),Gt=kn[0],mn=kn[1];Tn=await Rn(Gt,mn,Ft,Ge,_e)}else Tn=await En(It,Ft,Ge,_e);if(It!==dn||mt!==rt)return;Be(Tn,{noData:Tn.length===0})}catch(Ft){const Tn=Ft&&Ft.response&&Ft.response.status;if(je==="lighter"&&Tn===400){It===dn&&mt===rt&&Be([],{noData:!0});return}try{qt(Ft&&Ft.message?Ft.message:"Datafeed error")}catch{}}},getMarks:async(ze,xe,Ge,_e,Be)=>{const qt=ze.ticker||ze.name;if(Ib(qt))return _e([]);const It=qF[Be]||null;It&&(Ut=It);let mt=Number(xe),Ft=Number(Ge);const Tn=Math.floor(Date.now()/1e3);(!Number.isFinite(mt)||!Number.isFinite(Ft)||Ft<=mt||mt<=0||Ft<=0)&&(Ft=Tn,mt=Ft-30*24*3600);const kn=je==="extended"?Ke(qt):qt;if(je==="extended"&&!st)return _e([]);const Gt=[je,kn||qt,mt,Ft,Ut];je==="extended"&&Gt.push(st||"no-key");const mn=Gt.join("|");if(mn===wn&&Jt.length)return _e(Jt);if(Vt&&Vt.key===mn){const Wt=await Vt.promise;return _e(Wt)}Vt={key:mn,promise:(async()=>{try{let Wt=new Map;if(je==="hyperliquid"){const kt=await Zn(qt,mt,Ft);Wt=new Map;for(const cn of kt){const Ce=Dv(cn.t,Ut),m=Math.floor(Ce/1e3),p=cn.b?"B":"S",N=m+"-"+p;Wt.has(N)||Wt.set(N,{time:m,isBuy:cn.b})}}else if(je==="extended"){const kt=await Vn(kn,mt,Ft);Wt=new Map;for(const cn of kt){const Ce=Dv(cn.t,Ut),m=Math.floor(Ce/1e3),p=cn.b?"B":"S",N=m+"-"+p;Wt.has(N)||Wt.set(N,{time:m,isBuy:cn.b})}}const jn=Array.from(Wt.values()).map((kt,cn)=>({id:kt.time+"-"+(kt.isBuy?"B":"S")+"-"+cn,time:kt.time,color:kt.isBuy?Wmn:qmn,label:kt.isBuy?"B":"S",labelFontColor:kt.isBuy?Eqe:kqe,text:kt.isBuy?"Buy":"Sell",minSize:16,borderWidth:1,hoveredBorderWidth:2})).sort((kt,cn)=>kt.time-cn.time);return wn=mn,Jt=jn,Vt=null,jn}catch{return Vt=null,[]}})()};const gt=await Vt.promise;_e(gt)},getTimescaleMarks:(ze,xe,Ge,_e)=>_e([]),subscribeBars:(ze,xe,Ge,_e)=>{const Be=ze.ticker||ze.name,qt=qF[xe]||"1m";if(jt[_e]=Ge,Ut=qt,je==="lighter"){tr(_e);const It=y_[Ut]||60,mt=Math.max(2e3,Math.min(15e3,Math.floor(It*1e3/3)));let Ft=0;const Tn=async()=>{try{const kn=Math.floor(Date.now()/1e3),Gt=kn-It*500,mn=await Mn(Fe,Ut,Gt,kn);if(!Array.isArray(mn)||!mn.length)return;const gt=mn[mn.length-1];if(!Number.isFinite(gt.time))return;if(gt.time>Ft){Ft=gt.time;const Wt=jt[_e];Wt&&Wt(gt)}}catch{}};Tn(),un[_e]=setInterval(Tn,mt);return}if(je==="extended"){if(Ib(Be))return;const It=Ke(Be);if(!It)return;const mt=Pt(qt);if(Kt=`${Rmn}/stream.extended.exchange/v1/candles/${encodeURIComponent(It)}/trades?interval=${encodeURIComponent(mt)}`,He){try{He.close()}catch{}He=null}hn();return}if(je==="hyperliquid")if(Ib(Be)){const It=String(Be).split("/"),mt=It[0],Ft=It[1];yn(mt,Ft,qt)}else{if(yt={type:"candle",coin:Be,interval:qt},at){try{at.close()}catch{}at=null}Rt()}},unsubscribeBars:ze=>{delete jt[ze],tr(ze)},cleanup:()=>{try{at&&at.close()}catch{}try{He&&He.close()}catch{}try{qe&&qe.close()}catch{}try{vt&&vt.close()}catch{}Sn(),wn="",Jt=[],Vt=null,xt=null,We=null,Kt=null}}}const pe=se(s||null,be=>{ee=be},o,l,c,u,o==="extended"?d:null);g.current=pe;let Se=null;if(typeof window<"u"){const be=window.localStorage.getItem(nje);if(be)try{Se=rje(JSON.parse(be))}catch{}}const ge={container:f.current.id,library_path:r,datafeed:pe,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:be=>Number(be).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}};Se?ge.saved_data=Se:(ge.symbol=t,ge.interval=ie);const ve=new window.TradingView.widget(ge);x.current=ve,ve.onChartReady(()=>{const be=ve.activeChart(),we=()=>{var Fe;try{(Fe=be.autoScaleAllSeries)==null||Fe.call(be)}catch{}},je=()=>{!ve||!ve.save||typeof window>"u"||ve.save(Fe=>{try{const Re=rje(Fe||{});window.localStorage.setItem(nje,JSON.stringify(Re||{}))}catch{}})};if(!Se)try{const Fe=Math.floor(Date.now()/1e3);be.setVisibleRange({from:Fe-30*24*3600,to:Fe},{percentRightMargin:.2}),we()}catch{}try{be.setEntityMarksVisible(!0)}catch{}be.onIntervalChanged().subscribe(null,Fe=>{try{const Re=qF[Fe]||Fe||ie;Re&&typeof window<"u"&&window.localStorage.setItem("tranding_chart_interval_time",Re)}catch{}try{be.requestMarksRefresh()}catch{}je()}),ve.subscribe("onAutoSaveNeeded",()=>{je()}),je(),C(!0)})})(),()=>{K=!1;const H=x.current,ee=g.current;try{const se=H&&H.activeChart&&H.activeChart();se&&(KF(y.current,H,se),y.current.clear(),KF($.current,H,se),$.current.clear())}catch{}try{ee&&ee.cleanup&&ee.cleanup()}catch{}try{H&&H.remove&&H.remove()}catch{}x.current=null,g.current=null,C(!1)}},[r,o,l,c,t,e,s]),h.useEffect(()=>{if(!g.current)return;g.current.setWallet(s||null);const K=x.current;if(!K||!v)return;const H=K.activeChart&&K.activeChart();if(H)try{H.requestMarksRefresh&&H.requestMarksRefresh()}catch{}},[s,v]),h.useEffect(()=>{g.current&&typeof g.current.setExtendedApiKey=="function"&&g.current.setExtendedApiKey(o==="extended"&&d||null)},[d,o]),h.useEffect(()=>{if(!g.current||o!=="extended")return;const K=g.current.setExtendedFallbackPrice;typeof K=="function"&&K(u)},[u,o]),h.useEffect(()=>{if(!v||o!=="hyperliquid"&&o!=="extended")return;const K=x.current,H=K&&K.activeChart&&K.activeChart();if(!H||!H.createMultipointShape)return;const ee=y.current;KF(ee,K,H),ee.clear();const se=Array.isArray(q)?q:[];if(!se.length)return;const pe=H.getVisibleRange&&H.getVisibleRange(),Se=Math.floor(Date.now()/1e3),ge=pe&&pe.to||Se,ve=new Map;for(const be of se){const we=xfe(be);if(!Number.isFinite(we)||we<=0)continue;const je=be.sideRaw==="S"?"S":"B",Fe=/take\s*profit/i.test(String(be.type||"")),Re=/stop/i.test(String(be.type||"")),Ye=`${we}|${je}|${Fe?"TP":Re?"SL":"L"}`,dt=Pqe(be);if(!ve.has(Ye))ve.set(Ye,{base:be,px:we,sz:dt});else{const st=ve.get(Ye);st.sz+=dt}}ve.forEach(({base:be,px:we,sz:je})=>{const Fe=a0n(be),Re={...be,sz:je},Qe=i0n(Re,t),Ye={time:ge,price:we};try{const dt=H.createMultipointShape([Ye],{shape:"horizontal_line",text:Qe,lock:!0,disableSelection:!0,disableSave:!0,overrides:{linecolor:Fe.br,linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0,showLabel:!0,textcolor:Fe.txt,fillBackground:!0,backgroundColor:Fe.bg,bold:!1,fontsize:11}}),st=o0n(Re,t);y.current.set(st,dt)}catch{}})},[q,v,t,o]),h.useEffect(()=>{if(!v||q.length>0)return;const K=x.current,H=K&&K.activeChart&&K.activeChart();if(!H)return;let ee=null;try{const ve=H.getPanes&&H.getPanes();if(Array.isArray(ve)&&ve[0]){const be=ve[0].getRightPriceScales&&ve[0].getRightPriceScales();Array.isArray(be)&&be[0]?ee=be[0]:ve[0].getMainSourcePriceScale&&(ee=ve[0].getMainSourcePriceScale())}}catch{}const se=$.current;if(KF(se,K,H),se.clear(),!Array.isArray(a)){try{ee&&ee.setAutoScale(!0)}catch{}return}const pe=H.getVisibleRange&&H.getVisibleRange(),Se=Math.floor(Date.now()/1e3),ge=pe&&pe.to||Se;if(a.forEach((ve,be)=>{const we=Number(typeof ve=="number"?ve:ve&&ve.price);if(!Number.isFinite(we)||we<=0)return;const je=typeof ve=="object"&&ve?ve.side:null,Fe=je==="buy"?"#1EC98A":je==="sell"?"#FF5C7A":"#444CFF";try{const Re=H.createMultipointShape([{time:ge,price:we}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,text:"",overrides:{linecolor:Fe,linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0,showLabel:!1,fillBackground:!1}});se.set(`grid-${t}-${be}-${we}`,Re)}catch{}}),ee)try{ee.setAutoScale(!0)}catch{}},[a,v,t,q.length]);const oe=n||`tv_${t}_container`;return i.jsx("div",{id:oe,ref:f,className:"relative h-full min-h-[320px] w-full bg-[#101010]"})}const c0n=({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]=h.useState(VQ(l)),[d,f]=h.useState((t==null?void 0:t.markPx)||0),[x,g]=h.useState("text-white"),y=h.useRef((t==null?void 0:t.markPx)||0);h.useEffect(()=>{var re;if((t==null?void 0:t.markPx)!=null){const Q=((re=t.markPx.toString().split(".")[1])==null?void 0:re.length)||0;e(Q)}},[t==null?void 0:t.markPx,e]),h.useEffect(()=>{u(VQ(l));const re=setInterval(()=>u(VQ(l)),1e3);return()=>clearInterval(re)},[l]),h.useEffect(()=>{if((t==null?void 0:t.markPx)==null)return;const re=t.markPx,Q=y.current;re>Q?g("text-[#1DE6A3]"):re<Q&&g("text-[#FF7173]"),f(re);const q=setTimeout(()=>g("text-white"),700);return y.current=re,()=>clearTimeout(q)},[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,S=C!=null?C>=0?"text-[#1DE6A3]":"text-[#FF7173]":"text-white",T=re=>{const Q=Number(re);if(!Number.isFinite(Q))return null;const q=Math.abs(Q);let te=1;return q>=1e3?te=1:q>=100?te=2:q>=1?te=3:q>=.1?te=4:te=6,Q.toLocaleString(void 0,{maximumFractionDigits:te})},I=re=>re==null||isNaN(re)?null:re>=1e3?m3(re):re,L=re=>{const Q=Number(re);if(!Number.isFinite(Q))return null;const q=Math.abs(Q),te=Q>=0?"+":"-";if(!o)return`${te}${q.toFixed(5)}`;let fe=0;q<.1?fe=6:q<1?fe=4:q<10?fe=2:q<100&&(fe=1);const G=q.toFixed(fe),ie=fe>0?G.replace(/\.?0+$/,""):G;return`${te}${ie}`},F=v!=null?L(v):null,$=d!=null?o?T(d):I(d):null,O=(t==null?void 0:t.dayNtlVlm)!=null?`$${m3(Number(t.dayNtlVlm))}`:null,U=(t==null?void 0:t.oraclePx)!=null&&(t==null?void 0:t.openInterest)!=null?`$${m3(Number(t.oraclePx*t.openInterest))}`:null,Y=(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(ffe,{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(F7,{label:"Mid Price",value:$,tone:x}),i.jsx(F7,{label:"24h Change",value:F,sub:C!=null?`${C>=0?"+":"-"}${Math.abs(C).toFixed(2)}%`:null,tone:S}),i.jsx(F7,{label:"Vol 24h",value:O}),i.jsx(F7,{label:"Open Interest",value:U}),i.jsx(F7,{label:"Funding",value:Y,sub:t!=null&&t.funding?c:null,tone:"text-[#50D2C1]"})]})})]})};function VQ(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 F7=({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(u0n,{w:"90px"})}),n!=null&&i.jsx("span",{className:`text-[11px] leading-none ${r}`,children:n})]}),u0n=({w:t="90px"})=>i.jsx("span",{className:"inline-block align-middle h-[12px] rounded skeleton-ticker-text short",style:{width:t}}),d0n=({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(Sde,{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(gse,{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?`${Ir(e==null?void 0:e.long_qty)} ${t}`:"--",color:2}),i.jsx(zp,{name:"Total",info:e!=null&&e.total_qty?`${Ir(e==null?void 0:e.total_qty)} ${t}`:"--",color:1}),i.jsx(zp,{name:"Short",info:e!=null&&e.short_qty?`${Ir(e==null?void 0:e.short_qty)} ${t}`:"--",color:3,info_1:"true"}),i.jsx(gse,{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:OJ,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?`$${Ir(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(ije,{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:MJ,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?`$${Ir(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(ije,{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]`})]}),ije=({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]`})}),f0n="wss://api.hyperliquid.xyz/ws",h0n="https://api.hyperliquid.xyz/info",lB=t=>t==null?0:Number(t),cB=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),p0n=(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})},m0n=t=>{if(t>=1)return t.toLocaleString();const e=Math.min(8,Math.max(0,-Math.floor(Math.log10(t))));return t.toFixed(e)},Iqe={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}}},x0n=t=>{if(!t)return null;const e=String(t).toUpperCase(),n=Iqe[e];return n?Object.values(n).map(s=>s.value).filter(s=>Number.isFinite(s)&&s>0).sort((s,a)=>s-a):null},g0n=(t,e)=>{if(!t)return null;const n=String(t).toUpperCase(),r=Iqe[n];if(!r)return null;const s=Number(e)||0;return Object.values(r).find(l=>l.value===s)||null};function aje(t,e,n){const r=new Map;for(const s of t||[]){const a=lB(s.px),o=lB(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 b0n(t){var o;const n=await fetch(h0n,{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 y0n(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 v0n(t){const e=t.toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),n=Number(e);return Number.isFinite(n)?n:0}function w0n(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(v0n),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 oje(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 C0n(t){if(!t)return[];const e=String(t).trim(),n=x0n(e);if(n&&n.length)return n;const r=e.toUpperCase();try{const s=await b0n(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=y0n(s);let c=w0n(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:oje(e)}catch(s){return console.error("getUiStepsForCoin error",e,s),oje(e)}}function N0n(t,e){const n=g0n(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 S0n(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 j0n({coin:t,rows:e=10,onSelectPrice:n,onBest:r}){const s=h.useRef(null),a=h.useRef([]),o=h.useRef(null),l=h.useRef(0),c=h.useRef(null),u=h.useRef(null),[d,f]=h.useState({bids:[],asks:[]}),[x,g]=h.useState("COIN"),[y,v]=h.useState(null),[C,S]=h.useState([]),T=(K,H)=>x==="USD"?K*H:K,I=x==="USD"?"USD":t,L=K=>{const H=s.current;H&&H.readyState===WebSocket.OPEN?H.send(JSON.stringify(K)):(a.current.push(K),F())},F=()=>{const K=s.current;if(K&&(K.readyState===WebSocket.OPEN||K.readyState===WebSocket.CONNECTING)||o.current)return;const H=new WebSocket(f0n);s.current=H,H.onopen=()=>{l.current=0,a.current.splice(0,a.current.length).forEach(se=>H.send(JSON.stringify(se)))},H.onmessage=ee=>{var Re;const se=JSON.parse(ee.data||"{}");if((se==null?void 0:se.channel)!=="l2Book")return;const pe=(se==null?void 0:se.data)??se,Se=(pe==null?void 0:pe.coin)??(se==null?void 0:se.coin);if(!Se||Se!==c.current)return;const ge=(pe==null?void 0:pe.levels)??((Re=pe==null?void 0:pe.data)==null?void 0:Re.levels)??(se==null?void 0:se.levels);let ve,be;if(Array.isArray(ge))ve=ge[0]||[],be=ge[1]||[];else if(ge)ve=ge.bs||ge.bids||[],be=ge.as||ge.asks||[];else return;const we=Qe=>(Qe||[]).map(Ye=>{const dt=Number(Array.isArray(Ye)?Ye[0]:Ye.px),st=Number(Array.isArray(Ye)?Ye[1]:Ye.sz);return{px:dt,sz:st}}).filter(Ye=>Number.isFinite(Ye.px)&&Ye.px>0&&Number.isFinite(Ye.sz)&&Ye.sz>0),je=we(ve),Fe=we(be);f({bids:je,asks:Fe})},H.onclose=()=>{l.current=Math.min(l.current+1,6),o.current=setTimeout(()=>{o.current=null,F()},500*Math.pow(2,l.current))},H.onerror=()=>{try{H.close()}catch{}}},$=K=>{K&&(S0n(u.current,K)||(u.current&&L({method:"unsubscribe",subscription:u.current}),u.current=K,L({method:"subscribe",subscription:K})))},O=()=>{f({bids:[],asks:[]})};h.useEffect(()=>{let K=!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,O(),S([]),v(null),c.current=t||null,!!t)return F(),(async()=>{const H=await C0n(t);K||(S(H),v(H[0]??null))})(),()=>{K=!0}},[t]),h.useEffect(()=>{if(!t)return;const K=y||1,{nSigFigs:H,mantissa:ee}=N0n(K,t),se={type:"l2Book",coin:t};H!=null&&(se.nSigFigs=H),ee!=null&&(se.mantissa=ee),$(se)},[t,y]);const U=h.useMemo(()=>(d.bids||[]).map(K=>lB(K.px)).filter(K=>Number.isFinite(K)&&K>0),[d]),Y=h.useMemo(()=>(d.asks||[]).map(K=>lB(K.px)).filter(K=>Number.isFinite(K)&&K>0),[d]),re=U.length?Math.max(...U):null,Q=Y.length?Math.min(...Y):null;h.useEffect(()=>{re!=null&&Q!=null&&(r==null||r({bestBid:re,bestAsk:Q,mid:(re+Q)/2}))},[re,Q,r]);const q=h.useMemo(()=>{const K=Number(y)||1,H=aje(d.bids,K,"bid").sort((se,pe)=>pe.price-se.price),ee=aje(d.asks,K,"ask").sort((se,pe)=>se.price-pe.price);return{bids:H,asksAsc:ee}},[d,y]),te=h.useMemo(()=>{const K=q.asksAsc.slice(0,e);let H=0;return K.map(se=>(H+=T(se.size,se.price),{...se,total:H})).reverse()},[q,e,x]),fe=h.useMemo(()=>{const K=q.bids.slice(0,e);let H=0;return K.map(ee=>(H+=T(ee.size,ee.price),{...ee,total:H}))},[q,e,x]),G=h.useMemo(()=>{if(re==null||Q==null)return null;const K=Math.abs(Q-re),H=(Q+re)/2;return{diff:K,pct:H?K/H*100:0}},[re,Q]),ie=Math.max(te.reduce((K,H)=>Math.max(K,H.total||0),0),1e-9),oe=Math.max(fe.reduce((K,H)=>Math.max(K,H.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(cje,{value:String(y??""),onChange:K=>v(Number(K)),items:(C||[]).map(K=>({key:String(K),label:m0n(K)}))}),i.jsx(cje,{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 (",I,")"]}),i.jsxs("span",{className:"uppercase text-right",children:["Total (",I,")"]})]}),i.jsx("div",{className:"flex-1 overflow-hidden w-full",children:i.jsxs("div",{className:"overflow-auto w-full",children:[te.map((K,H)=>i.jsx(lje,{side:"ask",step:Number(y)||1,price:K.price,size:K.size!=null?T(K.size,K.price):null,total:K.total,widthPct:K.total?Math.min(100,K.total/ie*100):0,onClick:()=>K.price!=null&&(n==null?void 0:n(K.price)),unit:x},`ask-${H}`)),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:G?cB(G.diff,4):"--"}),i.jsx("span",{className:"text-right",children:G?`${cB(G.pct,4)}%`:"--"})]}),fe.map((K,H)=>i.jsx(lje,{side:"bid",step:Number(y)||1,price:K.price,size:K.size!=null?T(K.size,K.price):null,total:K.total,widthPct:K.total?Math.min(100,K.total/oe*100):0,onClick:()=>K.price!=null&&(n==null?void 0:n(K.price)),unit:x},`bid-${H}`))]})})]})}function lje({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?"—":p0n(e,o)}),i.jsx("span",{className:"text-center text-[#dcdada] hover:text-white",children:c?"—":cB(n,f?0:6)}),i.jsx("span",{className:"text-right text-[#a8a8a8] hover:text-white",children:c?"—":cB(r,f?0:6)})]})]})}function cje({value:t,onChange:e,items:n,align:r="left"}){var l,c;const[s,a]=h.useState(!1),o=h.useRef(null);return h.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 A0n="wss://api.hyperliquid.xyz/ws",_0n=t=>`https://app.hyperliquid.xyz/explorer/tx/${t}`,uje=t=>t==null?0:Number(t),E0n=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),k0n=t=>isNaN(t)?"--":t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:4}),T0n=t=>new Date(t).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});function P0n({coin:t,maxRows:e=300}){const n=h.useRef(null),r=h.useRef(null),s=h.useRef([]),a=h.useRef(null),[o,l]=h.useState([]);h.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(A0n),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 S=Array.isArray(C.data)?C.data:[C.data];s.current.push(...S)}};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 S=[...v,...C],T=[],I=new Set;for(const L of S){const F=L.tid??`${L.hash??""}-${L.time??""}`;if(!I.has(F)&&(I.add(F),T.push(L),T.length>=e))break}return T.sort((L,F)=>(F.time||0)-(L.time||0)),T})},150);return r.current=t,()=>{var v;(v=n.current)==null||v.removeEventListener("message",f),clearInterval(x)}},[t,e]),h.useEffect(()=>()=>{var u;a.current&&clearInterval(a.current);try{(u=n.current)==null||u.close()}catch{}},[]);const c=h.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=uje(u.px),f=uje(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:k0n(d)}),i.jsx("div",{className:"text-right text-[#dcdada]",children:E0n(f)}),i.jsx("div",{className:"text-right text-[#a8a8a8]",children:u.time?T0n(u.time):"--:--:--"}),i.jsx("div",{className:"flex justify-end",children:u.hash?i.jsx("a",{href:_0n(u.hash),target:"_blank",rel:"noreferrer",className:"text-white hover:text-white opacity-70 hover:opacity-100",children:i.jsx(Hrt,{className:"w-4 h-4 shrink-0"})}):null})]},(u.tid??u.hash)+String(u.time))})})]})}function I0n({coin:t,data:e,loading:n,period:r,periods:s,handlePeriodChange:a,onBookPrice:o,onBest:l,className:c=""}){const[u,d]=h.useState("orderbook"),[f,x]=h.useState("orderbook"),g=[{k:"orderbook",t:"Order Book"},{k:"trades",t:"Trades"}],y=S=>{x(u),d(S)},v=g.findIndex(S=>S.k===u)>g.findIndex(S=>S.k===f)?"right":"left",C={enter:S=>({x:S==="right"?24:-24,opacity:0}),center:{x:0,opacity:1},exit:S=>({x:S==="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(S=>{const T=u===S.k;return i.jsxs("button",{onClick:()=>y(S.k),className:`relative flex-1 flex items-center justify-center py-[6px] cursor-pointer font-semibold text-xs rounded-[12px] bg-transparent ${T?"text-white":"text-[#a8a8a8] hover:text-white"}`,children:[T&&i.jsx(Ya.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:S.t})]},S.k)})}),i.jsx("div",{className:"relative w-full h-[calc(100%-40px)] min-h-0",children:i.jsx(dP,{mode:"wait",custom:v,children:i.jsxs(Ya.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(d0n,{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(j0n,{coin:t,rows:9,onSelectPrice:o,onBest:l})}),u==="trades"&&i.jsx("div",{className:"h-full overflow-auto",children:i.jsx(P0n,{coin:t})})]},u)})})]})})}const Fqe="#101010",Do="#101010",Da="#2b3640",$i="#929292",Si="#929292",Vg="#67FFBD",v_="#FF7272",F0n="https://dextrabothypev2.nftinit.io",O0n=[{key:"market",label:"Market"},{key:"limit",label:"Limit"},{key:"twap",label:"Twap"}];function M0n({mode:t,onModeChange:e,className:n=""}){const r=h.useMemo(()=>O0n,[]),s=h.useRef(null),a=h.useRef({}),[o,l]=h.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 h.useEffect(()=>{c()},[t]),h.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 ${Da}`},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":Si,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 K4({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 ${Da}`},children:t})}function Fb({label:t,value:e,onChange:n,right:r,clearZeroOnFocus:s=!0,restoreZeroOnBlur:a=!0}){const o=r?ke.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:Si},children:t}),i.jsxs("div",{className:"flex items-center gap-2 h-[30px] px-2 rounded-lg",style:{background:Do,border:`1px solid ${Da}`},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 YF({value:t,onChange:e,items:n}){var o;const[r,s]=h.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:Do,color:$i},children:[a," ▾"]}),r&&i.jsx("div",{className:"absolute right-0 z-40 mt-1 min-w-[140px] rounded-md p-1",style:{background:Do,border:`1px solid ${Da}`},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":$i},onClick:()=>{e(l.key),s(!1)},children:l.label},l.key))})]})}function Bv({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:$i},children:e})]})}function dje({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:Fqe,border:`1px solid ${Da}`,borderRadius:16,padding:16},children:[t&&i.jsx("div",{className:"mb-3 text-sm font-semibold",style:{color:$i},children:t}),e]})}function H0({children:t,onClick:e}){return i.jsx("button",{onClick:e,className:"w-full h-[38px] rounded-xl font-semibold text-sm",style:{background:Vg,color:"#0f151a"},children:t})}function WQ({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)":Do,border:`1px solid ${t?"#67FFBD":Da}`,color:$i},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:Si},children:r})]})}function lp({open:t,onClose:e,children:n}){const[r,s]=h.useState(!1),[a,o]=h.useState(!1);return h.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]),h.useEffect(()=>{const l=c=>{c.key==="Escape"&&e()};return t&&window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t,e]),r?Ea.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 Use(t=""){return t?`${t.slice(0,6)}...${t.slice(-4)}`:""}const qQ="https://api.hyperliquid.xyz/info",L0n="wss://api.hyperliquid.xyz/ws",GQ={accountValue:0,withdrawable:0,totalNtlPos:0,totalRawUsd:0,totalMarginUsed:0,crossMaintenanceMarginUsed:0,unrealizedPnl:0,crossAccountValue:0};function H8(t){const[e,n]=h.useState(GQ),[r,s]=h.useState([]),[a,o]=h.useState({}),[l,c]=h.useState({}),[u,d]=h.useState({}),[f,x]=h.useState(!1),g=h.useRef(null),y=h.useRef(null);h.useEffect(()=>{let T=!0;return n(GQ),s([]),o({}),c({}),d({}),x(!1),t?((async()=>{try{const[I,L,F]=await Promise.all([fetch(qQ,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:t})}),fetch(qQ,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"spotClearinghouseState",user:t})}),fetch(qQ,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"spotMeta"})})]);if(!T)return;const $=await I.json(),O=await L.json(),U=await F.json(),Y=($==null?void 0:$.marginSummary)||{},re=($==null?void 0:$.crossMarginSummary)||{},Q=Array.isArray($==null?void 0:$.assetPositions)?$.assetPositions.reduce((oe,K)=>{var H;return oe+Number(((H=K==null?void 0:K.position)==null?void 0:H.unrealizedPnl)||0)},0):0,q={accountValue:Number((Y==null?void 0:Y.accountValue)||0),totalNtlPos:Number((Y==null?void 0:Y.totalNtlPos)||0),totalRawUsd:Number((Y==null?void 0:Y.totalRawUsd)||0),withdrawable:Number(($==null?void 0:$.withdrawable)||0),totalMarginUsed:Number((Y==null?void 0:Y.totalMarginUsed)||0),crossMaintenanceMarginUsed:Number(($==null?void 0:$.crossMaintenanceMarginUsed)||0),unrealizedPnl:Q,crossAccountValue:Number((re==null?void 0:re.accountValue)||0)},te=Array.isArray(O==null?void 0:O.balances)?O.balances.map(oe=>({coin:String(oe.coin),total:Number(oe.total||0),hold:Number(oe.hold||0)})):[],fe={},G={};if((Array.isArray(U==null?void 0:U.tokens)?U.tokens:[]).forEach(oe=>{const K=oe==null?void 0:oe.name;K&&(oe.tokenId&&(fe[K]=oe.tokenId),G[K]={tokenId:oe.tokenId||null,evmContract:oe.evmContract||null})}),!T)return;n(q),s(te),o(fe),c(G)}catch{if(!T)return;n(GQ),s([]),o({}),c({})}finally{T&&x(!0)}})(),()=>{T=!1}):(T&&x(!0),()=>{T=!1})},[t]),h.useEffect(()=>{if(!t)return;const T=new WebSocket(L0n);return g.current=T,T.onopen=()=>{[{method:"subscribe",subscription:{type:"user",user:t}},{method:"subscribe",subscription:{type:"webData2",user:t}}].forEach(I=>T.send(JSON.stringify(I))),y.current=setInterval(()=>{T.readyState===WebSocket.OPEN&&T.send(JSON.stringify({id:99,method:"ping"}))},3e4)},T.onmessage=I=>{var L,F,$,O,U,Y;try{const re=JSON.parse(I.data);if((re==null?void 0:re.channel)==="webData2"&&((L=re==null?void 0:re.data)!=null&&L.clearinghouseState)){const q=re.data.clearinghouseState,te=(q==null?void 0:q.marginSummary)||{},fe=(q==null?void 0:q.crossMarginSummary)||{},G=Array.isArray(q==null?void 0:q.assetPositions)?q.assetPositions.reduce((ie,oe)=>{var K;return ie+Number(((K=oe==null?void 0:oe.position)==null?void 0:K.unrealizedPnl)||0)},0):0;n(ie=>({...ie,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:(q==null?void 0:q.withdrawable)!=null?Number(q.withdrawable):ie.withdrawable,totalMarginUsed:Number((te==null?void 0:te.totalMarginUsed)||0),crossMaintenanceMarginUsed:Number((q==null?void 0:q.crossMaintenanceMarginUsed)||0),crossAccountValue:Number((fe==null?void 0:fe.accountValue)||0),unrealizedPnl:G}))}if((re==null?void 0:re.channel)==="webData2"&&Array.isArray((F=re==null?void 0:re.data)==null?void 0:F.assetCtxs)){const q={};for(const te of re.data.assetCtxs){const fe=te==null?void 0:te.coin,G=Number((te==null?void 0:te.midPx)??(te==null?void 0:te.markPx)??(te==null?void 0:te.px));fe&&Number.isFinite(G)&&(q[fe]=G)}Object.keys(q).length&&d(te=>({...te,...q}))}if((re==null?void 0:re.channel)==="user"&&(($=re==null?void 0:re.data)!=null&&$.state)){const q=re.data.state,te=(q==null?void 0:q.marginSummary)||{},fe=Array.isArray(q==null?void 0:q.assetPositions)?q.assetPositions.reduce((G,ie)=>{var oe;return G+Number(((oe=ie==null?void 0:ie.position)==null?void 0:oe.unrealizedPnl)||0)},0):void 0;n(G=>({...G,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 Q=Array.isArray((U=(O=re==null?void 0:re.data)==null?void 0:O.spotState)==null?void 0:U.balances)?re.data.spotState.balances:Array.isArray((Y=re==null?void 0:re.data)==null?void 0:Y.balances)?re.data.balances:null;if(Array.isArray(Q)){const q=Q.filter(te=>te&&te.coin).map(te=>({coin:String(te.coin),total:Number(te.total||0),hold:Number(te.hold||0)}));s(q)}}catch{}},T.onclose=()=>{y.current&&clearInterval(y.current)},T.onerror=()=>{},()=>{y.current&&clearInterval(y.current);try{T.close()}catch{}}},[t]);const v=h.useMemo(()=>({spot:r.reduce((I,L)=>{if(L.coin==="USDC")return I+Number(L.total||0);const F=u[L.coin];return I+(F?Number(L.total||0)*Number(F):0)},0),perps:e.accountValue}),[r,u,e.accountValue]),C=h.useMemo(()=>{const T=e.accountValue,I=e.unrealizedPnl,L=Number(e.crossAccountValue||0)>0?Number(e.crossAccountValue||0):Number(T||0),F=L>0?Number(e.crossMaintenanceMarginUsed||0)/L:0,$=Number(e.crossMaintenanceMarginUsed||0),O=T>0?e.totalNtlPos/T:0;return{balance:T,uPnl:I,cmr:F,maintenanceMargin:$,crossLeverage:O}},[e]);return{rows:h.useMemo(()=>{const T=[];return T.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(I=>{const L=Math.max(0,Number(I.total||0)-Number(I.hold||0)),F=u[I.coin],$=I.coin==="USDC"?Number(I.total||0):Number(F)?Number(I.total||0)*Number(F):null;T.push({id:`spot-${I.coin}`,kind:"spot",coin:I.coin,unit:I.coin,totalDisplay:I.total,totalSort:I.total,availableDisplay:L,availableSort:L,usdcValue:$})}),T},[e,r,u]),perps:e,spotBalances:r,tokenIdMap:a,tokenMetaMap:l,priceMap:u,accountEquity:v,perpsOverview:C,initialLoaded:f}}const R0n="https://dextrabothypev2.nftinit.io/api/wallet/request-agent",D0n="https://express-proxy-delta.vercel.app/proxy?url=",B0n="https://api.starknet.extended.exchange/api/v1",Oqe=t=>`${Number(t||0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})} USDC`;function $0n({w:t,active:e,onSelect:n,open:r,mode:s,balances:a}){const[o,l]=h.useState(!1),[c,u]=h.useState(!1);h.useEffect(()=>{try{l(!!localStorage.getItem("hyperToken"))}catch{}},[]);const d=(t.wallet_address||"").toLowerCase(),{perpsOverview:f}=H8(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 h.useEffect(()=>{if(!r||!o)return;u(!0);const S=setTimeout(()=>u(!1),2e3);return()=>clearTimeout(S)},[r,o,d]),h.useEffect(()=>{C&&u(!1)},[C]),i.jsxs("div",{className:"px-3 py-2 rounded cursor-pointer",style:{background:e?"#26313b":"transparent",color:e?"#ffffff":$i},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(ZVe,{size:3,color:"#ffffff"}):C?i.jsxs("span",{className:"text-[11px]",children:["— ",Oqe(v)]}):""]}),i.jsx("div",{className:"text-[11px]",style:{color:Si},children:Use(t.wallet_address)})]})}function pP({wallets:t=[],value:e,onChange:n,selectedBalance:r,mode:s="hyper"}){const[a,o]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState(0),[f,x]=h.useState(!1),[g,y]=h.useState({}),v=h.useRef(new Set),C=h.useRef(null),S=h.useRef(null),{address:T}=ds();h.useEffect(()=>{const Y=()=>{try{c(!!localStorage.getItem("hyperToken")),d(re=>re+1)}catch{}};return Y(),window.addEventListener("localStorageUpdated",Y),window.addEventListener("storage",Y),()=>{window.removeEventListener("localStorageUpdated",Y),window.removeEventListener("storage",Y)}},[]),h.useEffect(()=>{if(!l||!e)return;x(!0);const Y=setTimeout(()=>x(!1),2e3);return()=>clearTimeout(Y)},[e,l]),h.useEffect(()=>{var re;Number.isFinite(Number(r))&&x(!1);const Y=t&&t.length?String(((re=t.find(Q=>String(Q.wallet_id)===String(e))||t[0])==null?void 0:re.wallet_id)??""):null;Y&&Number.isFinite(Number(r))&&Number(r)>=0&&(C.current=Y,y(Q=>Q[Y]===Number(r)?Q:{...Q,[Y]:Number(r)}))},[r,t,e]),h.useEffect(()=>{const Y=Q=>{S.current&&(S.current.contains(Q.target)||o(!1))},re=Q=>{Q.key==="Escape"&&o(!1)};return document.addEventListener("pointerdown",Y,!0),document.addEventListener("keydown",re),()=>{document.removeEventListener("pointerdown",Y,!0),document.removeEventListener("keydown",re)}},[]);const I=t&&t.length>0,L=I?t.find(Y=>String(Y.wallet_id)===String(e))||(e?null:t[0]):null,F=L&&L.wallet_address?`${L.wallet_name||`Wallet ${L.wallet_id}`} — ${Use(L.wallet_address)}`:L?L.wallet_name||`Wallet ${L.wallet_id}`:T?`MetaMask — ${Use(T)}`:"Select Wallet";let $=null;if(Number.isFinite(Number(r)))$=Number(r);else if(L){const re=(g&&g[L.wallet_id!=null?String(L.wallet_id):""])??L.available_balance??L.availableForTrade??L.available_for_trade??L.balance??L.available??null,Q=Number(re);Number.isFinite(Q)&&($=Q)}const O=L&&!f&&$!=null?`${F} — ${Oqe($)}`:F,U=h.useCallback(async Y=>{var K;if(s!=="hyper")return{data:{agent_pk:null,from_cache:!1}};const re=localStorage.getItem("hyperTradeToken")||"",Q=localStorage.getItem("hyperToken")||"",q=localStorage.getItem("hyperAddress")||"",te=`hl_pk:${Y}`,fe=localStorage.getItem(te);if(fe)return localStorage.setItem("hl_pk",fe),{data:{agent_pk:fe,from_cache:!0}};const ie=await(await fetch(R0n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:q,trade_token:re,token:Q,wallet_id:String(Y)})})).json().catch(()=>({})),oe=(K=ie==null?void 0:ie.data)==null?void 0:K.agent_pk;return oe&&(localStorage.setItem(te,oe),localStorage.setItem("hl_pk",oe)),ie},[s]);return h.useEffect(()=>{if(!L||s!=="hyper"||!l)return;const re=`hl_pk:${String(L.wallet_id)}`,Q=localStorage.getItem("hyperTradeToken")||"",q=localStorage.getItem("hyperToken")||"",te=localStorage.getItem("hyperAddress")||"";if(!(!Q||!q||!te)){try{const fe=localStorage.getItem(re);if(fe){localStorage.setItem("hl_pk",fe);return}}catch{}U(L.wallet_id).catch(()=>{})}},[l,s,L,U,u]),h.useEffect(()=>{if(typeof window>"u")return;const Y=s==="lighter"?"lighter":"hl";if(t&&t.length){const re=t.find(te=>String(te.wallet_id)===String(e))||t[0];if(!re)return;const Q=String(re.wallet_id),q=String(re.wallet_address||"").toLowerCase();try{window.localStorage.setItem(`${Y}_selected_wallet_id`,Q),window.localStorage.setItem(`${Y}_selected_wallet_address`,q),window.dispatchEvent(new Event("localStorageUpdated")),window.dispatchEvent(new CustomEvent("hl_selected_wallet_changed",{detail:{id:Q,address:q,mode:s}})),s==="hyper"&&l&&U(re.wallet_id).catch(()=>{})}catch{}}else if(T){const re="",Q=String(T||"").toLowerCase();try{window.localStorage.setItem(`${Y}_selected_wallet_id`,re),window.localStorage.setItem(`${Y}_selected_wallet_address`,Q),window.dispatchEvent(new Event("localStorageUpdated")),window.dispatchEvent(new CustomEvent("hl_selected_wallet_changed",{detail:{id:re,address:Q,mode:s}}))}catch{}}},[t,e,s,T,l,U]),h.useEffect(()=>{if(s!=="extended")return;let Y=!1;const re=async Q=>{var ie,oe,K;const q=Q.wallet_id!=null?String(Q.wallet_id):"";if(!q||v.current.has(q))return;const te=g[q];if(Number.isFinite(te)&&te>0)return;const fe=Q.available_balance??Q.availableForTrade??Q.available_for_trade??Q.balance??Q.available??null,G=Number(fe);if(Number.isFinite(G)&&G>0){y(H=>H[q]===G?H:{...H,[q]:G});return}if(Q.wallet_api_key){v.current.add(q);try{const H=`${D0n}${encodeURIComponent(`${B0n}/user/balance`)}`,se=await(await fetch(H,{headers:{"X-Api-Key":Q.wallet_api_key}})).json().catch(()=>({}));if(Y)return;const pe=((ie=se==null?void 0:se.data)==null?void 0:ie.availableForTrade)??(se==null?void 0:se.availableForTrade)??((oe=se==null?void 0:se.data)==null?void 0:oe.available_balance)??(se==null?void 0:se.available_balance)??((K=se==null?void 0:se.data)==null?void 0:K.available)??(se==null?void 0:se.available)??null,Se=Number(pe);Number.isFinite(Se)&&y(ge=>ge[q]===Se?ge:{...ge,[q]:Se})}catch{}finally{v.current.delete(q)}}};return t.forEach(Q=>re(Q)),()=>{Y=!0}},[t,s,g]),i.jsxs("div",{className:"relative",ref:S,children:[i.jsxs("div",{onClick:()=>o(Y=>!Y),className:"h-[32px] px-3 rounded-md flex justify-between items-center cursor-pointer",style:{background:Do,border:`1px solid ${Da}`,color:$i},children:[i.jsxs("span",{className:"truncate text-xs flex items-center gap-1",children:[O,f&&i.jsx(ZVe,{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:Do,border:`1px solid ${Da}`},children:[i.jsxs("div",{onClick:()=>{o(!1);const Y=s==="hyper"?"hyperliquid":s==="lighter"?"lighter":"extended";window.open(`/wallet-management#${Y}#add-account#${Y}`,"_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"})]}),I&&t.map(Y=>{const re=String(Y.wallet_id)===String(e);return i.jsx($0n,{w:Y,active:re,open:a,mode:s,balances:g,onSelect:async()=>{n(String(Y.wallet_id)),o(!1);try{await U(Y.wallet_id)}catch{}}},Y.wallet_id)}),!I&&i.jsx("div",{className:"px-3 py-2 text-xs",style:{color:Si},children:"No wallets"})]})]})}const KQ=new Map;function U0n(t,e){const n=KQ.get(t);if(n)return n;const r=Promise.resolve().then(e).finally(()=>KQ.delete(t));return KQ.set(t,r),r}const z0n=15e3,fje=new Map;function Mqe(t,e,n=!0,{pollMs:r=0,refreshOnFocus:s=!1}={}){const[a,o]=h.useState([]),[l,c]=h.useState(!1),u=h.useCallback(async()=>{if(!t||!e){o([]);return}const d=`wallets:${t}:${n?1:0}`,f=Date.now(),x=fje.get(d);if(x&&f-x.ts<z0n)return o(x.data),c(!1),x.data;c(!0);const g=await U0n(d,async()=>{const v=await(await fetch(`${F0n}/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(S=>{var T,I,L;return{...S,balances:{eth:((T=S==null?void 0:S.balances)==null?void 0:T.eth)??0,usdc:((I=S==null?void 0:S.balances)==null?void 0:I.usdc)??0,hyper_usdc:((L=S==null?void 0:S.balances)==null?void 0:L.hyper_usdc)??0}}}),C});return o(g),fje.set(d,{ts:Date.now(),data:g}),c(!1),g},[t,e,n]);return h.useEffect(()=>{(async()=>await u())()},[u]),h.useEffect(()=>{if(!s)return;const d=()=>{document.visibilityState==="visible"&&u()};return document.addEventListener("visibilitychange",d),()=>document.removeEventListener("visibilitychange",d)},[u,s]),h.useEffect(()=>{if(!r)return;const d=setInterval(u,r);return()=>clearInterval(d)},[u,r]),{wallets:a,loading:l,refresh:u}}function Aj({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]=h.useState(!1),u=(C,S,T)=>Math.max(S,Math.min(T,C)),d=Math.max(2,s.length)-1,f=C=>{const S=u(Number(C)||0,s[0],s[s.length-1]);if(S<=s[0])return 0;if(S>=s[s.length-1])return 100;let T=0;for(;T<d&&S>s[T+1];)T++;const I=s[T+1]-s[T]||1,L=(S-s[T])/I;return(T+L)/d*100},x=C=>{const T=u(Number(C)||0,0,100)/100*d,I=Math.min(d-1,Math.floor(T)),L=T-I,F=s[I]+(s[I+1]-s[I])*L;if(!o)return F;let $=s[0],O=1/0;for(const U of s){const Y=Math.abs(U-F);Y<O&&(O=Y,$=U)}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,S)=>{const T=S/d*100,I=g/100*d;return S<=I?null:i.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 top-1/2",style:{left:`${T}%`},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"}})},S)})}),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 ${Da}`},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,S)=>{if(S===0)return null;const T=S/d*100;return i.jsxs("div",{className:"absolute -translate-x-1/2 text-[12px] text-[#CFCFCF]",style:{left:`${T}%`},children:[C,"%"]},S)})}),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 LC=42161,XF=10,YQ=[{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"},$v={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 H0n({open:t,onClose:e,initialAsset:n="USDC",initialChain:r,toWalletAddress:s,usdcTokenAddress:a="0xaf88d065e77c8cC2239327C5EDb3A432268e5831"}){const[o,l]=h.useState(n),[c,u]=h.useState(r||$v[n].chains[0].key),d=$v[o],[f,x]=h.useState(""),[g,y]=h.useState(!1),[v,C]=h.useState(null),[S,T]=h.useState(!1);h.useEffect(()=>{t&&(l(n),u(r||$v[n].chains[0].key),x(""),y(!1),C(null),T(!1))},[t,n,r]);const I=h.useMemo(()=>`https://app.hyperliquid.xyz/coins/${(d.icon||o).toUpperCase()}.svg`,[o,d.icon]);d.kind==="usdc"?`${c}`:`${o}${c}`;const{address:L,isConnected:F}=ds(),$=i8(),{switchChainAsync:O}=Hoe(),U=EPe(),{writeContractAsync:Y}=L2t(),re=o==="USDC",Q=re&&c==="Arbitrum",q=re&&c!=="Arbitrum",te=Q&&$!==LC,{data:fe}=_xe({address:a,abi:YQ,functionName:"decimals",chainId:LC,query:{enabled:Q}}),G=Number(fe??6),{data:ie,refetch:oe}=_xe({address:a,abi:YQ,functionName:"balanceOf",args:[L??"0x0000000000000000000000000000000000000000"],chainId:LC,query:{enabled:Q&&!!L}}),K=h.useMemo(()=>{try{return ie?NT(ie,G):"0.00"}catch{return"0.00"}},[ie,G]),H=Q&&Number(f||0)<XF;function ee(be,we="error"){C({text:be,type:we})}function se(be){const we=String((be==null?void 0:be.shortMessage)||(be==null?void 0:be.message)||be||"");return we.toLowerCase().includes("does not match the connection's chain")||we.toLowerCase().includes("chain mismatch")||we.toLowerCase().includes("connector chain")?"You're not on Arbitrum. Please switch to Arbitrum.":we}async function pe(){try{if(!F)return ee("Wallet is not connected");if(q)return ee("The deposit bridge supports Arbitrum only");te&&await O({chainId:LC});const be=String(f||"").trim();if(!be||Number(be)<=0)return ee("Enter a valid amount");if(Number(be)<XF)return ee(`Minimum is ${XF} USDC`);const we=P1t(be,G);y(!0),C({type:"info",text:"Submitting transaction..."});const je=await Y({address:a,abi:YQ,functionName:"transfer",args:[$v.USDC.bridge,we],chainId:LC});C({type:"info",text:"Waiting for confirmation..."}),await U.waitForTransactionReceipt({hash:je}),C({type:"success",text:"Deposit completed"}),x(""),oe==null||oe()}catch(be){ee(se(be),"error")}finally{y(!1)}}function Se(be){var we;be&&((we=navigator.clipboard)==null||we.writeText(be),T(!0),setTimeout(()=>T(!1),1500))}const ge=q?"Arbitrum Required":Q?te?"Deposit":g?"Depositing...":"Deposit":"Done",ve=g||q||Q&&H;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:I,alt:o,className:"w-10 h-10",onError:be=>{be.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:be=>{var je;const we=be.target.value;l(we),u((je=$v[we].chains[0])==null?void 0:je.key),C(null)},children:Object.keys($v).map(be=>i.jsx("option",{value:be,children:be},be))}),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:be=>{u(be.target.value),C(null)},children:$v[o].chains.map(be=>i.jsx("option",{value:be.key,children:be.label},be.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)]})]}),Q&&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:be=>x(be.target.value.replace(",",".").replace(/[^\d.]/g,"")),inputMode:"decimal"}),i.jsxs("button",{type:"button",onClick:()=>x(String(K)),className:"absolute right-3 text-[12px] text-[#67FFBD] font-semibold",children:["MAX: ",Number(K||0).toFixed(2)]})]}),i.jsxs("div",{className:"text-[11px]",style:{color:H?"#ffb4b4":"#9BA3A7"},children:["Minimum: ",XF," USDC"]})]}),re&&i.jsx(i.Fragment,{children:q&&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:()=>Se(d.address),className:"text-[12px] text-[#67FFBD]",children:"Copy"})]})]}),S&&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:re?q?void 0:te?async()=>{try{C(null),await O({chainId:LC}),C({type:"success",text:"Switched to Arbitrum"})}catch(be){C({type:"error",text:se(be)})}}:pe:e,disabled:ve,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:ge})]})]})]})})}function V0n(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 W0n(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 q0n=new TextEncoder,G0n=50;function K0n(t,e,n){q0n.encodeInto(t,e.subarray(n))}function Y0n(t,e,n){t.length>G0n?K0n(t,e,n):W0n(t,e,n)}new TextDecoder;class QF{constructor(e,n){this.type=e,this.data=n}}class uB extends Error{constructor(e){super(e);const n=Object.create(uB.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:uB.name})}}function X0n(t,e,n){const r=n/4294967296,s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function Lqe(t,e,n){const r=Math.floor(n/4294967296),s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function Q0n(t,e){const n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}const Z0n=-1,J0n=4294967296-1,exn=17179869184-1;function txn({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=exn)if(e===0&&t<=J0n){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),Lqe(r,4,t),n}}function nxn(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 rxn(t){if(t instanceof Date){const e=nxn(t);return txn(e)}else return null}function sxn(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=Q0n(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new uB(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function ixn(t){const e=sxn(t);return new Date(e.sec*1e3+e.nsec/1e6)}const axn={type:Z0n,encode:rxn,decode:ixn};class zse{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(axn)}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 QF(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 QF(o,a)}}}return e instanceof QF?e:null}decode(e,n,r){const s=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return s?s(e,n,r):new QF(n,e)}}zse.defaultCodec=new zse;function oxn(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function lxn(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):oxn(t)?new Uint8Array(t):Uint8Array.from(t)}const cxn=100,uxn=2048;class gfe{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??zse.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)??cxn,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??uxn,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 gfe({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=V0n(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),Y0n(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=lxn(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),X0n(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),Lqe(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 Rqe(t,e){return new gfe(e).encodeSharedRef(t)}const dxn={name:"Exchange",version:"1",chainId:1337,verifyingContract:"0x0000000000000000000000000000000000000000"},fxn={Agent:[{name:"source",type:"string"},{name:"connectionId",type:"bytes32"}]};function hxn(t){if(typeof t!="string"||!t.includes("."))return String(t);const e=t.replace(/\.?0+$/,"");return e==="-0"?"0":e}function Hse(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(Hse);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]=Hse(r):(n==="p"||n==="s")&&typeof r=="string"&&(e[n]=hxn(r))}return e}function pxn(t){return js(t)}function mxn(t,e,n){const r=Hse(t),s=Rqe(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(pxn(e),s.length+9)),go(o)}function xxn(t,e){return{source:e?"a":"b",connectionId:t}}async function gxn(t,e){const n=await t.signTypedData(e.domain,e.types,e.message),{r,s,v:a}=lu.from(n);return{r,s,v:a}}async function bxn(t,e,n,r,s){const a=mxn(e,n,r),o=xxn(a,s);return gxn(t,{domain:dxn,types:fxn,primaryType:"Agent",message:o})}function mP({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 fE(a);return bxn(o,r,n,s,e)}}}function yxn(t){return new fE(t).address}function vxn({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 wxn=({children:t})=>i.jsx("div",{className:"text-[12px] text-[#9B9B9B] font-inter mb-1 font-semibold",children:t}),Cxn=({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 hje(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}const XQ=t=>t==="perps"?"Perps":"Spot";function Dqe({open:t,onClose:e,perpsAvailable:n=0,spotUsdcAvailable:r=0,onSubmit:s,loading:a=!1,initialToPerp:o=!1}){const[l,c]=h.useState(o?"spot":"perps"),[u,d]=h.useState("");h.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(S=>S==="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(vxn,{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:XQ(l)}),i.jsx(Sle,{className:"text-[#67FFBD]"}),i.jsx("span",{className:`${f==="perps"?"text-[#67FFBD] font-medium":"text-[#bdbdbd]"}`,children:XQ(f)})]})}),i.jsxs("div",{className:"space-y-2 text-xs",children:[i.jsx(wxn,{children:"Amount (USDC)"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Cxn,{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:hje(x,6)})]})]}),i.jsxs("div",{className:"text-[12px] text-[#9B9B9B]",children:["Available (",XQ(l),"): ",hje(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 pje({label:t,children:e}){return i.jsxs("div",{className:"mb-3",children:[i.jsx("div",{className:"mb-1 text-[12px]",style:{color:Si},children:t}),i.jsx("div",{className:"flex items-center gap-2",children:e})]})}const QQ=42161,Nxn="0xa4b1",mje="Mainnet";function Sxn(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 jxn({open:t,onClose:e,perpsBalance:n=0,defaultDest:r=""}){const{address:s}=ds(),a=i8(),{switchChainAsync:o}=Hoe(),{signTypedDataAsync:l}=M2t(),[c,u]=h.useState(""),[d,f]=h.useState(r||s||""),[x,g]=h.useState(!1),[y,v]=h.useState(null);h.useEffect(()=>{t&&(u(""),f(r||s||""),g(!1),v(null))},[t,r,s]);const C=h.useMemo(()=>{const L=Math.max(0,Number(n||0)-1);return L>0?Number(L.toFixed(6)):0},[n]),S="Withdraw USDC to Arbitrum";async function T(){var L;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!==QQ)try{await o({chainId:QQ})}catch{v({type:"error",text:"Switch to Arbitrum to withdraw."});return}g(!0),v({type:"info",text:"Signing request..."});const O=Date.now(),U={name:"HyperliquidSignTransaction",version:"1",chainId:QQ,verifyingContract:"0x0000000000000000000000000000000000000000"},Y={"HyperliquidTransaction:Withdraw":[{name:"hyperliquidChain",type:"string"},{name:"destination",type:"string"},{name:"amount",type:"string"},{name:"time",type:"uint64"}]},re={hyperliquidChain:mje,destination:$,amount:String(F),time:O},Q=await l({domain:U,types:Y,primaryType:"HyperliquidTransaction:Withdraw",message:re});v({type:"info",text:"Submitting..."});const q={action:{type:"withdraw3",signatureChainId:Nxn,hyperliquidChain:mje,destination:$,amount:String(F),time:O},nonce:O,signature:Sxn(Q)},te=await fetch("https://api.hyperliquid.xyz/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)}).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),(L=window==null?void 0:window.dispatchEvent)==null||L.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 I=y&&i.jsx("div",{className:"p-2 rounded-lg text-[12px] mb-3",style:{border:`1px solid ${Da}`,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:S,children:[I,i.jsxs(pje,{label:"Amount",children:[i.jsxs("div",{className:"flex items-center gap-2 h-[36px] px-2 rounded-lg",style:{background:Do,border:`1px solid ${Da}`,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:$i,fontFeatureSettings:'"tnum"'},value:c,onChange:L=>u(L.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:Si},children:["MAX: ",C.toFixed(6)," USDC"]})]}),i.jsx(pje,{label:"Destination Address",children:i.jsxs("div",{className:"flex items-center gap-2 h-[36px] px-2 rounded-lg",style:{background:Do,border:`1px solid ${Da}`,width:"100%"},children:[i.jsx("input",{className:"min-w-0 flex-1 bg-transparent outline-none text-sm",placeholder:"0x...",style:{color:$i},value:d,onChange:L=>f(L.target.value)}),i.jsx("button",{className:"text-xs h-6 flex items-center justify-center text-[#67FFBD]",onClick:async()=>{const L=await navigator.clipboard.readText().catch(()=>"");L&&f(L.trim())},children:"Paste"})]})}),i.jsx("div",{className:"p-2 rounded-lg text-[12px] mb-3",style:{background:"#3b1f1f",color:"#ffb4b4",border:`1px solid ${Da}`},children:"IMPORTANT: A $1 fee is deducted from each withdrawal."}),i.jsx("button",{onClick:T,disabled:x,className:"w-full h-[42px] mt-1 rounded-xl font-semibold text-sm disabled:opacity-60",style:{background:Vg,color:"#0f151a"},children:x?"Submitting...":"Withdraw"})]})})}function Axn({value:t,onChange:e,leftLabel:n,rightLabel:r,leftUsd:s=0,rightUsd:a=0}){const o=h.useRef(null),l=h.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 h.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:Vg},children:[n,": ",t,"%"]}),i.jsxs("span",{className:"font-semibold",style:{color:v_},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, ${Vg}80 0%, ${Vg}80 ${t}%, ${v_}80 ${t}%, ${v_}80 100%)`,border:`1px solid ${Da}`}}),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:Vg,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:Vg},children:s?`${s.toLocaleString(void 0,{maximumFractionDigits:2})} USDC`:""}),i.jsx("span",{style:{color:v_},children:a?`${a.toLocaleString(void 0,{maximumFractionDigits:2})} USDC`:""})]})]})}function _xn(t){return Ol({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 Exn({skipConfirm:t,setSkipConfirm:e}){const[n,r]=h.useState(!1),s=h.useRef(null);return h.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(_xn,{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 ZQ="wss://api.hyperliquid.xyz/ws";function O7(t,e=2){const n=Number(t||0),r={maximumFractionDigits:e,minimumFractionDigits:n===0?2:0};return n.toLocaleString(void 0,r)}function xje(t){return Number(t||0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}const gje=t=>{const e=String(t||"").toUpperCase();return e==="GTC"?"Gtc":e==="IOC"?"Ioc":e==="ALO"?"Alo":"Gtc"};function kxn(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 Txn({book:t,side:e,sizeCoin:n,mid:r}){const s=kxn(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 Bqe={position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12,border:"1px solid #2A2A2A"}},Pxn="dextra-global-toast";function qa(t,e){return fn.promise(t,e,{id:Pxn,...Bqe})}const M7=t=>Number(t||0);function Ixn(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 Fxn(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 Oxn({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:M7(f)||1,longSize:M7(n??(g?0:y?v:0)),shortSize:M7(r??(g||y?0:v)),slippage:Number(o||0),takeProfit:l&&M7(c)>0?String(c):"",stopLoss:l&&M7(u)>0?String(u):""}}}async function JQ({draft:t,responses:e,user:n}){const r=[];for(const o of Array.isArray(e)?e:[e])r.push(...Ixn(o));const s=r.length?await Fxn(n,r):[];return{...t,exchangeOids:r,orderStatus:s}}function RC(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 bje({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]=h.useState("market"),[f,x]=h.useState("buy"),[g,y]=h.useState(""),[v,C]=h.useState(""),[S,T]=h.useState("USD"),[I,L]=h.useState(0),[F,$]=h.useState(!1),[O,U]=h.useState("GTC"),[Y,re]=h.useState(!1),[Q,q]=h.useState(""),[te,fe]=h.useState(""),[G,ie]=h.useState(""),[oe,K]=h.useState(""),[H,ee]=h.useState(!1),[se,pe]=h.useState(!1),[Se,ge]=h.useState(!1),[ve,be]=h.useState("Cross"),[we,je]=h.useState("Cross"),[Fe,Re]=h.useState(s),[Qe,Ye]=h.useState(!1),[dt,st]=h.useState(!1),[at,He]=h.useState(!1),[qe,vt]=h.useState("One-Way"),[yt,Kt]=h.useState(""),[jt,un]=h.useState("USDC"),[vn,Hn]=h.useState(0),[ln,Nn]=h.useState(5),[dn,rt]=h.useState(!1),[nt,Ut]=h.useState(0),[wn,Jt]=h.useState(!1),[Vt,xt]=h.useState(null),[We,Pt]=h.useState(null),[Ke,ct]=h.useState(null),[Nt,Ht]=h.useState(s),[Rt,hn]=h.useState(null),[yn,Cn]=h.useState({address:null,token:null}),[En,Rn]=h.useState(null),[Mn,Yn]=h.useState(null),[Zn,Vn]=h.useState(null),[tr,Sn]=h.useState(50),[ze,xe]=h.useState(!1),[Ge,_e]=h.useState({bids:[],asks:[]}),[Be,qt]=h.useState(!1),[It,mt]=h.useState(String(t)),[Ft,Tn]=h.useState(()=>{if(typeof window>"u")return"8";const Pn=localStorage.getItem("hl_max_slip_pct");if(Pn==null||Pn==="")return"8";const Ln=Number(Pn);return Number.isFinite(Ln)&&Ln>0?String(Ln):"8"}),[kn,Gt]=h.useState(""),[mn,gt]=h.useState({}),[Wt,jn]=h.useState([]),[kt,cn]=h.useState(!1),Ce=h.useRef(null),m=h.useRef(null),[p,N]=h.useState(()=>localStorage.getItem("skipCloseConfirm")==="true"),[A,k]=h.useState([0,0]),[P,D]=h.useState({takerPct:null,makerPct:null});h.useEffect(()=>{localStorage.setItem("skipCloseConfirm",p?"true":"false")},[p]);const V=h.useMemo(()=>Math.max(0,Number(Ft||0))/100,[Ft]),Z=Pn=>String(Pn||"").trim().toUpperCase(),ce="dextrabot.last_used_leverage",ue=()=>{try{return JSON.parse(localStorage.getItem(ce)||"{}")}catch{return{}}},me=Pn=>{const Ln=`leverage:${Z(Pn)}`,ht=Number(localStorage.getItem(Ln));return Number.isFinite(ht)&&ht>0?ht:null},Ne=Pn=>{const Ln=Z(Pn),ht=ue(),Yt=Number(ht==null?void 0:ht[Ln]);return Number.isFinite(Yt)&&Yt>0?Yt:me(Ln)},Ie=(Pn,Ln)=>{var sr;const ht=Z(Pn),Yt=Math.max(1,Number(Ln)||1),lr=ue();lr[ht]=Yt,localStorage.setItem(ce,JSON.stringify(lr)),localStorage.setItem(`leverage:${ht}`,String(Yt)),(sr=window.dispatchEvent)==null||sr.call(window,new Event("localStorageUpdated"))},{isConnected:Le}=ds(),{openConnectModal:Xe}=z5(),{setSignInConnectButtonOpen:Oe}=h.useContext(Qr),{address:$e}=ds(),ae=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,Pe=!!(typeof window<"u"&&localStorage.getItem("hyperToken")&&(Le||ae)),Ve=h.useRef(null);h.useEffect(()=>{const Pn=$e?$e.toLowerCase():null;if(Ve.current&&Ve.current!==Pn&&typeof window<"u"){const Ln=window.localStorage;Ln.removeItem("hyperToken"),Ln.removeItem("hyperAddress"),Ln.removeItem("hyperTradeToken"),Ln.removeItem("hl_pk"),Ln.removeItem("hl:wallet_id"),Object.keys(Ln).forEach(ht=>{ht.startsWith("hl_pk:")&&Ln.removeItem(ht)}),window.dispatchEvent(new Event("localStorageUpdated"))}Ve.current=Pn,xt(null)},[$e]),h.useEffect(()=>{const Pn=(a==null?void 0:a.id)!=null?String(a.id):null;if(Pn==null){xt(null);return}xt(Ln=>Ln!=null&&String(Ln)===Pn?Ln:Pn)},[a==null?void 0:a.id]),h.useEffect(()=>{Vt!=null&&localStorage.setItem("hl:wallet_id",String(Vt))},[Vt]);const Te=h.useRef(null);h.useEffect(()=>{l!=="pair"&&It&&Te.current===It&&Ie(It,Fe)},[Fe,It,l]),h.useEffect(()=>{let Pn,Ln=!0;function ht(){Pn=new WebSocket(ZQ),Pn.onopen=()=>{const Yt={method:"subscribe",subscription:{type:"l2Book",coin:String(t).toUpperCase()}};Pn.send(JSON.stringify(Yt))},Pn.onmessage=Yt=>{var ys;if(!Ln)return;const lr=JSON.parse(Yt.data),sr=((ys=lr==null?void 0:lr.data)==null?void 0:ys.levels)||(lr==null?void 0:lr.levels),Mr=(sr==null?void 0:sr.bs)||(sr==null?void 0:sr.bids)||[],Lr=(sr==null?void 0:sr.as)||(sr==null?void 0:sr.asks)||[],ss=Bt=>Bt.map(mr=>Array.isArray(mr)?{px:Number(mr[0]),sz:Number(mr[1])}:{px:Number(mr.px),sz:Number(mr.sz)}).filter(mr=>mr.px>0&&mr.sz>0);(Mr.length||Lr.length)&&_e({bids:ss(Mr),asks:ss(Lr)})}}return ht(),()=>{Ln=!1;try{Pn&&Pn.close()}catch{}}},[t]),h.useEffect(()=>{const Pn=()=>{const Ln=typeof window<"u"?localStorage.getItem("hyperAddress"):null,ht=typeof window<"u"?localStorage.getItem("hyperToken"):null;Cn({address:Ln,token:ht})};return Pn(),window.addEventListener("localStorageUpdated",Pn),window.addEventListener("storage",Pn),()=>{window.removeEventListener("localStorageUpdated",Pn),window.removeEventListener("storage",Pn)}},[]);const Ze=()=>{const Pn=parseFloat(String(Ft).replace(",",".")),ht=Math.max(.01,Math.min(50,Number.isFinite(Pn)?Pn:8)).toString();Tn(ht),localStorage.setItem("hl_max_slip_pct",ht),qt(!1)},{wallets:it}=Mqe(yn.address,yn.token,!0,{pollMs:5e3});h.useEffect(()=>{if(!it||!it.length||Vt&&it.some(ht=>String(ht.wallet_id)===String(Vt)))return;const Pn=it.find(ht=>ht.confirmed)||it[0];if(!Pn)return;const Ln=String(Pn.wallet_id);String(Vt)!==Ln&&(xt(Ln),o==null||o({id:Ln,address:Pn.wallet_address}))},[it,Vt,o]);const wt=h.useMemo(()=>(it||[]).find(Pn=>String(Pn.wallet_id)===String(Vt))||null,[it,Vt]);h.useEffect(()=>{n!=null&&n!==""&&(d("limit"),y(Number(n)))},[n]),h.useEffect(()=>{let Pn=!0;cn(!1);async function Ln(){try{const Yt=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"metaAndAssetCtxs"})})).json(),lr=Array.isArray(Yt)?Yt[0]:Yt,sr=(lr==null?void 0:lr.universe)||[],Mr=new Map(sr.map(ys=>{const Bt=typeof ys=="string"?ys:(ys==null?void 0:ys.name)??(ys==null?void 0:ys[0])??"";return[Z(Bt),typeof ys=="string"?{name:Bt}:ys]}));if(l==="pair"){const[ys,Bt]=String(c||"").split("/").map(qr=>qr.trim()),mr=Mr.get(Z(ys)),er=Mr.get(Z(Bt));if(Pn){const qr=(mr==null?void 0:mr.maxLeverage)??s,xs=(er==null?void 0:er.maxLeverage)??s,ls=Math.max(1,Math.min(qr,xs));Ht(ls),Re(hs=>Math.min(hs||1,ls)),Pt(null),ct(null),hn(null),mt(null),cn(!0)}return}const Lr=Mr.get(Z(t));if(!Lr){Pn&&(Pt(null),ct(null),Ht(s),Re(ys=>Math.min(ys||1,s)),hn(null),mt(String(t)),cn(!0));return}const ss=(Lr==null?void 0:Lr.name)||String(t);if(Pn){Pt(0),ct((Lr==null?void 0:Lr.szDecimals)??0),Ht((Lr==null?void 0:Lr.maxLeverage)??s),hn((Lr==null?void 0:Lr.maintenanceMarginFraction)??(Lr==null?void 0:Lr.mmr)??null),mt(ss);const ys=Ne(ss),Bt=ys!=null?Math.min((Lr==null?void 0:Lr.maxLeverage)??s,Math.max(1,ys)):Math.min((Lr==null?void 0:Lr.maxLeverage)??s,Math.max(1,Fe||1));Re(Bt),Te.current=ss,cn(!0)}}catch{Pn&&(Pt(null),ct(null),Ht(s),Re(ht=>Math.min(ht||1,s)),hn(null),mt(String(t)),cn(!0))}}return Ln(),()=>{Pn=!1}},[t,s,l,c]);const Dt=f==="buy",Qt=Dt?Vg:v_,xn=h.useMemo(()=>{var ht,Yt,lr,sr;const Pn=(Yt=(ht=Ge==null?void 0:Ge.bids)==null?void 0:ht[0])==null?void 0:Yt.px,Ln=(sr=(lr=Ge==null?void 0:Ge.asks)==null?void 0:lr[0])==null?void 0:sr.px;return Number.isFinite(Pn)&&Number.isFinite(Ln)&&Pn>0&&Ln>0?(Ln+Pn)/2:null},[Ge]),pn=h.useMemo(()=>{if(u==="limit"&&g!=="")return Number(g);const Pn=Number(e||0);if(Pn>0)return Pn;if(Number(xn||0)>0)return Number(xn);const Ln=Number((mn||{})[t]||0);return Ln>0?Ln:0},[u,g,e,xn,mn,t]),An=wt==null?void 0:wt.wallet_address,{accountEquity:or,perpsOverview:$t,spotBalances:bt,perps:rn}=H8(An),{rows:ur}=pfe(An);h.useEffect(()=>{let Pn=!1;async function Ln(){var Yt,lr,sr,Mr;if(!An){Pn||D({takerPct:null,makerPct:null});return}try{const ss=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"userFees",user:An.toLowerCase()})})).json();if(Pn)return;const ys=Number(ss.userCrossRate??((Yt=ss.feeSchedule)==null?void 0:Yt.cross)??NaN),Bt=Number(ss.userAddRate??((lr=ss.feeSchedule)==null?void 0:lr.add)??NaN);if(!Number.isFinite(ys)||!Number.isFinite(Bt)){D({takerPct:null,makerPct:null});return}const mr=Number(ss.activeReferralDiscount??((sr=ss.feeSchedule)==null?void 0:sr.referralDiscount)??0)||0,er=Number(((Mr=ss.activeStakingDiscount)==null?void 0:Mr.discount)??0)||0,qr=Math.max(0,1-mr-er),xs=ys*qr,ls=Bt*qr;D({takerPct:xs*100,makerPct:ls*100})}catch{Pn||D({takerPct:null,makerPct:null})}}Ln();const ht=setInterval(Ln,5*60*1e3);return()=>{Pn=!0,clearInterval(ht)}},[An]);const gr=h.useMemo(()=>{const{takerPct:Pn,makerPct:Ln}=P;if(Pn==null||Ln==null)return"—";const ht=Yt=>Number(Yt).toLocaleString(void 0,{minimumFractionDigits:4,maximumFractionDigits:4});return`${ht(Pn)}% / ${ht(Ln)}%`},[P]);h.useEffect(()=>{let Pn=!1;async function Ln(){if(!(!An||l==="pair"))try{const Yt=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"activeAssetData",user:An.toLowerCase(),coin:String(It||t)})})).json();if(Pn)return;const lr=Yt==null?void 0:Yt.leverage;if(!lr)return;const sr=String(lr.type||"").toLowerCase()==="cross"?"Cross":"Isolated",Lr=Math.max(1,Math.min(Nt||s,Number(lr.value||lr.leverage)||1));be(sr),je(sr),Re(Lr)}catch{}}return Ln(),()=>{Pn=!0}},[An,t,l,Nt,s]),h.useEffect(()=>{if(!An)return;const Pn=new WebSocket(ZQ);return Ce.current=Pn,Pn.onopen=()=>{Pn.send(JSON.stringify({method:"subscribe",subscription:{type:"user",user:An}})),Pn.send(JSON.stringify({method:"subscribe",subscription:{type:"webData2",user:An}})),m.current=setInterval(()=>{Pn.readyState===WebSocket.OPEN&&Pn.send(JSON.stringify({id:99,method:"ping"}))},3e4)},Pn.onmessage=Ln=>{var ht,Yt,lr,sr;try{const Mr=JSON.parse(Ln.data),Lr=(Mr==null?void 0:Mr.data)||{},ss=(ht=Lr==null?void 0:Lr.meta)==null?void 0:ht.universe,ys=Lr==null?void 0:Lr.allMids;if(Array.isArray(ss)&&Array.isArray(ys)&&ss.length===ys.length){const mr={};for(let er=0;er<ss.length;er++){const qr=typeof ss[er]=="string"?ss[er]:((Yt=ss[er])==null?void 0:Yt.name)||((lr=ss[er])==null?void 0:lr[0]),xs=Number(ys[er]);qr&&Number.isFinite(xs)&&(mr[qr]=xs)}gt(er=>({...er,...mr}))}const Bt=Array.isArray((sr=Lr==null?void 0:Lr.spotState)==null?void 0:sr.balances)?Lr.spotState.balances:Array.isArray(Lr==null?void 0:Lr.balances)?Lr.balances:null;Array.isArray(Bt)&&jn(Bt.filter(mr=>mr&&mr.coin).map(mr=>({coin:String(mr.coin),total:Number(mr.total||0),hold:Number(mr.hold||0)})))}catch{}},Pn.onclose=()=>{m.current&&clearInterval(m.current)},()=>{m.current&&clearInterval(m.current);try{Pn.close()}catch{}}},[An]),h.useEffect(()=>{if(!An){k([0,0]);return}k([0,0]);let Pn=!0;const Ln=new WebSocket(ZQ);return Ln.onopen=()=>{Ln.send(JSON.stringify({method:"subscribe",subscription:{type:"activeAssetData",user:An.toLowerCase(),coin:String(t)}}))},Ln.onmessage=ht=>{if(Pn)try{const Yt=JSON.parse(ht.data);if(Yt.channel==="activeAssetData"&&Yt.data){const lr=Yt.data.availableToTrade||[];k([Number(lr[0]||0),Number(lr[1]||0)])}}catch{}},Ln.onclose=()=>{Pn&&k([0,0])},()=>{Pn=!1;try{Ln.close()}catch{}}},[An,t]);const br=h.useMemo(()=>{const Pn=(bt||[]).find(Ln=>Ln.coin==="USDC");return Pn?Math.max(0,Number(Pn.total||0)-Number(Pn.hold||0)):0},[bt]),Br=h.useMemo(()=>{if(!Wt.length)return null;let Pn=0;for(const Ln of Wt){const ht=Number(Ln.total||0);if(ht>0)if(Ln.coin==="USDC")Pn+=ht;else{const Yt=mn[Ln.coin];Number.isFinite(Yt)&&Yt>0&&(Pn+=ht*Yt)}}return Pn},[Wt,mn]),Gr=Number((rn==null?void 0:rn.accountValue)??0),Or=Number((rn==null?void 0:rn.totalMarginUsed)??0),Lt=Math.max(0,Gr-Or),nn=Lt,Ot=Lt<1;async function en({toPerp:Pn,amount:Ln,available:ht}){var Yt;try{if(xe(!0),!En){await qa(Promise.reject(new Error("Trading is not ready (HL not initialized)")),{loading:"Validating...",success:"OK",error:sr=>sr.message});return}if(!Number(Ln)){await qa(Promise.reject(new Error("Amount is invalid")),{loading:"Validating...",success:"OK",error:sr=>sr.message});return}if(Number(Ln)>Number(ht||0)){await qa(Promise.reject(new Error("Amount exceeds available")),{loading:"Validating...",success:"OK",error:sr=>sr.message});return}const lr=En.transfers.usdClassTransfer(String(Ln),!!Pn).then(sr=>{if((sr==null?void 0:sr.status)==="ok")return"Transfer successful.";const Mr=typeof(sr==null?void 0:sr.response)=="string"?sr.response:"Transfer failed";throw new Error(Mr)});await qa(lr,{loading:`Transferring ${Ln} USDC ${Pn?"Spot → Perps":"Perps → Spot"}...`,success:sr=>sr,error:sr=>(sr==null?void 0:sr.message)||"Transfer failed"}),(Yt=window==null?void 0:window.dispatchEvent)==null||Yt.call(window,new Event("balances:refresh")),Ye(!1)}catch{}finally{xe(!1)}}const Fn=(()=>{const Pn=Number(v)||0;return S==="COIN"?Pn:pn?Pn/pn:0})(),yr=Fn*(pn||0),hr=Fe?yr/Fe:0;function lt(Pn){const Ln=Math.max(1,Number(Fe)||1),ht=Math.max(0,Number(Rt)||0),Yt=Pn/Ln+Pn*ht,lr=nn>0?Yt/nn*100:0;L(Math.max(0,Math.min(100,Math.round(lr))))}function Ct(Pn){L(Pn);const Ln=Math.max(1,Number(Fe)||1),ht=Math.max(0,Number(Rt)||0),Yt=Pn/100*nn,lr=1/Ln+ht,sr=lr>0?Yt/lr:0;if(l==="pair"){Gt(sr?String(sr.toFixed(2)):"");return}if(S==="USD")C(sr?String(sr.toFixed(2)):"");else{const Mr=pn?sr/pn:0,Lr=Ke??4;C(Mr?String(Mr.toFixed(Lr)):""),lt(Mr*pn)}}function On(Pn){const Ln=Math.max(1,Number(Fe)||1),ht=Math.max(0,Number(Rt)||0),Yt=Pn/Ln+Pn*ht,lr=nn>0?Yt/nn*100:0;Ut(Math.max(0,Math.min(100,Math.round(lr))))}function qn(Pn){const Ln=Math.max(0,Math.min(100,Number(Pn)||0));Ut(Ln);const ht=Math.max(1,Number(Fe)||1),Yt=Math.max(0,Number(Rt)||0),lr=Ln/100*nn,sr=1/ht+Yt,Mr=sr>0?lr/sr:0;if(jt==="COIN"){const Lr=pn?Mr/pn:0,ss=Ke??4;Kt(Lr?String(Lr.toFixed(ss)):"")}else Kt(Mr?String(Mr.toFixed(2)):"")}function _r(Pn){Kt(Pn);const Ln=Number(Pn)||0,Yt=(jt==="COIN"?Ln:pn?Ln/pn:0)*(pn||0);On(Yt)}function jr(Pn){if(Pn===jt)return;const Ln=Number(yt)||0;let ht="";if(Pn==="USDC")ht=String(((Ln||0)*(pn||0)).toFixed(2)),un("USDC"),Kt(ht),On(Number(ht)||0);else if(!pn)un("COIN"),Kt(""),On(0);else{const Yt=Ke??4;ht=String(((Ln||0)/pn).toFixed(Yt)),un("COIN"),Kt(ht),On((Number(ht)||0)*pn)}}function Fr(Pn){C(Pn);const Ln=Number(Pn)||0,Yt=(S==="COIN"?Ln:pn?Ln/pn:0)*(pn||0);lt(Yt)}function nr(Pn){const Ln=Pn==="USDC"?"USD":Pn;if(Ln===S)return;const ht=Number(v)||0;let Yt="";if(Ln==="USD")Yt=String(((ht||0)*(pn||0)).toFixed(2)),T("USD"),C(Yt),lt(Number(Yt)||0);else if(!pn)T("COIN"),C(""),lt(0);else{const lr=Ke??4;Yt=String(((ht||0)/pn).toFixed(lr)),T("COIN"),C(Yt),lt((Number(Yt)||0)*pn)}}function vr({entry:Pn,side:Ln,notionalUSD:ht,maintenanceFrac:Yt,marginMode:lr,accountValueUSD:sr,isolatedMarginUSD:Mr}){const Lr=Number(Pn)||0,ss=Math.abs(Number(ht)||0);if(!Lr||!ss)return null;const ys=Ln==="buy"?1:-1,Bt=Math.max(0,Number(Yt)||0),mr=ss/Lr,er=ss*Bt;let qr;lr==="Cross"?qr=sr-er:qr=Mr-er;const xs=1-Bt*ys;if(!mr||!isFinite(xs))return null;const ls=Lr-ys*(qr/mr)/xs;return Math.max(0,ls)}const Yr=Number(($t==null?void 0:$t.balance)??0),dr=typeof Rt=="number"?Rt:.01,rs=Fn>0&&pn?vr({entry:pn,side:f,notionalUSD:yr,maintenanceFrac:dr,marginMode:ve,accountValueUSD:Yr}):null;h.useEffect(()=>{Fr(v)},[S,pn,Fe,nn]),h.useEffect(()=>{u==="twap"&&_r(yt)},[u,jt,yt,pn,Fe,nn]);const gs=h.useMemo(()=>Txn({book:Ge,side:f,sizeCoin:Fn,mid:e}),[Ge,f,Fn,e]);h.useEffect(()=>{let Pn=!1;async function Ln(){if(!(wt!=null&&wt.wallet_address)||!Vt){Rn(null);return}const ht=mP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null}),Yt=jj({address:wt.wallet_address,signer:ht,dex:"",defaultSlippage:V});Pn||Rn(Yt)}return Ln(),()=>{Pn=!0}},[Vt,wt==null?void 0:wt.wallet_address,V]);const ms=Pn=>Pn||Pn===0?String(Math.trunc(Number(Pn))):"",At=Number(pn||0),pt=Pn=>{ie(Pn),Yn("pct");const Ln=Number(Pn),ht=Math.max(1,Number(Fe)||1);if(!At||!isFinite(Ln)){q("");return}const Yt=Ln/(ht*100),lr=Dt?At*(1+Yt):At*(1-Yt);q(ms(lr))};h.useEffect(()=>{Y&&(q(""),fe(""),ie(""),K(""),Yn(null),Vn(null))},[f]);const le=Pn=>{q(Pn),Yn("price");const Ln=Number(Pn),ht=Math.max(1,Number(Fe)||1);if(!At||!Ln){ie("");return}const Yt=Ln/At,lr=Dt?(Yt-1)*ht*100:(1-Yt)*ht*100;ie(String(Number(lr).toFixed(2)))},Me=Pn=>{K(Pn),Vn("pct");const Ln=Number(Pn),ht=Math.max(1,Number(Fe)||1);if(!At||!isFinite(Ln)){fe("");return}const Yt=Ln/(ht*100),lr=Dt?At*(1-Yt):At*(1+Yt);fe(ms(lr))},ft=Pn=>{fe(Pn),Vn("price");const Ln=Number(Pn),ht=Math.max(1,Number(Fe)||1);if(!At||!Ln){K("");return}const Yt=Ln/At,lr=Dt?(1-Yt)*ht*100:(Yt-1)*ht*100;K(String(Number(lr).toFixed(2)))};h.useEffect(()=>{At&&(Y&&(Mn==="pct"?pt(G):Mn==="price"&&le(Q)),Zn==="pct"?Me(oe):Zn==="price"&&ft(te))},[At,Fe]);function ut(){var Pn;(Pn=window==null?void 0:window.dispatchEvent)==null||Pn.call(window,new Event("balances:refresh"))}async function on(Pn){const Ln=()=>{typeof Pn=="function"&&Pn()};if(!Vt){await qa(Promise.reject(new Error("Select a wallet")),{loading:"Validating...",success:"OK",error:sr=>sr.message}),Ln();return}if(!En){await qa(Promise.reject(new Error("Please sign in to perform this action.")),{loading:"Validating...",success:"OK",error:sr=>sr.message}),Ln();return}const ht=String(ve||"").toLowerCase().startsWith("iso")?"isolated":"cross",lr=Math.max(1,Math.min(Nt||s,Number(Fe)||1));if(!wr&&Math.abs(Zr||0)>0){const sr=String(we||"").toLowerCase().startsWith("iso")?"isolated":"cross";if(ht!==sr){await qa(new Promise(Mr=>Mr()),{loading:"Validating...",success:()=>{throw new Error("Cannot switch leverage type with open position.")},error:Mr=>Mr.message}),be(we),Ln();return}}try{if(l==="pair"){const[sr,Mr]=String(c||"").split("/").map(ss=>ss.trim().toUpperCase()),Lr=Promise.all([En.updateLeverage(sr,ht,lr),En.updateLeverage(Mr,ht,lr)]);await qa(Lr,{loading:`Updating for ${sr}/${Mr}...`,success:()=>"Updated",error:ss=>(ss==null?void 0:ss.message)||"Failed to update leverage for pair"})}else{const sr=It||String(t).toUpperCase(),Mr=En.updateLeverage(sr,ht,lr);await qa(Mr,{loading:`Updating for ${sr}...`,success:()=>"Updated",error:Lr=>(Lr==null?void 0:Lr.message)||"Failed to update leverage"}),je(ve)}Ln()}catch{be(we),Ln()}}async function bn(){const[Pn,Ln]=String(c||"").split("/").map(ht=>ht.trim().toUpperCase());try{if(!Vt){await qa(Promise.reject(new Error("Select a wallet")),{loading:"Validating...",success:"OK",error:qr=>qr.message});return}if(!En){await qa(Promise.reject(new Error("Trading is not ready (HL not initialized)")),{loading:"Validating...",success:"OK",error:qr=>qr.message});return}const ht=await En.info.allMids(),Yt=Number(ht[Pn]||0),lr=Number(ht[Ln]||0);if(!(Yt>0&&lr>0)){await qa(Promise.reject(new Error("Mid price not available for pair")),{loading:"Validating...",success:"OK",error:qr=>qr.message});return}const sr=Math.max(1,Math.min(Number(Fe)||1,Number(Nt)||1));sr!==Fe&&(Re(sr),fn.success(`Leverage adjusted to ${sr}x`,Bqe));let Mr=Number(kn)>0?Number(kn):I/100*nn*sr;if(!(Mr>0)){await qa(Promise.reject(new Error("Enter a valid total notional for pair")),{loading:"Validating...",success:"OK",error:qr=>qr.message});return}const Lr=Math.max(0,Math.min(100,Number(tr)||0))/100,ss=Mr*Lr,ys=Mr-ss,Bt=ss/Yt,mr=ys/lr,er=Oxn({longSymbol:Pn,shortSymbol:Ln,longSize:Bt,shortSize:mr,orderType:u,reduceOnlyFlag:!!F,maxSlipVal:V,tpOnFlag:!1,tpVal:"",slVal:"",userAddr:(wt==null?void 0:wt.wallet_address)||$e,lev:sr,coinSym:"",isPairMode:!0,isBuySide:!0,sizeCoinVal:0});if(u==="market"){const qr=F?En.marketClose(Pn,void 0,{tif:"Ioc",reduceOnly:!0,slippage:V}):En.marketOpen(Pn,!0,Number(Bt),{tif:"Ioc",reduceOnly:!1,slippage:V}),xs=F?En.marketClose(Ln,void 0,{tif:"Ioc",reduceOnly:!0,slippage:V}):En.marketOpen(Ln,!1,Number(mr),{tif:"Ioc",reduceOnly:!1,slippage:V}),ls=(async()=>{const[hs,vs]=await Promise.all([qr,xs]);return await JQ({draft:er,responses:[hs,vs],user:er.userAddress}),"Pair market placed"})();await qa(ls,{loading:`Opening ${Pn} long / ${Ln} short...`,success:hs=>hs,error:hs=>(hs==null?void 0:hs.message)||"Pair order failed"}),ut(),L(0),Gt("");return}if(u==="limit"){const qr=gje(O),xs=En.placeOrder({symbol:Pn,isBuy:!0,size:Number(Bt),price:Yt,tif:qr,reduceOnly:!1}),ls=En.placeOrder({symbol:Ln,isBuy:!1,size:Number(mr),price:lr,tif:qr,reduceOnly:!1}),hs=(async()=>{const[vs,vi]=await Promise.all([xs,ls]);return await JQ({draft:er,responses:[vs,vi],user:er.userAddress}),"Pair limit placed"})();await qa(hs,{loading:`Placing ${Pn} long / ${Ln} short limits...`,success:vs=>vs,error:vs=>(vs==null?void 0:vs.message)||"Pair limit failed"}),ut(),L(0),Gt("");return}if(u==="twap"){const qr=Math.max(5,Math.min(1440,Number(vn||0)*60+Number(ln||0))),xs=En.placeTwapOrder({symbol:Pn,isBuy:!0,size:Number(Bt),minutes:qr,randomize:!!dn,reduceOnly:!!F}),ls=En.placeTwapOrder({symbol:Ln,isBuy:!1,size:Number(mr),minutes:qr,randomize:!!dn,reduceOnly:!!F}),hs=(async()=>{const[vs,vi]=await Promise.all([xs,ls]);return await JQ({draft:er,responses:[vs,vi],user:er.userAddress}),"Pair TWAP started"})();await qa(hs,{loading:"Starting pair TWAP...",success:vs=>vs,error:vs=>(vs==null?void 0:vs.message)||"Pair TWAP failed"}),ut(),L(0),Gt("");return}await qa(Promise.reject(new Error("Unsupported mode for pair")),{loading:"Validating...",success:"OK",error:qr=>qr.message})}catch{}}const Gn=h.useMemo(()=>{const Pn=Number(vn||0)*60+Number(ln||0);return Pn?Math.max(5,Math.min(1440,Pn)):0},[vn,ln]),rr=h.useMemo(()=>{if(!Gn)return 0;const Pn=Math.floor(Gn*60/30);return Math.max(1,Pn+1)},[Gn]),Jn=h.useMemo(()=>{const Pn=Number(yt)||0;return Pn>0?jt==="COIN"?Pn:pn?Pn/pn:0:0},[yt,jt,pn]),Xn=h.useMemo(()=>!rr||!(Jn>0)?0:Jn/rr,[Jn,rr]),Zr=h.useMemo(()=>{const Pn=String(t||"").toUpperCase();if(!ur||!ur.length)return 0;const Ln=ur.find(ht=>String(ht.coin||"").toUpperCase()===Pn);return Ln?Number(Ln.size||0):0},[ur,t]);async function $r(){try{if(!Vt){await qa(Promise.reject(new Error("Select a wallet")),{loading:"Validating...",success:"OK",error:Ln=>Ln.message});return}if(!En){await qa(Promise.reject(new Error("Trading is not ready (HL not initialized)")),{loading:"Validating...",success:"OK",error:Ln=>Ln.message});return}if(l==="pair"){Jt(!0),await bn(),Jt(!1);return}const Pn=Number(v)||0;if((u==="market"||u==="limit")&&Pn<=0&&!(u==="market"&&F)){await qa(Promise.reject(new Error("Enter a valid amount")),{loading:"Validating...",success:"OK",error:Ln=>Ln.message});return}if(Jt(!0),u==="market")if(F){const Ln=Pn>0?RC(En.marketClose(t,Number(Fn),{tif:"Ioc",reduceOnly:!0,slippage:V})):RC(En.marketClose(t,void 0,{tif:"Ioc",reduceOnly:!0,slippage:V}));await qa(Ln,{loading:`Closing ${t} position...`,success:ht=>ht,error:ht=>(ht==null?void 0:ht.message)||"Close failed"}),ut()}else{const Ln=Y&&Q!==""&&Number(Q)>0,ht=Y&&te!==""&&Number(te)>0,Yt=RC(Ln||ht?En.placeMarketWithTPSL({symbol:t,isBuy:Dt,size:Number(Fn),entrySlippage:V,tpPrice:Ln?Number(Q):null,slPrice:ht?Number(te):null,triggerSlippage:.1}):En.marketOpen(t,Dt,Number(Fn),{tif:"Ioc",reduceOnly:!1,slippage:V}));await qa(Yt,{loading:`Placing ${Dt?"Buy":"Sell"} market order...`,success:lr=>lr,error:lr=>(lr==null?void 0:lr.message)||"Order failed"}),ut(),L(0),C("")}else if(u==="limit"){const Ln=gje(O),ht=Y&&Q!==""&&Number(Q)>0,Yt=Y&&te!==""&&Number(te)>0,lr=RC(ht||Yt?En.placeLimitWithTPSL({symbol:t,isBuy:Dt,size:Number(Fn),price:Number(g),tif:Ln,reduceOnly:F,tpPrice:ht?Number(Q):null,slPrice:Yt?Number(te):null,triggerSlippage:V}):En.placeOrder({symbol:t,isBuy:Dt,size:Number(Fn),price:Number(g),tif:Ln,reduceOnly:F}));await qa(lr,{loading:`Placing ${Dt?"Buy":"Sell"} limit order...`,success:sr=>sr,error:sr=>(sr==null?void 0:sr.message)||"Order failed"}),ut(),L(0),C("")}else if(u==="twap"){const Ln=Gn;if(!Ln){await qa(Promise.reject(new Error("Enter a valid running time (min 5 minutes)")),{loading:"Validating...",success:"OK",error:sr=>sr.message}),Jt(!1);return}let ht=0;const Yt=Number(yt)||0;if(jt==="COIN")ht=Yt;else{if(!pn){await qa(Promise.reject(new Error("Price required to convert USD to size")),{loading:"Validating...",success:"OK",error:sr=>sr.message}),Jt(!1);return}ht=Yt/pn}if(!(ht>0)){await qa(Promise.reject(new Error("Enter a valid TWAP size")),{loading:"Validating...",success:"OK",error:sr=>sr.message}),Jt(!1);return}const lr=En.placeTwapOrder({symbol:t,isBuy:Dt,size:Number(ht),minutes:Ln,randomize:!!dn,reduceOnly:!!F});await qa(lr,{loading:`Starting TWAP for ${t}...`,success:()=>`TWAP started: ${Number(ht).toLocaleString(void 0,{maximumFractionDigits:Ke??4})} ${t} over ${Ln}m`,error:sr=>(sr==null?void 0:sr.message)||"TWAP failed"}),ut()}else{await qa(Promise.reject(new Error("This mode is not wired to HyperSDK yet")),{loading:"Validating...",success:"OK",error:Ln=>Ln.message}),Jt(!1);return}}catch{}finally{Jt(!1)}}const wr=l==="pair",[pr,ar]=String(c||"").split("/").map(Pn=>Pn.trim().toUpperCase()),Vr=h.useMemo(()=>wr?0:Number((Dt?A[0]:A[1])||0),[wr,Dt,A]),Ur=Number(wr?kn||0:yr||0),bs=u!=="twap"&&Ur<10,Sr=bs?"Order must have minimum value of $10.":Ot?"Not Enough Margin":wn?"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:Fqe,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(K4,{onClick:()=>ee(!0),children:ve}),i.jsx(K4,{onClick:kt?()=>pe(!0):void 0,children:kt?`${Fe}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(K4,{onClick:()=>ge(!0),children:qe})]}),i.jsx(Exn,{skipConfirm:p,setSkipConfirm:N})]}),Pe&&i.jsx("div",{className:"mb-3",children:i.jsx(pP,{wallets:it,value:Vt,selectedBalance:$t==null?void 0:$t.balance,onChange:Pn=>{if(String(Vt)===String(Pn))return;xt(Pn);const Ln=(it||[]).find(ht=>String(ht.wallet_id)===String(Pn));o==null||o({id:String(Pn),address:(Ln==null?void 0:Ln.wallet_address)||null})}})}),i.jsx(M0n,{mode:u,onModeChange:d,moreItems:[{key:"twap",label:"TWAP"}],className:"mb-3"}),!wr&&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)":Do,color:f==="buy"?"rgb(15, 21, 26)":$i},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)":Do,color:f==="sell"?"rgb(15, 21, 26)":$i},children:"Sell / Short"})]})}),i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("div",{style:{color:Si},children:"Available to Trade"}),i.jsxs("div",{className:"text-white font-semibold",children:[Vr.toLocaleString(void 0,{maximumFractionDigits:2})," ","USDC"]})]}),i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("div",{style:{color:Si},children:"Current Position"}),i.jsx("div",{className:"text-white font-semibold",children:Zr?`${Math.abs(Zr).toLocaleString(void 0,{maximumFractionDigits:Ke??5})} ${t}`:`0.00000 ${t}`})]}),!wr&&u==="limit"&&i.jsx("div",{className:"mb-3",children:i.jsx(Fb,{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 ${Da}`},onClick:()=>y(e??""),children:"Mid"})})}),!wr&&(u==="market"||u==="limit")&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mb-3",children:i.jsx(Fb,{label:"Size",value:v,onChange:Fr,right:i.jsx(YF,{value:S,onChange:nr,items:[{key:"USD",label:"USDC"},{key:"COIN",label:t}]})})}),i.jsxs("div",{className:"flex items-center gap-3 mb-6 ",children:[i.jsx(Aj,{value:I,onChange:Ct,accent:Qt}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:I,onChange:Pn=>Ct(Math.max(0,Math.min(100,Number(Pn.target.value)||0))),style:{color:$i,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:Si},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:Pn=>$(Pn.target.checked)}),"Reduce Only"]}),u==="limit"&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(as,{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:Si},children:"TIF"})}),i.jsx(YF,{value:O,onChange:U,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:Y,onChange:Pn=>re(Pn.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:Y,onChange:Pn=>re(Pn.target.checked)}),"TP/SL"]}),Y&&i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsx(Fb,{label:"TP",value:Q,onChange:le}),i.jsx(Fb,{label:"Gain %",value:G,onChange:pt,right:i.jsx("span",{style:{color:Si},children:"%"})}),i.jsx(Fb,{label:"SL",value:te,onChange:ft}),i.jsx(Fb,{label:"Loss %",value:oe,onChange:Me,right:i.jsx("span",{style:{color:Si},children:"%"})})]})]}),wr&&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/${pr}.svg`,alt:"Dextrabot - Terminal",className:"w-4 h-4 mr-2"}),pr," 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/${ar}.svg`,alt:"Dextrabot - Terminal",className:"w-4 h-4 mr-2"}),ar," Short"]})]}),i.jsx("div",{className:"mb-3",children:i.jsx(Axn,{value:tr,onChange:Sn,leftLabel:pr,rightLabel:ar,leftUsd:Number(kn||0)>0?Number(kn)*tr/100:0,rightUsd:Number(kn||0)>0?Number(kn)*(100-tr)/100:0})}),i.jsx("div",{className:"mb-3",children:i.jsx(Fb,{label:"Size (USD)",value:kn,onChange:Pn=>{Gt(Pn)},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 ${Da}`},onClick:()=>{const Pn=nn*(Number(Fe)||1);Gt(String(Pn.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:Pn=>$(Pn.target.checked)}),"Reduce Only"]}),u==="limit"&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{style:{color:Si},children:"TIF"}),i.jsx(YF,{value:O,onChange:U,items:[{key:"GTC",label:"GTC"},{key:"IOC",label:"IOC"},{key:"ALO",label:"ALO"}]})]})]})]}),u==="twap"&&!wr&&i.jsxs(i.Fragment,{children:[i.jsx(Fb,{label:"Total Size",value:yt,onChange:_r,right:i.jsx(YF,{value:jt,onChange:jr,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(Aj,{value:nt,onChange:qn,accent:Qt}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:nt,onChange:Pn=>qn(Math.max(0,Math.min(100,Number(Pn.target.value)||0))),style:{color:$i,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:Si},className:"ml-1",children:"%"})]})]}),i.jsx("div",{className:"mb-2 mt-3",style:{color:Si},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:Do,border:`1px solid ${Da}`},children:i.jsx("input",{className:"w-full bg-transparent outline-none text-right",inputMode:"numeric",placeholder:"Hour(s)",value:vn===0?"":vn,onChange:Pn=>{const Ln=Pn.target.value.replace(/[^\d]/g,""),ht=Math.max(0,Math.min(24,Number(Ln)||0));Hn(ht)},style:{color:vn?"#FFFFFF":Si,fontFeatureSettings:'"tnum"'}})}),i.jsx("div",{className:"h-[30px] px-2 rounded-lg flex items-center",style:{background:Do,border:`1px solid ${Da}`},children:i.jsx("input",{className:"w-full bg-transparent outline-none text-right",inputMode:"numeric",placeholder:"Minute(s)",value:ln===0?"":ln,onFocus:()=>{ln===5&&Nn(0)},onChange:Pn=>{const Ln=Pn.target.value.replace(/[^\d]/g,""),ht=Math.max(0,Math.min(59,Number(Ln)||0));Nn(ht)},style:{color:ln?"#FFFFFF":Si,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:dn,onChange:Pn=>rt(Pn.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:Pn=>$(Pn.target.checked)}),"Reduce Only"]})]})]}),Pe?i.jsx("button",{onClick:$r,disabled:wn||!Vt||Ot||bs,className:"w-full h-[32px] rounded-xl font-bold transition-opacity mb-2 flex items-center justify-center disabled:opacity-60",style:{background:Qt,color:"#0f151a"},children:Sr}):i.jsx(om,{onClick:()=>{Xe==null||Xe(),Oe(!0)}}),u==="twap"&&!wr?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:[Gn.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:rr.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:Xn>0?`${Xn.toLocaleString(void 0,{maximumFractionDigits:Ke??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:gr})]})]}):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:wr?"-":rs?`$${rs.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:wr?`$${Number(kn||0).toLocaleString(void 0,{maximumFractionDigits:2})}`:`$${(yr||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:wr?`$${(Number(kn||0)/(Number(Fe)||1)||0).toLocaleString(void 0,{maximumFractionDigits:2})}`:`$${(hr||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:()=>qt(!0),className:"text-[#67FFBD] hover:opacity-80 h-5 text-xs flex justify-center items-center",children:[`Est: ${gs}% / `,`Max: ${Number(Ft||0).toFixed(2)}%`]})]})]}),Pe&&wt&&i.jsx("button",{onClick:()=>He(!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"}),Pe&&wt&&i.jsxs("div",{className:"flex w-full gap-2 mt-2",children:[i.jsxs(dje,{onClick:()=>Ye(!0),className:"flex-1",children:["Perps ",i.jsx(Sle,{className:"mx-1 text-xs"})," Spot"]}),i.jsx(dje,{onClick:()=>st(!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(Bv,{k:"Spot",v:`$${xje(Br??Number(or.spot||0))}`}),i.jsx(Bv,{k:"Perps",v:`$${xje($t.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(Bv,{k:"Balance",v:`$${O7($t.balance,2)}`}),i.jsx(Bv,{k:"Unrealized PNL",v:i.jsxs("span",{style:{color:$t.uPnl<0?"#FF7173":"#67FFBD"},children:["$",O7($t.uPnl,2)]})}),i.jsx(Bv,{k:"Cross Margin Ratio",v:i.jsxs("span",{style:{color:$t.cmr>=.5?"#FF7173":"#67FFBD"},children:[O7($t.cmr*100,2),"%"]}),link:!0}),i.jsx(Bv,{k:"Maintenance Margin",v:`$${O7($t.maintenanceMargin,2)}`}),i.jsx(Bv,{k:"Cross Account Leverage",v:`${O7($t.crossLeverage,2)}x`})]}),i.jsx(H0n,{open:at,onClose:()=>He(!1),initialAsset:"USDC",initialChain:"Arbitrum",toWalletAddress:(wt==null?void 0:wt.wallet_address)||""}),i.jsx(Dqe,{open:Qe,onClose:()=>Ye(!1),perpsAvailable:Lt,spotUsdcAvailable:br,onSubmit:en,loading:ze,initialToPerp:!1}),i.jsx(jxn,{open:dt,onClose:()=>st(!1),perpsBalance:Number(($t==null?void 0:$t.balance)??0),defaultDest:$e||""}),i.jsx(lp,{open:se,onClose:()=>pe(!1),children:i.jsxs(ym,{title:"Adjust Leverage",children:[i.jsxs("div",{className:"text-[12px] leading-5 mb-3",style:{color:Si},children:["Control the leverage used for ",wr?`${pr}/${ar}`:t," ","positions. The maximum leverage is ",Nt,"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:Nt,step:1,value:Fe,onChange:Pn=>Re(Number(Pn.target.value)),className:"flex-1",style:{accentColor:Vg}}),i.jsxs("div",{className:"h-[36px] rounded-lg flex items-center px-2",style:{width:84,background:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right",inputMode:"numeric",value:Fe,onChange:Pn=>Re(Math.max(1,Math.min(Nt,Number(Pn.target.value)||1))),style:{color:$i,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:Si},className:"ml-1",children:"x"})]})]}),i.jsx(H0,{onClick:()=>on(()=>pe(!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:Be,onClose:()=>qt(!1),children:i.jsxs(ym,{title:"Adjust Max Slippage",children:[i.jsx("div",{className:"text-[12px] leading-5 mb-3",style:{color:Si},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:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right",type:"text",inputMode:"decimal",value:Ft,onChange:Pn=>{const Ln=Pn.target.value.replace(",",".");if(Ln===""){Tn("");return}/^\d*\.?\d*$/.test(Ln)&&Tn(Ln)},style:{color:$i,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:Si},className:"ml-1",children:"%"})]}),i.jsx(H0,{onClick:Ze,children:"Confirm"})]})}),i.jsx(lp,{open:H,onClose:()=>ee(!1),children:i.jsxs(ym,{title:`${wr?`${pr}/${ar}`:t} Margin Mode`,children:[i.jsx(WQ,{active:ve==="Cross",onClick:()=>be("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(WQ,{active:ve==="Isolated",onClick:()=>be("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(H0,{onClick:()=>on(()=>ee(!1)),children:"Confirm"})})]})}),i.jsx(lp,{open:Se,onClose:()=>ge(!1),children:i.jsxs(ym,{title:"Position Mode",children:[i.jsx(WQ,{active:qe==="One-Way",onClick:()=>vt("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(H0,{onClick:()=>ge(!1),children:"Confirm"})})]})})]})}const Ob=({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(us,{className:"text-[#c9c9c9] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ra,{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]`})]})]})},Mxn=({walletFilter:t,setWalletFilter:e,filterTerminal:n,setFilterTerminal:r,resetFilters:s})=>{const a=h.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:Na,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})]}),i.jsx(Ob,{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(Ob,{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(Ob,{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(Ob,{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(Ob,{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(Ob,{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(Ob,{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(Ob,{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})]})},$qe=h.createContext({key:"All",setKey:()=>{}});function Lxn({children:t}){const e=typeof window<"u"&&localStorage.getItem("terminal_side_filter")||"All",[n,r]=h.useState(e);h.useEffect(()=>{typeof window<"u"&&localStorage.setItem("terminal_side_filter",n)},[n]);const s=h.useMemo(()=>({key:n,setKey:r}),[n]);return i.jsx($qe.Provider,{value:s,children:t})}function H2(){return h.useContext($qe)}function Rxn({className:t=""}){const{key:e,setKey:n}=H2(),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 Dxn(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 Bxn(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 f1(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=>Bxn(s,e));const r=n;return t.filter(s=>{const a=Dxn(s);return a?a===r:!1})}const $xn=({data:t,loading:e,error:n,isDigits:r,period:s,periods:a,handlePeriodChange:o})=>{const[l,c]=h.useState("All"),[u,d]=h.useState(!1),{key:f}=H2(),{copyTradeWatchList:x,trackedWatchList:g,setSignModalOpen:y}=h.useContext(Qr),{address:v}=ds(),[C,S]=h.useState(!1),[T,I]=h.useState(null),[L,F]=h.useState(null),[$,O]=h.useState(""),[U,Y]=h.useState(""),[re,Q]=h.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:""}),q=()=>{c("All"),Y(""),Q({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=((K,H)=>H.reduce((ee,se)=>{const pe=K[se];return pe!==void 0&&pe!==""&&pe!==null&&ee++,ee},0))({...re,walletFilter:U},[...Object.keys(re),"walletFilter"]),G=h.useMemo(()=>f1(t,"positions",f),[t,f]),ie=async({walletAddress:K,isFollow:H,isScalper:ee})=>{try{O(K);const se=window.localStorage.getItem("hyperToken"),pe=window.localStorage.getItem("hyperAddress");if(!se){y(!0);return}const Se=H?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",ge=H?{address:v?v.toLowerCase():pe,token:se,follow_address:K.toLowerCase()}:{address:v?v.toLowerCase():pe,token:se},ve=await fetch(Se,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ge)});if(!ve.ok)throw new El(`Server responded with status ${ve.status}`);const be=await ve.json();be.success?(I(Array.isArray(be==null?void 0:be.data)?[...be.data].sort((we,je)=>new Date(je.created_at||0)-new Date(we.created_at||0)):be==null?void 0:be.data),F(ee),S(!0)):fn.error(be.error_message)}catch(se){fn.error(se.message||"Something went wrong!")}},oe=[{key:"action",label:"Action",sortable:!1,width:"125px",render:(K,H)=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{onClick:ee=>{ee.preventDefault();const se=x==null?void 0:x.some(pe=>pe.wallet_address===(H==null?void 0:H.address));ie({walletAddress:H==null?void 0:H.address,isFollow:se,isScalper:H==null?void 0:H.is_scalper})},className:`${x.some(ee=>ee.wallet_address===(H==null?void 0:H.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(H5,{walletAddress:H==null?void 0:H.address,children:i.jsx("div",{className:"w-[18px] h-[18px] flex items-center justify-center cursor-pointer",children:g.some(ee=>ee.wallet_address===(H==null?void 0:H.address))?i.jsx("img",{src:k5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:qj,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})},{key:"address",label:"Wallet",sortable:!0,sortValue:K=>(K.address||"").toLowerCase(),render:(K,H)=>i.jsx("div",{onClick:()=>window.open(`/wallet-details/${H==null?void 0:H.address}`,"_blank"),className:"flex items-center gap-2.5 cursor-pointer",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(lg,{info:H!=null&&H.address?`${H.address.slice(0,5)}...${H.address.slice(-4)}`:"--",textColor:"text-white"}),i.jsx("img",{onClick:ee=>{ee.stopPropagation(),navigator.clipboard.writeText((H==null?void 0:H.address)||""),fn.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:io,alt:"",className:"cursor-pointer"})]})})},{key:"direction",label:"Direction",sortable:!0,sortValue:K=>K.direction==="long"?1:K.direction==="short"?0:-1,render:(K,H)=>i.jsx("div",{className:"flex items-center gap-2 h-8",children:i.jsxs("div",{className:`${H.direction==="long"?"text-[#67ffbd] bg-[#67ffbd]/20":H.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:H.direction==="long"?i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):H.direction==="short"?i.jsx(Us,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Us,{className:"text-[#67FFBD] rotate-180 w-3 h-3"})}),i.jsxs("div",{className:"text-[11px] font-semibold leading-[8px] tracking-wide uppercase",children:[H.direction," - ",H.leverage_value,"x"]})]})})},{key:"notional",label:"Notional",sortable:!0,sortValue:K=>Number(K.notional)||-1/0,render:(K,H)=>i.jsx(lg,{info:(H==null?void 0:H.notional)==null||isNaN(parseFloat(H==null?void 0:H.notional))?"--":`$${ad(H==null?void 0:H.notional)}`,textColor:"text-white"})},{key:"szi",label:"Size",sortable:!0,sortValue:K=>Number(K.szi)||-1/0,render:(K,H)=>i.jsx(lg,{info:(H==null?void 0:H.szi)==null||isNaN(parseFloat(H==null?void 0:H.szi))?"--":`${Ir(H==null?void 0:H.szi)}`,textColor:"text-white"})},{key:"entry_price",label:"Entry Price",sortable:!0,sortValue:K=>Number(K.entry_price)||-1/0,render:(K,H)=>i.jsx(lg,{info:(H==null?void 0:H.entry_price)==null||isNaN(parseFloat(H==null?void 0:H.entry_price))?"--":`$${m3(parseFloat(H==null?void 0:H.entry_price).toFixed((H==null?void 0:H.entry_price)>=1e4?0:r))}`,textColor:"text-white"})},{key:"liq_price",label:"Liq. Price",sortable:!0,sortValue:K=>Number(K.liq_price)||-1/0,render:(K,H)=>i.jsx(lg,{info:(H==null?void 0:H.liq_price)==null||isNaN(parseFloat(H==null?void 0:H.liq_price))?"--":`$${m3(parseFloat(H==null?void 0:H.liq_price).toFixed((H==null?void 0:H.liq_price)>=1e4?0:r))}`,textColor:"text-white"})},{key:"unrealized_pnl",label:"Unrealized PnL",sortable:!0,sortValue:K=>Number(K.unrealized_pnl)||0,render:(K,H)=>i.jsx(lg,{info:(H==null?void 0:H.unrealized_pnl)==null||isNaN(parseFloat(H==null?void 0:H.unrealized_pnl))?"--":`$${Ir(Math.abs(H==null?void 0:H.unrealized_pnl))}`,textColor:`${(H==null?void 0:H.unrealized_pnl)==null||isNaN(parseFloat(H==null?void 0:H.unrealized_pnl))||(H==null?void 0:H.unrealized_pnl)===0?"text-white":(H==null?void 0:H.unrealized_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})},{key:"funding_paid",label:"Funding Paid",sortable:!0,sortValue:K=>Number(K.funding_paid)||0,render:(K,H)=>i.jsx(lg,{info:(H==null?void 0:H.funding_paid)==null||isNaN(parseFloat(H==null?void 0:H.funding_paid))?"--":`$${Ir(Math.abs(H==null?void 0:H.funding_paid))}`,textColor:`${(H==null?void 0:H.funding_paid)==null||isNaN(parseFloat(H==null?void 0:H.funding_paid))||(H==null?void 0:H.funding_paid)===0?"text-white":(H==null?void 0:H.funding_paid)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})},{key:"account_value",label:"Margin",sortable:!0,sortValue:K=>Number(K.account_value)||-1/0,render:(K,H)=>i.jsx(lg,{info:(H==null?void 0:H.account_value)==null||isNaN(parseFloat(H==null?void 0:H.account_value))?"--":`$${ad(H==null?void 0:H.account_value)}`,textColor:"text-white"})},{key:"perp_equity",label:"Account Value",sortable:!0,sortValue:K=>Number(K.perp_equity)||-1/0,render:(K,H)=>i.jsx(lg,{info:(H==null?void 0:H.perp_equity)==null||isNaN(parseFloat(H==null?void 0:H.perp_equity))?"--":`$${ad(H==null?void 0:H.perp_equity)}`,textColor:"text-white"})}];return i.jsxs(i.Fragment,{children:[i.jsx(V5,{open:C,setOpen:S,copyTradeData:T,copyTradeWallet:$,setCopyTradeWallet:O,isScalper:L,setCopyTradeData:I}),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(xd,{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(Uxn,{title:"Reset Filter",set_click:()=>q(),tableSortButton:"Reset"})]}),i.jsx("div",{className:"flex",children:i.jsx(Sde,{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:()=>q(),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(Mxn,{walletFilter:U,setWalletFilter:Y,filterTerminal:re,setFilterTerminal:Q,resetFilters:q})]}),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(ka,{})}):n&&!t?i.jsx("div",{className:"flex min-h-[26vh] sm:min-h-[66vh] flex-col justify-center items-center",children:i.jsx(El,{})}):(G==null?void 0: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%] 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:Yl,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:G,columns:oe,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"})})]})]})]})},lg=({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})}),Uxn=({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 nw(t,e=2){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function yje(t){return new Promise(e=>setTimeout(e,t))}function vje(t){if(!t)return"";const e=String(t);return e.slice(0,6)+"..."+e.slice(-4)}function zxn({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 ZF({children:t}){return i.jsx("div",{className:"text-[12px] text-[#9B9B9B] font-inter mb-1",children:t})}function wje({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 Cje({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 Hxn({children:t}){return i.jsx("div",{className:"grid grid-cols-2 gap-4",children:t})}function Vxn({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 Wxn({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 qxn(){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 Gxn(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 Kxn=t=>typeof t=="string"&&/^0x[0-9a-fA-F]{40}$/.test(t.trim());function Yxn({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]=h.useState(""),[u,d]=h.useState("perps"),[f,x]=h.useState("USDC"),[g,y]=h.useState("");h.useEffect(()=>{u==="perps"&&x("USDC")},[u]);const v=u==="perps"?Number(n||0):r.find(O=>O.coin===f)?Math.max(0,Number(b.total||0)-Number(b.hold||0)):0,C=()=>y(String(v)),S=()=>s({kind:"send",from:u,token:f,destination:l,amount:g,available:v}),T=Kxn(l),I=Number(g)>0&&Number(g)<=Number(v||0),L=!T||!I,F=l.length>0&&!T;return i.jsx(zxn,{open:t,onClose:e,title:"Send Tokens",children:i.jsxs("div",{className:"space-y-4 text-xs",children:[i.jsxs("div",{children:[i.jsx(ZF,{children:"Destination"}),i.jsx(wje,{value:l,onChange:c,placeholder:"Enter Hyperliquid account address (0x…)",invalid:F})]}),i.jsxs(Hxn,{children:[i.jsxs("div",{children:[i.jsx(ZF,{children:"From Account"}),i.jsx(Cje,{value:u,onChange:$=>d($),options:[{value:"perps",label:"Perps Account"},{value:"spot",label:"Spot Account"}]})]}),i.jsxs("div",{children:[i.jsx(ZF,{children:"Token"}),i.jsx(Cje,{value:f,onChange:x,options:o,disabled:u==="perps"})]})]}),i.jsxs("div",{children:[i.jsx(ZF,{children:"Amount"}),i.jsxs("div",{className:"flex items-center",children:[i.jsx(wje,{value:g,onChange:y,placeholder:"0.0"}),i.jsx(Vxn,{onMax:C})]}),i.jsxs("div",{className:"mt-1 text-[12px] text-[#9B9B9B]",children:["Available: ",nw(v,6)," ",f]})]}),i.jsx(Wxn,{onClick:S,disabled:L,loading:a,children:"Send"})]})})}const Xxn={name:"Exchange",version:"1",chainId:1337,verifyingContract:"0x0000000000000000000000000000000000000000"},Qxn={Agent:[{name:"source",type:"string"},{name:"connectionId",type:"bytes32"}]};function Zxn(t){if(typeof t!="string"||!t.includes("."))return String(t);const e=t.replace(/\.?0+$/,"");return e==="-0"?"0":e}function Vse(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(Vse);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]=Vse(r):(n==="p"||n==="s")&&typeof r=="string"&&(e[n]=Zxn(r))}return e}function Jxn(t,e,n){const r=Vse(t),s=Rqe(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(js(e),s.length+9)),go(o)}function egn(t,e){return{source:e?"a":"b",connectionId:t}}function tgn(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 ngn(t,e){const n=qxn();if(!n)throw new Error("No injected provider");return await Gxn(n,"0xa4b1"),await n.request({method:"eth_signTypedData_v4",params:[t,JSON.stringify(e)]})}function rgn({addr:t,isMainnet:e=!0,vaultAddress:n=null}){return{sign:async(r,s)=>{const a=Jxn(r,n,s),o={domain:Xxn,types:Qxn,primaryType:"Agent",message:egn(a,e)},l=await ngn(t,o);return tgn(l)}}}const Nje=t=>t?`${t.slice(0,6)}...${t.slice(-4)}`:"-";function sgn({walletAddress:t,listHeight:e=560}){const{address:n}=ds(),{latestPnL:r}=h.useContext(Qr),[s,a]=h.useState(()=>typeof window>"u"?t||null:window.localStorage.getItem("hl_selected_wallet_address")||null||t||null);h.useEffect(()=>{const ie=()=>{if(typeof window>"u")return;const oe=window.localStorage.getItem("hl_selected_wallet_address")||null;a(oe||t||null)};return ie(),window.addEventListener("hl_selected_wallet_changed",ie),window.addEventListener("storage",ie),()=>{window.removeEventListener("hl_selected_wallet_changed",ie),window.removeEventListener("storage",ie)}},[t]);const o=H8(s?s.toLowerCase():null),{perps:l={},spotBalances:c=[],tokenIdMap:u={},tokenMetaMap:d={},priceMap:f={},initialLoaded:x=!1}=o,[g,y]=h.useState({send:!1,transfer:!1,transferInitToPerp:!1}),[v,C]=h.useState(!1),S=h.useMemo(()=>{const ie=typeof window<"u"?localStorage.getItem("hl_pk"):null,oe=ie?yxn(ie).toLowerCase():null,K=n?n.toLowerCase():null,H=s?s.toLowerCase():null,ee=ie&&oe&&H&&oe===H;return{mode:ee?"local":!ee&&K?"metamask":"none",localAddr:oe,mmAddr:K,targetAddr:H}},[n,s]);h.useEffect(()=>{const ie=oe=>{var H;const K=!!((H=oe==null?void 0:oe.detail)!=null&&H.toPerp);y(ee=>({...ee,transfer:!0,transferInitToPerp:K}))};return window.addEventListener("balances:open-transfer",ie),()=>window.removeEventListener("balances:open-transfer",ie)},[]);const T=h.useMemo(()=>{try{if(!s)return null;if(S.mode==="local"){const ie=mP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return jj({address:s,signer:ie,isMainnet:!0,signatureChainIdHex:"0xa4b1",getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null})}if(S.mode==="metamask"&&S.mmAddr){const ie=rgn({addr:S.mmAddr,isMainnet:!0,vaultAddress:null});return jj({address:s,signer:ie,isMainnet:!0,signatureChainIdHex:"0xa4b1",getPK:()=>null})}return null}catch{return null}},[s,S]);h.useEffect(()=>{const ie=()=>{(async()=>{try{await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:s})}).then(oe=>oe.json()),window.dispatchEvent(new CustomEvent("noop"))}catch{}})()};return window.addEventListener("balances:refresh",ie),()=>window.removeEventListener("balances:refresh",ie)},[s]);const I=h.useMemo(()=>c||[],[c]),L=h.useMemo(()=>{const ie=I.find(oe=>oe.coin==="USDC");return ie?Math.max(0,Number(ie.total||0)-Number(ie.hold||0)):0},[I]),F=()=>{const ie=S.mode==="local"?S.localAddr:S.mode==="metamask"?S.mmAddr:null;return ie?S.targetAddr?ie!==S.targetAddr?(fn.error(`Connected wallet ${vje(ie)} does not match selected account ${vje(S.targetAddr)}. Switch wallet or change the selected account.`,{id:"addr-mismatch",duration:6e3}),!1):!0:(fn.error("Target account is missing.",{id:"target-missing"}),!1):(fn.error("Wallet not connected or signer unavailable.",{id:"signer-missing"}),!1)},$=()=>{fn.error("No deposit found for this account. Please deposit USDC (Arbitrum) to Hyperliquid before performing this action.",{id:"err-deposit"})},O=async({from:ie,token:oe,destination:K,amount:H,available:ee})=>{var se;try{if(C(!0),!T)throw new Error("SDK not ready");if(!F())return;const pe=(K||"").trim().toLowerCase();if(!pe||!pe.startsWith("0x")||pe.length!==42)throw new Error("Destination address is invalid");if(!Number(H))throw new Error("Amount is invalid");if(Number(H)>Number(ee||0))throw new Error("Amount exceeds available balance");let Se;if(ie==="perps")Se=await T.transfers.usdTransfer(pe,H);else{const ge=u[oe];if(!ge)throw new Error(`TokenId not found for ${oe}`);const ve=`${oe}:${ge}`;Se=await T.transfers.spotTransfer(pe,ve,String(H))}if((Se==null?void 0:Se.status)==="ok")fn.success("Send successful.",{id:"send-success"}),await yje(600),(se=window==null?void 0:window.dispatchEvent)==null||se.call(window,new Event("balances:refresh"));else{const ge=typeof(Se==null?void 0:Se.response)=="string"?Se.response:JSON.stringify(Se);ge&&ge.toLowerCase().includes("must deposit")?$():fn.error(`Send failed: ${ge||"Unknown error"}`,{id:"send-error"})}}catch(pe){const Se=(pe==null?void 0:pe.message)||"Send failed";Se.toLowerCase().includes("must deposit")?$():fn.error(Se,{id:"send-error"})}finally{C(!1),y(pe=>({...pe,send:!1}))}},U=async({toPerp:ie,amount:oe,available:K})=>{var H;try{if(C(!0),!T)throw new Error("SDK not ready");if(!F())return;if(!Number(oe))throw new Error("Amount is invalid");if(Number(oe)>Number(K||0))throw new Error("Amount exceeds available balance");const ee=await T.transfers.usdClassTransfer(String(oe),!!ie);if((ee==null?void 0:ee.status)==="ok")fn.success("Transfer successful.",{id:"transfer-success"}),await yje(600),(H=window==null?void 0:window.dispatchEvent)==null||H.call(window,new Event("balances:refresh"));else{const se=typeof(ee==null?void 0:ee.response)=="string"?ee.response:JSON.stringify(ee);se&&se.toLowerCase().includes("must deposit")?$():fn.error(`Transfer failed: ${se||"Unknown error"}`,{id:"transfer-error"})}}catch(ee){const se=(ee==null?void 0:ee.message)||"Transfer failed";se.toLowerCase().includes("must deposit")?$():fn.error(se,{id:"transfer-error"})}finally{C(!1),y(ee=>({...ee,transfer:!1}))}},Y=1,[re,Q]=h.useState(()=>typeof window>"u"?!1:localStorage.getItem("hide_small_balances")==="1");h.useEffect(()=>{const ie=oe=>{var K;typeof((K=oe==null?void 0:oe.detail)==null?void 0:K.value)=="boolean"?Q(oe.detail.value):Q(typeof window<"u"&&localStorage.getItem("hide_small_balances")==="1")};return window.addEventListener("balances:hide-small-changed",ie),()=>window.removeEventListener("balances:hide-small-changed",ie)},[]);const q=h.useMemo(()=>ie=>{if(Number.isFinite(Number(ie.usdcValue)))return Number(ie.usdcValue);const oe=f[ie.coin],K=Number(ie.totalDisplay??0);return Number.isFinite(oe)&&Number.isFinite(K)?oe*K:null},[f]),te=h.useMemo(()=>{const ie=[],oe=Number((l==null?void 0:l.accountValue)??0),K=Number((l==null?void 0:l.totalMarginUsed)??0),H=Math.max(0,oe-K);return ie.push({id:"USDC_PERPS",kind:"perps",coin:"USDC",unit:"USDC",usdcValue:oe,totalDisplay:oe,availableDisplay:H,totalSort:oe,availableSort:H}),I.forEach(ee=>{const se=String(ee.coin),pe=Number(ee.total||0),Se=Number(ee.hold||0),ge=Math.max(0,pe-Se);let ve=null;se==="USDC"&&(ve=pe);const be=f[se];ve==null&&Number.isFinite(be)&&(ve=be*pe),ie.push({id:`SPOT_${se}`,kind:"spot",coin:se,unit:se,usdcValue:ve,totalDisplay:pe,availableDisplay:ge,totalSort:pe,availableSort:ge})}),ie},[l,I,f]),fe=h.useMemo(()=>re?te.filter(ie=>{if(ie.kind==="perps")return!0;const oe=q(ie);return oe!=null?oe>=Y:Number(ie.totalDisplay??0)>=1e-6}):te,[te,re,q]),G=h.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,sortValue:ie=>ie.coin,render:(ie,oe)=>i.jsxs("span",{className:"text-white",children:[oe.coin," ",oe.kind==="perps"?i.jsx("span",{className:"text-[#9B9B9B]",children:"(Perps)"}):oe.coin==="USDC"&&oe.kind==="spot"?i.jsx("span",{className:"text-[#9B9B9B]",children:"(Spot)"}):null]})},{key:"total",label:"Total Balance",sortable:!0,sortValue:ie=>ie.totalSort,render:(ie,oe)=>i.jsxs("span",{className:"text-white",children:[nw(oe.totalDisplay)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:oe.unit})]})},{key:"available",label:"Available Balance",sortable:!0,sortValue:ie=>ie.availableSort,render:(ie,oe)=>{const K=oe.kind==="perps"&&oe.coin==="USDC",H=Number((l==null?void 0:l.withdrawable)||0),ee=K?`Available balance to open positions ignoring open orders. ${nw(H,2)} USDC is availableto withdraw.`:void 0;return i.jsxs("span",{className:"text-white underline-offset-2",title:ee,children:[nw(oe.availableDisplay)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:oe.unit})]})}},{key:"usdcValue",label:"USDC Value",sortable:!0,sortValue:ie=>{const oe=q(ie);return oe??-1},render:(ie,oe)=>{const K=q(oe);return i.jsxs("span",{className:"text-white",children:[K!=null?nw(K):"-"," ",K!=null?i.jsx("span",{className:"text-[#9B9B9B]",children:"USDC"}):null]})}},{key:"pnlRoe",label:"PnL (ROE %)",sortable:!1,render:(ie,oe)=>{if(oe.kind!=="perps")return i.jsx("span",{className:"text-white",children:"-"});const K=r==null?void 0:r.all,H=Number((l==null?void 0:l.accountValue)||0),ee=H>0&&typeof K=="number"?K/H*100:null,se=typeof K!="number"?"text-white":K>0?"text-[#67FFBD]":K<0?"text-[#FF7173]":"text-white";return i.jsxs("span",{className:se,children:[typeof K!="number"?"-":`$${nw(Math.abs(K),2)}`," ",i.jsx("span",{className:"text-[#9B9B9B]",children:ee==null?"":`(${nw(Math.abs(ee),2)}%)`})]})}},{key:"send",label:"Send",sortable:!1,render:(ie,oe)=>oe.kind==="perps"||oe.coin==="USDC"?i.jsxs("button",{onClick:()=>y(K=>({...K,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(rSt,{}),i.jsx("span",{children:"Send"})]}):null},{key:"transfer",label:"Transfer",sortable:!1,render:(ie,oe)=>oe.coin==="USDC"?i.jsxs("button",{onClick:()=>y(K=>({...K,transfer:!0,transferInitToPerp:oe.kind==="spot"})),className:"p-0 inline-flex items-center gap-1 h-5 text-white bg-transparent hover:opacity-90 -ml-1",title:oe.kind==="perps"?"Transfer to Spot":"Transfer to Perpetual",children:[i.jsx(Sle,{}),i.jsx("span",{children:oe.kind==="perps"?"Transfer to Spot":"Transfer to Perps"})]}):null},{key:"contract",label:"Contract",sortable:!1,render:(ie,oe)=>{const K=d[oe.coin],H=(K==null?void 0:K.tokenId)||null,ee=(K==null?void 0:K.evmContract)||null;if(H){const se=`https://app.hyperliquid.xyz/explorer/token/${H}`;return i.jsx("a",{href:se,target:"_blank",rel:"noreferrer",className:"text-white bg-transparent hover:text-white/80 -ml-2",children:Nje(H)})}if(ee){const se=`https://arbiscan.io/token/${ee}`;return i.jsx("a",{href:se,target:"_blank",rel:"noreferrer",className:"text-white bg-transparent -ml-2",children:Nje(ee)})}return i.jsx("span",{className:"text-[#9B9B9B] -ml-2",children:"-"})}}],[r==null?void 0:r.all,l,q,d]);return x?i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:fe,columns:G,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:ie=>ie.id}),i.jsx(Yxn,{open:g.send,onClose:()=>y(ie=>({...ie,send:!1})),perpsAvailable:l==null?void 0:l.withdrawable,spotBalances:I,onSubmit:O,loading:v}),i.jsx(Dqe,{open:g.transfer,onClose:()=>y(ie=>({...ie,transfer:!1})),perpsAvailable:l==null?void 0:l.withdrawable,spotUsdcAvailable:L,onSubmit:U,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 ign={position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12,border:"1px solid #2A2A2A"}},agn="dextra-global-toast";function eZ(t,e){return fn.promise(t,e,{id:agn,...ign})}async function tZ(t){const e=mP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return jj({address:t,signer:e,dex:""})}function jo(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function ogn(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}function bfe({open:t,onClose:e,title:n,width:r=720,children:s}){return t?Ea.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 Wg=({children:t})=>i.jsx("div",{className:"text-[11px] text-[#9B9B9B] mb-1",children:t}),Wse=({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]"}),nZ=({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]}),Uqe=({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(p2,{size:14,color:"#FFF"}):null,i.jsx("span",{children:t})]});function lgn({open:t,onClose:e,row:n,onConfirm:r,initialTab:s="limit",busy:a=!1}){const[o,l]=ke.useState(s),[c,u]=ke.useState(n!=null&&n.markPrice?String(n.markPrice):""),[d,f]=ke.useState(100),x=ke.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);ke.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 S=()=>{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}))},T=o==="market"?"Market Close":"Limit Close",I=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(bfe,{open:t,onClose:a?()=>{}:e,title:T,width:500,children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"text-[12px] text-[#9B9B9B]",children:I}),i.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[i.jsx(Wg,{children:"Size"}),i.jsxs("div",{className:"text-[#CFCFCF]",children:[jo(g)," ",n==null?void 0:n.coin]})]}),o==="market"?i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{children:[i.jsx(Wg,{children:"Price"}),i.jsx(nZ,{right:"",children:i.jsx("span",{className:"text-white",children:"Market"})})]}),i.jsxs("div",{children:[i.jsx(Wg,{children:"Size"}),i.jsx(nZ,{right:"USDC",children:jo(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(Wg,{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(Wse,{value:c,onChange:u,placeholder:"0.0"})]}),i.jsxs("div",{children:[i.jsx(Wg,{children:"Size"}),i.jsx(nZ,{right:"USDC",children:jo(v*(C||y),2)})]})]}),i.jsx(Aj,{value:d,onChange:f,accent:"#67FFBD",trackBg:"rgba(255,255,255,0.12)",marks:[0,25,50,75,100],snap:!0}),i.jsx(Uqe,{onClick:S,disabled:o==="limit"&&!c,loading:a,children:o==="market"?"Market Close":"Confirm"})]})})}function cgn({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(bfe,{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," ",jo(a)]}),i.jsxs("div",{className:"text-[#FF797C]",children:[o," ",jo(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(p2,{size:14,color:"#FFF"}):"Reverse"})]})]})})}const Sje=({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 ugn({open:t,onClose:e,row:n,initialTp:r,initialSl:s,onSubmit:a}){var ie;const[o,l]=h.useState(r?String(r):""),[c,u]=h.useState(s?String(s):""),[d,f]=h.useState(""),[x,g]=h.useState(""),[y,v]=h.useState(!1),[C,S]=h.useState(!1),T=Number((n==null?void 0:n.entryPrice)||0),I=Number((n==null?void 0:n.markPrice)??0),L=Math.abs(Number((n==null?void 0:n.size)||0)),F=n==null?void 0:n.type,$=(((ie=n==null?void 0:n.leverage)==null?void 0:ie.type)||(n==null?void 0:n.marginType)||"").toString(),O=oe=>Number.isFinite(oe)?Math.max(0,oe):0,U=(oe,K=4)=>Number.isFinite(oe)?String(Number(oe.toFixed(K))):"",Y=oe=>{var se;if(!T)return"";const K=Number(oe);if(!Number.isFinite(K))return"";const H=Number(((se=n==null?void 0:n.leverage)==null?void 0:se.value)||1),ee=(F==="Long"?K/T-1:1-K/T)*100*H;return U(O(ee),2)},re=oe=>{var se;if(!T)return"";const K=Number(oe);if(!Number.isFinite(K))return"";const H=Number(((se=n==null?void 0:n.leverage)==null?void 0:se.value)||1),ee=(F==="Long"?1-K/T:K/T-1)*100*H;return U(O(ee),2)},Q=oe=>{var pe;const K=Number(oe);if(!Number.isFinite(K)||!T)return"";const H=Number(((pe=n==null?void 0:n.leverage)==null?void 0:pe.value)||1),ee=K/(H*100),se=F==="Long"?T*(1+ee):T*(1-ee);return U(se,4)},q=oe=>{var pe;const K=Number(oe);if(!Number.isFinite(K)||!T)return"";const H=Number(((pe=n==null?void 0:n.leverage)==null?void 0:pe.value)||1),ee=K/(H*100),se=F==="Long"?T*(1-ee):T*(1+ee);return U(se,4)};h.useEffect(()=>{if(t){const oe=r?String(r):"",K=s?String(s):"";l(oe),u(K),f(oe?Y(oe):""),g(K?re(K):""),v(!1),S(!1)}},[t,r,s]);const te=o&&L?Math.max(0,(F==="Long"?Number(o)-I:I-Number(o))*L):0,fe=c&&L?Math.max(0,(F==="Long"?I-Number(c):Number(c)-I)*L):0,G=()=>{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(bfe,{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:[jo(L)," ",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:jo(T,4)})]}),i.jsxs("div",{className:"flex justify-between text-[#9B9B9B]",children:[i.jsx("span",{children:"Mark Price"}),i.jsx("span",{className:"text-white",children:jo(I,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(Wg,{children:"TP Price"}),i.jsx(Wse,{value:o,onChange:oe=>{l(oe),f(oe?Y(oe):"")},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:["+$",jo(te,2)]})]}),i.jsxs("div",{children:[i.jsx(Wg,{children:"Gain"}),i.jsx(Sje,{value:d,onChange:oe=>{f(oe),l(oe?Q(oe):"")}})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_220px] gap-6 items-start",children:[i.jsxs("div",{children:[i.jsx(Wg,{children:"SL Price"}),i.jsx(Wse,{value:c,onChange:oe=>{u(oe),g(oe?re(oe):"")},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:["-$",jo(fe,2)]})]}),i.jsxs("div",{children:[i.jsx(Wg,{children:"Loss"}),i.jsx(Sje,{value:x,onChange:oe=>{g(oe),u(oe?q(oe):"")}})]})]}),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:oe=>v(oe.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:oe=>S(oe.target.checked)}),i.jsx("span",{children:"Limit Price"})]})]}),i.jsx(Uqe,{onClick:G,disabled:!o&&!c,children:"Confirm"})]})]})})}function dgn({selectedRow:t,onOpenCloseModal:e,onOpenReverse:n,onCloseAll:r,busyCloseAll:s}){const[a,o]=h.useState(!1),l=h.useRef(null),[c,u]=h.useState({x:0,y:0});return h.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]),h.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&&Ea.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(p2,{size:12,color:"#FFF"})}):null]})]})}),document.body)]})}function fgn({walletAddress:t,listHeight:e=560}){var ge,ve,be,we;const{isReferralCodeName:n}=h.useContext(Qr),{rows:r,tpslByCoin:s={},viewOrdersOnly:a}=pfe(t),[o,l]=h.useState(t||"");h.useEffect(()=>{l(t||"")},[r]);const c=(o||"")===(t||""),u=h.useMemo(()=>c?r.map(je=>({...je,id:je.id})):[],[c,r]),{key:d}=H2(),[f,x]=h.useState({}),[g,y]=h.useState(null),[v,C]=h.useState(!1),[S,T]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),[I,L]=h.useState(null),F=h.useMemo(()=>u.find(je=>je.id===I)||null,[u,I]),[$,O]=h.useState(!1),[U,Y]=h.useState("limit"),[re,Q]=h.useState(!1),[q,te]=h.useState(!1),[fe,G]=h.useState(!1),ie=()=>typeof window<"u"&&window.localStorage.getItem("skipCloseConfirm")==="true",oe={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},K=je=>oe[je]||je,H=h.useCallback(async({id:je,coin:Fe,tpPrice:Re,slPrice:Qe,configureAmount:Ye,useLimitPx:dt})=>{var st;try{const at=await tZ(t);await eZ(at.replaceTPSLForPosition({symbol:Fe,tpPrice:Re??null,slPrice:Qe??null,useLimitPx:!!dt,triggerSlippage:.1}),{loading:`Placing TP/SL for ${Fe}...`,success:`TP/SL placed for ${Fe}`,error:He=>`TP/SL failed: ${(He==null?void 0:He.message)||He}`}),x(He=>({...He,[je]:{tp:Re||null,sl:Qe||null}})),(st=window.dispatchEvent)==null||st.call(window,new Event("orders:refresh"))}catch{}finally{y(null)}},[t]);h.useEffect(()=>{if(v&&!S.referral){const je=n||window.localStorage.getItem("refcode")||"";je&&T(Fe=>({...Fe,referral:je}))}},[v,n,S.referral]);const ee=h.useCallback(async je=>{te(!0);try{const Fe=await tZ(t),Re=je.mode==="market"?Fe.marketClose(je.coin,je.size,{tif:"Ioc",reduceOnly:!0}):Fe.placeOrder({symbol:je.coin,isBuy:je.side==="Short",size:je.size,price:je.price,tif:"Gtc",reduceOnly:!0});await eZ(Re,{loading:`Closing ${je.coin} ${je.mode}...`,success:`Closed ${je.coin} (${jo(je.size)} ${je.mode})`,error:Qe=>`Close failed: ${je.coin} • ${(Qe==null?void 0:Qe.message)||Qe}`}),O(!1)}finally{te(!1)}},[t]),se=h.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,sortValue:Fe=>Fe.coin||"",render:(Fe,Re)=>{var dt;const Qe=yo(),Ye=()=>Qe(`/terminal/hyperliquid/${Re.coin}`);return i.jsxs("div",{onPointerDown:Ye,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/${K(Re.coin)}.svg`,onError:Zi,className:"w-5 h-5 mr-2",alt:Re.coin}),i.jsx("span",{children:Fe.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:[jo(((dt=Re.leverage)==null?void 0:dt.value)??0,0),"x"]})})})]})}},{key:"size",label:"Size",sortable:!0,sortValue:Fe=>Math.abs(Fe.size),render:(Fe,Re)=>i.jsxs("span",{className:`font-medium ${Re.type==="Long"?"text-[#67ffbd]":"text-[#ff787b]"}`,children:[jo(Math.abs(Fe))," ",Re.coin.replace("xyz:","")]})},{key:"positionValue",label:"Pos. Val.",sortable:!0,sortValue:Fe=>Fe.positionValue,render:Fe=>i.jsxs("span",{className:"text-white font-semibold",children:["$",jo(Fe,2)]})},{key:"entryPrice",label:"Entry Price",sortable:!0,sortValue:Fe=>Fe.entryPrice,render:Fe=>i.jsxs("span",{className:"text-white font-semibold",children:["$",jo(Fe,4)]})},{key:"markPrice",label:"Mark Price",sortable:!0,sortValue:Fe=>Fe.markPrice,render:Fe=>i.jsxs("span",{className:"text-white font-semibold",children:["$",jo(Fe,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:Fe=>Fe.pnl,render:(Fe,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:["$",jo(Math.abs(Re.pnl),2)," ",i.jsxs("span",{className:"text-[#9B9B9B]",children:["(",jo(Math.abs(Re.roe),1),"%)"]})]}),i.jsx("button",{onClick:Qe=>{var dt;Qe.stopPropagation();const Ye=n||window.localStorage.getItem("refcode")||"";T({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:Ye,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:jm,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})},{key:"liquidationPx",label:"Liq. Price",sortable:!0,sortValue:Fe=>Fe.liquidationPx??-1,render:Fe=>Fe==null?i.jsx("span",{className:"text-[#979797]",children:"--"}):i.jsx("span",{className:"text-white font-semibold",children:jo(Fe,0)})},{key:"marginUsed",label:"Margin",headerTooltip:"For isolated positions margin includes unrealized pnl.",sortable:!0,sortValue:Fe=>Fe.marginUsed,render:(Fe,Re)=>{var dt;const Qe=Re.marginUsed,Ye=(dt=Re.leverage)!=null&&dt.type?ogn(Re.leverage.type):null;return i.jsxs("span",{className:"text-white font-semibold",children:["$",jo(Qe,2)," ",Ye?i.jsxs("span",{className:"text-[#9B9B9B]",children:["(",Ye,")"]}):null]})}},{key:"funding",label:"Funding",headerTooltip:"Net funding payments since the position was opened. Hover for all-time and since changed.",sortable:!0,sortValue:Fe=>Fe.funding,render:Fe=>i.jsxs("span",{className:Number(Fe)<=0?"text-[#67FFBD] font-semibold":"text-[#FF797C] font-semibold",children:["$",jo(Math.abs(Fe),4)]})},{key:"close",label:i.jsx(dgn,{selectedRow:F,onOpenCloseModal:async Fe=>{if(F){if(Y(Fe),Fe==="market"&&ie()){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}O(!0)}},onOpenReverse:()=>F&&Q(!0),onCloseAll:async()=>{G(!0);try{const Fe=await tZ(t);await eZ(Fe.closeAllPositions(),{loading:"Closing all positions...",success:"Closed all positions",error:Re=>`Close all failed: ${(Re==null?void 0:Re.message)||Re}`})}finally{G(!1)}},busyCloseAll:fe}),sortable:!1,align:"start",render:(Fe,Re)=>i.jsxs("div",{className:"w-full flex items-center gap-1",children:[i.jsx("button",{onClick:()=>{L(Re.id),Y("limit"),O(!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()=>{L(Re.id),Y("market"),ie()?await ee({mode:"market",id:Re.id,coin:Re.coin,side:Re.type,size:Math.abs(Number(Re.size||0))}):O(!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:(Fe,Re)=>{const Qe=s==null?void 0:s[Re.coin],Ye=Qe&&(Qe.tp||Qe.sl),dt=a instanceof Set?a.has(Re.coin):!1,st=f[Re.id];return Ye?i.jsxs("div",{className:"flex items-center justify-end gap-2 text-[#CFCFCF]",children:[i.jsxs("span",{className:"text-[#CFCFCF]",children:[Qe.tp?jo(Qe.tp,0):"--"," /"," ",Qe.sl?jo(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"})}):st&&(st.tp||st.sl)?i.jsxs("div",{className:"flex items-center justify-end gap-2 text-[#CFCFCF]",children:[i.jsxs("span",{className:"text-[#CFCFCF]",children:[st.tp?jo(st.tp,0):"--"," /"," ",st.sl?jo(st.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]),pe=g?((ge=s==null?void 0:s[g.coin])==null?void 0:ge.tp)??((ve=f[g.id])==null?void 0:ve.tp)??null:null,Se=g?((be=s==null?void 0:s[g.coin])==null?void 0:be.sl)??((we=f[g.id])==null?void 0:we.sl)??null:null;return i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:f1(u,"positions",d),columns:se,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 ${I===je.id?"bg-[#0d0d0d]":""}`,cellClassName:()=>"py-1 flex min-w-0 !text-[11px] font-normal",rowKey:je=>je.id,onRowClick:je=>L(je.id),emptyRenderer:()=>i.jsx("div",{className:"flex items-center justify-center h-[200px] text-[#9B9B9B] text-sm",children:"No open positions"})}),i.jsx(ugn,{open:!!g,onClose:()=>y(null),row:g,initialTp:pe,initialSl:Se,onSubmit:H}),i.jsx(lgn,{open:$&&!!F,onClose:()=>O(!1),row:F,initialTab:U,onConfirm:ee,busy:q}),i.jsx(cgn,{open:re&&!!F,onClose:()=>Q(!1),row:F,onConfirm:je=>{Q(!1),console.log("REVERSE CONFIRM",je)}}),i.jsx(cP,{open:v,setOpen:C,data:S,setTradeInfo:T})]})}async function jje(t){const e=mP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return jj({address:t,signer:e,dex:""})}function qse(t,e=2,n=!0){return Number(t||0).toLocaleString(void 0,{minimumFractionDigits:n?0:e,maximumFractionDigits:e})}function hgn(t,e=2){return`${Number(t||0).toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})} USDC`}function pgn(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 mgn(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 xgn({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 ggn(t){return typeof(t==null?void 0:t.type)=="string"&&t.type.toLowerCase()==="limit"}function bgn(t){return typeof t=="string"&&t.toLowerCase().includes("stop")}function ygn(t){return typeof t=="string"&&t.toLowerCase().includes("take profit")}function vgn(t){return t==="B"?"Long":"Short"}function wgn(t){return t==="B"?"Short":"Long"}function L7({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 JF({title:t,order:e,parentRawSide:n}){const r=!!e,s=r?e.side?vgn(e.side):wgn(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(L7,{k:"Order Type",v:e.orderType||"--"}),i.jsx(L7,{k:"Side",v:s}),i.jsx(L7,{k:"Amount",v:`${e.sz}`}),i.jsx(L7,{k:"Trigger",v:e.triggerCondition&&e.triggerCondition!=="N/A"?e.triggerCondition:"N/A"}),i.jsx(L7,{k:"Price",v:a?`$${qse(e.limitPx,3)}`:"Market"})]}):i.jsx("div",{className:"text-[#9B9B9B]",children:"—"})]})}function Cgn({onBulkCancel:t,busy:e}){const[n,r]=h.useState(!1),s=h.useRef(null),[a,o]=h.useState({x:0,y:0});h.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]),h.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(p2,{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&&Ea.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 Ngn({walletAddress:t,listHeight:e=560,onCancelOrder:n,onBulkCancel:r}){const{rows:s,loading:a}=mfe(t),[o,l]=h.useState(!1),[c,u]=h.useState(null),[d,f]=h.useState(null),[x,g]=h.useState(null),{key:y}=H2(),[v,C]=h.useState(new Set),[S,T]=h.useState(!1),I=H=>v.has(H),L=H=>C(ee=>new Set([...ee,H])),F=H=>C(ee=>{const se=new Set(ee);return se.delete(H),se}),$=h.useCallback(async H=>{await(await jje(t)).cancelOrder({symbol:H.coin,oid:H.oid})},[t]),O=h.useCallback(async H=>{await(await jje(t)).cancelOrdersFiltered({filter:H})},[t]),U={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},Y=H=>U[H]||H,re=n??$,Q=r??O,q=h.useCallback(async H=>{const ee=H.oid;if(!I(ee)){L(ee);try{await fn.promise(Promise.resolve(re(H)),{loading:`Cancelling: ${H.coin} #${ee}...`,success:`Cancelled: ${H.coin} #${ee}`,error:se=>`Cancel failed: ${H.coin} #${ee} • ${(se==null?void 0:se.message)||se}`},{position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12}})}finally{F(ee)}}},[re,v]),te=H=>H==="all"?"All orders":H==="limit"?"Limit orders":H==="tpsl"?"TP/SL orders":H==="reduceOnly"?"ReduceOnly orders":H==="nonReduce"?"Non-Reduce orders":H,fe=h.useCallback(async H=>{if(H){T(!0);try{await fn.promise(Promise.resolve(Q(H)),{loading:`Bulk cancelling: ${te(H)}...`,success:`Bulk cancelled: ${te(H)}`,error:ee=>`Bulk cancel failed: ${te(H)} • ${(ee==null?void 0:ee.message)||ee}`},{position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12}})}finally{T(!1)}}},[Q]),G=h.useCallback(H=>{const ee=Array.isArray(H==null?void 0:H.children)?H.children:[],se=ee.find(Se=>ygn(Se.orderType))||null,pe=ee.find(Se=>bgn(Se.orderType))||null;u({orderType:H.type,coin:H.coin,side:H.sideRaw,sz:H.size,limitPx:H.limitPx,triggerCondition:H.triggerCondition,timestamp:H.timestamp}),f(pe||se||null),g(se&&pe?se:null),l(!0)},[]),ie=h.useMemo(()=>[{key:"timestamp",label:"Time",sortable:!0,width:"140px",sortValue:H=>H.timestamp,render:H=>i.jsx("span",{className:"text-white",children:pgn(H)})},{key:"type",label:"Type",sortable:!0,width:"120px",sortValue:H=>H.type||"",render:(H,ee)=>i.jsx("span",{className:"text-white",children:ee.type||"--"})},{key:"coin",label:"Coin",sortable:!0,sortValue:H=>H.coin||"",render:(H,ee)=>{const se=(ee.side==="B",ee.reduceOnly?"text-[#FF797C]":"text-[#67FFBD]"),pe=yo(),Se=()=>pe(`/terminal/hyperliquid/${ee.coin}`);return i.jsxs("div",{onPointerDown:Se,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Y(ee.coin)}.svg`,onError:Zi,className:"w-5 h-5 mr-2",alt:ee.coin}),i.jsx("span",{className:se,children:ee.coin.replace("xyz:","")||"--"})]})}},{key:"side",label:"Direction",sortable:!0,sortValue:H=>H.side==="B"?1:0,render:(H,ee)=>{const se=mgn(ee),pe=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 ${pe?"text-[#FF797C] bg-[#FF797C]/20":"text-[#67FFBD] bg-[#67FFBD]/20"}`,children:se})}},{key:"size",label:"Size",sortable:!0,sortValue:H=>H.size,render:H=>i.jsx("span",{className:"text-white font-semibold",children:H})},{key:"originalSize",label:"Original Size",sortable:!0,sortValue:H=>Math.abs(H.originalSize),render:H=>i.jsx("span",{className:"text-white font-semibold",children:H})},{key:"orderValue",label:"Order value",sortable:!0,sortValue:H=>Math.abs(H.orderValue),render:H=>i.jsx("span",{className:"text-white font-semibold",children:hgn(H,2)})},{key:"price",label:"Price",sortable:!0,sortValue:H=>H.limitPx,render:(H,ee)=>{if(ee.price==="Market")return i.jsx("span",{className:"text-white font-semibold",children:"Market"});const se=typeof ee.pxDecimals=="number"?ee.pxDecimals:3;return i.jsx("span",{className:"text-white font-semibold",children:qse(ee.limitPx,se)})}},{key:"reduceOnly",label:"Reduce",sortable:!0,sortValue:H=>H.reduceOnly?1:0,render:H=>i.jsx("span",{className:"text-white font-semibold",children:H?"Yes":"No"})},{key:"triggerCondition",label:"Trigger",sortable:!0,sortValue:H=>H.triggerPx||0,width:"140px",render:(H,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:(H,ee)=>{const se=Array.isArray(ee.children)&&ee.children.length>0;return ggn(ee)&&se?i.jsx("button",{onClick:pe=>{pe.stopPropagation(),G(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(Cgn,{onBulkCancel:fe,busy:S}),sortable:!1,render:(H,ee)=>{const se=I(ee.oid);return i.jsx("button",{onClick:pe=>{pe.stopPropagation(),se||q(ee)},disabled:se,className:`h-6 w-6 flex items-center justify-center rounded-md border text-[#FF797C] transition-all duration-200 p-1 text-[11px] ${se?"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:se?"Cancelling...":"Cancel order",children:se?i.jsx(p2,{size:12,color:"#FF797C"}):"×"})}}],[G,q,fe,S,v]),oe=(d?1:0)+(x?1:0),K=c?`${c.coin} • TP/SL for Limit @ ${qse(c.limitPx,3)}`:"Take Profit / Stop Loss";return i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:f1(s,"openOrders",y),loading:a,columns:ie,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:H=>H.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No open orders"})}),i.jsxs(xgn,{open:o,onClose:()=>l(!1),title:K,children:[i.jsx("div",{className:"text-center text-[14px] text-[#9B9B9B] mb-4",children:oe===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(JF,{title:"",order:c,parentRawSide:c==null?void 0:c.side})})]}),i.jsx("div",{className:"relative mx-auto h-10 w-px bg-[#2a2a2a]"}),oe===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(JF,{title:"Order B",order:d,parentRawSide:c==null?void 0:c.side}),i.jsx(JF,{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(JF,{title:"",order:d,parentRawSide:c==null?void 0:c.side})]})]})]})]})}async function Sgn(t){const e=mP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return jj({address:t,signer:e,dex:""})}const jgn="wss://api.hyperliquid.xyz/ws",zqe="https://api.hyperliquid.xyz/info";function Uv(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function R7(t,e=2){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function rZ(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 sZ(t){return t?"Yes":"No"}function Hqe(t,e){const n=Number(e||0);return n?Number(t||0)/n:null}const iZ=new Map;function Vqe(t){const e=(t==null?void 0:t.toLowerCase())||"";return e?(iZ.has(e)||iZ.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}),iZ.get(e)):null}function v5(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 LM(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 Agn(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 Wqe(t){if(t.booting||t.connected)return;t.booting=!0,LM(t);const e=new WebSocket(jgn);t.ws=e,e.onopen=()=>{t.connected=!0,!t.hydratedActive&&t.activeRows.length===0&&(t.loadingActive=!0,v5(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}=Agn(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=Hqe(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,v5(t)}}catch{}},e.onclose=()=>{LM(t),setTimeout(()=>Wqe(t),1500)},e.onerror=()=>{LM(t)},t.booting=!1}async function qqe(t){try{t.loadingHistory=!0,v5(t);const n=await(await fetch(zqe,{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=Hqe(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,v5(t)}}function _gn(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 Gqe(t){try{t.loadingFills=!0,v5(t);const n=await(await fetch(zqe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"userTwapSliceFills",user:t.key})})).json();t.fillRows=_gn(n||[])}catch{t.fillRows=[]}finally{t.loadingFills=!1,v5(t)}}function Egn(t){const e=(t==null?void 0:t.toLowerCase())||"",[n,r]=h.useState({activeRows:[],historyRows:[],fillRows:[],loadingActive:!0,loadingHistory:!0,loadingFills:!0,hydratedActive:!1});return h.useEffect(()=>{const s=Vqe(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}),Wqe(s),qqe(s),Gqe(s),()=>{s.subs.delete(a),s.subs.size===0&&LM(s)}},[e]),n}function kgn(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 Tgn(t=1e3){const[e,n]=h.useState(Date.now());return h.useEffect(()=>{const r=setInterval(()=>n(Date.now()),t);return()=>clearInterval(r)},[t]),e}function RM(t=""){const e=t.toLowerCase();return e.includes("long")||e==="buy"}function DM(t=""){const e=t.toLowerCase();return e.includes("short")||e==="sell"}function Pgn(t=""){return RM(t)&&!DM(t)?3:RM(t)&&DM(t)?2:DM(t)&&!RM(t)?1:0}function Ign({walletAddress:t}){const{activeRows:e,historyRows:n,fillRows:r,loadingActive:s,loadingHistory:a,loadingFills:o,hydratedActive:l}=Egn(t),c=Tgn(1e3),u=h.useMemo(()=>e.map(te=>({...te,runtimeMs:Math.max(0,c-Number(te.timestamp||0))})),[e,c]),{key:d}=H2(),[f,x]=h.useState(new Set),g=te=>f.has(te),y=te=>x(fe=>new Set([...fe,te])),v=te=>x(fe=>{const G=new Set(fe);return G.delete(te),G}),C=async te=>{const fe=te.twapId??Number(te.id);if(!g(fe)){y(fe);try{const G=await Sgn(t);await fn.promise(G.cancelTwapOrder({symbol:te.coin,twapId:fe}),{loading:`Terminating: ${te.coin} #${fe}...`,success:`Terminated: ${te.coin} #${fe}`,error:oe=>`Terminate failed: ${te.coin} #${fe} • ${(oe==null?void 0:oe.message)||oe}`},{position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12}});const ie=Vqe(t);if(ie){const oe=String(fe);ie.activeRows=ie.activeRows.filter(K=>String(K.twapId??K.id)!==oe),ie.hydratedActive=!0,v5(ie),qqe(ie),Gqe(ie)}}finally{v(fe)}}},[S,T]=h.useState("active"),[I,L]=h.useState("active"),F=["active","history","fills"],$=F.indexOf(S)>F.indexOf(I)?"right":"left",O={enter:te=>({x:te==="right"?24:-24,opacity:0}),center:{x:0,opacity:1},exit:te=>({x:te==="right"?-24:24,opacity:0})};h.useEffect(()=>{const te=setInterval(()=>{},3e4);return()=>clearInterval(te)},[]);const U=(te,fe,G)=>te?i.jsxs("div",{className:"px-3 py-6 flex items-center gap-2 text-[#9B9B9B]",children:[i.jsx(p2,{size:14,color:"#9B9B9B"}),i.jsx("span",{children:G})]}):i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:fe}),Y=h.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,sortValue:te=>te.coin||"",render:(te,fe)=>{const G=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",ie=yo(),oe=()=>ie(`/terminal/hyperliquid/${fe.coin}`);return i.jsxs("div",{onPointerDown:oe,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:Zi,className:"w-5 h-5 mr-2",alt:fe.coin}),i.jsx("span",{className:`font-bold ${G}`,children:te||"--"})]})}},{key:"sz",label:"Size",sortable:!0,sortValue:te=>te.sz,render:(te,fe)=>{const G=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]";return i.jsxs("span",{className:G,children:[Uv(te)," ",fe.coin]})}},{key:"executedSz",label:"Executed Size",sortable:!0,sortValue:te=>te.executedSz,render:(te,fe)=>{const G=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]";return te&&Number(te)!==0?i.jsxs("span",{className:G,children:[Uv(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:R7(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:[kgn(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:sZ(te)})},{key:"timestamp",label:"Creation Time",sortable:!0,sortValue:te=>te.timestamp,render:te=>i.jsx("span",{className:"text-white font-semibold",children:rZ(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 G=fe.twapId??Number(fe.id),ie=g(G);return i.jsx("button",{onClick:oe=>{oe.stopPropagation(),ie||C(fe)},disabled:ie,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] ${ie?"opacity-60 cursor-not-allowed bg-red-500/10":"bg-red-500/20"}`,title:ie?"Terminating...":"Terminate",children:ie?i.jsx(p2,{size:12,color:"#FF797C"}):"×"})}}],[f,t]),re=h.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:te=>te.time,render:te=>i.jsx("span",{className:"text-white font-semibold",children:rZ(te)})},{key:"coin",label:"Coin",sortable:!0,sortValue:te=>te.coin||"",render:(te,fe)=>{const G=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",ie=yo(),oe=()=>ie(`/terminal/hyperliquid/${fe.coin}`);return i.jsxs("div",{onPointerDown:oe,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:Zi,className:"w-5 h-5 mr-2",alt:fe.coin}),i.jsx("span",{className:`font-bold ${G}`,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:[Uv(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:[Uv(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:R7(te,0)}):"--"},{key:"totalMinutes",label:"Total Runtime",sortable:!0,sortValue:te=>te.totalMinutes,render:te=>i.jsxs("span",{className:"text-white font-semibold",children:[Uv(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:sZ(te)})},{key:"randomize",label:"Randomize",sortable:!0,sortValue:te=>te.randomize?1:0,render:te=>i.jsx("span",{className:"text-white font-semibold",children:sZ(te)})},{key:"status",label:"Status",sortable:!0,sortValue:te=>te.status||"",render:te=>i.jsx("span",{className:"text-white font-semibold",children:te||"--"})}],[]),Q=h.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:te=>te.time,render:(te,fe)=>i.jsx("span",{className:"text-white font-semibold",children:rZ(fe.time)})},{key:"coin",label:"Coin",sortable:!0,sortValue:te=>te.coin||"",render:(te,fe)=>{const G=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",ie=yo(),oe=()=>ie(`/terminal/hyperliquid/${fe.coin}`);return i.jsxs("div",{onPointerDown:oe,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:Zi,className:"w-5 h-5 mr-2",alt:fe.coin}),i.jsx("span",{className:`font-bold ${G}`,children:te||"--"})]})}},{key:"dir",label:"Direction",sortable:!0,sortValue:te=>Pgn(te.dir),render:te=>i.jsx("span",{className:`${DM(te)?"text-[#FF6B6B]":RM(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:["$",R7(te,0)]}):"--"},{key:"sz",label:"Size",sortable:!0,sortValue:te=>te.sz,render:te=>i.jsx("span",{className:"text-white font-semibold",children:Uv(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:["$",R7(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:Uv(te)})},{key:"closedPnl",label:"Closed PnL",sortable:!0,sortValue:te=>te.closedPnl-te.fee,render:(te,fe)=>{const G=Number(fe.closedPnl||0)-Number(fe.fee||0),ie=G>0,oe=G<0;return i.jsxs("span",{className:`${ie?"text-[#67FFBD] font-semibold":oe?"text-[#FF797C] font-semibold":"text-white font-semibold"}`,children:["$",R7(Math.abs(G))]})}},{key:"oid",label:"Order ID",sortable:!0,sortValue:te=>te.oid,render:te=>i.jsx("span",{className:"text-[#979797] font-semibold",children:te||"--"})}],[]),q=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=S===te.k;return i.jsxs("button",{onClick:()=>{L(S),T(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(Ya.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:[q,i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(dP,{mode:"wait",custom:$,children:i.jsx(Ya.div,{custom:$,variants:O,initial:"enter",animate:"center",exit:"exit",transition:{type:"spring",stiffness:320,damping:28},className:"absolute inset-0",children:S==="active"?i.jsx(zu,{data:f1(u,"twap",d),loading:s||!l,columns:Y,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:U(s||!l,"No Active TWAP","Loading Active TWAP…")}):S==="history"?i.jsx(zu,{data:f1(n,"twap",d),loading:a,columns:re,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:U(a,"No TWAP History","Loading TWAP History…")}):i.jsx(zu,{data:f1(r,"twap",d),loading:o,columns:Q,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:U(o,"No TWAP fills available","Loading TWAP fills…")})},S)})})]})}const Fgn="wss://api.hyperliquid.xyz/ws",Ogn="https://api-ui.hyperliquid.xyz/info",Mgn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},Lgn=t=>Mgn[t]||t;function Rgn(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function D7(t,e=2){return`$${Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}`}function Gse(t){return t==="Open Long"||t==="Close Short"||t==="Short > Long"}function Kse(t){return t==="Open Short"||t==="Close Long"||t==="Long > Short"}function Dgn(t){return Gse(t)?1:Kse(t)?0:-1}function Bgn(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 $gn(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 aZ=new Map;function Ugn(t,e=!0){const n=(t==null?void 0:t.toLowerCase())||"";if(!n)return null;aZ.has(n)||aZ.set(n,{key:n,rows:[],loading:!0,ws:null,ping:null,subs:new Set,booting:!1,connected:!1,hydrated:!1,aggregateByTime:e});const r=aZ.get(n);return r.aggregateByTime=e,r}function Yse(t){t.subs.forEach(e=>e({rows:t.rows,loading:t.loading}))}function BM(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 zgn(t){try{t.loading=!0,Yse(t);const n=await(await fetch(Ogn,{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,Yse(t)}}function Aje(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,Yse(t)}async function Yqe(t){if(t.booting||t.connected)return;t.booting=!0,BM(t);const e=new WebSocket(Fgn);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"&&Aje(t,a==null?void 0:a.data),(a==null?void 0:a.channel)==="user"&&((r=a==null?void 0:a.data)!=null&&r.fills)&&Aje(t,(s=a==null?void 0:a.data)==null?void 0:s.fills)}catch{}},e.onclose=()=>{BM(t),setTimeout(()=>Yqe(t),1500)},e.onerror=()=>{BM(t)},t.booting=!1}function Hgn(t,e){const n=(t==null?void 0:t.toLowerCase())||"",[r,s]=h.useState({rows:[],loading:!0});return h.useEffect(()=>{const a=Ugn(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}),zgn(a),Yqe(a),()=>{a.subs.delete(o),a.subs.size===0&&BM(a)}},[n,e]),r}function Vgn({walletAddress:t,listHeight:e=560}){const[n,r]=h.useState(()=>typeof window>"u"?!0:window.localStorage.getItem("tradeHistoryAggregate")!=="false");h.useEffect(()=>{typeof window<"u"&&window.localStorage.setItem("tradeHistoryAggregate",n?"true":"false")},[n]);const{rows:s,loading:a}=Hgn(t,n),[o,l]=h.useState(typeof window<"u"&&localStorage.getItem("isDateTradeHistoryFormat")||"date"),c=h.useRef(o);h.useEffect(()=>{typeof window<"u"&&localStorage.setItem("isDateTradeHistoryFormat",o),c.current=o},[o]);const{key:u}=H2(),{isReferralCodeName:d}=h.useContext(Qr),[f,x]=h.useState(!1),[g,y]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),[v,C]=h.useState(()=>new Map),S=h.useCallback(async L=>{const F=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,$=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;if(!F||!$||!L||L.length===0)return null;try{const{data:O}=await Ns.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_leverage_with_oids/",{address:F,token:$,position_oids:L},{headers:{"Content-Type":"application/json"}});if(O&&O.success){const U=parseFloat(O.leverage);return C(Y=>{const re=new Map(Y);return L.forEach(Q=>re.set(String(Q),U)),re}),U}}catch(O){console.error("leverage fetch error:",O)}return null},[]);h.useEffect(()=>{if(f&&!g.referral){const L=d||typeof window<"u"&&window.localStorage.getItem("refcode")||"";L&&y(F=>({...F,referral:L}))}},[f,d,g.referral]);const T=h.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:L=>L.time,render:(L,F)=>i.jsx("button",{onClick:()=>l($=>$==="date"?"relative":"date"),className:"text-left text-white bg-transparent font-semibold",children:c.current==="date"?$gn(F.time):Bgn(F.time)})},{key:"coin",label:"Coin",sortable:!0,sortValue:L=>L.coin||"",render:(L,F)=>{const $=yo(),O=()=>$(`/terminal/hyperliquid/${F.coin}`);return i.jsxs("div",{onPointerDown:O,className:"flex items-center text-white font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Lgn(F.coin)}.svg`,onError:Zi,className:"w-5 h-5 mr-2",alt:F.coin}),i.jsx("span",{className:`font-bold ${Kse(F.dir)?"text-[#FF6B6B]":Gse(F.dir)?"text-[#67FFBD]":"text-white"}`,children:L||"--"})]})}},{key:"dir",label:"Direction",sortable:!0,sortValue:L=>Dgn(L.dir),render:L=>i.jsx("span",{className:`font-semibold ${Kse(L)?"text-[#FF6B6B]":Gse(L)?"text-[#67FFBD]":"text-white"}`,children:L||"--"})},{key:"px",label:"Price",sortable:!0,sortValue:L=>L.px,render:L=>i.jsx("span",{className:"text-white font-semibold",children:D7(L)})},{key:"sz",label:"Size",sortable:!0,sortValue:L=>L.sz,render:(L,F)=>i.jsxs("span",{className:"text-white font-semibold",children:[Rgn(L)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:F.coin})]})},{key:"tradeValue",label:"Trade Value",sortable:!0,sortValue:L=>L.px*L.sz,render:(L,F)=>i.jsxs("span",{className:"text-white font-semibold",children:[D7(F.px*F.sz)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:"USDC"})]})},{key:"fee",label:"Fee",sortable:!0,sortValue:L=>L.fee,render:(L,F)=>i.jsxs("span",{className:"text-white font-semibold",children:[D7(L)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:F.feeToken||"USDC"})]})},{key:"netPnl",label:"Closed PnL",sortable:!0,sortValue:L=>L.closedPnl-L.fee,render:(L,F)=>{const $=Number(F.closedPnl||0),O=Number(F.fee||0),U=$-O,Y=U>0,re=U<0,Q=!!$,q=Number(F.px||0)*Number(F.sz||0),te=q>0?U/q*100:0;return i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:`${Y?"text-[#67FFBD] font-semibold":re?"text-[#FF797C] font-semibold":"text-white font-semibold"}`,children:[U===0?D7(0):`${U<0?"-":""}${D7(Math.abs(U))}`," ",i.jsx("span",{className:"text-[#9B9B9B]",children:"USDC"})]}),Q&&i.jsx("button",{onClick:async()=>{const fe=d||typeof window<"u"&&window.localStorage.getItem("refcode")||"";let G=0;const ie=F.oid;if(ie){const oe=v.get(String(ie));if(oe!=null)G=oe;else{const K=await S([ie]);typeof K=="number"&&!Number.isNaN(K)&&(G=K)}}y({coin:F.coin||"",type:(F.dir||"").toUpperCase(),leverage:G,roe:te,entryPrice:Number(F.px||0),markPrice:Number(F.px||0),referral:fe,positionDistribution:0,pnl:Number(U||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:jm,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})}}],[o,d,S,v]),I=h.useMemo(()=>f1(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:L=>r(L.target.checked),className:"w-3 h-3 accent-[#67FFBD]"})]})}),i.jsx(zu,{data:I,loading:a,columns:T,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:L=>L.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No trades"})}),i.jsx(cP,{open:f,setOpen:x,data:g,setTradeInfo:y,pnlTitle:""})]})}const Wgn="https://api.hyperliquid.xyz/info";function qgn(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function _je(t,e=4){return`$${Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}`}function Ggn(t){return`${(Number(t||0)*100).toLocaleString(void 0,{maximumFractionDigits:6})}%`}function Kgn(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 Ygn(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 Xgn({walletAddress:t,listHeight:e=560,days:n=30}){const[r,s]=h.useState([]),[a,o]=h.useState(!0),[l,c]=h.useState(typeof window<"u"&&localStorage.getItem("isDateFundingHistoryFormat")||"date"),{key:u}=H2(),d=h.useRef(l);h.useEffect(()=>{typeof window<"u"&&localStorage.setItem("isDateFundingHistoryFormat",l),d.current=l},[l]),h.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(Wgn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"userFunding",user:t,startTime:y})})).json(),T=(Array.isArray(C)?C:Array.isArray(C==null?void 0:C.data)?C.data:[]).map((I,L)=>{const F=(I==null?void 0:I.delta)||{},$=Number((F==null?void 0:F.szi)||0),O=Number((F==null?void 0:F.fundingRate)||0),U=Number((F==null?void 0:F.usdc)||0);let Y=$>0?"Long":$<0?"Short":null;return!Y&&O!==0&&U!==0&&(Y=O>0?U<0?"Long":"Short":U<0?"Short":"Long"),Y||(Y="Flat"),{id:`${I.time||L}-${F.coin||""}-${L}`,time:Number((I==null?void 0:I.time)||0),coin:(F==null?void 0:F.coin)||"",rate:Number((F==null?void 0:F.fundingRate)||0),size:$,amount:U,token:"USDC",side:Y}}).sort((I,L)=>L.time-I.time);x&&s(T)}catch{x&&s([])}finally{x&&o(!1)}}return g(),()=>{x=!1}},[t,n]);const f=h.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"?Ygn(g.time):Kgn(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=yo(),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:Zi,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:[qgn(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?_je(0):`${x<0?"-":""}${_je(Math.abs(x))}`})}},{key:"rate",label:"Rate",sortable:!0,sortValue:x=>x.rate,render:x=>i.jsx("span",{className:"text-white font-semibold",children:Ggn(x)})}],[]);return i.jsx(zu,{data:f1(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 eO(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function Qgn(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 Zgn(t){return t.side==="B"?t.reduceOnly?"Close Short":"Open Long":t.side==="A"?t.reduceOnly?"Close Long":"Open Short":t.side||"-"}function Xse(t){return t==="Open Long"||t==="Close Short"||t==="Short > Long"}function Qse(t){return t==="Open Short"||t==="Close Long"||t==="Long > Short"}function Jgn(t){return Xse(t)?1:Qse(t)?0:-1}function e1n({walletAddress:t,listHeight:e=560}){const[n,r]=h.useState([]),[s,a]=h.useState(!1),{key:o}=H2();h.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:Zgn(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":`${eO(Number(y.limitPx||0),2)} USD`,reduceOnly:!!y.reduceOnly,trigger:y.triggerCondition&&y.triggerCondition!=="N/A"?`${y.triggerCondition} @ ${eO(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=h.useMemo(()=>[{key:"time",label:"Time",width:"140px",sortable:!0,sortValue:c=>c.time,render:c=>i.jsx("span",{className:"text-white font-semibold",children:Qgn(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=yo(),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:Zi,className:"w-5 h-5 mr-2",alt:u.coin}),i.jsx("span",{className:`font-bold ${Qse(u.sideText)?"text-[#FF6B6B]":Xse(u.sideText)?"text-[#67FFBD]":"text-white"}`,children:c})]})}},{key:"sideText",label:"Side",sortable:!0,sortValue:c=>Jgn(c.sideText),render:c=>i.jsx("span",{className:`font-semibold ${Qse(c)?"text-[#FF6B6B]":Xse(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:eO(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:eO(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:f1(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 t1n="https://dextrabothypev2.nftinit.io/api/hyper/gridbot/list/",n1n="https://dextrabothypev2.nftinit.io/api/hyper/gridbot/update/",r1n="https://dextrabothypev2.nftinit.io/api/hyper/gridbot/update/",s1n="https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/update/";function Eje(t,e=4){const n=Number(t||0);return Number.isFinite(n)?n.toLocaleString(void 0,{maximumFractionDigits:e}):"--"}function i1n(t,e=2){const n=Number(t||0);return Number.isFinite(n)?`$${n.toLocaleString(void 0,{maximumFractionDigits:e})}`:"--"}const a1n={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},B7=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 a1n[t]||t},o1n=t=>t&&t.length>10?`${t.slice(0,6)}...${t.slice(-4)}`:t||"--";function $M({walletAddress:t,sourceMarket:e="hyper"}){var $,O;const{botSlotsInfo:n,refreshBotSlots:r}=h.useContext(Qr)||{},[s,a]=h.useState([]),[o,l]=h.useState(!1),[c,u]=h.useState(null),[d,f]=h.useState(0),[x,g]=h.useState(null),y=yo();h.useEffect(()=>{let U=!0;async function Y(){if(typeof window>"u")return;const re=window.localStorage.getItem("hyperAddress"),Q=window.localStorage.getItem("hyperToken");if(!re||!Q){U&&(a([]),l(!1));return}try{l(!0);const te=await(await fetch(t1n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:re,token:Q})})).json(),G=(Array.isArray(te==null?void 0:te.data)?te.data:Array.isArray(te)?te:[]).filter(ie=>e?ie.source_market===e:!0);U&&a(G)}catch{U&&(a([]),fn.error("Failed to load bots"))}finally{U&&l(!1)}}return Y(),()=>{U=!1}},[t,e,d]),h.useEffect(()=>{const U=Y=>{const re=Y&&Y.detail&&Y.detail.sourceMarket;re&&re!==e||f(Q=>Q+1)};return window.addEventListener("gridbotUpdated",U),()=>{window.removeEventListener("gridbotUpdated",U)}},[e]);const v=h.useMemo(()=>{const U=s.map(Y=>{const re=Y.bot_params||{},Q=re.investment||{},q=re.priceRange||{},te=re.liquidationPrices||{},fe=re.direction==="long"?"Long":re.direction==="short"?"Short":"--";return{id:Y.id,coin:Y.coin||re.symbol||"--",market:Y.source_market||"",status:Y.is_deleted?"Stopped":"Active",side:fe,gridType:re.gridType||"--",gridCount:re.gridCount??"--",lower:q.lower??null,upper:q.upper??null,currentPrice:re.currentPrice??null,leverage:Q.leverage??null,collateral:Q.collateral??null,totalInvestment:Q.totalInvestment??null,liqLong:te.long??null,liqShort:te.short??null,trailingUp:re.trailing_up??null,trailingDown:re.trailing_down??null,slUp:re.sl_up??null,slDown:re.sl_down??null,timestamp:re.timestamp||null,walletName:Y.wm_name||null,walletAddress:Y.wm_address||null,walletId:Y.wallet_id??null,raw:Y}});return U.sort((Y,re)=>{const Q=Y.status==="Active",q=re.status==="Active";if(Q!==q)return Q?-1:1;const te=Y.timestamp?new Date(Y.timestamp).getTime():0;return(re.timestamp?new Date(re.timestamp).getTime():0)-te}),U},[s]),C=async(U,Y)=>{var q,te,fe;if(!U||!U.raw||typeof window>"u")return;const re=window.localStorage.getItem("hyperAddress"),Q=window.localStorage.getItem("hyperToken");if(!re||!Q){fn.error("Please sign in to manage bots");return}try{u(U.id);const G={is_deleted:Y,bot_params:U.raw.bot_params||{}},ie=String(((q=U.raw)==null?void 0:q.source_market)||"").toLowerCase().includes("lighter")?r1n:String(((te=U.raw)==null?void 0:te.source_market)||"").toLowerCase().includes("extended")?s1n:n1n,K=await(await fetch(ie,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:re,token:Q,bot_id:U.id,update_params:G})})).json().catch(()=>null);if(!(K!=null&&K.success)){const H=(K==null?void 0:K.error_message)||(K==null?void 0:K.message)||(K==null?void 0:K.detail)||"Failed to update bot";throw new Error(H)}fn.success(Y?"Bot stopped":"Bot started"),a(H=>H.map(ee=>ee.id===U.id?{...ee,is_deleted:Y}:ee)),r==null||r(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:((fe=U.raw)==null?void 0:fe.source_market)||e}})),f(H=>H+1)}catch(G){fn.error(G.message||"Failed to update bot")}finally{u(null)}},S=U=>{if(!U||!U.raw||typeof window>"u")return;const Y=U.status==="Active",re=(Q,q)=>{var oe,K,H,ee;const te=((oe=Q==null?void 0:Q.raw)==null?void 0:oe.wallet_id)??(Q==null?void 0:Q.walletId),fe=((K=q==null?void 0:q.raw)==null?void 0:K.wallet_id)??(q==null?void 0:q.walletId);if(te&&fe&&String(te)===String(fe))return!0;const G=((Q==null?void 0:Q.walletAddress)||((H=Q==null?void 0:Q.raw)==null?void 0:H.wm_address)||"").toLowerCase(),ie=((q==null?void 0:q.walletAddress)||((ee=q==null?void 0:q.raw)==null?void 0:ee.wm_address)||"").toLowerCase();return!!(G&&ie&&G===ie)};if(!Y){if(v.some(q=>{var te,fe;return q.id!==U.id&&q.status==="Active"&&((te=q.raw)==null?void 0:te.source_market)===((fe=U.raw)==null?void 0:fe.source_market)&&re(q,U)})){fn.error("You already have an active bot on this wallet. Please add an account.");return}g(U);return}C(U,Y)},T=()=>g(null),I=()=>{x&&(C(x,!1),g(null))},L=U=>{var te,fe,G;if(!U)return;const Y=U.coin;if(!Y)return;const re=((te=U.raw)==null?void 0:te.source_market)||U.market||e,Q=U.status==="Active",q={sourceMarket:re,coin:Y,botParams:((fe=U.raw)==null?void 0:fe.bot_params)||{},walletId:(G=U.raw)==null?void 0:G.wallet_id,isActive:Q};if(typeof window<"u"){try{window.localStorage.setItem("gridbot:pending_selection",JSON.stringify(q))}catch{}window.dispatchEvent(new CustomEvent("gridbotSelectFromTasks",{detail:q}))}y(re==="hyper"?`/terminal/hyperliquid/${B7(Y)}#gridbot`:re==="lighter"?`/terminal/lighter/${B7(Y)}#gridbot`:`/terminal/extended/${B7(Y)}#gridbot`)},F=h.useMemo(()=>[{key:"status",label:"Status",sortable:!0,sortValue:U=>U.status==="Active"?1:0,render:U=>{const Y=U==="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 ${Y}`,children:U})}},{key:"coin",label:"Coin",sortable:!0,sortValue:U=>U.coin||"",render:(U,Y)=>{var te;const re=yo(),Q=String(((te=Y.raw)==null?void 0:te.source_market)||Y.market||e||"").toLowerCase();Q.includes("lighter")||Q.includes("extended");const q=()=>re(`/terminal/${Q}/${B7(Y.coin)}${Y.status==="Active"||Y.status==="Stopped"?"#gridbot":""}`);return i.jsxs("div",{onPointerDown:q,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/${B7(U)}.svg`,onError:Zi,className:"w-4 h-4",alt:U}),i.jsx("span",{children:U.replace("XYZ:","")||"--"})]})}},{key:"wallet",label:"Wallet",sortable:!0,sortValue:U=>U.walletName||U.walletAddress||"",render:(U,Y)=>{const re=Y.walletName||"Wallet",Q=Y.walletAddress?o1n(Y.walletAddress):"--";return i.jsxs("div",{className:"flex flex-col leading-[14px]",children:[i.jsx("span",{className:"text-white font-medium",children:re}),i.jsx("span",{className:"text-[10px] text-white/60",children:Q})]})}},{key:"gridCount",label:"Grids",sortable:!0},{key:"lower",label:"Lower",sortable:!0,render:U=>U==null?"--":i.jsx("span",{className:"text-[#67FFBD] font-semibold",children:Eje(U)})},{key:"upper",label:"Upper",sortable:!0,render:U=>U==null?"--":i.jsx("span",{className:"text-[#FF797C] font-semibold",children:Eje(U)})},{key:"investment",label:"Investment",sortable:!0,sortValue:U=>U.totalInvestment??U.collateral??0,render:(U,Y)=>i.jsx("div",{className:"flex flex-col leading-[14px]",children:i.jsx("span",{className:"text-white font-semibold",children:Y.collateral!=null?i1n(Y.collateral):"--"})})},{key:"leverage",label:"Lev",sortable:!0,render:U=>U==null?"--":`${U}x`},{key:"gridType",label:"Grid Type",sortable:!0},{key:"actions",label:"Actions",render:(U,Y)=>{const re=Y.status==="Active",Q=c===Y.id;return i.jsxs("div",{className:"relative z-10 flex items-center justify-start gap-2",onClick:q=>q.stopPropagation(),onMouseDown:q=>q.stopPropagation(),children:[i.jsx("button",{type:"button",onPointerDown:q=>{q.preventDefault(),q.stopPropagation(),L(Y)},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:Q,onPointerDown:q=>{q.preventDefault(),q.stopPropagation(),S(Y)},className:`h-6 flex justify-center items-center px-3 rounded-md text-[11px] font-semibold ${re?"bg-[#2a1616] text-[#ff797c] hover:bg-[#3a1c1c]":"bg-[#101613] text-[#67ffbd] hover:bg-[#19201b]"} disabled:opacity-60 disabled:cursor-not-allowed`,children:Q?"Saving...":re?"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:U=>U.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No bots for this market"})}),i.jsx(yp,{isOpen:!!x,onClose:T,children:i.jsxs("div",{className:"w-[320px] sm:w-[380px] rounded-2xl bg-[#050505] px-6 py-5 text-[#E5E7EB]",onClick:U=>U.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(((O=x==null?void 0:x.raw)==null?void 0:O.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:T,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:I,className:"h-9 rounded-xl bg-[#67FFBD] px-4 text-[12px] font-semibold text-black transition hover:brightness-105",children:"Start Bot"})]})]})})]})}function l1n(){const[t,e]=h.useState(()=>typeof window>"u"?!1:localStorage.getItem("hide_small_balances")==="1");return h.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 c1n(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}=h.useContext(Qr),[y,v]=h.useState(()=>typeof window>"u"?d||null:window.localStorage.getItem("hl_selected_wallet_address")||d||null);h.useEffect(()=>{const pe=()=>{if(typeof window>"u"){v(d||null);return}const Se=window.localStorage.getItem("hl_selected_wallet_address");v(Se||d||null)};return pe(),window.addEventListener("hl_selected_wallet_changed",pe),window.addEventListener("storage",pe),()=>{window.removeEventListener("hl_selected_wallet_changed",pe),window.removeEventListener("storage",pe)}},[d]);const C=y||d||null,[S,T]=h.useState(()=>C);h.useEffect(()=>{C&&T(C)},[C]);const I=C||S||null,[L,F]=h.useState({address:null,token:null}),[$,O]=h.useState(!1);h.useEffect(()=>{const pe=()=>{const Se=typeof window<"u"?localStorage.getItem("hyperAddress"):null,ge=typeof window<"u"?localStorage.getItem("hyperToken"):null;F({address:Se,token:ge}),O(!0)};return pe(),window.addEventListener("localStorageUpdated",pe),window.addEventListener("storage",pe),()=>{window.removeEventListener("localStorageUpdated",pe),window.removeEventListener("storage",pe)}},[]);const U=!!(L.address&&L.token),Y=pe=>pe==="balances"?"Connect your wallet to see your balances":pe==="positions"?"Connect your wallet to see your positions":pe==="open"?"Connect your wallet to see your open orders":pe==="twap"?"Connect your wallet to see your TWAP orders":pe==="trades"?"Connect your wallet to see your trade history":pe==="funding"?"Connect your wallet to see your funding history":pe==="orders"?"Connect your wallet to see your order history":"Connect your wallet to continue",re=(pe,Se)=>$?U?pe: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:Y(Se)}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>g(!0)})})]}):pe,q=`terminalTabs:${typeof window<"u"?window.location.pathname:"tt"}`,[te,fe]=h.useState(()=>typeof window>"u"?"balances":localStorage.getItem(q)||"balances"),G=_qe(I),ie=Lmn(I),oe=[{k:"balances",t:"Balances"},{k:"positions",t:`Positions${U&&Number.isFinite(G)?` (${G})`:""}`},{k:"open",t:`Open Orders${U&&Number.isFinite(ie)?` (${ie})`:""}`},{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"}];h.useEffect(()=>{oe.map(Se=>Se.k).includes(te)||fe("balances")},[oe,te]),h.useEffect(()=>{typeof window<"u"&&localStorage.setItem(q,te)},[te,q]),h.useEffect(()=>{const pe=Se=>{var be;const ge=(be=Se==null?void 0:Se.detail)==null?void 0:be.tab,ve=oe.map(we=>we.k);ge&&ve.includes(ge)&&fe(ge)};return window.addEventListener("terminal:setTab",pe),()=>window.removeEventListener("terminal:setTab",pe)},[oe]);const K=pe=>{fe(pe)},H=(I||"no-wallet").toLowerCase();let ee;te==="balances"?ee=i.jsx(sgn,{walletAddress:I}):te==="positions"?ee=i.jsx(fgn,{walletAddress:I,coin:f}):te==="open"?ee=i.jsx(Ngn,{walletAddress:I}):te==="twap"?ee=i.jsx(Ign,{walletAddress:I}):te==="trades"?ee=i.jsx(Vgn,{walletAddress:I}):te==="funding"?ee=i.jsx(Xgn,{walletAddress:I}):te==="orders"?ee=i.jsx(e1n,{walletAddress:I}):te==="bots"?ee=i.jsx($M,{walletAddress:I,sourceMarket:x}):te==="all"?ee=i.jsx($xn,{data:e,loading:n,error:r,isDigits:s,period:a,periods:o,handlePeriodChange:l}):ee=i.jsx("div",{className:"h-full"});const se=te==="all"?ee:re(ee,te);return i.jsx(Lxn,{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:[oe.map(pe=>{const Se=te===pe.k;return i.jsxs("button",{onClick:()=>K(pe.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 ${Se?"text-white":"text-[#929292] hover:text-white"}`,children:[Se&&i.jsx("span",{className:"absolute inset-0 rounded-lg bg-[#262626]"}),i.jsx("span",{className:"relative z-10",children:pe.t})]},pe.k)}),i.jsx("div",{className:"absolute right-3 top-2 hidden md:flex items-center gap-3",children:te==="balances"?i.jsx(l1n,{}):i.jsx(Rxn,{})})]})}),i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx("div",{className:"absolute inset-0",children:se})})]})},H)}function yfe(){const[t,e]=h.useState([]),n=["XAG","XAU","USDKRW","USDJPY","USDCAD","USDCHF","NZDUSD","AUDUSD","GBPUSD","EURUSD","HOOD"];return h.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),S=f>0?C*f:null;return{symbol:d.symbol,last:f,chg24:y,vol:v,funding:null,openInterest:S,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 u1n="https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=extended",d1n="https://dextrabothypesocketv2.nftinit.io/",f1n='J5a5j28NeLpQbf"=h',h1n=6e4,p1n=t=>{if(t==null||t==="")return null;const e=Number(t);return Number.isFinite(e)?e:null},cg=(...t)=>{for(const e of t){const n=p1n(e);if(n!=null)return n}return null},Xqe=t=>String(t||"").trim().toUpperCase(),m1n=t=>Xqe(t).replace(/-USD$/,"").replace(/\/USD$/,"");function x1n(t,e){var S;if(!t||typeof t!="object")return null;const n=Xqe(t.value||t.symbol||t.market||t.coin||t.label),r=m1n(t.label||t.assetName||t.uiName||n);if(!n&&!r)return null;const s=t.marketStats||{},a=cg(s.lastPrice,s.markPrice,s.indexPrice,t.lastPrice,t.markPrice,t.last),o=cg(s.markPrice,t.markPrice,s.lastPrice,t.lastPrice,a),l=cg(t.volume,s.dailyVolume,t.vol),c=cg(s.fundingRate,t.fundingRate,t.funding),u=cg(s.openInterestBase,t.openInterestBase),d=cg(s.openInterest,t.openInterestUsd,t.openInterest),f=cg((S=t==null?void 0:t.tradingConfig)==null?void 0:S.maxLeverage,t.maxLeverage,t.leverage,t.max_leverage);let x=null;const g=cg(s.dailyPriceChange,t.dailyPriceChange);if(g!=null&&a!=null){const T=a-g;T&&(x=g/T*100)}if(x==null){const T=cg(s.dailyPriceChangePercentage,t.dailyPriceChangePercentage,t.change24hPct,t.chg24);T!=null&&(x=Math.abs(T)<=1?T*100:T)}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 nf={rows:[],subs:new Set,started:!1,socket:null,timer:null};function g1n(){for(const t of nf.subs)try{t(nf.rows)}catch{}}function Qqe(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 Zqe(t){const e=t.map((n,r)=>x1n(n,r)).filter(n=>n&&n.symbol);return e.length?(nf.rows=e,g1n(),!0):!1}function kje(t){const e=Qqe(t);return e.length?Zqe(e):!1}async function Tje(){try{const e=await(await fetch(u1n)).json(),n=Qqe(e);if(!n.length)return;Zqe(n)}catch{}}function b1n(){if(!nf.started){nf.started=!0,Tje(),nf.timer=setInterval(()=>{nf.socket&&nf.socket.connected||Tje()},h1n);try{const t=K0(d1n);nf.socket=t;const e=()=>{try{t.emit("extended_feed_subscribe",{password:f1n},r=>kje(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(kje(a))return}})}catch{}}}function vfe(){const[t,e]=h.useState(nf.rows);return h.useEffect(()=>{b1n();const n=r=>e(r);return nf.subs.add(n),nf.rows.length&&e(nf.rows),()=>{nf.subs.delete(n)}},[]),t}const y1n=["arithmetic","geometric"];function v1n(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 Pje({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 Ije({coin:t,midPrice:e,selectedPrice:n,wallet:r,onLevelsChange:s}){const a=yfe(),[o]=h.useState("short"),[l,c]=h.useState(""),[u,d]=h.useState(""),[f,x]=h.useState(2),[g,y]=h.useState("2"),[v,C]=h.useState(""),[S,T]=h.useState("arithmetic"),[I,L]=h.useState(""),[F,$]=h.useState(0),[O,U]=h.useState(10),[Y,re]=h.useState(!1),[Q,q]=h.useState(!1),[te,fe]=h.useState(!1),[G,ie]=h.useState(50),[oe,K]=h.useState([]),[H,ee]=h.useState(!1),[se,pe]=h.useState(0),[Se,ge]=h.useState(!1),[ve,be]=h.useState(!1),[we,je]=h.useState(0),[Fe,Re]=h.useState(!1),[Qe,Ye]=h.useState(0),[dt,st]=h.useState(!1),[at,He]=h.useState(!0),[qe,vt]=h.useState(!1),[yt,Kt]=h.useState(()=>r&&r.id&&r.address?{id:r.id,address:r.address}:{id:null,address:null}),jt=h.useRef(!1),{refreshBotSlots:un,botSlotsInfo:vn}=h.useContext(Qr),Hn=h.useCallback(async()=>{try{const k=window.localStorage.getItem("hyperToken"),P=window.localStorage.getItem("hyperAddress");if(!k||!P){He(!1),vt(!0);return}const D=await bi(P.toLowerCase(),k);He(!!(D!=null&&D.farming_tools))}catch{He(!1)}finally{vt(!0)}},[]);h.useEffect(()=>{un==null||un(),Hn()},[un,Hn]);const ln=h.useMemo(()=>{const k=Array.isArray(vn)?vn:[],P=k.find(D=>String((D==null?void 0:D.bot_type)||"").toLowerCase()==="grid_bot"&&String((D==null?void 0:D.source_market)||"").toLowerCase()==="lighter");return P||k.find(D=>String((D==null?void 0:D.bot_type)||"").toLowerCase()==="grid_bot")},[vn]),Nn=Number((ln==null?void 0:ln.total_slot_count)||0),dn=Number((ln==null?void 0:ln.using_extra_slot_count)||0)+Number((ln==null?void 0:ln.using_subs_slot_count)||0),rt=Nn+dn,nt=ln?Nn<=0:!1,Ut=nt;h.useEffect(()=>{r&&r.id&&r.address&&Kt(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 wn=h.useMemo(()=>a.find(k=>k.symbol===t),[a,t]),Jt=wn&&wn.raw&&wn.raw.last_trade_price!=null&&Number(wn.raw.last_trade_price)||0;h.useEffect(()=>{let k=!1;async function P(){try{const V=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=lighter_fr")).json().catch(()=>null);if(!V||k)return;const Z=Array.isArray(V)&&V||Array.isArray(V.data)&&V.data||Array.isArray(V.coins)&&V.coins||[],ce=String(t||"").toUpperCase(),ue=Z.find(Ne=>String(Ne.value||Ne.label||Ne.symbol||Ne.coin||"").toUpperCase()===ce),me=ue&&ue.maxLeverage!=null?Number(ue.maxLeverage):null;!k&&me!=null&&Number.isFinite(me)&&me>0&&(ie(me),U(Ne=>{const Ie=Number(Ne)||1;return Math.min(me,Math.max(1,Ie))}))}catch{if(k)return}}return t&&P(),()=>{k=!0}},[t]),h.useEffect(()=>{let k=!1;async function P(){if(typeof window>"u")return;const D=window.localStorage.getItem("hyperAddress"),V=window.localStorage.getItem("hyperToken");if(!D||!V){k||K([]);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:D,token:V})})).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 me=await Promise.all(ue.map(async Ne=>{let Ie=null;if(Ne.available_balance!=null){const Le=Number(Ne.available_balance);Number.isFinite(Le)&&(Ie=Le)}else if(Ne.balance!=null){const Le=Number(Ne.balance);Number.isFinite(Le)&&(Ie=Le)}try{if(Ne.wallet_address){const Xe=await(await fetch(`https://mainnet.zklighter.elliot.ai/api/v1/account?by=l1_address&value=${encodeURIComponent(Pc(Ne.wallet_address))}`)).json().catch(()=>null),Oe=Xe&&Array.isArray(Xe.accounts)&&Xe.accounts.length>0&&Xe.accounts[0];if(Oe&&Oe.available_balance!=null){const $e=Number(Oe.available_balance);Number.isFinite($e)&&(Ie=$e)}}}catch{}return{wallet_id:Ne.wallet_id,wallet_address:Ne.wallet_address,wallet_name:Ne.wallet_name||`Wallet ${Ne.wallet_id}`,available_balance:Ie}}));if(k)return;K(me),Kt(Ne=>{if(Ne&&Ne.id)return Ne;const Ie=me[0];return Ie?{id:Ie.wallet_id,address:Ie.wallet_address}:Ne})}catch{k||K([])}finally{k||ee(!1)}}return P(),()=>{k=!0}},[]);const Vt=h.useMemo(()=>{if(!yt||!yt.id)return null;const k=oe.find(D=>String(D.wallet_id)===String(yt.id));if(!k||k.available_balance==null)return null;const P=Number(k.available_balance);return Number.isFinite(P)?P:null},[oe,yt]),xt=(k,P,D)=>{const V=typeof D=="boolean"?D:!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 Z=Number(k.gridCount);x(Z),y(String(Z))}if((k.gridType==="geometric"||k.gridType==="arithmetic")&&T(k.gridType),k.investment&&k.investment.leverage!=null&&Number.isFinite(Number(k.investment.leverage))){const Z=Number(k.investment.leverage);U(Z)}if(k.investment&&k.investment.collateral!=null&&Number.isFinite(Number(k.investment.collateral))){const Z=Number(k.investment.collateral);if(L(String(Z)),P&&P>0&&Z>0){const ce=Z/P*100;$(Math.max(0,Math.min(100,ce)))}else $(0)}else L(""),$(0);re(V)};h.useEffect(()=>{if(typeof window>"u")return;if(!t||!(yt!=null&&yt.id)||!(yt!=null&&yt.address)){re(!1);return}let k=!1;function P(){c(""),d(""),x(2),y("2"),T("arithmetic"),L(""),$(0),U(10),C("")}async function D(){q(!0);try{const V=window.localStorage.getItem("hyperToken");if(!V){k||(re(!1),P(),q(!1));return}const Z={address:localStorage.getItem("hyperAddress"),token:V,wallet_id:Number(yt.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(Z)})).json().catch(()=>null);if(k)return;if(jt.current){jt.current=!1,q(!1);return}const me=ue&&ue.data?ue.data:ue;me&&typeof me=="object"&&me.is_deleted===!1&&me.bot_params&&me.bot_params?xt(me.bot_params,Vt,!0):(re(!1),P())}catch{if(k)return;re(!1),c(""),d(""),x(2),y("2"),T("arithmetic"),L(""),$(0),U(10),C("")}finally{k||q(!1)}}return D(),()=>{k=!0}},[t,yt==null?void 0:yt.id,yt==null?void 0:yt.address,we]);const We=h.useMemo(()=>v1n(l,u,f,S),[l,u,f,S]),Pt=h.useMemo(()=>{if(!We.length)return[];const k=Number(l),P=Number(u),D=Number.isFinite(k)&&Number.isFinite(P)?(k+P)/2:null;return We.map(V=>({price:V,side:D==null?null:V>=D?"sell":"buy"}))},[We,l,u]);h.useEffect(()=>{typeof s=="function"&&s(Pt)},[Pt,s]);const Ke=k=>{const P=Number(k);if(!(P>0))return;const V=P*.01;c((P-V).toFixed(2)),d((P+V).toFixed(2))};h.useEffect(()=>{const k=P=>{const D=P&&P.detail&&P.detail.sourceMarket;D&&D!=="lighter"||je(V=>V+1)};return window.addEventListener("gridbotUpdated",k),()=>{window.removeEventListener("gridbotUpdated",k)}},[]),h.useEffect(()=>{const k=P=>{const D=P&&P.detail;if(!D)return;const V=D.sourceMarket||D.source_market;if(V&&V!=="lighter"||String(D.coin||"").toUpperCase()!==String(t||"").toUpperCase())return;const ce=D.botParams||{};if(jt.current=!0,xt(ce,Vt,D.isActive),D.isActive===!0?re(!0):D.isActive===!1&&re(!1),D.walletId&&oe&&oe.length){const ue=oe.find(me=>String(me.wallet_id)===String(D.walletId));ue&&Kt({id:ue.wallet_id,address:ue.wallet_address})}};return window.addEventListener("gridbotSelectFromTasks",k),()=>{window.removeEventListener("gridbotSelectFromTasks",k)}},[t,oe]),h.useEffect(()=>{if(typeof window>"u")return;const k=window.localStorage.getItem("gridbot:pending_selection");if(!k)return;let P=null;try{P=JSON.parse(k)}catch{P=null}if(!(!P||P.sourceMarket&&P.sourceMarket!=="lighter"||String(P.coin||"").toUpperCase()!==String(t||"").toUpperCase())){if(jt.current=!0,xt(P.botParams||{},Vt,P.isActive),P.isActive===!0?re(!0):P.isActive===!1&&re(!1),P.walletId&&oe&&oe.length){const D=oe.find(V=>String(V.wallet_id)===String(P.walletId));D&&Kt({id:D.wallet_id,address:D.wallet_address})}try{window.localStorage.removeItem("gridbot:pending_selection")}catch{}}},[t,oe,Vt]),h.useEffect(()=>{if(l||u)return;const k=Jt>0?Jt:Number(e||n||0);!Number.isFinite(k)||k<=0||Ke(k)},[Jt,e,n,l,u]);const ct=h.useMemo(()=>{if(Jt>0)return Jt;const k=Number(e||0);if(k>0)return k;const P=Number(n||0);if(P>0)return P;const D=Number(l),V=Number(u);return Number.isFinite(D)&&Number.isFinite(V)&&V>D?(D+V)/2:0},[Jt,e,n,l,u]),Nt=ct,Ht=h.useMemo(()=>{const k=Math.max(1,Number(O)||1);return Math.min(G,k)},[O,G]),Rt=Number(I)||0,hn=Rt*Ht,yn=We.length,Cn=ct>0?ct:Jt,En=Cn>0&&yn>0&&hn>0?Number((hn/yn/Cn).toFixed(5)):0,Rn=Number.isFinite(wn==null?void 0:wn.sizeDecimals)?wn.sizeDecimals:4,Mn=Number.isFinite(wn==null?void 0:wn.priceDecimals)?wn.priceDecimals:4,Yn=Mn,Zn=(wn==null?void 0:wn.minBaseAmount)??0,Vn=(wn==null?void 0:wn.minQuoteAmount)??0,tr=En>0?Number(En.toFixed(Rn)):0,Sn=tr>0&&Zn>0&&tr<Zn,ze=tr>0&&Vn>0&&We.length>0&&We.some(k=>k*tr<Vn),xe=ct>0&&hn>0&&Rt>0?Pje({entry:ct,side:"buy",notionalUSD:hn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Rt,isolatedMarginUSD:Rt}):null,Ge=ct>0&&hn>0&&Rt>0?Pje({entry:ct,side:"sell",notionalUSD:hn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Rt,isolatedMarginUSD:Rt}):null,_e=h.useMemo(()=>{if(!l&&!u)return"";const k=Number(l),P=Number(u);if(!Number.isFinite(k)||!Number.isFinite(P))return"";if(!(P>k))return"Upper price must be greater than lower price.";if(Nt>0){if(k>Nt)return`Lower price cannot be above mark price (${Nt.toFixed(Mn)}).`;if(P<Nt)return`Upper price cannot be below mark price (${Nt.toFixed(Mn)}).`}return""},[l,u,Nt,Mn]),Be=h.useMemo(()=>{const k=Number(l),P=Number(u);return!(!Number.isFinite(k)||!Number.isFinite(P)||!(P>k)||Nt>0&&(k>Nt||P<Nt))},[l,u,Nt]),qt=yn>1&&Be&&Rt>0&&Ht>0&&(yt==null?void 0:yt.id)&&(yt==null?void 0:yt.address),It=se>0,mt=!!v,Ft=Sn||ze,Tn=qe&&!at,kn=qt&&!Q&&!te&&!H&&!It&&!mt&&!Ft&&!nt&&!Tn,Gt=te||Q||H||mt?!1:Y||Tn?!0:Ft||It||nt?!1:qt,mn=te||Q||H?!0:Y||Tn?!1:Ft||It||nt||mt?!0:!qt,gt=Y||te||Q,Wt=G&&G>0;h.useEffect(()=>{if(!se)return;const k=setInterval(()=>{pe(P=>P>1?P-1:0)},1e3);return()=>clearInterval(k)},[se]);const jn=()=>{if(gt)return;const k=Jt>0?Jt:ct>0?ct:Number(e||n||0);!Number.isFinite(k)||k<=0||Ke(k)},kt=k=>{if(gt)return;const P=Math.max(0,Math.min(100,Number(k)||0));if($(P),!Vt||Vt<=0){P===0&&L("");return}const D=Vt*P/100;L(D&&Number.isFinite(D)?String(D.toFixed(2)):"")},cn=k=>{if(gt)return;L(k);const P=Number(k);if(!Vt||!Number.isFinite(P)||P<=0||Vt<=0){$(0);return}const D=P/Vt*100;$(Math.max(0,Math.min(100,D)))},Ce=async()=>{if(!kn||typeof window>"u"||!(yt!=null&&yt.address)||!(yt!=null&&yt.id))return;const k=We.filter(Ie=>Number.isFinite(Ie));if(k.length<2)return;const P=k[0],D=k[k.length-1],V=(P+D)/2,Z=k.length,ce=window.localStorage.getItem("hyperToken");if(!ce)return;const ue=tr,me={symbol:String(t||"").toUpperCase(),gridType:S==="geometric"?"geometric":"arithmetic",direction:o,priceRange:{lower:Number(P.toFixed(Yn)),upper:Number(D.toFixed(Yn)),middle:Number(V.toFixed(Yn))},gridCount:Z,gridPrices:k.map(Ie=>Number(Ie.toFixed(Yn))),investment:{collateral:Rt,leverage:Ht,totalInvestment:hn,qtyPerOrder:ue},liquidationPrices:{long:xe?Number(xe.toFixed(2)):null,short:Ge?Number(Ge.toFixed(2)):null},marginMode:"Cross",currentPrice:ct||null,timestamp:new Date().toISOString()},Ne={address:localStorage.getItem("hyperAddress"),token:ce,wallet_id:Number(yt.id),source_market:"lighter",bot_params:me,coin:String(t||"").toUpperCase()};fe(!0);try{const Le=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/save/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ne)})).json().catch(()=>null);if(!(Le&&(Le.success===!0||Le.status==="ok"||Le.status==="success"))){const Oe=Le&&(Le.error_message||Le.message||Le.detail)||"Grid bot failed to start.";fn.error(Oe);return}re(!0),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"lighter"}})),un==null||un(),fn.success("Grid bot started.")}catch{fn.error("An error occurred while starting the grid bot.")}finally{fe(!1)}},m=async()=>{if(typeof window>"u"||!(yt!=null&&yt.address)||!(yt!=null&&yt.id))return;const k=window.localStorage.getItem("hyperToken");if(!k)return;const P={address:localStorage.getItem("hyperAddress"),token:k,wallet_id:Number(yt.id),source_market:"lighter",coin:String(t||"").toUpperCase()};fe(!0);try{const V=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/stop/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})).json().catch(()=>null);if(!(V&&(V.success===!0||V.status==="ok"||V.status==="success"))){const ce=V&&(V.error_message||V.message||V.detail)||"Grid bot could not be stopped.";fn.error(ce);return}re(!1),pe(10),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"lighter"}})),un==null||un(),fn.success("Grid bot has been stopped.")}catch{fn.error("An error occurred while stopping the grid bot.")}finally{fe(!1)}},p=()=>{if(Tn){st(!0);return}Gt&&(Y?m():be(!0))},N=async()=>{kn&&(be(!1),await Ce())},A=Tn?"Subscribe / 0.12 ETH":te?Y?"Stopping...":"Starting...":Y?"Stop":It?`Stopping ${se}s`:"Start";return i.jsxs(i.Fragment,{children:[dt&&i.jsx(tWe,{open:dt,setOpen:st,checkAccountCopy:Hn,roleType:"farming"}),Fe&&i.jsx(D5,{open:Fe,setOpen:Re,oldSlotCount:Qe,checkAccountLighter:un,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(pP,{wallets:oe,value:yt&&yt.id?String(yt.id):"",onChange:k=>{const P=oe.find(D=>String(D.wallet_id)===String(k));P&&Kt({id:P.wallet_id,address:P.wallet_address})},selectedBalance:Vt,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(E5,{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:rt?`${dn}/${rt}`:ln?"0/0":"--"})})]}),i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("div",{className:"text-[11px] text-[#7C7C7C]",children:nt?"No slots left. Get more to start new grid bots.":""}),Ut&&i.jsx("button",{type:"button",onClick:()=>{Ye(Nn),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:jn,disabled:gt,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=>{gt||c(k.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:gt})})]}),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=>{gt||d(k.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:gt})})]})]}),Nt>0&&i.jsxs("div",{className:"text-[11px] text:white/40 text-white/40",children:["Mark Price: ",Nt.toFixed(Mn)]}),_e&&i.jsx("div",{className:"text-[11px] text-[#FF7173]",children:_e})]}),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(gt)return;const P=k.target.value.replace(/[^\d]/g,"");if(y(P),C(""),P==="")return;const D=Number(P);if(Number.isFinite(D)){if(D<2){C("The minimum number of grids must be 2.");return}if(D>36){C("The maximum number of grids can be 36.");return}if(D%2!==0){C("The number of grids must be even.");return}x(D)}},className:"bg-transparent outline-none flex-1 text-[13px]",inputMode:"numeric",disabled:gt})}),i.jsx("div",{className:"relative",children:i.jsx("select",{value:S,onChange:k=>{gt||T(k.target.value)},className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 text-[12px] outline-none",disabled:gt,children:y1n.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:"," ",We.length>1?(We[1]-We[0]).toFixed(Yn):"--"]})]}),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:I,onChange:k=>cn(k.target.value),className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"USDC",inputMode:"decimal",disabled:gt}),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(K4,{onClick:Wt&&!gt?()=>ge(!0):void 0,children:Wt?`${Ht}x`:"--"})})]}),i.jsxs("div",{className:"flex items-center gap-3 mt-3 pb-6",children:[i.jsx(Aj,{value:F,onChange:k=>kt(k),accent:"#67FFBD"}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:F,onChange:k=>kt(Math.max(0,Math.min(100,Number(k.target.value)||0))),style:{color:$i,fontFeatureSettings:'"tnum"'},disabled:gt}),i.jsx("span",{style:{color:Si},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,": ",`${G}x`]}),i.jsxs("span",{children:["Total:"," ",hn>0?`${hn.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:"," ",tr>0?`${tr} ${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:xe?`$${xe.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:Ge?`$${Ge.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),i.jsx("button",{type:"button",onClick:p,disabled:mn,className:`w-full h-[32px] rounded-xl font-bold text-[13px] flex items-center justify-center transition-opacity ${mn?"bg-[#303030] text-white/40 cursor-not-allowed opacity-70":Tn?"bg-[#7446FF] text-white hover:bg-[#5834C3]":Y?"bg-[#FF7173] text:black text-black hover:opacity-90":"bg-[#67FFBD] text-black hover:opacity-90"}`,children:A}),Sn&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Quantity per order is below min size (",Zn," ",t,")."]}),ze&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Your order size is below minimum order size of $",Vn.toFixed(2),"."]})]})]})]}),i.jsx(lp,{open:Se,onClose:()=>ge(!1),children:i.jsxs(ym,{title:"Adjust Leverage",children:[i.jsxs("div",{className:"text-[12px] leading-5 mb-3",style:{color:Si},children:["Control the leverage used for ",t," grid bot positions. The maximum leverage is ",G,"x."]}),i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("input",{type:"range",min:1,max:G||1,step:1,value:O,onChange:k=>U(Math.max(1,Math.min(G||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:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-white",inputMode:"numeric",value:O,onChange:k=>{const P=Number(k.target.value)||1,D=Math.max(1,Math.min(G||1,P));U(D)}}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"x"})]})]}),i.jsx(H0,{onClick:()=>ge(!1),children:"Confirm"})]})}),i.jsx(lp,{open:ve,onClose:()=>be(!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 ",Ht,"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:Si},children:"Price Range"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:Number.isFinite(Number(l))&&Number.isFinite(Number(u))?`${Number(l).toFixed(Yn)} - ${Number(u).toFixed(Yn)} USDC`:"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Number of Grids"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:yn||"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Mode"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:S==="geometric"?"Geometric":"Arithmetic"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Qty Per Order"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:tr>0?`${tr} ${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:$i},children:"Total Investment"}),i.jsx("span",{className:"font-semibold text-[#67FFBD]",children:hn>0?`${hn.toFixed(2)} USDC`:"--"})]})}),i.jsx("div",{className:"mt-4",children:i.jsx(H0,{onClick:N,disabled:te,children:te?"Starting...":"Confirm"})})]})})]})}const w1n=["arithmetic","geometric"],C1n=6,Jqe="https://api.hyperliquid.xyz/info",N1n=10,S1n=10*60*1e3;let Mb={data:null,ts:0,promise:null};async function j1n(){const t=Date.now();if(Mb.data&&t-Mb.ts<S1n)return Mb.data;if(Mb.promise)return Mb.promise;const e=fetch(Jqe,{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 Mb={data:r,ts:Date.now(),promise:null},r}).catch(n=>{throw Mb.promise=null,n});return Mb.promise=e,e}function A1n(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 Fje({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 oZ(t){const e=String(t||""),n=e.indexOf(":");return n>0?e.slice(0,n).toLowerCase():"hl"}function _1n(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 E1n(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 Oje({coin:t,midPrice:e,selectedPrice:n,wallet:r,onWalletChange:s,onLevelsChange:a}){const o=hP(),[l]=h.useState("short"),[c,u]=h.useState(""),[d,f]=h.useState(""),[x,g]=h.useState(2),[y,v]=h.useState("2"),[C,S]=h.useState(""),[T,I]=h.useState("arithmetic"),[L,F]=h.useState(""),[$,O]=h.useState(0),[U,Y]=h.useState(10),[re,Q]=h.useState(!1),[q,te]=h.useState(!1),[fe,G]=h.useState(!1),[ie,oe]=h.useState(50),[K,H]=h.useState(0),[ee,se]=h.useState(!1),[pe,Se]=h.useState(!1),[ge,ve]=h.useState(()=>r&&r.id&&r.address?{id:r.id,address:r.address}:{id:null,address:null}),[be,we]=h.useState({address:null,token:null}),[je,Fe]=h.useState(null),[Re,Qe]=h.useState(null),[Ye,dt]=h.useState(""),[st,at]=h.useState(""),[He,qe]=h.useState(""),[vt,yt]=h.useState(""),[Kt,jt]=h.useState(!1),[un,vn]=h.useState(!1),[Hn,ln]=h.useState(!1),[Nn,dn]=h.useState(!1),[rt,nt]=h.useState(0),Ut=()=>{u(""),f(""),g(2),v("2"),I("arithmetic"),F(""),O(0),Y(10),S(""),dt(""),at(""),qe(""),yt(""),jt(!1),vn(!1),ln(!1),dn(!1)},{address:wn,isConnected:Jt}=ds();Jt&&(typeof window<"u"&&window.localStorage.getItem("hyperToken"));const{wallets:Vt,loading:xt}=Mqe(be.address,be.token,!0,{pollMs:5e3}),We=h.useRef(!1),Pt=xt&&(!Vt||Vt.length===0);h.useEffect(()=>{r&&r.id&&r.address&&ve(it=>it.id===r.id&&it.address&&it.address.toLowerCase()===r.address.toLowerCase()?it:{id:r.id,address:r.address})},[r==null?void 0:r.id,r==null?void 0:r.address]),h.useEffect(()=>{const it=()=>{const wt=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,Dt=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;we({address:wt,token:Dt})};return it(),window.addEventListener("localStorageUpdated",it),window.addEventListener("storage",it),()=>{window.removeEventListener("localStorageUpdated",it),window.removeEventListener("storage",it)}},[]),h.useEffect(()=>{if(ge.id||!Vt||!Vt.length)return;const it=Vt.find(Dt=>Dt.confirmed)||Vt[0];if(!it)return;const wt={id:it.wallet_id,address:it.wallet_address};ve(wt),typeof s=="function"&&s({id:String(wt.id),address:wt.address})},[Vt,ge.id,s]),h.useEffect(()=>{t&&(Ut(),Q(!1))},[t]);const Ke=h.useMemo(()=>o.find(it=>it.symbol===t),[o,t]),ct=Ke&&Ke.raw&&Ke.raw.last_trade_price!=null&&Number(Ke.raw.last_trade_price)||0;h.useEffect(()=>{let it=!1;async function wt(){if(t)try{const Qt=await(await fetch(Jqe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"allPerpMetas"})})).json().catch(()=>null);if(!Qt||it)return;let xn=null;for(const An of Qt)if(Array.isArray(An==null?void 0:An.universe)){for(const or of An.universe)if(String(or.name||"").toUpperCase()===String(t||"").toUpperCase()){xn=or;break}}if(!xn||!Number.isFinite(xn.maxLeverage))return;const pn=Number(xn.maxLeverage);oe(pn),Y(An=>Math.min(pn,Math.max(1,An)))}catch{}}return wt(),()=>{it=!0}},[t]),h.useEffect(()=>{let it=!1;async function wt(){try{const Qt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=hyper_fr")).json().catch(()=>null);if(!Qt||it)return;const xn=Array.isArray(Qt)&&Qt||Array.isArray(Qt.data)&&Qt.data||Array.isArray(Qt.coins)&&Qt.coins||[],pn=String(t||"").toUpperCase(),An=xn.find($t=>String($t.value||$t.label||$t.symbol||$t.coin||"").toUpperCase()===pn),or=An&&An.maxLeverage!=null?Number(An.maxLeverage):null;!it&&or!=null&&Number.isFinite(or)&&or>0&&(oe(or),Y($t=>Math.min(or,Math.max(1,Number($t)||1))))}catch{}}return t&&wt(),()=>{it=!0}},[t]);const Nt=(ge==null?void 0:ge.address)||(wn?wn.toLowerCase():null),{perpsOverview:Ht}=H8(Nt),Rt=h.useMemo(()=>{if(!Ht||Ht.balance==null)return null;const it=Number(Ht.balance);return Number.isFinite(it)?it:null},[Ht]),hn=(it,wt)=>{var br,Br,Gr,Or;const Dt=it.priceRange||{},Qt=Array.isArray(it.gridPrices)?it.gridPrices:[];let xn=Dt.lower,pn=Dt.upper;(!Number.isFinite(xn)||!Number.isFinite(pn))&&Qt.length>=2&&(xn=Qt[0],pn=Qt[Qt.length-1]),Number.isFinite(xn)?u(String(xn)):u(""),Number.isFinite(pn)?f(String(pn)):f("");let An=it.gridCount;Number.isFinite(An)||Qt.length>=2&&(An=Qt.length),Number.isFinite(An)?(g(An),v(String(An))):(g(2),v("2"));let or=it.gridType;or!=="geometric"&&or!=="arithmetic"&&(or="arithmetic"),I(or);const $t=it.investment||{};if($t&&$t.leverage!=null&&Number.isFinite(Number($t.leverage))&&Y(Number($t.leverage)),$t&&$t.collateral!=null&&Number.isFinite(Number($t.collateral))){const Lt=Number($t.collateral);if(F(String(Lt)),wt&&wt>0&&Lt>0){const nn=Lt/wt*100;O(Math.max(0,Math.min(100,nn)))}else O(0)}else F(""),O(0);const bt=it.trailing_up??((br=it==null?void 0:it.trailing)==null?void 0:br.up),rn=it.trailing_down??((Br=it==null?void 0:it.trailing)==null?void 0:Br.down),ur=it.sl_up??((Gr=it==null?void 0:it.sl)==null?void 0:Gr.up),gr=it.sl_down??((Or=it==null?void 0:it.sl)==null?void 0:Or.down);dt(bt!=null&&Number.isFinite(Number(bt))?String(bt):""),at(rn!=null&&Number.isFinite(Number(rn))?String(rn):""),qe(ur!=null&&Number.isFinite(Number(ur))?String(ur):""),yt(gr!=null&&Number.isFinite(Number(gr))?String(gr):""),jt(bt!=null&&Number.isFinite(Number(bt))),vn(rn!=null&&Number.isFinite(Number(rn))),ln(ur!=null&&Number.isFinite(Number(ur))),dn(gr!=null&&Number.isFinite(Number(gr)))};h.useEffect(()=>{if(typeof window>"u")return;if(!t||!(ge!=null&&ge.id)||!(ge!=null&&ge.address)){Q(!1),Ut();return}let it=!1;async function wt(){te(!0);try{const Dt=window.localStorage.getItem("hyperToken");if(!Dt){it||(Q(!1),Ut(),te(!1));return}const Qt={address:window.localStorage.getItem("hyperAddress"),token:Dt,wallet_id:Number(ge.id),source_market:"hyper",coin:String(t||"").toUpperCase()},pn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/info/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qt)})).json().catch(()=>null);if(it)return;if(We.current){We.current=!1,te(!1);return}const An=pn&&pn.data?pn.data:pn;An&&typeof An=="object"&&An.is_deleted===!1&&An.bot_params&&An.bot_params?(hn(An.bot_params,Rt),Q(!0)):(Q(!1),Ut(),u(""),f(""))}catch{Q(!1),Ut(),u(""),f("")}finally{it||te(!1)}}return wt(),()=>{it=!0}},[t,ge==null?void 0:ge.id,ge==null?void 0:ge.address,rt]),h.useEffect(()=>{if(typeof window>"u")return;const it=window.localStorage.getItem("gridbot:pending_selection");if(!it)return;let wt=null;try{wt=JSON.parse(it)}catch{wt=null}if(!(!wt||wt.sourceMarket&&wt.sourceMarket!=="hyper"||String(wt.coin||"").toUpperCase()!==String(t||"").toUpperCase())){if(We.current=!0,hn(wt.botParams||{},Rt),wt.isActive===!0?Q(!0):wt.isActive===!1&&Q(!1),wt.walletId&&Vt&&Vt.length){const Dt=Vt.find(Qt=>String(Qt.wallet_id)===String(wt.walletId));if(Dt){const Qt={id:Dt.wallet_id,address:Dt.wallet_address};ve(Qt),typeof s=="function"&&s({id:String(Qt.id),address:Qt.address})}}try{window.localStorage.removeItem("gridbot:pending_selection")}catch{}}},[t,Vt,s,Rt]),h.useEffect(()=>{const it=wt=>{const Dt=wt&&wt.detail&&wt.detail.sourceMarket;Dt&&Dt!=="hyper"||nt(Qt=>Qt+1)};return window.addEventListener("gridbotUpdated",it),()=>{window.removeEventListener("gridbotUpdated",it)}},[]),h.useEffect(()=>{const it=wt=>{const Dt=wt&&wt.detail;if(!Dt)return;const Qt=Dt.sourceMarket||Dt.source_market;if(Qt&&Qt!=="hyper"||String(Dt.coin||"").toUpperCase()!==String(t||"").toUpperCase())return;const pn=Dt.botParams||{};if(hn(pn,Rt),We.current=!0,Dt.isActive===!0?Q(!0):Dt.isActive===!1&&Q(!1),Dt.walletId&&Vt&&Vt.length){const An=Vt.find(or=>String(or.wallet_id)===String(Dt.walletId));if(An){const or={id:An.wallet_id,address:An.wallet_address};ve(or),typeof s=="function"&&s({id:String(or.id),address:or.address})}}};return window.addEventListener("gridbotSelectFromTasks",it),()=>{window.removeEventListener("gridbotSelectFromTasks",it)}},[t,Vt,s]);const yn=h.useMemo(()=>A1n(c,d,x,T),[c,d,x,T]),Cn=h.useMemo(()=>{if(!yn.length)return[];const it=Number(c),wt=Number(d),Dt=Number.isFinite(it)&&Number.isFinite(wt)?(it+wt)/2:null;return yn.map(Qt=>({price:Qt,side:Dt==null?null:Qt>=Dt?"sell":"buy"}))},[yn,c,d]);h.useEffect(()=>{typeof a=="function"&&a(Cn)},[Cn,a]);const En=it=>{const wt=Number(it);if(!(wt>0))return;const Dt=wt*.01;u((wt-Dt).toFixed(2)),f((wt+Dt).toFixed(2))},Rn=h.useMemo(()=>{if(ct>0)return ct;const it=Number(e||0);if(it>0)return it;const wt=Number(n||0);if(wt>0)return wt;const Dt=Number(c),Qt=Number(d);return Number.isFinite(Dt)&&Number.isFinite(Qt)&&Qt>Dt?(Dt+Qt)/2:0},[ct,e,n,c,d]);h.useEffect(()=>{let it=!1;async function wt(){const Dt=_1n(t);if(!Dt){Fe(null),Qe(null);return}try{const Qt=await j1n();let xn=null;e:for(const pn of Qt)if(Array.isArray(pn==null?void 0:pn.universe)){for(const An of pn.universe)if(String((An==null?void 0:An.name)||"").toUpperCase()===Dt){const $t=Number(An.szDecimals);Number.isFinite($t)&&(xn=$t);break e}}if(it)return;xn!=null?Fe(xn):(Fe(null),Qe(null))}catch{Fe(null),Qe(null)}}return t?wt():(Fe(null),Qe(null)),()=>{it=!0}},[t]),h.useEffect(()=>{if(!Number.isFinite(je)){Qe(null);return}const it=E1n(Rn,je);Qe(it)},[Rn,je]);const Mn=Rn,Yn=h.useMemo(()=>Math.min(ie,Math.max(1,Number(U)||1)),[U,ie]),Zn=Number(L)||0,Vn=Zn*Yn,tr=yn.length,Sn=Rn>0?Rn:ct,ze=Sn>0&&tr>0&&Vn>0?Number((Vn/tr/Sn).toFixed(5)):0,xe=Number.isFinite(je)?je:Number.isFinite(Ke==null?void 0:Ke.sizeDecimals)?Ke.sizeDecimals:4,Ge=h.useMemo(()=>{if(Number.isFinite(Re))return Re;const it=Number.isFinite(xe)?Number(xe):4,wt=Math.max(0,C1n-it),Dt=Math.abs(Number(Rn||0));if(!(Dt>0)||!Number.isFinite(Dt))return wt;const Qt=Dt>=1?Math.floor(Math.log10(Dt))+1:0,xn=Math.max(0,5-Qt);return Math.min(wt,xn)},[Re,xe,Rn]),_e=Ge,Be=(Ke==null?void 0:Ke.minBaseAmount)??0,qt=(Ke==null?void 0:Ke.minQuoteAmount)??0,It=ze>0?Number(ze.toFixed(xe)):0,mt=It>0&&Be>0&&It<Be,Ft=It>0&&qt>0&&yn.length>0&&yn.some(it=>it*It<qt),Tn=h.useMemo(()=>{if(It<=0||yn.length===0)return 0;let it=1/0;for(const wt of yn){if(!(wt>0))continue;const Dt=wt*It;Dt<it&&(it=Dt)}return it===1/0?0:it},[It,yn]),kn=It<=0||Tn<N1n,Gt=Rn>0&&Vn>0&&Zn>0?Fje({entry:Rn,side:"buy",notionalUSD:Vn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Zn,isolatedMarginUSD:Zn}):null,mn=Rn>0&&Vn>0&&Zn>0?Fje({entry:Rn,side:"sell",notionalUSD:Vn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Zn,isolatedMarginUSD:Zn}):null,gt=h.useMemo(()=>{if(!c&&!d)return"";const it=Number(c),wt=Number(d);if(!Number.isFinite(it)||!Number.isFinite(wt))return"";if(!(wt>it))return"Upper price must be greater than lower price.";if(Mn>0){if(it>Mn)return`Lower price cannot be above mark price (${Mn.toFixed(Ge)}).`;if(wt<Mn)return`Upper price cannot be below mark price (${Mn.toFixed(Ge)}).`}return""},[c,d,Mn,Ge]),Wt=h.useMemo(()=>{const it=Number(c),wt=Number(d);return!(!Number.isFinite(it)||!Number.isFinite(wt)||!(wt>it)||Mn>0&&(it>Mn||wt<Mn))},[c,d,Mn]),jn=Number(c),kt=Number(d),cn=Number(Ye),Ce=Number(st),m=Number(He),p=Number(vt),N=Kt&&(Ye===""||!Number.isFinite(cn)||!(cn>kt)),A=un&&(st===""||!Number.isFinite(Ce)||!(Ce<jn));h.useEffect(()=>{Kt||dt(""),un||at("")},[Kt,un]),h.useEffect(()=>{Hn||qe(""),Nn||yt("")},[Hn,Nn]);const k=Hn&&(He===""||!Number.isFinite(m)||!Kt&&Number.isFinite(kt)&&!(m>kt)||Kt&&Number.isFinite(cn)&&!(m>cn)),P=Nn&&(vt===""||!Number.isFinite(p)||!un&&Number.isFinite(jn)&&!(p<jn)||un&&Number.isFinite(Ce)&&!(p<Ce)),D=tr>1&&Wt&&Zn>0&&Yn>0&&(ge==null?void 0:ge.id)&&(ge==null?void 0:ge.address),V=K>0,Z=!!C,ce=mt||Ft,ue=N||A||k||P,me=D&&!q&&!fe&&!Pt&&!V&&!Z&&!ce&&!kn&&!ue,Ne=fe||q||Pt||Z||ce||kn||V||ue?!1:re?!0:D,Ie=re||fe||q||Pt;h.useEffect(()=>{if(!K)return;const it=setInterval(()=>H(wt=>wt>1?wt-1:0),1e3);return()=>clearInterval(it)},[K]);const Le=()=>{if(Ie)return;const it=ct>0?ct:Rn>0?Rn:Number(e||n||0);!Number.isFinite(it)||it<=0||En(it)},Xe=it=>{if(Ie)return;const wt=Math.max(0,Math.min(100,Number(it)||0));if(O(wt),!Rt||Rt<=0){wt===0&&F("");return}const Dt=Rt*wt/100;F(Dt&&Number.isFinite(Dt)?String(Dt.toFixed(2)):"")},Oe=it=>{if(Ie)return;F(it);const wt=Number(it);if(!Rt||!Number.isFinite(wt)||wt<=0||Rt<=0){O(0);return}const Dt=wt/Rt*100;O(Math.max(0,Math.min(100,Dt)))},$e=async()=>{if(!me||typeof window>"u"||!(ge!=null&&ge.address)||!(ge!=null&&ge.id))return;const it=yn.filter(rn=>Number.isFinite(rn));if(it.length<2)return;const wt=it[0],Dt=it[it.length-1],Qt=(wt+Dt)/2,xn=it.length,pn=window.localStorage.getItem("hyperToken");if(!pn)return;if(Kt&&N){fn.error("Trailing Up is invalid.");return}if(un&&A){fn.error("Trailing Down is invalid.");return}if(Hn&&k){const rn=Kt?"SL Up must be greater than Trailing Up.":"SL Up must be greater than Upper price.";fn.error(rn);return}if(Nn&&P){const rn=un?"SL Down must be less than Trailing Down.":"SL Down must be less than Lower price.";fn.error(rn);return}const An=It,or=oZ(t),$t={symbol:String(t||"").toUpperCase(),dex:or,gridType:T==="geometric"?"geometric":"arithmetic",direction:l,priceRange:{lower:Number(wt.toFixed(_e)),upper:Number(Dt.toFixed(_e)),middle:Number(Qt.toFixed(_e))},gridCount:xn,gridPrices:it.map(rn=>Number(rn.toFixed(_e))),investment:{collateral:Zn,leverage:Yn,totalInvestment:Vn,qtyPerOrder:An},liquidationPrices:{long:Gt?Number(Gt.toFixed(2)):null,short:mn?Number(mn.toFixed(2)):null},trailing_up:Kt&&!N?Number(cn.toFixed(_e)):null,trailing_down:un&&!A?Number(Ce.toFixed(_e)):null,sl_up:Hn&&!k?Number(m.toFixed(_e)):null,sl_down:Nn&&!P?Number(p.toFixed(_e)):null,marginMode:"Cross",currentPrice:Rn||null,timestamp:new Date().toISOString()},bt={address:window.localStorage.getItem("hyperAddress"),token:pn,wallet_id:Number(ge.id),source_market:"hyper",...or?{dex:or}:{},bot_params:$t,coin:String(t||"").toUpperCase()};G(!0);try{const ur=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/save/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(bt)})).json().catch(()=>null);if(!(ur&&(ur.success===!0||ur.status==="ok"||ur.status==="success"))){const br=ur&&(ur.error_message||ur.message||ur.detail)||"Grid bot failed to start.";fn.error(br);return}Q(!0),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"hyper"}})),fn.success("Grid bot started.")}catch{fn.error("An error occurred while starting the grid bot.")}finally{G(!1)}},ae=async()=>{if(typeof window>"u"||!(ge!=null&&ge.address)||!(ge!=null&&ge.id))return;const it=window.localStorage.getItem("hyperToken");if(!it)return;const wt=oZ(t),Dt={address:window.localStorage.getItem("hyperAddress"),token:it,wallet_id:Number(ge.id),source_market:"hyper",...wt?{dex:wt}:{},coin:String(t||"").toUpperCase()};G(!0);try{const xn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/stop/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Dt)})).json().catch(()=>null);if(!(xn&&(xn.success===!0||xn.status==="ok"||xn.status==="success"))){const An=xn&&(xn.error_message||xn.message||xn.detail)||"Grid bot could not be stopped.";fn.error(An);return}Q(!1),H(10),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"hyper"}})),fn.success("Grid bot has been stopped.")}catch{fn.error("An error occurred while stopping the grid bot.")}finally{G(!1)}},he=()=>{Ne&&(re?ae():Se(!0))},Pe=async()=>{me&&(Se(!1),await $e())},Ve=fe?re?"Stopping...":"Starting...":re?"Stop":V?`Stopping ${K}s`:"Start",Te=["xyz","vntl","flx"].includes(oZ(t))?"Isolated":"Cross",Ze=!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(pP,{wallets:Vt,value:ge&&ge.id?String(ge.id):"",onChange:it=>{const wt=(Vt||[]).find(Dt=>String(Dt.wallet_id)===String(it))||null;if(wt){const Dt={id:wt.wallet_id,address:wt.wallet_address};ve(Dt),typeof s=="function"&&s({id:String(Dt.id),address:Dt.address})}},selectedBalance:Rt})]}),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:Le,disabled:Ie,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:it=>{Ie||u(it.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:Ie})})]}),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:it=>{Ie||f(it.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:Ie})})]})]}),Mn>0&&i.jsxs("div",{className:"text-[11px] text-white/40",children:["Mark Price: ",Mn.toFixed(Ge)]}),gt&&i.jsx("div",{className:"text-[11px] text-[#FF7173]",children:gt})]}),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:it=>{if(Ie)return;const wt=it.target.value.replace(/[^\d]/g,"");if(v(wt),S(""),wt==="")return;const Dt=Number(wt);if(Number.isFinite(Dt)){if(Dt<2){S("The minimum number of grids must be 2.");return}if(Dt>120){S("The maximum number of grids is 120.");return}if(Dt%2!==0){S("The number of grids must be even.");return}g(Dt)}},className:"bg-transparent outline-none flex-1 text-[13px]",inputMode:"numeric",disabled:Ie})}),i.jsx("div",{className:"relative",children:i.jsx("select",{value:T,onChange:it=>{Ie||I(it.target.value)},className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 text-[12px] outline-none",disabled:Ie,children:w1n.map(it=>i.jsx("option",{value:it,className:"bg-[#101010]",children:it[0].toUpperCase()+it.slice(1)},it))})})]}),i.jsx("div",{className:"text-[11px] text-white/40",children:C&&i.jsx("div",{className:"text-[11px] text-[#FF7173] mt-1",children:C})})]}),Ze,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:L,onChange:it=>Oe(it.target.value),className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"USDC",inputMode:"decimal",disabled:Ie}),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(K4,{onClick:ie&&ie>0&&!Ie?()=>se(!0):void 0,children:ie&&ie>0?`${Yn}x`:"--"})})]}),i.jsxs("div",{className:"flex items-center gap-3 !mt-4 pb-6",children:[i.jsx(Aj,{value:$,onChange:it=>Xe(it),accent:"#67FFBD"}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:$,onChange:it=>Xe(Math.max(0,Math.min(100,Number(it.target.value)||0))),style:{color:$i,fontFeatureSettings:'"tnum"'},disabled:Ie}),i.jsx("span",{style:{color:Si},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,": ",`${ie}x`]}),i.jsxs("span",{children:["Total:"," ",Vn>0?`${Vn.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:"," ",It>0?`${It} ${t}`:"--"]}),i.jsxs("span",{children:["Margin Mode: ",Te]})]})]}),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:Gt?`$${Gt.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:mn?`$${mn.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),i.jsx("button",{type:"button",onClick:he,disabled:!Ne,className:`w-full h-[32px] rounded-xl font-bold text-[13px] flex items-center justify-center transition-opacity ${Ne?re?"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:Ve}),mt&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Quantity per order is below min size (",Be," ",t,")."]}),Ft&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Your order size is below minimum order size of $",qt.toFixed(2),"."]}),kn&&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."}),Ze]})]})]}),i.jsx(lp,{open:ee,onClose:()=>se(!1),children:i.jsxs(ym,{title:"Adjust Leverage",children:[i.jsxs("div",{className:"text-[12px] leading-5 mb-3",style:{color:Si},children:["Control the leverage used for ",t," grid bot positions. The maximum leverage is ",ie,"x."]}),i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("input",{type:"range",min:1,max:ie||1,step:1,value:U,onChange:it=>Y(Math.max(1,Math.min(ie||1,Number(it.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:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-white",inputMode:"numeric",value:U,onChange:it=>{const wt=Number(it.target.value)||1,Dt=Math.max(1,Math.min(ie||1,wt));Y(Dt)}}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"x"})]})]}),i.jsx(H0,{onClick:()=>se(!1),children:"Confirm"})]})}),i.jsx(lp,{open:pe,onClose:()=>Se(!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:Te}),i.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-[#FF71731a] text-[#FF7173]",children:["Leverage ",Yn,"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:Si},children:"Price Range"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:Number.isFinite(Number(c))&&Number.isFinite(Number(d))?`${Number(c).toFixed(_e)} - ${Number(d).toFixed(_e)} USDC`:"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Number of Grids"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:tr||"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Mode"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:T==="geometric"?"Geometric":"Arithmetic"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Qty Per Order"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:It>0?`${It} ${t}`:"--"})]}),Ze,Ze,Ze,Ze]}),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:$i},children:"Total Investment"}),i.jsx("span",{className:"font-semibold text-[#67FFBD]",children:Vn>0?`${Vn.toFixed(2)} USDC`:"--"})]})}),i.jsx("div",{className:"mt-4",children:i.jsx(H0,{onClick:Pe,disabled:fe,children:fe?"Starting...":"Confirm"})})]})})]})}const k1n=["arithmetic","geometric"],T1n=10,P1n="https://express-proxy-delta.vercel.app/proxy?url=",I1n="https://api.starknet.extended.exchange/api/v1";function F1n(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},(S,T)=>{const I=o*Math.pow(C,T),L=I>0?x/I:0;return{index:T,price:I,qty:L,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,S)=>{const T=o+g*S;return{index:S,price:T,qty:v,order_size_usd:x}})}function Mje({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 lZ(t){const e=String(t||""),n=e.indexOf(":");return n>0?e.slice(0,n).toLowerCase():"hl"}function O1n(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 Lje({coin:t,midPrice:e,selectedPrice:n,wallet:r,onWalletChange:s,onLevelsChange:a}){var Fn,yr,hr;const{setSignInConnectButtonOpen:o}=h.useContext(Qr),l=vfe();h.useState("short");const[c,u]=h.useState("neutral"),[d,f]=h.useState(""),[x,g]=h.useState(""),[y,v]=h.useState(2),[C,S]=h.useState("2"),[T,I]=h.useState(""),[L,F]=h.useState("arithmetic"),[$,O]=h.useState(""),[U,Y]=h.useState(0),[re,Q]=h.useState(10),[q,te]=h.useState(!1),[fe,G]=h.useState(!1),[ie,oe]=h.useState(!1),[K,H]=h.useState(50),[ee,se]=h.useState(0),[pe,Se]=h.useState(!1),[ge,ve]=h.useState(!1),[be,we]=h.useState(()=>r&&r.id&&r.address?{id:r.id,address:r.address,apiKey:r.apiKey}:{id:null,address:null,apiKey:null}),[je,Fe]=h.useState({address:null,token:null}),[Re,Qe]=h.useState(null),[Ye,dt]=h.useState(""),[st,at]=h.useState(""),[He,qe]=h.useState(""),[vt,yt]=h.useState(""),[Kt,jt]=h.useState(!1),[un,vn]=h.useState(!1),[Hn,ln]=h.useState(!1),[Nn,dn]=h.useState(!1),[rt,nt]=h.useState(0),Ut=h.useRef(null),wn=h.useRef(!1),Jt=lt=>{const Ct=Number(lt);if(!Number.isFinite(Ct)||Ct<=0)return{num:null,str:""};const On=Ct>=3?Ct*.99:Ct,qn=Number(On.toFixed(2));return{num:Number.isFinite(qn)?qn:null,str:Number.isFinite(qn)?String(Ct.toFixed(2)):""}},Vt=()=>{f(""),g(""),v(2),S("2"),F("arithmetic"),O(""),Y(0),Q(10),I(""),u("neutral"),dt(""),at(""),qe(""),yt(""),jt(!1),vn(!1),ln(!1),dn(!1),Ut.current=null,wn.current=!1},{address:xt,isConnected:We}=ds(),Ke=!(We&&!!(typeof window<"u"&&window.localStorage.getItem("hyperToken"))),[ct,Nt]=h.useState([]),[Ht,Rt]=h.useState(!1),hn=h.useRef(!1),yn=Ht&&(!ct||ct.length===0);h.useEffect(()=>{r&&r.id&&r.address&&we(lt=>lt.id===r.id&<.address&<.address.toLowerCase()===r.address.toLowerCase()?lt:{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]),h.useEffect(()=>{const lt=()=>{const Ct=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,On=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;Fe({address:Ct,token:On})};return lt(),window.addEventListener("localStorageUpdated",lt),window.addEventListener("storage",lt),()=>{window.removeEventListener("localStorageUpdated",lt),window.removeEventListener("storage",lt)}},[]),h.useEffect(()=>{if(!je.address||!je.token){Nt([]);return}let lt=!1;return(async()=>{try{Rt(!0);const qn=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(lt)return;if(qn!=null&&qn.success&&Array.isArray(qn.data)){const _r=qn.data.map((jr,Fr)=>({...jr,wallet_id:jr.wallet_id??jr.id??Fr,wallet_address:jr.wallet_address||"",wallet_name:jr.wallet_name||jr.name||`Extended Wallet ${Fr+1}`,wallet_api_key:jr.wallet_api_key||jr.api_key||null}));Nt(_r)}else Nt([])}catch(On){lt||(console.error("Extended wallet list error",On),Nt([]))}finally{lt||Rt(!1)}})(),()=>{lt=!0}},[je.address,je.token]),h.useEffect(()=>{if(be.id||!ct||!ct.length)return;const lt=ct.find(On=>On.confirmed)||ct[0];if(!lt)return;const Ct={id:lt.wallet_id,address:lt.wallet_address,apiKey:lt.wallet_api_key};we(Ct),typeof s=="function"&&s({id:String(Ct.id),address:Ct.address,apiKey:Ct.apiKey})},[ct,be.id,s]),h.useEffect(()=>{if(!(be!=null&&be.id)||!(ct!=null&&ct.length))return;const lt=ct.find(qn=>String(qn.wallet_id)===String(be.id));if(!lt||!(be.apiKey!==lt.wallet_api_key||!be.address&<.wallet_address))return;const On={id:lt.wallet_id,address:lt.wallet_address,apiKey:lt.wallet_api_key};we(On),typeof s=="function"&&s({id:String(On.id),address:On.address,apiKey:On.apiKey})},[be==null?void 0:be.id,be==null?void 0:be.apiKey,be==null?void 0:be.address,ct,s]),h.useEffect(()=>{t&&(Vt(),te(!1))},[t]);const Cn=h.useMemo(()=>{if(!t)return null;const lt=String(t).toUpperCase(),Ct=lt.replace(/-USD$/,"");return l.find(On=>{const qn=String((On==null?void 0:On.symbol)||"").toUpperCase(),_r=String((On==null?void 0:On.rawSymbol)||"").toUpperCase();return qn===lt||_r===lt||qn===Ct||_r===Ct})||null},[l,t]),En=h.useMemo(()=>{const lt=Cn==null?void 0:Cn.marketStats,Ct=(lt==null?void 0:lt.markPrice)??(lt==null?void 0:lt.lastPrice)??(lt==null?void 0:lt.indexPrice)??(Cn==null?void 0:Cn.markPrice)??(Cn==null?void 0:Cn.lastPrice)??(Cn==null?void 0:Cn.last)??null,On=Number(Ct);return Number.isFinite(On)?On:0},[Cn]);h.useEffect(()=>{var On;const lt=((On=Cn==null?void 0:Cn.tradingConfig)==null?void 0:On.maxLeverage)??(Cn==null?void 0:Cn.maxLeverage)??(Cn==null?void 0:Cn.leverage),Ct=Number(lt);!Number.isFinite(Ct)||Ct<=0||(H(Ct),Q(qn=>Math.min(Ct,Math.max(1,Number(qn)||1))))},[Cn]);const Rn=(be==null?void 0:be.address)||(xt?xt.toLowerCase():null),{perpsOverview:Mn}=H8(Rn),Yn=h.useMemo(()=>{const lt=ct.find(jr=>String(jr.wallet_id)===String(be==null?void 0:be.id)),Ct=(lt==null?void 0:lt.available_balance)??(lt==null?void 0:lt.balance)??null,On=Number(Ct);if(!(be!=null&&be.apiKey))return Number.isFinite(On)?On:null;const qn=Number(Re==null?void 0:Re.availableForTrade);if(Number.isFinite(qn))return qn;if(Number.isFinite(On))return On;if(!Mn||Mn.balance==null)return null;const _r=Number(Mn.balance);return Number.isFinite(_r)?_r:null},[Re,Mn,be==null?void 0:be.apiKey,be==null?void 0:be.id,ct]);h.useEffect(()=>{if(!(be!=null&&be.apiKey)){Qe(null);return}let lt=!1;const Ct=async()=>{var qn,_r,jr;try{const Fr=`${P1n}${encodeURIComponent(`${I1n}/user/balance`)}`,vr=await(await fetch(Fr,{headers:{"X-Api-Key":be.apiKey}})).json().catch(()=>null);if(!lt){const Yr=((qn=vr==null?void 0:vr.data)==null?void 0:qn.availableForTrade)??(vr==null?void 0:vr.availableForTrade)??((_r=vr==null?void 0:vr.data)==null?void 0:_r.available_balance)??(vr==null?void 0:vr.available_balance)??((jr=vr==null?void 0:vr.data)==null?void 0:jr.available)??(vr==null?void 0:vr.available),dr=Number(Yr);Qe({availableForTrade:Number.isFinite(dr)&&dr>=0?dr:null,raw:vr})}}catch{lt||Qe(null)}};Ct();const On=setInterval(Ct,2e4);return()=>{lt=!0,clearInterval(On)}},[be==null?void 0:be.apiKey]);const Zn=(lt,Ct)=>{var Gn,rr,Jn,Xn;const On=lt.priceRange||{},_r=(Array.isArray(lt.gridPrices)?lt.gridPrices:[]).map(Zr=>Zr&&typeof Zr=="object"&&Zr.price!=null?Number(Zr.price):Number(Zr)).filter(Zr=>Number.isFinite(Zr));let jr=On.lower,Fr=On.upper;(!Number.isFinite(jr)||!Number.isFinite(Fr))&&_r.length>=2&&(jr=_r[0],Fr=_r[_r.length-1]),Number.isFinite(jr)?f(String(jr)):f(""),Number.isFinite(Fr)?g(String(Fr)):g("");let nr=lt.gridType;nr!=="geometric"&&nr!=="arithmetic"&&(nr="arithmetic"),F(nr);const vr=lt.grid_side_mode??lt.gridSideMode??lt.gridSide??lt.sideMode??null,Yr=String(vr||"").toLowerCase(),dr=lt.grid_count_base??lt.gridCountBase??lt.grid_count_input??lt.gridCountInput??null,rs=Number(dr);let gs=lt.gridCount;Number.isFinite(gs)||_r.length>=2&&(gs=_r.length);const ms=Yr&&Yr!=="neutral"&&Number.isFinite(rs)?rs:gs;Number.isFinite(ms)?(v(ms),S(String(ms))):(v(2),S("2")),u(Yr==="short"||Yr==="short_only"?"short":Yr==="long"||Yr==="long_only"?"long":"neutral");const At=lt.investment||{};At&&At.leverage!=null&&Number.isFinite(Number(At.leverage))&&Q(Number(At.leverage));const pt=At.wallet_balance??At.walletBalance??At.balance??At.available_balance??At.availableBalance??null,le=(At==null?void 0:At.collateral_input)??(At==null?void 0:At.collateralInput)??(At==null?void 0:At.collateral)??(At==null?void 0:At.collateral_used)??(At==null?void 0:At.collateralUsed)??(At==null?void 0:At.collateralEffective)??null,Me=Number(le);if(At&&Number.isFinite(Me)){const{num:Zr,str:$r}=Jt(Me);O($r),Ut.current=Zr;const wr=At.percentChosen!=null?Number(At.percentChosen):At.percent!=null?Number(At.percent):null,pr=wr!=null&&Number.isFinite(wr),ar=Number(pt);if(pr)Y(Math.max(0,Math.min(100,wr))),wn.current=!1;else{const Vr=Number.isFinite(ar)&&ar>0?ar:Ct;if(Vr&&Vr>0&&Zr>0){const Ur=Zr/Vr*100;Y(Math.max(0,Math.min(100,Ur))),wn.current=!1}else Y(0),wn.current=Zr>0}}else O(""),Y(0),Ut.current=null,wn.current=!1;const ft=lt.trailing_up??((Gn=lt==null?void 0:lt.trailing)==null?void 0:Gn.up),ut=lt.trailing_down??((rr=lt==null?void 0:lt.trailing)==null?void 0:rr.down),on=lt.sl_up??((Jn=lt==null?void 0:lt.sl)==null?void 0:Jn.up),bn=lt.sl_down??((Xn=lt==null?void 0:lt.sl)==null?void 0:Xn.down);dt(ft!=null&&Number.isFinite(Number(ft))?String(ft):""),at(ut!=null&&Number.isFinite(Number(ut))?String(ut):""),qe(on!=null&&Number.isFinite(Number(on))?String(on):""),yt(bn!=null&&Number.isFinite(Number(bn))?String(bn):""),jt(ft!=null&&Number.isFinite(Number(ft))),vn(ut!=null&&Number.isFinite(Number(ut))),ln(on!=null&&Number.isFinite(Number(on))),dn(bn!=null&&Number.isFinite(Number(bn)))};h.useEffect(()=>{if(!wn.current)return;const lt=Number(Ut.current),Ct=Number(Yn);if(!Number.isFinite(lt)||lt<=0||!Number.isFinite(Ct)||Ct<=0)return;const On=lt/Ct*100;Y(Math.max(0,Math.min(100,On))),wn.current=!1},[Yn]),h.useEffect(()=>{if(typeof window>"u")return;if(!t||!(be!=null&&be.id)||!(be!=null&&be.address)){te(!1),Vt();return}let lt=!1;async function Ct(){G(!0);try{const On=window.localStorage.getItem("hyperToken");if(!On){lt||(te(!1),Vt(),G(!1));return}const qn={address:window.localStorage.getItem("hyperAddress"),token:On,wallet_id:Number(be.id),source_market:"extended",coin:String(t||"").toUpperCase()},jr=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/info/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(qn)})).json().catch(()=>null);if(lt)return;if(hn.current){hn.current=!1,G(!1);return}const Fr=jr&&jr.data?jr.data:jr,vr=(Array.isArray(Fr)?Fr:[Fr]).filter(Boolean).filter(dr=>dr&&typeof dr=="object"&&String(dr.coin||"").toUpperCase()===String(t||"").toUpperCase()&&String(dr.wallet_id||"")===String(be.id||"")),Yr=vr.find(dr=>dr&&typeof dr=="object"&&dr.is_deleted===!1&&dr.bot_params)||vr.find(dr=>dr&&typeof dr=="object"&&dr.is_deleted!==!0&&dr.bot_params)||null;if(Yr){if(Yr.wallet_id&&String(Yr.wallet_id)!==String(be.id)){const dr=ct.find(rs=>String(rs.wallet_id)===String(Yr.wallet_id));if(dr){const rs={id:dr.wallet_id,address:dr.wallet_address,apiKey:dr.wallet_api_key};we(rs),typeof s=="function"&&s({id:String(rs.id),address:rs.address,apiKey:rs.apiKey})}}Zn(Yr.bot_params,Yn),te(!0)}else te(!1),Vt(),f(""),g("")}catch{te(!1),Vt(),f(""),g("")}finally{lt||G(!1)}}return Ct(),()=>{lt=!0}},[t,be==null?void 0:be.id,be==null?void 0:be.address,rt,ct,s]),h.useEffect(()=>{if(typeof window>"u")return;const lt=window.localStorage.getItem("gridbot:pending_selection");if(!lt)return;let Ct=null;try{Ct=JSON.parse(lt)}catch{Ct=null}if(!(!Ct||Ct.sourceMarket&&Ct.sourceMarket!=="extended"||String(Ct.coin||"").toUpperCase()!==String(t||"").toUpperCase())){if(hn.current=!0,Zn(Ct.botParams||{},Yn),Ct.isActive===!0?te(!0):Ct.isActive===!1&&te(!1),Ct.walletId&&ct&&ct.length){const On=ct.find(qn=>String(qn.wallet_id)===String(Ct.walletId));if(On){const qn={id:On.wallet_id,address:On.wallet_address,apiKey:On.wallet_api_key};we(qn),typeof s=="function"&&s({id:String(qn.id),address:qn.address,apiKey:qn.apiKey})}}try{window.localStorage.removeItem("gridbot:pending_selection")}catch{}}},[t,ct,s,Yn]),h.useEffect(()=>{const lt=Ct=>{const On=Ct&&Ct.detail&&Ct.detail.sourceMarket;On&&On!=="extended"||nt(qn=>qn+1)};return window.addEventListener("gridbotUpdated",lt),()=>{window.removeEventListener("gridbotUpdated",lt)}},[]),h.useEffect(()=>{const lt=Ct=>{const On=Ct&&Ct.detail;if(!On)return;const qn=On.sourceMarket||On.source_market;if(qn&&qn!=="extended"||String(On.coin||"").toUpperCase()!==String(t||"").toUpperCase())return;const jr=On.botParams||{};if(Zn(jr,Yn),hn.current=!0,On.isActive===!0?te(!0):On.isActive===!1&&te(!1),On.walletId&&ct&&ct.length){const Fr=ct.find(nr=>String(nr.wallet_id)===String(On.walletId));if(Fr){const nr={id:Fr.wallet_id,address:Fr.wallet_address,apiKey:Fr.wallet_api_key};we(nr),typeof s=="function"&&s({id:String(nr.id),address:nr.address,apiKey:nr.apiKey})}}};return window.addEventListener("gridbotSelectFromTasks",lt),()=>{window.removeEventListener("gridbotSelectFromTasks",lt)}},[t,ct,s]);const Vn=h.useMemo(()=>Math.min(K,Math.max(1,Number(re)||1)),[re,K]),tr=(()=>{const lt=Number($);return!Number.isFinite(lt)||lt<=0?0:lt>=3?lt*.99:lt})(),Sn=Number($)||0,ze=h.useMemo(()=>{const lt=Number(d),Ct=Number(x);return!Number.isFinite(lt)||!Number.isFinite(Ct)?null:(lt+Ct)/2},[d,x]),xe=h.useMemo(()=>{if(En>0)return En;const lt=Number(e||0);if(lt>0)return lt;const Ct=Number(n||0);return Ct>0?Ct:ze!=null&&ze>0?ze:0},[En,e,n,ze]),Ge=Number.isFinite(xe)&&xe>0?xe:ze,_e=h.useMemo(()=>F1n(d,x,y,tr,L,Vn),[d,x,y,tr,L,Vn]),Be=h.useMemo(()=>{const lt=_e.map((Yr,dr)=>{const rs=Number(Yr==null?void 0:Yr.price);return Number.isFinite(rs)?{index:Number.isFinite(Yr==null?void 0:Yr.index)?Yr.index:dr,price:rs}:null}).filter(Boolean);if(!lt.length)return[];const Ct=tr*Vn,On=Number.isFinite(Ge)&&Ge>0?Ge:null;let qn=0,_r=0;if(On!=null)for(const Yr of lt)Yr.price>=On?_r+=1:qn+=1;else qn=lt.length;let jr=lt.length;c==="long"?jr=qn+_r*2:c==="short"&&(jr=_r+qn*2),(!Number.isFinite(jr)||jr<=0)&&(jr=lt.length);const Fr=jr>0?Ct/jr:0,nr=ze??0,vr=L==="geometric";return lt.map(Yr=>{const dr=vr?Yr.price>0?Fr/Yr.price:0:nr>0?Fr/nr:0;return{index:Yr.index,price:Yr.price,qty:dr,order_size_usd:Fr}})},[_e,tr,Vn,ze,L,c,Ge]),qt=h.useMemo(()=>Be.length?Be.map(lt=>({price:lt.price,side:Ge==null?null:Number(lt.price)>=Ge?"sell":"buy"})):[],[Be,Ge]);h.useEffect(()=>{typeof a=="function"&&a(qt)},[qt,a]);const It=lt=>{const Ct=Number(lt);if(!(Ct>0))return;const On=Ct*.01;f((Ct-On).toFixed(2)),g((Ct+On).toFixed(2))},mt=xe,Ft=tr*Vn,Tn=Be.length,kn=h.useMemo(()=>{if(!Be.length)return 0;let lt=0,Ct=0;for(const On of Be){const qn=Number(On==null?void 0:On.qty);Number.isFinite(qn)&&(lt+=qn,Ct+=1)}return Ct?lt/Ct:0},[Be]),Gt=Number(Cn==null?void 0:Cn.collateralAssetPrecision),mn=Number(Cn==null?void 0:Cn.assetPrecision),gt=(Fn=Cn==null?void 0:Cn.tradingConfig)==null?void 0:Fn.minOrderSizeChange,Wt=(()=>{const lt=Number(gt);if(!Number.isFinite(lt))return null;const[,Ct=""]=String(gt).split(".");return Math.max(0,Ct.length)})(),jn=Number.isFinite(Gt)?Gt:Number.isFinite(mn)?mn:4,kt=Wt!=null&&Number.isFinite(Wt)?Wt:jn,cn=Number((yr=Cn==null?void 0:Cn.tradingConfig)==null?void 0:yr.minPriceChange),Ce=h.useMemo(()=>Number.isFinite(cn)&&cn>0?cn>=1?0:Math.min(8,Math.max(0,-Math.floor(Math.log10(cn)))):O1n(xe),[cn,xe]),m=Ce,p=Number(((hr=Cn==null?void 0:Cn.tradingConfig)==null?void 0:hr.minOrderSize)??0),N=0,A=kn>0?Number(kn.toFixed(kt)):0,k=h.useMemo(()=>Be.some(lt=>Number(lt==null?void 0:lt.qty)>0),[Be]),P=k&&p>0&&Be.some(lt=>{const Ct=Number(lt==null?void 0:lt.qty);return Number.isFinite(Ct)?Ct<p:!1}),D=k&&N>0,V=h.useMemo(()=>{if(!k||Be.length===0)return 0;let lt=1/0;for(const Ct of Be){const On=Number(Ct==null?void 0:Ct.price),qn=Number(Ct==null?void 0:Ct.qty);if(!Number.isFinite(On)||!Number.isFinite(qn))continue;if(On<=0||qn<=0){lt=0;break}const _r=On*qn;_r<lt&&(lt=_r)}return lt===1/0?0:lt},[k,Be]),Z=k&&V<T1n,ce=xe>0&&Ft>0&&tr>0?Mje({entry:xe,side:"buy",notionalUSD:Ft,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:tr,isolatedMarginUSD:tr}):null,ue=xe>0&&Ft>0&&tr>0?Mje({entry:xe,side:"sell",notionalUSD:Ft,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:tr,isolatedMarginUSD:tr}):null,me=h.useMemo(()=>{if(!d&&!x)return"";const lt=Number(d),Ct=Number(x);if(!Number.isFinite(lt)||!Number.isFinite(Ct))return"";if(!(Ct>lt))return"Upper price must be greater than lower price.";if(mt>0){if(lt>mt)return`Lower price cannot be above mark price (${mt.toFixed(Ce)}).`;if(Ct<mt)return`Upper price cannot be below mark price (${mt.toFixed(Ce)}).`}return""},[d,x,mt,Ce]),Ne=h.useMemo(()=>{const lt=Number(d),Ct=Number(x);return!(!Number.isFinite(lt)||!Number.isFinite(Ct)||!(Ct>lt)||mt>0&&(lt>mt||Ct<mt))},[d,x,mt]),Ie=Number(d),Le=Number(x),Xe=Number(Ye),Oe=Number(st),$e=Number(He),ae=Number(vt),he=Kt&&(Ye===""||!Number.isFinite(Xe)||!(Xe>Le)),Pe=un&&(st===""||!Number.isFinite(Oe)||!(Oe<Ie));h.useEffect(()=>{Kt||dt(""),un||at("")},[Kt,un]),h.useEffect(()=>{Hn||qe(""),Nn||yt("")},[Hn,Nn]);const Ve=Hn&&(He===""||!Number.isFinite($e)||!Kt&&Number.isFinite(Le)&&!($e>Le)||Kt&&Number.isFinite(Xe)&&!($e>Xe)),Te=Nn&&(vt===""||!Number.isFinite(ae)||!un&&Number.isFinite(Ie)&&!(ae<Ie)||un&&Number.isFinite(Oe)&&!(ae<Oe)),Ze=Tn>1&&Ne&&tr>0&&Vn>0&&(be==null?void 0:be.id)&&(be==null?void 0:be.address),it=ee>0,wt=!!T,Dt=P||D,Qt=he||Pe||Ve||Te,xn=Ze&&!fe&&!ie&&!yn&&!it&&!wt&&!Dt&&!Z&&!Qt,pn=ie||fe||yn||wt||Dt||Z||it||Qt?!1:q?!0:Ze,An=q||ie||fe||yn;h.useEffect(()=>{if(!ee)return;const lt=setInterval(()=>se(Ct=>Ct>1?Ct-1:0),1e3);return()=>clearInterval(lt)},[ee]);const or=()=>{if(An)return;const lt=En>0?En:xe>0?xe:Number(e||n||0);!Number.isFinite(lt)||lt<=0||It(lt)},$t=lt=>{if(An)return;wn.current=!1;const Ct=Math.max(0,Math.min(100,Number(lt)||0));if(Y(Ct),!Yn||Yn<=0){Ct===0&&O("");return}const On=Yn*Ct/100;Jt(On),O(Number.isFinite(On)?On.toFixed(2):"")},bt=lt=>{if(An)return;wn.current=!1;const Ct=Number(lt);if(O(lt),!Yn||!Number.isFinite(Ct)||Ct<=0||Yn<=0){Y(0);return}const On=(Ct>=3?Ct*.99:Ct)/Yn*100;Y(Math.max(0,Math.min(100,On)))},rn=async()=>{if(!xn||typeof window>"u"||!(be!=null&&be.address)||!(be!=null&&be.id))return;const lt=Be.filter(ms=>Number.isFinite(ms==null?void 0:ms.price));if(lt.length<2)return;const Ct=lt[0],On=lt[lt.length-1],qn=lt.length,_r=qn>1?qn-1:0,jr=L!=="geometric"&&_r>0?(On.price-Ct.price)/_r:null,Fr=L==="geometric"&&_r>0?Math.pow(On.price/Ct.price,1/_r):null,nr=(Ct.price+On.price)/2,vr=window.localStorage.getItem("hyperToken");if(!vr)return;if(Kt&&he){fn.error("Trailing Up is invalid.");return}if(un&&Pe){fn.error("Trailing Down is invalid.");return}if(Hn&&Ve){const ms=Kt?"SL Up must be greater than Trailing Up.":"SL Up must be greater than Upper price.";fn.error(ms);return}if(Nn&&Te){const ms=un?"SL Down must be less than Trailing Down.":"SL Down must be less than Lower price.";fn.error(ms);return}const Yr=A,dr=lZ(t),rs={symbol:String(t||"").toUpperCase(),dex:dr,gridType:L==="geometric"?"geometric":"arithmetic",direction:c,grid_side_mode:c,grid_count_base:y,priceRange:{lower:Number(Ct.price.toFixed(m)),upper:Number(On.price.toFixed(m)),middle:Number(nr.toFixed(m))},gridCount:qn,gridPrices:lt.map(ms=>({price:Number(ms.price.toFixed(m)),qty:Number(Number(ms.qty||0).toFixed(kt))})),trailing_up_grid_prices:(()=>{if(!(Kt&&!he&&Number.isFinite(Xe)))return[];const ms=[];if(L==="geometric"&&Fr&&Fr>0){let At=On.price*Fr,pt=0;for(;At<=Xe+1e-12&&pt<500;){const le=(xe>0,A);ms.push({price:Number(At.toFixed(m)),qty:Number(le.toFixed(kt))}),At*=Fr,pt+=1}}else if(jr&&jr>0)for(let At=On.price+jr,pt=0;At<=Xe+1e-12&&pt<500;At+=jr,pt+=1)ms.push({price:Number(At.toFixed(m)),qty:Number(A.toFixed(kt))});return ms})(),trailing_down_grid_prices:(()=>{if(!(un&&!Pe&&Number.isFinite(Oe)))return[];const ms=[];if(L==="geometric"&&Fr&&Fr>0){let At=Ct.price/Fr,pt=0;for(;At>=Oe-1e-12&&pt<500;)ms.push({price:Number(At.toFixed(m)),qty:Number(A.toFixed(kt))}),At/=Fr,pt+=1}else if(jr&&jr>0)for(let At=Ct.price-jr,pt=0;At>=Oe-1e-12&&pt<500;At-=jr,pt+=1)ms.push({price:Number(At.toFixed(m)),qty:Number(A.toFixed(kt))});return ms})(),investment:{collateral:Sn,collateralUsed:tr,percentChosen:U,leverage:Vn,totalInvestment:tr,qtyPerOrder:Yr},liquidationPrices:{long:ce?Number(ce.toFixed(2)):null,short:ue?Number(ue.toFixed(2)):null},trailing_up:Kt&&!he?Number(Xe.toFixed(m)):null,trailing_down:un&&!Pe?Number(Oe.toFixed(m)):null,sl_up:Hn&&!Ve?Number($e.toFixed(m)):null,sl_down:Nn&&!Te?Number(ae.toFixed(m)):null,marginMode:"Cross",currentPrice:xe||null,timestamp:new Date().toISOString()},gs={address:window.localStorage.getItem("hyperAddress"),token:vr,wallet_id:Number(be.id),source_market:"extended",bot_params:rs,coin:String(t||"").toUpperCase()};oe(!0);try{const At=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/save/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(gs)})).json().catch(()=>null);if(!(At&&(At.success===!0||At.status==="ok"||At.status==="success"))){const le=At&&(At.error_message||At.message||At.detail)||"Grid bot failed to start.";fn.error(le);return}te(!0),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"extended"}})),fn.success("Grid bot started.")}catch{fn.error("An error occurred while starting the grid bot.")}finally{oe(!1)}},ur=async()=>{if(typeof window>"u"||!(be!=null&&be.address)||!(be!=null&&be.id))return;const lt=window.localStorage.getItem("hyperToken");if(!lt)return;lZ(t);const Ct={address:window.localStorage.getItem("hyperAddress"),token:lt,wallet_id:Number(be.id),source_market:"extended",coin:String(t||"").toUpperCase()};oe(!0);try{const qn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/stop/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ct)})).json().catch(()=>null);if(!(qn&&(qn.success===!0||qn.status==="ok"||qn.status==="success"))){const jr=qn&&(qn.error_message||qn.message||qn.detail)||"Grid bot could not be stopped.";fn.error(jr);return}te(!1),se(10),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"extended"}})),fn.success("Grid bot has been stopped.")}catch{fn.error("An error occurred while stopping the grid bot.")}finally{oe(!1)}},gr=()=>{pn&&(q?ur():ve(!0))},br=async()=>{xn&&(ve(!1),await rn())},Br=ie?q?"Stopping...":"Starting...":q?"Stop":it?`Stopping ${ee}s`:"Start",Gr=["xyz","vntl","flx"].includes(lZ(t))?"Isolated":"Cross",Or=Kt&&!he,Lt=un&&!Pe,nn=Hn&&!Ve,Ot=Nn&&!Te,en=[{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(pP,{wallets:ct,mode:"extended",value:be&&be.id?String(be.id):"",onChange:lt=>{const Ct=(ct||[]).find(On=>String(On.wallet_id)===String(lt))||null;if(Ct){const On={id:Ct.wallet_id,address:Ct.wallet_address,apiKey:Ct.wallet_api_key};we(On),typeof s=="function"&&s({id:String(On.id),address:On.address,apiKey:On.apiKey})}},selectedBalance:Yn})]}),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:en.map(lt=>{const Ct=c===lt.key;return i.jsx("button",{type:"button",onClick:()=>{An||u(lt.key)},disabled:An,"aria-pressed":Ct,className:`h-8 rounded-lg border text-[11px] font-semibold transition-colors ${An?"opacity-60 cursor-not-allowed":"cursor-pointer"} ${Ct?lt.activeClass:"bg-[#161616] text-white/60 border-[#292929] hover:text-white"}`,children:lt.label},lt.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:or,disabled:An,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:lt=>{An||f(lt.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:An})})]}),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:lt=>{An||g(lt.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:An})})]})]}),mt>0&&i.jsxs("div",{className:"text-[11px] text-white/40",children:["Mark Price: ",mt.toFixed(Ce)]}),me&&i.jsx("div",{className:"text-[11px] text-[#FF7173]",children:me})]}),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:lt=>{if(An)return;const Ct=lt.target.value.replace(/[^\d]/g,"");if(S(Ct),I(""),Ct==="")return;const On=Number(Ct);if(Number.isFinite(On)){if(On<2){I("The minimum number of grids must be 2.");return}if(On>200){I("The maximum number of grids is 200.");return}if(On%2!==0){I("The number of grids must be even.");return}v(On)}},className:"bg-transparent outline-none flex-1 text-[13px]",inputMode:"numeric",disabled:An})}),i.jsx("div",{className:"relative",children:i.jsx("select",{value:L,onChange:lt=>{An||F(lt.target.value)},className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 text-[12px] outline-none",disabled:An,children:k1n.map(lt=>i.jsx("option",{value:lt,className:"bg-[#101010]",children:lt[0].toUpperCase()+lt.slice(1)},lt))})})]}),i.jsx("div",{className:"text-[11px] text-white/40",children:T&&i.jsx("div",{className:"text-[11px] text-[#FF7173] mt-1",children:T})})]}),(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(as,{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:lt=>bt(lt.target.value),className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"USDC",inputMode:"decimal",disabled:An}),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(K4,{onClick:K&&K>0&&!An?()=>Se(!0):void 0,children:K&&K>0?`${Vn}x`:"--"})})]}),i.jsxs("div",{className:"flex items-center gap-3 !mt-4 pb-6",children:[i.jsx(Aj,{value:U,onChange:lt=>$t(lt),accent:"#67FFBD"}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:U,onChange:lt=>$t(Math.max(0,Math.min(100,Number(lt.target.value)||0))),style:{color:$i,fontFeatureSettings:'"tnum"'},disabled:An}),i.jsx("span",{style:{color:Si},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,": ",`${K}x`]}),i.jsxs("span",{children:["Total:"," ",Ft>0?`${Ft.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:"," ",A>0?`${A} ${t}`:"--"]}),i.jsxs("span",{children:["Margin Mode: ",Gr]})]})]}),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})}`:"--"})]}),Ke?i.jsx(om,{onClick:()=>typeof o=="function"?o(!0):null}):i.jsx("button",{type:"button",onClick:gr,disabled:!pn,className:`w-full h-[32px] rounded-xl font-bold text-[13px] flex items-center justify-center transition-opacity ${pn?q?"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:Br}),P&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Quantity per order is below min size (",p," ",t,")."]}),D,Z&&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."}),Qt&&i.jsx("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:"Fix trailing/SL input errors to start."})]})]})]}),i.jsx(lp,{open:pe,onClose:()=>Se(!1),children:i.jsxs(ym,{title:"Adjust Leverage",children:[i.jsxs("div",{className:"text-[12px] leading-5 mb-3",style:{color:Si},children:["Control the leverage used for ",t," grid bot positions. The maximum leverage is ",K,"x."]}),i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("input",{type:"range",min:1,max:K||1,step:1,value:re,onChange:lt=>Q(Math.max(1,Math.min(K||1,Number(lt.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:Do,border:`1px solid ${Da}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-white",inputMode:"numeric",value:re,onChange:lt=>{const Ct=Number(lt.target.value)||1,On=Math.max(1,Math.min(K||1,Ct));Q(On)}}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"x"})]})]}),i.jsx(H0,{onClick:()=>Se(!1),children:"Confirm"})]})}),i.jsx(lp,{open:ge,onClose:()=>ve(!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:Gr}),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:Si},children:"Price Range"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:Number.isFinite(Number(d))&&Number.isFinite(Number(x))?`${Number(d).toFixed(m)} - ${Number(x).toFixed(m)} USDC`:"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Number of Grids"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:Tn||"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Mode"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:L==="geometric"?"Geometric":"Arithmetic"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Qty Per Order"}),i.jsx("div",{className:"font-medium",style:{color:$i},children:A>0?`${A} ${t}`:"--"})]}),Or&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Trailing Up"}),i.jsxs("div",{className:"font-medium",style:{color:$i},children:[Number(Ye).toFixed(m)," USDC"]})]}),Lt&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Trailing Down"}),i.jsxs("div",{className:"font-medium",style:{color:$i},children:[Number(st).toFixed(m)," USDC"]})]}),nn&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"SL Up"}),i.jsxs("div",{className:"font-medium",style:{color:$i},children:[Number(He).toFixed(m)," USDC"]})]}),Ot&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"SL Down"}),i.jsxs("div",{className:"font-medium",style:{color:$i},children:[Number(vt).toFixed(m)," 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:$i},children:"Total Investment"}),i.jsx("span",{className:"font-semibold text-[#67FFBD]",children:Ft>0?`${Ft.toFixed(2)} USDC`:"--"})]})}),i.jsx("div",{className:"mt-4",children:i.jsx(H0,{onClick:br,disabled:ie,children:ie?"Starting...":"Confirm"})})]})})]})}const g2="/assets/fee-animation-Cvx53PQy.mp4",M1n="wss://mainnet.zklighter.elliot.ai/stream",L1n="https://api.hyperliquid.xyz/info",dB=t=>t==null?0:Number(t),fB=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),R1n=(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})},D1n=t=>{if(t>=1)return t.toLocaleString();const e=Math.min(8,Math.max(0,-Math.floor(Math.log10(t))));return t.toFixed(e)},B1n={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}}},$1n=t=>{if(!t)return null;const e=String(t).toUpperCase(),n=B1n[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 U1n(t){var o;const n=await fetch(L1n,{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 z1n(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 H1n(t){const e=t.toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),n=Number(e);return Number.isFinite(n)?n:0}function V1n(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(H1n),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 Rje(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 W1n(t){if(!t)return[];const e=String(t).trim(),n=$1n(e);if(n&&n.length)return n;const r=e.toUpperCase();try{const s=await U1n(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=z1n(s);let c=V1n(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:Rje(e)}catch(s){return console.error("getUiStepsForCoin error",e,s),Rje(e)}}function Dje(t,e,n){const r=new Map;for(const s of t||[]){const a=dB(s.px),o=dB(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 q1n({marketId:t,baseSymbol:e,rows:n=16,onSelectPrice:r,onBest:s}){const a=h.useRef(null),o=h.useRef(null),l=h.useRef(0),c=h.useRef({bids:new Map,asks:new Map}),u=h.useRef(!1),d=h.useRef(!0),[f,x]=h.useState({bids:[],asks:[]}),[g,y]=h.useState("COIN"),[v,C]=h.useState(null),[S,T]=h.useState([]),I=(oe,K)=>g==="USD"?oe*K:oe,L=g==="USD"?"USD":e?String(e):"COIN";h.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]);const F=()=>{u.current||(u.current=!0,requestAnimationFrame(()=>{if(u.current=!1,!d.current)return;const oe=c.current;if(!((oe==null?void 0:oe.bids)instanceof Map)||!((oe==null?void 0:oe.asks)instanceof Map))return;const K=512,H=Array.from(oe.bids.entries()).map(([se,pe])=>({px:se,sz:pe})).sort((se,pe)=>pe.px-se.px).slice(0,K),ee=Array.from(oe.asks.entries()).map(([se,pe])=>({px:se,sz:pe})).sort((se,pe)=>se.px-pe.px).slice(0,K);x({bids:H,asks:ee})}))},$=oe=>{if(oe==null)return;const K=a.current;if(K&&(K.readyState===WebSocket.OPEN||K.readyState===WebSocket.CONNECTING))return;const H=new WebSocket(M1n);a.current=H,H.onopen=()=>{l.current=0;const ee={type:"subscribe",channel:`order_book/${String(oe)}`};try{H.send(JSON.stringify(ee))}catch{}},H.onmessage=ee=>{let se;try{se=JSON.parse(ee.data||"{}")}catch{return}if((se==null?void 0:se.type)!=="update/order_book")return;const pe=`order_book:${String(oe)}`;if(se.channel!==pe)return;const Se=se.order_book;if(!Se)return;let ge=c.current;(!ge||typeof ge!="object")&&(ge={bids:new Map,asks:new Map},c.current=ge),ge.bids instanceof Map||(ge.bids=new Map),ge.asks instanceof Map||(ge.asks=new Map);const ve=(be,we)=>{const je=Array.isArray(Se[be])?Se[be]:[];if(je.length)for(const Fe of je){const Re=Number(Fe.price),Qe=Number(Fe.size);Number.isFinite(Re)&&(!Number.isFinite(Qe)||Qe<=0?we.delete(Re):we.set(Re,Qe))}};ve("bids",ge.bids),ve("asks",ge.asks),F()},H.onclose=()=>{l.current=Math.min(l.current+1,6),!o.current&&(o.current=setTimeout(()=>{o.current=null,$(oe)},500*Math.pow(2,l.current)))},H.onerror=()=>{try{H.close()}catch{}}};h.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:[]}),T([]),C(null),t==null)return;$(t);let oe=!1;return(async()=>{const K=await W1n(e||"");oe||(T(K),C(K[0]??null))})(),()=>{oe=!0}},[t,e]);const O=h.useMemo(()=>(f.bids||[]).map(oe=>dB(oe.px)).filter(oe=>Number.isFinite(oe)&&oe>0),[f]),U=h.useMemo(()=>(f.asks||[]).map(oe=>dB(oe.px)).filter(oe=>Number.isFinite(oe)&&oe>0),[f]),Y=O.length?Math.max(...O):null,re=U.length?Math.min(...U):null;h.useEffect(()=>{Y!=null&&re!=null&&(s==null||s({bestBid:Y,bestAsk:re,mid:(Y+re)/2}))},[Y,re,s]);const Q=h.useMemo(()=>{const oe=Number(v)||1,K=Dje(f.bids,oe,"bid").sort((ee,se)=>se.price-ee.price),H=Dje(f.asks,oe,"ask").sort((ee,se)=>ee.price-se.price);return{bids:K,asksAsc:H}},[f,v]),q=h.useMemo(()=>{const oe=Q.asksAsc.slice(0,n);let K=0;return oe.map(ee=>(K+=I(ee.size,ee.price),{...ee,total:K})).reverse()},[Q,n,g]),te=h.useMemo(()=>{const oe=Q.bids.slice(0,n);let K=0;return oe.map(H=>(K+=I(H.size,H.price),{...H,total:K}))},[Q,n,g]),fe=h.useMemo(()=>{if(Y==null||re==null)return null;const oe=Math.abs(re-Y),K=(re+Y)/2;return{diff:oe,pct:K?oe/K*100:0}},[Y,re]),G=Math.max(q.reduce((oe,K)=>Math.max(oe,K.total||0),0),1e-9),ie=Math.max(te.reduce((oe,K)=>Math.max(oe,K.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($je,{value:String(v??""),onChange:oe=>C(Number(oe)),items:(S||[]).map(oe=>({key:String(oe),label:D1n(oe)}))}),i.jsx($je,{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 (",L,")"]}),i.jsxs("span",{className:"uppercase text-right",children:["Total (",L,")"]})]}),i.jsx("div",{className:"flex-1 overflow-hidden w-full",children:i.jsxs("div",{className:"overflow-auto w-full",children:[q.map((oe,K)=>i.jsx(Bje,{side:"ask",step:Number(v)||1,price:oe.price,size:oe.size!=null?I(oe.size,oe.price):null,total:oe.total,widthPct:oe.total?Math.min(100,oe.total/G*100):0,onClick:()=>oe.price!=null&&(r==null?void 0:r(oe.price)),unit:g},`ask-${K}`)),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?fB(fe.diff,4):"--"}),i.jsx("span",{className:"text-right",children:fe?`${fB(fe.pct,4)}%`:"--"})]}),te.map((oe,K)=>i.jsx(Bje,{side:"bid",step:Number(v)||1,price:oe.price,size:oe.size!=null?I(oe.size,oe.price):null,total:oe.total,widthPct:oe.total?Math.min(100,oe.total/ie*100):0,onClick:()=>oe.price!=null&&(r==null?void 0:r(oe.price)),unit:g},`bid-${K}`))]})})]})}function Bje({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?"—":R1n(e,o)}),i.jsx("span",{className:"text-center text-[#dcdada] hover:text-white",children:c?"—":fB(n,f?0:6)}),i.jsx("span",{className:"text-right text-[#a8a8a8] hover:text-white",children:c?"—":fB(r,f?0:6)})]})]})}function $je({value:t,onChange:e,items:n,align:r="left"}){var l,c;const[s,a]=h.useState(!1),o=h.useRef(null);return h.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},Uje=(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})},zje=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),G1n=(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})},K1n=t=>{if(t>=1)return t.toLocaleString();const e=Math.min(8,Math.max(0,-Math.floor(Math.log10(t))));return t.toFixed(e)},Y1n={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}}},X1n=t=>{if(!t)return null;const e=String(t).toUpperCase(),n=Y1n[e];return n?Object.values(n).map(s=>s.value).filter(s=>Number.isFinite(s)&&s>0).sort((s,a)=>s-a):null};function Q1n(t){const e=t.toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),n=Number(e);return Number.isFinite(n)?n:0}function Z1n(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(Q1n),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 Hje(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 J1n(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 ebn(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 tbn({apiBaseUrl:t,market:e,baseSymbol:n}){var s,a,o,l;const r=X1n(n);if(r&&r.length)return r;try{const c=await J1n(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=Z1n(d,u);return f=Array.from(new Set(f.filter(x=>Number.isFinite(x)&&x>0))).sort((x,g)=>x-g),f.length?f:Hje(n)}catch{return Hje(n)}}function Vje(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 nbn({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 Se;const c=h.useRef(null),u=h.useRef(null),d=h.useRef(0),f=h.useRef(null),x=h.useRef({bids:new Map,asks:new Map}),g=h.useRef(!1),y=h.useRef(!0),[v,C]=h.useState({bids:[],asks:[]}),[S,T]=h.useState("COIN"),[I,L]=h.useState(null),[F,$]=h.useState([]),O=(ge,ve)=>S==="USD"?ge*ve:ge,U=S==="USD"?"USD":e?String(e):"COIN";h.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]);const Y=()=>{g.current||(g.current=!0,requestAnimationFrame(()=>{if(g.current=!1,!y.current)return;const ge=x.current;if(!((ge==null?void 0:ge.bids)instanceof Map)||!((ge==null?void 0:ge.asks)instanceof Map))return;const ve=1024,be=Array.from(ge.bids.entries()).map(([je,Fe])=>({px:je,sz:Fe})).sort((je,Fe)=>Fe.px-je.px).slice(0,ve),we=Array.from(ge.asks.entries()).map(([je,Fe])=>({px:je,sz:Fe})).sort((je,Fe)=>je.px-Fe.px).slice(0,ve);C({bids:be,asks:we})}))},re=(ge,ve)=>{const be=x.current||{bids:new Map,asks:new Map};be.bids=new Map,be.asks=new Map,x.current=be;for(const we of ge||[]){const je=sd((we==null?void 0:we.p)??(we==null?void 0:we.price)),Fe=sd((we==null?void 0:we.q)??(we==null?void 0:we.qty));if(!je||!Number.isFinite(Fe)||Fe<=1e-8)continue;const Re=Number(Fe.toFixed(12));Re>1e-8&&be.bids.set(je,Re)}for(const we of ve||[]){const je=sd((we==null?void 0:we.p)??(we==null?void 0:we.price)),Fe=sd((we==null?void 0:we.q)??(we==null?void 0:we.qty));if(!je||!Number.isFinite(Fe)||Fe<=1e-8)continue;const Re=Number(Fe.toFixed(12));Re>1e-8&&be.asks.set(je,Re)}},Q=(ge,ve)=>{for(const be of ge||[]){const we=sd(be==null?void 0:be.p),je=sd(be==null?void 0:be.q);if(!we||!Number.isFinite(je)||je===0)continue;const Re=sd(ve.get(we)||0)+je;if(Math.abs(Re)<=1e-8)ve.delete(we);else{const Qe=Number(Re.toFixed(12));Qe<=0?ve.delete(we):ve.set(we,Qe)}}},q=ge=>{if(!ge)return;const ve=c.current;if(ve&&(ve.readyState===WebSocket.OPEN||ve.readyState===WebSocket.CONNECTING))return;const be=`${o}/stream.extended.exchange/v1/orderbooks/${encodeURIComponent(ge)}`,we=new WebSocket(be);c.current=we,we.onopen=()=>{d.current=0,f.current=null},we.onmessage=je=>{let Fe;try{Fe=JSON.parse(je.data||"{}")}catch{return}const Re=Number(Fe==null?void 0:Fe.seq);if(Number.isFinite(Re)){const qe=f.current;if(qe!=null&&Re!==qe+1){try{we.close()}catch{}return}f.current=Re}const Qe=String((Fe==null?void 0:Fe.type)||"").toUpperCase(),Ye=Fe==null?void 0:Fe.data;if(!Ye)return;const dt=Array.isArray(Ye)?Ye.find(qe=>String(qe==null?void 0:qe.m)===String(ge)):Ye;if(!dt||String(dt==null?void 0:dt.m)!==String(ge))return;const st=String((dt==null?void 0:dt.t)||Qe).toUpperCase(),at=(dt==null?void 0:dt.b)||[],He=(dt==null?void 0:dt.a)||[];if(st==="SNAPSHOT")re(at,He);else if(st==="DELTA"){const qe=x.current;qe!=null&&qe.bids||(qe.bids=new Map),qe!=null&&qe.asks||(qe.asks=new Map),Q(at,qe.bids),Q(He,qe.asks)}else return;Y()},we.onclose=()=>{d.current=Math.min(d.current+1,6),!u.current&&(u.current=setTimeout(()=>{u.current=null,q(ge)},500*Math.pow(2,d.current)))},we.onerror=()=>{try{we.close()}catch{}}};h.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:[]}),$([]),L(null),!t)return;let ge=!1;return(async()=>{try{const ve=await ebn(a,t);if(ge)return;re(((ve==null?void 0:ve.bids)||[]).map(be=>({price:be.price,qty:be.qty})),((ve==null?void 0:ve.asks)||[]).map(be=>({price:be.price,qty:be.qty}))),Y()}catch{}})(),q(t),(async()=>{const ve=await tbn({apiBaseUrl:a,market:t,baseSymbol:e||t.split("-")[0]});ge||($(ve),L(ve[0]??null))})(),()=>{ge=!0}},[t,e,a,o]);const te=h.useMemo(()=>(v.bids||[]).map(ge=>sd(ge.px)).filter(ge=>Number.isFinite(ge)&&ge>0),[v]),fe=h.useMemo(()=>(v.asks||[]).map(ge=>sd(ge.px)).filter(ge=>Number.isFinite(ge)&&ge>0),[v]),G=te.length?Math.max(...te):null,ie=fe.length?Math.min(...fe):null;h.useEffect(()=>{G!=null&&ie!=null&&(s==null||s({bestBid:G,bestAsk:ie,mid:(G+ie)/2}))},[G,ie,s]);const oe=h.useMemo(()=>{const ge=Number(I)||1,ve=Vje(v.bids,ge,"bid").sort((we,je)=>je.price-we.price),be=Vje(v.asks,ge,"ask").sort((we,je)=>we.price-je.price);return{bids:ve,asksAsc:be}},[v,I]),K=h.useMemo(()=>{const ge=oe.asksAsc.slice(0,n);let ve=0;return ge.map(we=>(ve+=O(we.size,we.price),{...we,total:ve})).reverse()},[oe,n,S]),H=h.useMemo(()=>{const ge=oe.bids.slice(0,n);let ve=0;return ge.map(be=>(ve+=O(be.size,be.price),{...be,total:ve}))},[oe,n,S]),ee=h.useMemo(()=>{if(G==null||ie==null)return null;const ge=Math.abs(ie-G),ve=(ie+G)/2;return{diff:ge,pct:ve?ge/ve*100:0}},[G,ie]),se=Math.max(K.reduce((ge,ve)=>Math.max(ge,ve.total||0),0),1e-9),pe=Math.max(H.reduce((ge,ve)=>Math.max(ge,ve.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(qje,{value:String(I??""),onChange:ge=>L(Number(ge)),items:(F||[]).map(ge=>({key:String(ge),label:K1n(ge)}))}),i.jsx(qje,{value:S,onChange:T,items:[{key:"USD",label:"USD"},{key:"COIN",label:e||((Se=t==null?void 0:t.split("-"))==null?void 0:Se[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 (",U,")"]}),i.jsxs("span",{className:"uppercase text-right",children:["Total (",U,")"]})]}),i.jsx("div",{className:"flex-1 overflow-hidden w-full",children:i.jsxs("div",{className:"overflow-auto w-full",children:[K.map((ge,ve)=>i.jsx(Wje,{side:"ask",step:Number(I)||1,price:ge.price,size:ge.size!=null?O(ge.size,ge.price):null,total:ge.total,widthPct:ge.total?Math.min(100,ge.total/se*100):0,onClick:()=>ge.price!=null&&(r==null?void 0:r(ge.price)),unit:S},`ask-${ve}`)),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?zje(ee.diff,4):"--"}),i.jsx("span",{className:"text-right",children:ee?`${zje(ee.pct,4)}%`:"--"})]}),H.map((ge,ve)=>i.jsx(Wje,{side:"bid",step:Number(I)||1,price:ge.price,size:ge.size!=null?O(ge.size,ge.price):null,total:ge.total,widthPct:ge.total?Math.min(100,ge.total/pe*100):0,onClick:()=>ge.price!=null&&(r==null?void 0:r(ge.price)),unit:S},`bid-${ve}`))]})})]})}function Wje({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?"—":G1n(e,o)}),i.jsx("span",{className:"text-center text-[#dcdada] hover:text-white",children:c?"—":Uje(n,x)}),i.jsx("span",{className:"text-right text-[#a8a8a8] hover:text-white",children:c?"—":Uje(r,x)})]})]})}function qje({value:t,onChange:e,items:n,align:r="left"}){var l,c;const[s,a]=h.useState(!1),o=h.useRef(null);return h.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 tO="#67FFBD",rbn={type:"spring",stiffness:260,damping:26,mass:1},eGe=t=>{const e=Number(t);return Number.isFinite(e)?e:null},ug=(...t)=>{for(const e of t){const n=eGe(e);if(n!=null)return n}return null},sbn=t=>{const e=eGe(t);return e==null?null:Math.abs(e)>1?e/100:e};function $7({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 nO({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(Ya.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(Ya.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:g2,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[260px] object-cover bg-black"},g2)]}),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:tO},children:"Early Access"}),i.jsxs("div",{className:"text-lg font-semibold",children:["Enter ",i.jsx("span",{style:{color:tO},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:tO},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:tO},children:a})]})]})]})]})}function ibn({data:t,loading:e,error:n,coin:r,setCoin:s,period:a,periods:o,handlePeriodChange:l}){var kn,Gt,mn,gt,Wt,jn;const c=yo(),u=Pl(),{exchange:d,coin:f}=v2(),{address:x,isConnected:g}=ds(),{setSignInConnectButtonOpen:y}=h.useContext(Qr),[v,C]=h.useState("single"),[S,T]=h.useState("BTC/ETH"),[I,L]=h.useState([]),[F,$]=h.useState(2),[O,U]=h.useState("1m"),[Y,re]=h.useState(null),[Q,q]=h.useState(null),[te,fe]=h.useState({}),[G,ie]=h.useState({id:null,address:null}),[oe,K]=h.useState(!1),[H,ee]=h.useState(!1),[se,pe]=h.useState(()=>typeof window>"u"||window.location.hash==="#gridbot"?"grid":window.location.hash==="#trade"?"trade":"grid"),[Se,ge]=h.useState([]),[ve,be]=h.useState(()=>d==="lighter"?"lighter":d==="extended"?"extended":"hyperliquid"),[we,je]=h.useState(()=>r||f||"BTC"),[Fe,Re]=h.useState(()=>d==="lighter"&&f||"BTC"),[Qe,Ye]=h.useState(()=>d==="extended"&&f||"BTC"),[dt,st]=h.useState(null),[at,He]=h.useState(!1),[qe,vt]=h.useState(null),[yt,Kt]=h.useState(!1),[jt,un]=h.useState(null),[vn,Hn]=h.useState(!1),[ln,Nn]=h.useState({address:null,token:null}),[dn,rt]=h.useState(!1),[nt,Ut]=h.useState(!1),[wn,Jt]=h.useState(!1),[Vt,xt]=h.useState(!1),[We,Pt]=h.useState(""),[Ke,ct]=h.useState(!1),[Nt,Ht]=h.useState(""),Rt=h.useRef(null),hn=h.useRef(null),yn=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,Cn=kt=>U(kt),En=hP(),Rn=yfe(),Mn=vfe(),Yn=ve==="hyperliquid"?En:ve==="lighter"?Rn:Mn,Zn=ve==="hyperliquid"?!En.length:ve==="lighter"?!Rn.length:!Mn.length,Vn=ve==="hyperliquid"?we:ve==="lighter"?Fe:Qe,tr=ve==="hyperliquid"&&v==="pair"?S:Vn,Sn=ve==="hyperliquid"&&v==="pair"&&S.split("/")[0]||we,ze=h.useMemo(()=>ve==="lighter"&&Vn?Rn.find(kt=>kt.symbol===Vn):null,[ve,Rn,Vn]),xe=(ze==null?void 0:ze.marketIndex)??(ze==null?void 0:ze.market_id)??(ze==null?void 0:ze.id)??((kn=ze==null?void 0:ze.raw)==null?void 0:kn.marketIndex)??((Gt=ze==null?void 0:ze.raw)==null?void 0:Gt.market_id)??((mn=ze==null?void 0:ze.raw)==null?void 0:mn.id)??null,Ge=h.useMemo(()=>{if(!Vn)return null;const kt=String(Vn||"").toUpperCase(),cn=kt.replace(/-USD$/,"");return Mn.find(Ce=>{const m=String((Ce==null?void 0:Ce.symbol)||"").toUpperCase(),p=String((Ce==null?void 0:Ce.rawSymbol)||"").toUpperCase();return m===kt||p===kt||m===cn||p===cn})||null},[Mn,Vn]),_e=h.useMemo(()=>{if(Ge!=null&&Ge.rawSymbol)return Ge.rawSymbol;if(!Vn)return"";const kt=String(Vn||"").toUpperCase();return kt.includes("-")?kt:`${kt}-USD`},[Ge,Vn]),Be=h.useMemo(()=>Ge!=null&&Ge.symbol?Ge.symbol:Vn?String(Vn||"").toUpperCase().replace(/-USD$/,"").replace(/\/USD$/,""):"",[Ge,Vn]),qt=h.useMemo(()=>{const kt=(Ge==null?void 0:Ge.lastPrice)??(Ge==null?void 0:Ge.last);if(kt!=null&&Number.isFinite(Number(kt)))return Number(kt);const cn=Ge==null?void 0:Ge.marketStats,Ce=(cn==null?void 0:cn.lastPrice)??(cn==null?void 0:cn.markPrice)??(Ge==null?void 0:Ge.markPrice)??null;return Ce!=null&&Number.isFinite(Number(Ce))?Number(Ce):null},[Ge]);h.useEffect(()=>{u.hash==="#gridbot"?pe("grid"):u.hash==="#trade"?pe("trade"):u.hash||pe("grid")},[u.hash]),h.useEffect(()=>{d==="lighter"&&ve!=="lighter"?be("lighter"):d==="hyperliquid"&&ve!=="hyperliquid"?be("hyperliquid"):d==="extended"&&ve!=="extended"&&be("extended")},[d,ve]),h.useEffect(()=>{d==="hyperliquid"?f&&f!==we&&(je(f),s(f)):d==="lighter"?f&&f!==Fe&&Re(f):d==="extended"&&f&&f!==Qe&&Ye(f)},[d,f,we,Fe,Qe,s]),h.useEffect(()=>{const kt=()=>{if(typeof window>"u")return;const cn=window.localStorage.getItem("hyperAddress"),Ce=window.localStorage.getItem("hyperToken");Nn({address:cn,token:Ce})};return kt(),window.addEventListener("localStorageUpdated",kt),window.addEventListener("storage",kt),()=>{window.removeEventListener("localStorageUpdated",kt),window.removeEventListener("storage",kt)}},[]);const It=h.useMemo(()=>!ln.address||!ln.token?!1:yn?!0:x?ln.address.toLowerCase()===x.toLowerCase():!1,[ln.address,ln.token,x,yn]);h.useEffect(()=>{if(!It){rt(!1),Ut(!1),Jt(!1),xt(!1),Pt(""),Ht("");return}if(dn)return;let kt=!1;return(async()=>{if(typeof window>"u")return;const Ce=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!Ce||!m){kt||(rt(!0),Ut(!1),Jt(!1));return}xt(!0);try{const p=await bi(m.toLowerCase(),Ce);if(kt)return;const N=(p==null?void 0:p.data)||p||{},A=(N==null?void 0:N.data)||N||{},k=A.grid_hyper_alpha_code??N.grid_hyper_alpha_code??!1,P=A.grid_lighter_alpha_code??N.grid_lighter_alpha_code??!1;Ut(!k),Jt(!P),rt(!0)}catch{kt||(Ut(!1),Jt(!1),rt(!0))}finally{kt||xt(!1)}})(),()=>{kt=!0}},[It,dn]),h.useEffect(()=>{It&&rt(!1)},[ve,It]),h.useEffect(()=>{(ve!=="lighter"||se!=="grid")&&(Pt(""),Ht(""))},[ve,se]);const mt=async()=>{var kt,cn,Ce,m;if(!We.trim()){fn.error("Please enter your alpha code");return}if(!ln.address||!ln.token){fn.error("Please sign in again");return}ct(!0),Ht("");try{const p={address:ln.address.toLowerCase(),token:ln.token,alpha_code:We.trim(),source_market:ve==="hyperliquid"?"hyper":"lighter",app_type:"grid_bot"},A=(await Ns.post("https://dextrabothypev2.nftinit.io/api/subscriber/alpha_code/set/",p)).data||{};if(A.success){const k=A.message||"Alpha code added successfully";fn.success(k),Ht(k),ve==="hyperliquid"?Ut(!1):ve==="lighter"&&Jt(!1),rt(!0)}else{const k=A.error_message||A.message||"This alpha code is invalid";fn.error(k),Ht(k)}}catch(p){const N=((cn=(kt=p==null?void 0:p.response)==null?void 0:kt.data)==null?void 0:cn.error_message)||((m=(Ce=p==null?void 0:p.response)==null?void 0:Ce.data)==null?void 0:m.message)||p.message||"Failed to validate alpha code";fn.error(N),Ht(N)}finally{ct(!1)}};h.useEffect(()=>{ve==="hyperliquid"?s(we):ve==="lighter"?!Fe&&Rn.length>0&&Re(Rn[0].symbol):ve==="extended"&&!Qe&&Mn.length>0&&Ye(Mn[0].symbol)},[ve,we,Fe,Qe,Rn,Mn,s]),h.useEffect(()=>{if(ve!=="extended"||!Mn.length)return;const kt=Mn.some(cn=>cn.symbol===Qe);(!Qe||!kt)&&Ye(Mn[0].symbol)},[ve,Qe,Mn]),h.useEffect(()=>{if(!x){if(yn&&ln.address){ie(kt=>kt.address&&kt.address.toLowerCase()===ln.address.toLowerCase()?kt:{id:null,address:ln.address});return}ie(kt=>kt.address?{id:null,address:null}:kt);return}ie(kt=>kt.address&&kt.address.toLowerCase()===x.toLowerCase()?kt:{id:null,address:x})},[x,ln.address,yn]),h.useEffect(()=>{if(ve!=="hyperliquid"){if(Rt.current){try{Rt.current.close()}catch{}Rt.current=null}L([]),hn.current=null;return}if(!Sn)return;const kt=(cn,Ce)=>{if(cn)try{cn.readyState===WebSocket.OPEN&&cn.send(JSON.stringify(Ce))}catch(m){console.error("activeAssetCtx ws send error",m)}};if(Rt.current){const cn=Rt.current;hn.current&&hn.current!==Sn&&kt(cn,{method:"unsubscribe",subscription:{type:"activeAssetCtx",coin:hn.current}}),kt(cn,{method:"subscribe",subscription:{type:"activeAssetCtx",coin:Sn}})}else{const cn=new WebSocket("wss://api-ui.hyperliquid.xyz/ws");Rt.current=cn,cn.onopen=()=>{kt(cn,{method:"subscribe",subscription:{type:"activeAssetCtx",coin:Sn}})},cn.onmessage=Ce=>{var p;let m;try{m=JSON.parse(Ce.data)}catch(N){console.error("activeAssetCtx ws parse error",N);return}(p=m==null?void 0:m.data)!=null&&p.ctx&&L({...m.data.ctx,source:"hyperliquid"})},cn.onclose=()=>{Rt.current===cn&&(Rt.current=null)},cn.onerror=Ce=>{console.error("activeAssetCtx ws error",Ce)}}hn.current=Sn},[Sn,ve]),h.useEffect(()=>()=>{Rt.current&&(Rt.current.close(),Rt.current=null)},[]),h.useEffect(()=>{if(ve!=="lighter")return;if(!Vn){L([]);return}const kt=Rn.find(k=>k.symbol===Vn);if(!kt||!kt.raw){L([]);return}const cn=kt.raw,Ce=Number(cn.last_trade_price??0)||0,m=Number(cn.daily_price_change??0)||0,p=Number(cn.daily_quote_token_volume??0)||0,N=Number(cn.open_interest??0)||0,A=m&&Ce?Ce/(1+m/100):Ce;L({markPx:Ce,oraclePx:Ce,prevDayPx:A,dayNtlVlm:p,openInterest:N,funding:0,source:"lighter"})},[ve,Vn,Rn]),h.useEffect(()=>{if(ve!=="extended")return;if(!Ge){L([]);return}const kt=Ge.marketStats||{},cn=ug(kt.markPrice,kt.lastPrice,kt.indexPrice,Ge.markPrice,Ge.lastPrice,Ge.last),Ce=ug(kt.indexPrice,kt.markPrice,kt.lastPrice,Ge.indexPrice,cn),m=ug(kt.dailyPriceChange,Ge.dailyPriceChange),p=ug(kt.dailyPriceChangePercentage,Ge.dailyPriceChangePercentage,Ge.change24hPct,Ge.chg24),N=sbn(p);let A=null;if(cn!=null){if(m!=null){const ue=cn-m;Number.isFinite(ue)&&ue>0&&(A=ue)}if(A==null&&N!=null){const ue=1+N;if(Number.isFinite(ue)&&ue!==0){const me=cn/ue;Number.isFinite(me)&&me>0&&(A=me)}}}const k=ug(kt.dailyVolume,Ge.volume,Ge.vol),P=ug(kt.openInterestBase,Ge.openInterestBase),D=ug(kt.openInterest,Ge.openInterestUsd,Ge.openInterest);let V=P;V==null&&D!=null&&Ce!=null&&Ce>0&&(V=D/Ce);const Z=ug(kt.fundingRate,Ge.fundingRate,Ge.funding),ce=ug(kt.nextFundingRate,Ge.nextFundingRate);L({markPx:cn,oraclePx:Ce,prevDayPx:A,dayNtlVlm:k,openInterest:V,funding:Z,nextFundingTime:ce,source:"extended"})},[ve,Ge]),h.useEffect(()=>{ve==="hyperliquid"&&ge([])},[ve]),h.useEffect(()=>{ve==="lighter"&&(re(null),q(null))},[ve]),h.useEffect(()=>{if(ve!=="lighter"){st(null);return}if(!g||!x){st(null);return}let kt=!1;return(async()=>{if(typeof window>"u")return;const Ce=ln.address,m=ln.token;if(!Ce||!m){kt||st(null);return}if(Ce.toLowerCase()!==x.toLowerCase()){kt||st(null);return}He(!0);try{const p=await Ns.post("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{address:Ce,token:m});if(kt)return;const N=p.data;let A=[];if(Array.isArray(N)?A=N:N&&Array.isArray(N.data)?A=N.data:N&&N.wallet_id!=null&&(A=[N]),!A.length)st(null);else{const k=A[0],P={id:k.wallet_id,address:k.wallet_address,name:k.wallet_name};st(P),ie({id:P.id,address:P.address})}}catch{kt||st(null)}finally{kt||He(!1)}})(),()=>{kt=!0}},[ve,g,x,ln.address,ln.token]),h.useEffect(()=>{if(ve!=="extended"){vt(null);return}const kt=ln.address,cn=ln.token;if(!kt||!cn){vt(null);return}if(!yn&&x&&kt.toLowerCase()!==x.toLowerCase()){vt(null);return}let Ce=!1;return(async()=>{Kt(!0);try{const p=await Ns.post("https://dextrabothypev2.nftinit.io/api/wallet/list-extended",{address:kt,token:cn});if(Ce)return;const N=p.data;let A=[];if(Array.isArray(N)?A=N:N&&Array.isArray(N.data)?A=N.data:N&&N.wallet_id!=null&&(A=[N]),!A.length)vt(null);else{const k=A[0],P={id:k.wallet_id,address:k.wallet_address,name:k.wallet_name};vt(P),ie({id:P.id,address:P.address})}}catch{Ce||vt(null)}finally{Ce||Kt(!1)}})(),()=>{Ce=!0}},[ve,ln.address,ln.token,x,yn]),h.useEffect(()=>{if(ve!=="hyperliquid"){un(null);return}if(!g||!x){un(null);return}let kt=!1;return(async()=>{if(typeof window>"u")return;const Ce=ln.address,m=ln.token;if(!Ce||!m){kt||un(null);return}if(Ce.toLowerCase()!==x.toLowerCase()){kt||un(null);return}Hn(!0);try{const p=await Ns.post("https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list",{address:Ce,token:m});if(kt)return;const N=p.data;let A=!1;Array.isArray(N)?A=N.length>0:N&&Array.isArray(N.data)?A=N.data.length>0:N&&N.wallet_id!=null&&(A=!0),un(A)}catch{kt||un(null)}finally{kt||Hn(!1)}})(),()=>{kt=!0}},[ve,g,x,ln.address,ln.token]);const Ft=kt=>{if(v==="pair")return;const cn=se==="grid"?"#gridbot":"#trade";ve==="hyperliquid"?(je(kt),s(kt),c(`/terminal/hyperliquid/${kt}${cn}`)):ve==="lighter"?(Re(kt),c(`/terminal/lighter/${kt}${cn}`)):(Ye(kt),c(`/terminal/extended/${kt}${cn}`))},Tn=()=>{if(typeof window>"u")return;const kt=ve==="hyperliquid"||ve==="extended"||ve==="lighter"?ve:"extended";window.open(`/dca-bot?market=${kt}`,"_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 kt=we||r||"BTC";pe("grid"),be("hyperliquid"),c(`/terminal/hyperliquid/${kt}#gridbot`)},className:`px-3 py-1 rounded-full transition mr-2 ${ve==="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(yf,{className:"w-4 h-4 text-[#fff] mr-1"}),i.jsx("button",{onClick:()=>{const kt=Fe||"BTC";pe("grid"),be("lighter"),c(`/terminal/lighter/${kt}#gridbot`)},className:`px-3 py-1 rounded-full transition ${ve==="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 kt=Qe||"BTC";pe("grid"),be("extended"),c(`/terminal/extended/${kt}#gridbot`)},className:`px-3 py-1 rounded-full transition ${ve==="extended"?"bg-white text-black":"text:white/60 text-white/60 hover:text-white"}`,children:"Extended"})]})]})}),i.jsx(Ya.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(Ya.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(c0n,{coin:Vn,data:(gt=t.position_info)==null?void 0:gt[0],setIsDigits:$,headerData:I,active:O,onCoinChange:Ft,markets:Yn,marketsLoading:Zn,mode:v,pairKey:S,onPairChange:T})})}),i.jsxs("div",{className:"flex flex-col gap-1 xl:grid xl:h-[600px] rounded-[16px]",style:{gridTemplateColumns:oe?"minmax(0,1fr) 24px":"minmax(0,1fr) 300px"},children:[i.jsxs(Ya.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(Amn,{coin:Vn,data:(Wt=t.position_info)==null?void 0:Wt[0],setIsDigits:$,headerData:I,handleClick:Cn,active:O,onCoinChange:Ft,mode:v,pairKey:S,onPairChange:T,markets:Yn,market:ve})}),i.jsx("div",{className:"flex-1 min-h-0",children:ve==="hyperliquid"?i.jsx(HQ,{coin:tr,interval:O,walletAddress:G==null?void 0:G.address,gridLines:se==="grid"?Se:[],market:"hyperliquid"},`hl-${tr}-${O}`):ve==="lighter"?i.jsx(HQ,{coin:Vn,interval:"1h",walletAddress:G==null?void 0:G.address,gridLines:se==="grid"?Se:[],market:"lighter",lighterMarketId:xe},`lighter-${Vn}-${O}-${xe||"x"}`):i.jsx(HQ,{coin:Vn,interval:O,walletAddress:G==null?void 0:G.address,gridLines:se==="grid"?Se:[],market:"extended",extendedMarket:_e,extendedLastPrice:qt},`extended-${Vn}-${O}-${_e||"x"}`)})]}),i.jsxs(Ya.div,{className:"hidden sm:flex w-full xl:h-full xl:min-h-0 relative rounded-[16px]",children:[!oe&&i.jsxs("div",{className:"group relative w-full h-full bg-[#101010] border border-[#292929] rounded-[16px] overflow-hidden",children:[i.jsx("button",{onClick:()=>K(!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"})})})}),ve==="hyperliquid"?i.jsx(I0n,{className:"w-full xl:h-full xl:min-h-0 overflow-y-auto",coin:r,data:e?[]:(jn=t.position_info)==null?void 0:jn[0],loading:e,period:a,periods:o,handlePeriodChange:l,onBookPrice:kt=>re(kt),onBest:({mid:kt})=>q(kt)}):ve==="lighter"?xe!=null?i.jsx(q1n,{marketId:xe,baseSymbol:Vn,rows:10,onSelectPrice:kt=>re(kt),onBest:({mid:kt})=>q(kt)}):i.jsx($7,{title:"Lighter Order Book",subtitle:"Select a market to see the order book"}):i.jsx(nbn,{market:_e,baseSymbol:Be||Vn,rows:10,onSelectPrice:kt=>re(kt),onBest:({mid:kt})=>q(kt)})]}),oe&&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:()=>K(!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(Ya.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 kt=ve==="hyperliquid"?we||r||"BTC":ve==="lighter"?Fe||"BTC":Qe||"BTC";ge([]),pe("trade"),c(`/terminal/${ve}/${kt}#trade`)},className:`px-3 py-1 rounded-full transition ${se==="trade"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:"Trade"}),i.jsx("button",{onClick:()=>{const kt=ve==="hyperliquid"?we||r||"BTC":ve==="lighter"?Fe||"BTC":Qe||"BTC";pe("grid"),c(`/terminal/${ve}/${kt}#gridbot`)},className:`px-3 py-1 rounded-full transition ${se==="grid"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:ve==="hyperliquid"?"HL Grid Bot":ve==="lighter"?"Lighter Grid Bot":"Extended Grid Bot"}),(ve==="extended"||ve==="hyperliquid")&&i.jsx("button",{onClick:Tn,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:se==="trade"?ve==="hyperliquid"?i.jsx(bje,{coin:r,midPrice:Q,selectedPrice:Y,maxLeverage:te[r]||25,wallet:G,onWalletChange:ie,uiMode:v,pairKey:S},`trade-${G.address}`):ve==="lighter"?i.jsx("div",{className:"h-[260px]",children:i.jsx($7,{title:"Lighter Perp Trading",subtitle:"Coming Soon"})}):i.jsx("div",{className:"h-[260px]",children:i.jsx($7,{title:"Extended Perp Trading",subtitle:"Coming Soon"})}):ve==="hyperliquid"?vn||Vt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Hyperliquid account…"}):It?nt?i.jsx(nO,{code:We,onCodeChange:Pt,onSubmit:mt,loading:Ke,checking:Vt,message:Nt}):jt===!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(Oje,{coin:Vn,midPrice:Q,selectedPrice:Y,wallet:G,onWalletChange:ie,onLevelsChange:ge}):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)})})]}):ve==="lighter"?at||Vt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60 py-6",children:"Loading Lighter account…"}):It?wn?i.jsx(nO,{code:We,onCodeChange:Pt,onSubmit:mt,loading:Ke,checking:Vt,message:Nt}):dt?i.jsx(Ije,{coin:Vn,midPrice:Q,selectedPrice:Y,wallet:G,onLevelsChange:ge}):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)})})]}):yt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60 py-6",children:"Loading Extended account…"}):It?qe?i.jsx(Lje,{coin:Vn,midPrice:Q,selectedPrice:Y,wallet:G,onLevelsChange:ge}):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)})})]})})]}),ve==="lighter"&&It&&i.jsx(Ya.div,{className:"xl:hidden bg-[#101010] border border-[#292929] rounded-[16px] overflow-hidden",children:i.jsx($M,{walletAddress:G==null?void 0:G.address,sourceMarket:"lighter"})}),i.jsx(Ya.div,{className:"h-[500px] bg-[#101010] border border-[#292929] overflow-hidden rounded-[16px]",children:ve==="hyperliquid"?i.jsx(c1n,{data:t.positions_list,loading:e,error:n,isDigits:F,period:a,periods:o,handlePeriodChange:l,className:"h-full",minHeight:"min-h-0",walletAddress:G==null?void 0:G.address,coin:r,sourceMarket:"hyper"},`tabs-${G.address}`):ve==="lighter"?It?i.jsx($M,{walletAddress:G==null?void 0:G.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($M,{walletAddress:G==null?void 0:G.address,sourceMarket:"extended"})})]}),i.jsxs(Ya.div,{animate:{width:H?28:350},transition:rbn,className:"hidden xl:flex flex-col gap-1 rounded-[16px] overflow-visible",style:{minWidth:H?28:350},children:[!H&&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 kt=ve==="hyperliquid"?we||r||"BTC":ve==="lighter"?Fe||"BTC":Qe||"BTC";pe("trade"),ge([]),c(`/terminal/${ve}/${kt}#trade`)},className:`px-3 py-1 rounded-full transition ${se==="trade"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:"Trade"}),i.jsx("button",{onClick:()=>{const kt=ve==="hyperliquid"?we||r||"BTC":ve==="lighter"?Fe||"BTC":Qe||"BTC";pe("grid"),c(`/terminal/${ve}/${kt}#gridbot`)},className:`px-3 py-1 rounded-full transition ${se==="grid"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:"Grid Bot"}),(ve==="extended"||ve==="hyperliquid")&&i.jsx("button",{onClick:Tn,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:se==="trade"?ve==="hyperliquid"?i.jsx(bje,{coin:r,midPrice:Q,selectedPrice:Y,maxLeverage:te[r]||25,wallet:G,onWalletChange:ie,uiMode:v,pairKey:S}):ve==="lighter"?i.jsx($7,{title:"Lighter Perp Trading",subtitle:"Coming Soon"}):i.jsx($7,{title:"Extended Perp Trading",subtitle:"Coming Soon"}):ve==="hyperliquid"?vn||Vt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Hyperliquid account…"}):It?nt?i.jsx(nO,{code:We,onCodeChange:Pt,onSubmit:mt,loading:Ke,checking:Vt,message:Nt}):jt===!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(Oje,{coin:Vn,midPrice:Q,selectedPrice:Y,wallet:G,onWalletChange:ie,onLevelsChange:ge}):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)})})]}):ve==="lighter"?at||Vt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Lighter account…"}):It?wn?i.jsx(nO,{code:We,onCodeChange:Pt,onSubmit:mt,loading:Ke,checking:Vt,message:Nt}):dt?i.jsx(Ije,{coin:Vn,midPrice:Q,selectedPrice:Y,wallet:G,onLevelsChange:ge}):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)})})]}):yt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Extended account…"}):It?qe?i.jsx(Lje,{coin:Vn,midPrice:Q,selectedPrice:Y,wallet:G,onLevelsChange:ge}):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)})})]})})]}),H&&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:se==="trade"?"Trade Panel":"Grid Bot"})]})]})]})})]})}const abn=()=>{ds();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}=h.useContext(Qr),{coin:x}=v2(),[g,y]=h.useState(x||"BTC"),v=hP();function C(ee){return ee?ee.includes(":")?ee.split(":")[1]:ee:""}function S(ee){if(!ee)return"";if(ee.includes(":")){const[se,pe]=ee.split(":");return`${pe} (${se})`}return ee}const T=C(g),I=v.find(ee=>ee.symbol===`${T}-USD`||ee.symbol===`${T}-USDH`||ee.symbol===`${T}-USDC`),L=(I==null?void 0:I.last)??(I==null?void 0:I.coin),$=`${L?(ee=>{if(ee==null||!isFinite(ee))return"";const se=Number(ee),pe=Math.abs(se),Se=pe>=1e3?0:pe>=1?2:pe>=.1?6:7,ge=se.toFixed(Se);return Number(ge).toLocaleString(void 0,{maximumFractionDigits:Se})})(L):""} | ${S(g)} | Dextrabot | Top Hyperliquid Wallets`;h.useEffect(()=>{$&&(document.title=$)},[$]);const[O,U]=h.useState([]),[Y,re]=h.useState(!1),[Q,q]=h.useState(null);h.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")),G=!isNaN(fe)&&te[fe]?te[fe].value:te[1].value,[ie,oe]=h.useState(G),K=ee=>{oe(Number(ee)),localStorage.setItem("ticker_period",te.findIndex(se=>se.value===Number(ee)).toFixed(0))},H=async({coin:ee,period:se})=>{try{re(!0);const pe=`https://dextradata.nftinit.io/api/hyper/terminal/v2/${ee}/${se}`,Se=await fetch(pe);if(!Se.ok)throw U([]),new Error("Network response was not ok");const ge=await Se.json();ge!=null&&ge.success?(U(ge),re(!1),window.localStorage.getItem("hyperToken")&&(d(),f())):(U([]),re(!1),q(ge==null?void 0:ge.error_message))}catch(pe){q(pe.message),re(!1)}};return h.useEffect(()=>{g&&ie&&H({coin:g,period:ie})},[g,ie]),h.useEffect(()=>{(async()=>{var Se,ge;const se=window.localStorage.getItem("hyperToken"),pe=window.localStorage.getItem("hyperAddress");if(!(!se||!pe))try{const ve=await bi(pe.toLowerCase(),se);ve!=null&&ve.success?(t(ve==null?void 0:ve.telegram_chat_id),e(ve==null?void 0:ve.subscriber_role),n(ve==null?void 0:ve.subs_expire_day),r((Se=ve==null?void 0:ve.mushboomer_counts)==null?void 0:Se.eth),a((ge=ve==null?void 0:ve.mushboomer_counts)==null?void 0:ge.sol),o(ve==null?void 0:ve.referral_code),l(ve==null?void 0:ve.refcode),s(ve==null?void 0:ve.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(ve){console.error("Token verification error:",ve)}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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(ibn,{data:O,loading:Y,error:Q,coin:g,setCoin:y,period:ie,periods:te,handlePeriodChange:K})})})]})},obn="https://dextradata.nftinit.io/api/hyper/whale_stats/v2/",Lh=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)}`},dg=t=>t==null?"-":`${Number(t).toFixed(1)}%`,rO=t=>`calc(${t}%)`;function lbn({onData:t}){const[e,n]=h.useState(null);if(h.useEffect(()=>{let l=null;const c=()=>Ns.get(obn).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:_ct,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(as,{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:Lh(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:rO(r)},children:dg(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:rO(s)},children:dg(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:Lh(e.long.position)}),i.jsxs("span",{className:"text-[#909090]",children:["(",dg(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:Lh(e.short.position)}),i.jsxs("span",{className:"text-[#909090]",children:["(",dg(s),")"]})]})]})]}),i.jsx("div",{className:"h-px w-full bg-[#262626]"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(as,{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:Lh(e.total_margin)}),i.jsx(as,{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:["(",dg(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(Yie,{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(Vl,{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:rO(a)},children:dg(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:rO(o)},children:dg(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:Lh(e.long.margin)}),i.jsxs("span",{children:["(",dg(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:Lh(e.short.margin)}),i.jsxs("span",{children:["(",dg(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(as,{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:Lh(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"," ",Lh(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"," ",Lh(e.short.pnl)]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(as,{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:Lh(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"," ",Lh(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"," ",Lh(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]"}},Rk=[{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"}],wfe=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]},cbn="https://dextradata.nftinit.io/api/hyper/trade/highVolumeTrades/",ubn=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`},DC=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)}`},dbn=t=>t<250?1:t<1e4?2:t<5e4?3:t<1e5?4:t<5e5?5:t<1e6?6:t<5e6?7:8,Gje=t=>wfe(dbn(t)),Kje=()=>{const[t,e]=h.useState([]),[n,r]=h.useState(!0),[s,a]=h.useState(Date.now()),[o,l]=h.useState(""),c=h.useCallback(async(x=!1)=>{x&&r(!0);try{const g=await Ns.post(cbn,{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)}},[]);h.useEffect(()=>{c(!0);const x=setInterval(c,3e4);return()=>clearInterval(x)},[c]);const u=h.useMemo(()=>o?t.filter(x=>{var y;if(!o)return!0;const g=Gje((x==null?void 0:x.global_account_value)??0);return o===((y=Rk.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=Gje(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:Zi,className:"w-5 h-5"}),g.coin]})},{key:"activity",label:"Activity",width:"140px",render:(x,g)=>{var L,F,$,O;const y=(L=g==null?void 0:g.position_details)==null?void 0:L.direction,v=y==="Long",C=y==="Short",S=(O=($=(F=g==null?void 0:g.position_details)==null?void 0:F.position)==null?void 0:$.leverage)==null?void 0:O.value,T=g.side==="Change Position"?v?"Short > Long":"Long > Short":y??"Position Close",I=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:[I&&i.jsx(Us,{className:`w-3 h-3 ${v?"rotate-180 text-[#67ffbd]":"text-[#ff787b]"}`}),T]}),S&&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:[S,"X"]})]})}},{key:"current_trade_value",label:"Trade",width:"80px",sortable:!0,render:x=>DC(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?DC(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?DC(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 S,T;const y=(T=(S=g==null?void 0:g.position_details)==null?void 0:S.position)==null?void 0:T.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)?"-":DC(Math.abs(y)),!isNaN(y)&&i.jsx("img",{src:v?N9:S9,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?`${DC(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 S,T;const y=parseFloat((T=(S=g==null?void 0:g.position_details)==null?void 0:S.position)==null?void 0:T.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)?"-":`${DC(Math.abs(y))}`,!isNaN(y)&&i.jsx("img",{src:v?N9:S9,className:"ml-[6px] w-[9px] h-[8px]",alt:""})]})}},{key:"flags",label:i.jsx(as,{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 S="",T=null;return v===null?(S="bg-[#747474]",T=m_e):v===!0?(S="bg-[#67FFBD]",T=p_e):(S="bg-[#FF9C9C]",T=x_e),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] ${S} ${C!==0?"-ml-[6px]":""}`,children:i.jsx(T,{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:ubn(new Date((y=g.insert_date)==null?void 0:y.$date).getTime())})}}],f=(x,g)=>{var L;const v=((L=x==null?void 0:x.position_details)==null?void 0:L.direction)==="Long",C=x.current_trade_value>=5e6,S=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"} ${S} ${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(as,{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"}),Rk.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(as,{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")})})]})})},V8=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)},tGe=(t,e)=>Math.floor(t/Math.pow(10,e)%10),Zse=(t,e)=>!(tGe(t,e)%2),ku=(t,e,n)=>{const r=t%e;return n&&tGe(t,n)%2===0?-r:r},w5=(t,e,n)=>e[t%n],fbn=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"},hbn=4,uo=80;function pbn(t,e){const n=V8(t),r=e&&e.length;return Array.from({length:hbn},(s,a)=>({color:w5(n+a,e,r),translateX:ku(n*(a+1),uo/2-(a+17),1),translateY:ku(n*(a+1),uo/2-(a+17),2),rotate:ku(n*(a+1),360),isSquare:Zse(n,2)}))}const Yje=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=pbn(t,e),l=h.useId();return i.jsxs("svg",{viewBox:"0 0 "+uo+" "+uo,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:uo,height:uo,children:i.jsx("rect",{width:uo,height:uo,rx:r?void 0:uo*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("rect",{width:uo,height:uo,fill:o[0].color}),i.jsx("rect",{x:(uo-60)/2,y:(uo-20)/2,width:uo,height:o[1].isSquare?uo:uo/8,fill:o[1].color,transform:"translate("+o[1].translateX+" "+o[1].translateY+") rotate("+o[1].rotate+" "+uo/2+" "+uo/2+")"}),i.jsx("circle",{cx:uo/2,cy:uo/2,fill:o[2].color,r:uo/5,transform:"translate("+o[2].translateX+" "+o[2].translateY+")"}),i.jsx("line",{x1:0,y1:uo/2,x2:uo,y2:uo/2,strokeWidth:2,stroke:o[3].color,transform:"translate("+o[3].translateX+" "+o[3].translateY+") rotate("+o[3].rotate+" "+uo/2+" "+uo/2+")"})]})]})},zv=90,mbn=5;function xbn(t,e){const n=V8(t),r=e&&e.length,s=Array.from({length:mbn},(o,l)=>w5(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 gbn=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=xbn(t,e),l=ke.useId();return i.jsxs("svg",{viewBox:"0 0 "+zv+" "+zv,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:zv,height:zv,children:i.jsx("rect",{width:zv,height:zv,rx:r?void 0:zv*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]})]})]})},bbn=64,Hv=80;function ybn(t,e){const n=V8(t),r=e&&e.length;return Array.from({length:bbn},(s,a)=>w5(n%(a+1),e,r))}const vbn=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=ybn(t,e),l=h.useId();return i.jsxs("svg",{viewBox:"0 0 "+Hv+" "+Hv,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:Hv,height:Hv,children:i.jsx("rect",{width:Hv,height:Hv,rx:r?void 0:Hv*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]})]})]})},rl=36;function wbn(t,e){const n=V8(t),r=e&&e.length,s=w5(n,e,r),a=ku(n,10,1),o=a<5?a+rl/9:a,l=ku(n,10,2),c=l<5?l+rl/9:l;return{wrapperColor:s,faceColor:fbn(s),backgroundColor:w5(n+13,e,r),wrapperTranslateX:o,wrapperTranslateY:c,wrapperRotate:ku(n,360),wrapperScale:1+ku(n,rl/12)/10,isMouthOpen:Zse(n,2),isCircle:Zse(n,1),eyeSpread:ku(n,5),mouthSpread:ku(n,3),faceRotate:ku(n,10,3),faceTranslateX:o>rl/6?o/2:ku(n,8,1),faceTranslateY:c>rl/6?c/2:ku(n,7,2)}}const Xje=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=wbn(t,e),l=h.useId();return i.jsxs("svg",{viewBox:"0 0 "+rl+" "+rl,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:rl,height:rl,children:i.jsx("rect",{width:rl,height:rl,rx:r?void 0:rl*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("rect",{width:rl,height:rl,fill:o.backgroundColor}),i.jsx("rect",{x:"0",y:"0",width:rl,height:rl,transform:"translate("+o.wrapperTranslateX+" "+o.wrapperTranslateY+") rotate("+o.wrapperRotate+" "+rl/2+" "+rl/2+") scale("+o.wrapperScale+")",fill:o.wrapperColor,rx:o.isCircle?rl:rl/6}),i.jsxs("g",{transform:"translate("+o.faceTranslateX+" "+o.faceTranslateY+") rotate("+o.faceRotate+" "+rl/2+" "+rl/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})]})]})]})},Cbn=4,Wd=80;function Nbn(t,e){const n=V8(t),r=e&&e.length;return Array.from({length:Cbn},(s,a)=>w5(n+a,e,r))}const Sbn=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=Nbn(t,e),l=t.replace(/\s/g,""),c=h.useId();return i.jsxs("svg",{viewBox:"0 0 "+Wd+" "+Wd,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:Wd,height:Wd,children:i.jsx("rect",{width:Wd,height:Wd,rx:r?void 0:Wd*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:Wd/2,y1:0,x2:Wd/2,y2:Wd/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:Wd/2,y1:Wd/2,x2:Wd/2,y2:Wd,gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:o[2]}),i.jsx("stop",{offset:1,stopColor:o[3]})]})]})]})},jbn=3,Cu=80;function Abn(t,e){const n=V8(t),r=e&&e.length;return Array.from({length:jbn},(s,a)=>({color:w5(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 nGe=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=Abn(t,e),l=h.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"})]})})]})},_bn={pixel:vbn,bauhaus:Yje,ring:gbn,beam:Xje,sunset:Sbn,marble:nGe,geometric:Xje,abstract:Yje},rGe=({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=_bn[t]||nGe;return i.jsx(l,{colors:e,name:n,title:r,size:s,square:a,...o})},sO="rgba(155,155,155,0.16)";function Ebn({row:t}){var f,x,g,y,v,C,S,T,I,L,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=(T=(S=t==null?void 0:t.position_details)==null?void 0:S.position)==null?void 0:T.entryPx,l=parseFloat((L=(I=t==null?void 0:t.position_details)==null?void 0:I.position)==null?void 0:L.unrealizedPnl),c=t.side==="Change Position"?r?"Short > Long":"Long > Short":e??"Position Close",u=e==="Long"||e==="Short",d=({label:O,value:U,extraClass:Y=""})=>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:O}),i.jsx("span",{className:`text-[12px] font-semibold leading-[13px] tracking-[0.24px] ${Y}`,children:U})]});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(rGe,{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:Zi,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(Us,{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:sO},className:"h-px w-full"}),i.jsxs("div",{className:"flex divide-x",style:{divideColor:sO},children:[i.jsx(d,{label:"Trade Value",value:`$${Ir(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:Ir(Math.abs(o))})})]}),i.jsx("div",{style:{background:sO},className:"h-px w-full"}),i.jsxs("div",{className:"flex divide-x",style:{divideColor:sO},children:[i.jsx(d,{label:"Size",value:isNaN(a)?"-":Ir(Math.abs(a))}),i.jsx(d,{label:"Entry Price",value:`$${Ir((($=(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?"-":""}$${Ir(Math.abs(l))}`,i.jsx("img",{src:l>0?N9:S9,className:"ml-[6px] w-[9px] h-[8px]"})]})})]})]})}function kbn(){const[t,e]=h.useState(!1);return h.useEffect(()=>{const n=()=>e(window.innerWidth<640);return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}const Tbn="https://dextradata.nftinit.io/api/hyper/trade/highVolumeTrades/",Qje=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`},cZ=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)}`},Pbn=t=>t<250?1:t<1e4?2:t<5e4?3:t<1e5?4:t<5e5?5:t<1e6?6:t<5e6?7:8,Zje=t=>wfe(Pbn(t)),Ibn=()=>{const[t,e]=h.useState([]),[n,r]=h.useState(!0),[s,a]=h.useState(!1),[o,l]=h.useState(Date.now()),[c,u]=h.useState(""),d=kbn(),f=h.useCallback(async(C=!1)=>{C&&r(!0);try{const S=await Ns.post(Tbn,{limit:1e3,offset:0});if(S.data.success){const T=S.data.data.filter(I=>{var L;return!((L=I==null?void 0:I.typeDetail)!=null&&L.includes("Top100Wallet"))});e(T),l(Date.now())}}finally{C&&r(!1)}},[]);h.useEffect(()=>{f(!0);const C=setInterval(f,3e4);return()=>clearInterval(C)},[f]);const x=h.useMemo(()=>c?t.filter(C=>{var T;if(!c)return!0;const S=Zje((C==null?void 0:C.global_account_value)??0);return c===((T=Rk.find(I=>I.label===S.label))==null?void 0:T.id)}):t,[t,c]),g=[{key:"wallet",label:"Address",width:"235px",render:(C,S)=>{const T=(S==null?void 0:S.global_account_value)??0,I=Zje(T);return i.jsx(as,{content:i.jsx(Ebn,{row:S}),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:I.emoji}),i.jsxs("span",{className:"max-w-20 mr-2",children:[S.wallet.slice(0,5),"...",S.wallet.slice(-4)]}),i.jsx("span",{className:`flex justify-center items-center px-1 h-6 rounded-[6px] text-[11px] font-medium ml-[10px] ${I.bg} ${I.txt}`,children:I.label})]})})}},{key:"coin",label:"Symbol",width:"114px",sortable:!0,render:(C,S)=>i.jsxs("div",{className:"flex items-center gap-2 text-[14px]",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${S.coin}.svg`,onError:Zi,className:"w-5 h-5"}),S.coin]})},{key:"activity",label:"Activity",width:"130px",render:(C,S)=>{var U,Y,re,Q;const T=(U=S==null?void 0:S.position_details)==null?void 0:U.direction,I=T==="Long",L=T==="Short",F=(Q=(re=(Y=S==null?void 0:S.position_details)==null?void 0:Y.position)==null?void 0:re.leverage)==null?void 0:Q.value,$=S.side==="Change Position"?I?"Short > Long":"Long > Short":T??"Position Close",O=T==="Long"||T==="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 ${I?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":L?"text-[#ff787b] bg-[rgba(255,131,117,0.16)]":"text-[#8B8B8B] bg-transparent"}`,children:[O&&i.jsx(Us,{className:`w-3 h-3 ${I?"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
${I?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":L?"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=>cZ(C)},{key:"position_value",label:"Position",sortable:!0,width:"85px",sortValue:C=>{var S,T;return Number((T=(S=C==null?void 0:C.position_details)==null?void 0:S.position)==null?void 0:T.positionValue)},render:(C,S)=>{var T,I;return(I=(T=S==null?void 0:S.position_details)==null?void 0:T.position)!=null&&I.positionValue?cZ(S.position_details.position.positionValue):"-"}},{key:"price",label:"Price",width:"80px",sortable:!0,sortValue:C=>{var S,T;return Number((T=(S=C==null?void 0:C.position_details)==null?void 0:S.position)==null?void 0:T.entryPx)},render:(C,S)=>{var T,I;return(I=(T=S==null?void 0:S.position_details)==null?void 0:T.position)!=null&&I.entryPx?cZ(S.position_details.position.entryPx):"-"}},{key:"flags",label:i.jsx(as,{content:"Quick view of this whale’s recent trading performance.",children:i.jsx("span",{children:"Last 5 T."})}),width:"90px",render:(C,S)=>{const T=S.last5Trade??[];return i.jsx("div",{className:"inline-flex h-[18px] px-[2px] py-[4px] justify-center items-center rounded-[6px] overflow-visible",children:T.slice(0,5).map((I,L)=>{let F="",$=null;return I===null?(F="bg-[#747474]",$=m_e):I===!0?(F="bg-[#67FFBD]",$=p_e):(F="bg-[#FF9C9C]",$=x_e),i.jsx("div",{className:`relative z[${L}] w-[18px] h-[18px] flex-shrink-0 flex items-center justify-center rounded-full border-2 border-[#101010] ${F} ${L!==0?"-ml-[6px]":""}`,children:i.jsx($,{className:"w-3 h-3 text-black"})},L)})})}},{key:"insert_date",label:"Time",sortable:!0,width:"80px",sortValue:C=>{var S;return(S=C.insert_date)==null?void 0:S.$date},render:(C,S)=>{var T;return i.jsx("div",{className:"text-gray-400",children:Qje(new Date((T=S.insert_date)==null?void 0:T.$date).getTime())})}}],y=h.useMemo(()=>d?g.slice(1):g,[g,d]),v=(C,S)=>{var U;const I=((U=C==null?void 0:C.position_details)==null?void 0:U.direction)==="Long",L=C.current_trade_value>=5e6,F=L?I?"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
${L?I?"bg-[rgba(103,255,189,0.16)]":"bg-[rgba(255,131,117,0.16)]":S%2===0?"bg-[#191919]":"bg-transparent"} ${F} ${L?I?"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,S)=>i.jsx("div",{className:"h-[34px] w-full bg-[#202020] rounded-md animate-pulse"},S))})]}):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(as,{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 ",Qje(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"}),Rk.map(({id:C,label:S,emoji:T,description:I})=>{const L=c===C;return i.jsx("div",{onClick:()=>u(L?"":C),className:`h-7 w-7 flex items-center justify-center rounded-[8px] text-[18px] transition-colors cursor-pointer ${L?"bg-[#262626]":"hover:bg-[#262626]"}`,children:i.jsx(as,{content:I,children:T})},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:Ect,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 S,T;return((S=C._id)==null?void 0:S.$oid)||((T=C.insert_date)==null?void 0:T.$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(Kje,{})})})}),i.jsx("div",{className:" w-screen h-screen bg-[#101010] flex flex-col overflow-x-auto overflow-y-auto z-[9999]",children:i.jsx(Kje,{})})]})]})};function mi(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 Jje(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Pz(...t){return e=>{let n=!1;const r=t.map(s=>{const a=Jje(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():Jje(t[s],null)}}}}function du(...t){return h.useCallback(Pz(...t),t)}function Q5(t,e=[]){let n=[];function r(a,o){const l=h.createContext(o),c=n.length;n=[...n,o];const u=f=>{var S;const{scope:x,children:g,...y}=f,v=((S=x==null?void 0:x[t])==null?void 0:S[c])||l,C=h.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=h.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=>h.createContext(o));return function(l){const c=(l==null?void 0:l[t])||a;return h.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,Fbn(s,...e)]}function Fbn(...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 h.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var b2=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},Obn=Gy[" useInsertionEffect ".trim().toString()]||b2;function Iz({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,a,o]=Mbn({defaultProp:e,onChange:n}),l=t!==void 0,c=l?t:s;{const d=h.useRef(t!==void 0);h.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=h.useCallback(d=>{var f;if(l){const x=Lbn(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 Mbn({defaultProp:t,onChange:e}){const[n,r]=h.useState(t),s=h.useRef(n),a=h.useRef(e);return Obn(()=>{a.current=e},[e]),h.useEffect(()=>{var o;s.current!==n&&((o=a.current)==null||o.call(a,n),s.current=n)},[n,s]),[n,r,a]}function Lbn(t){return typeof t=="function"}function Dk(t){const e=Rbn(t),n=h.forwardRef((r,s)=>{const{children:a,...o}=r,l=h.Children.toArray(a),c=l.find(Bbn);if(c){const u=c.props.children,d=l.map(f=>f===c?h.Children.count(u)>1?h.Children.only(null):h.isValidElement(u)?u.props.children:null:f);return i.jsx(e,{...o,ref:s,children:h.isValidElement(u)?h.cloneElement(u,void 0,d):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}function Rbn(t){const e=h.forwardRef((n,r)=>{const{children:s,...a}=n;if(h.isValidElement(s)){const o=Ubn(s),l=$bn(a,s.props);return s.type!==h.Fragment&&(l.ref=r?Pz(r,o):o),h.cloneElement(s,l)}return h.Children.count(s)>1?h.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Dbn=Symbol("radix.slottable");function Bbn(t){return h.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Dbn}function $bn(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 Ubn(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 zbn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hc=zbn.reduce((t,e)=>{const n=Dk(`Primitive.${e}`),r=h.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 sGe(t,e){t&&Ea.flushSync(()=>t.dispatchEvent(e))}function iGe(t){const e=t+"CollectionProvider",[n,r]=Q5(e),[s,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=v=>{const{scope:C,children:S}=v,T=ke.useRef(null),I=ke.useRef(new Map).current;return i.jsx(s,{scope:C,itemMap:I,collectionRef:T,children:S})};o.displayName=e;const l=t+"CollectionSlot",c=Dk(l),u=ke.forwardRef((v,C)=>{const{scope:S,children:T}=v,I=a(l,S),L=du(C,I.collectionRef);return i.jsx(c,{ref:L,children:T})});u.displayName=l;const d=t+"CollectionItemSlot",f="data-radix-collection-item",x=Dk(d),g=ke.forwardRef((v,C)=>{const{scope:S,children:T,...I}=v,L=ke.useRef(null),F=du(C,L),$=a(d,S);return ke.useEffect(()=>($.itemMap.set(L,{ref:L,...I}),()=>void $.itemMap.delete(L))),i.jsx(x,{[f]:"",ref:F,children:T})});g.displayName=d;function y(v){const C=a(t+"CollectionConsumer",v);return ke.useCallback(()=>{const T=C.collectionRef.current;if(!T)return[];const I=Array.from(T.querySelectorAll(`[${f}]`));return Array.from(C.itemMap.values()).sort(($,O)=>I.indexOf($.ref.current)-I.indexOf(O.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:o,Slot:u,ItemSlot:g},y,r]}var Hbn=h.createContext(void 0);function aGe(t){const e=h.useContext(Hbn);return t||e||"ltr"}function I1(t){const e=h.useRef(t);return h.useEffect(()=>{e.current=t}),h.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Vbn(t,e=globalThis==null?void 0:globalThis.document){const n=I1(t);h.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 Wbn="DismissableLayer",Jse="dismissableLayer.update",qbn="dismissableLayer.pointerDownOutside",Gbn="dismissableLayer.focusOutside",e8e,oGe=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Fz=h.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=t,u=h.useContext(oGe),[d,f]=h.useState(null),x=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=h.useState({}),y=du(e,O=>f(O)),v=Array.from(u.layers),[C]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),S=v.indexOf(C),T=d?v.indexOf(d):-1,I=u.layersWithOutsidePointerEventsDisabled.size>0,L=T>=S,F=Xbn(O=>{const U=O.target,Y=[...u.branches].some(re=>re.contains(U));!L||Y||(s==null||s(O),o==null||o(O),O.defaultPrevented||l==null||l())},x),$=Qbn(O=>{const U=O.target;[...u.branches].some(re=>re.contains(U))||(a==null||a(O),o==null||o(O),O.defaultPrevented||l==null||l())},x);return Vbn(O=>{T===u.layers.size-1&&(r==null||r(O),!O.defaultPrevented&&l&&(O.preventDefault(),l()))},x),h.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(e8e=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),t8e(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=e8e)}},[d,x,n,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),t8e())},[d,u]),h.useEffect(()=>{const O=()=>g({});return document.addEventListener(Jse,O),()=>document.removeEventListener(Jse,O)},[]),i.jsx(Hc.div,{...c,ref:y,style:{pointerEvents:I?L?"auto":"none":void 0,...t.style},onFocusCapture:mi(t.onFocusCapture,$.onFocusCapture),onBlurCapture:mi(t.onBlurCapture,$.onBlurCapture),onPointerDownCapture:mi(t.onPointerDownCapture,F.onPointerDownCapture)})});Fz.displayName=Wbn;var Kbn="DismissableLayerBranch",Ybn=h.forwardRef((t,e)=>{const n=h.useContext(oGe),r=h.useRef(null),s=du(e,r);return h.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),i.jsx(Hc.div,{...t,ref:s})});Ybn.displayName=Kbn;function Xbn(t,e=globalThis==null?void 0:globalThis.document){const n=I1(t),r=h.useRef(!1),s=h.useRef(()=>{});return h.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let c=function(){lGe(qbn,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 Qbn(t,e=globalThis==null?void 0:globalThis.document){const n=I1(t),r=h.useRef(!1);return h.useEffect(()=>{const s=a=>{a.target&&!r.current&&lGe(Gbn,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 t8e(){const t=new CustomEvent(Jse);document.dispatchEvent(t)}function lGe(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?sGe(s,a):s.dispatchEvent(a)}var uZ=0;function cGe(){h.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??n8e()),document.body.insertAdjacentElement("beforeend",t[1]??n8e()),uZ++,()=>{uZ===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),uZ--}},[])}function n8e(){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 dZ="focusScope.autoFocusOnMount",fZ="focusScope.autoFocusOnUnmount",r8e={bubbles:!1,cancelable:!0},Zbn="FocusScope",Cfe=h.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=t,[l,c]=h.useState(null),u=I1(s),d=I1(a),f=h.useRef(null),x=du(e,v=>c(v)),g=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let v=function(I){if(g.paused||!l)return;const L=I.target;l.contains(L)?f.current=L:Vb(f.current,{select:!0})},C=function(I){if(g.paused||!l)return;const L=I.relatedTarget;L!==null&&(l.contains(L)||Vb(f.current,{select:!0}))},S=function(I){if(document.activeElement===document.body)for(const F of I)F.removedNodes.length>0&&Vb(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const T=new MutationObserver(S);return l&&T.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",C),T.disconnect()}}},[r,l,g.paused]),h.useEffect(()=>{if(l){i8e.add(g);const v=document.activeElement;if(!l.contains(v)){const S=new CustomEvent(dZ,r8e);l.addEventListener(dZ,u),l.dispatchEvent(S),S.defaultPrevented||(Jbn(syn(uGe(l)),{select:!0}),document.activeElement===v&&Vb(l))}return()=>{l.removeEventListener(dZ,u),setTimeout(()=>{const S=new CustomEvent(fZ,r8e);l.addEventListener(fZ,d),l.dispatchEvent(S),S.defaultPrevented||Vb(v??document.body,{select:!0}),l.removeEventListener(fZ,d),i8e.remove(g)},0)}}},[l,u,d,g]);const y=h.useCallback(v=>{if(!n&&!r||g.paused)return;const C=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,S=document.activeElement;if(C&&S){const T=v.currentTarget,[I,L]=eyn(T);I&&L?!v.shiftKey&&S===L?(v.preventDefault(),n&&Vb(I,{select:!0})):v.shiftKey&&S===I&&(v.preventDefault(),n&&Vb(L,{select:!0})):S===T&&v.preventDefault()}},[n,r,g.paused]);return i.jsx(Hc.div,{tabIndex:-1,...o,ref:x,onKeyDown:y})});Cfe.displayName=Zbn;function Jbn(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Vb(r,{select:e}),document.activeElement!==n)return}function eyn(t){const e=uGe(t),n=s8e(e,t),r=s8e(e.reverse(),t);return[n,r]}function uGe(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 s8e(t,e){for(const n of t)if(!tyn(n,{upTo:e}))return n}function tyn(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 nyn(t){return t instanceof HTMLInputElement&&"select"in t}function Vb(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&nyn(t)&&e&&t.select()}}var i8e=ryn();function ryn(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=a8e(t,e),t.unshift(e)},remove(e){var n;t=a8e(t,e),(n=t[0])==null||n.resume()}}}function a8e(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function syn(t){return t.filter(e=>e.tagName!=="A")}var iyn=Gy[" useId ".trim().toString()]||(()=>{}),ayn=0;function hB(t){const[e,n]=h.useState(iyn());return b2(()=>{t||n(r=>r??String(ayn++))},[t]),t||(e?`radix-${e}`:"")}var oyn=typeof document<"u",lyn=function(){},UM=oyn?h.useLayoutEffect:lyn;function pB(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(!pB(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)&&!pB(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function dGe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function o8e(t,e){const n=dGe(t);return Math.round(e*n)/n}function hZ(t){const e=h.useRef(t);return UM(()=>{e.current=t}),e}function cyn(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]=h.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,g]=h.useState(r);pB(x,r)||g(r);const[y,v]=h.useState(null),[C,S]=h.useState(null),T=h.useCallback(K=>{K!==$.current&&($.current=K,v(K))},[]),I=h.useCallback(K=>{K!==O.current&&(O.current=K,S(K))},[]),L=a||y,F=o||C,$=h.useRef(null),O=h.useRef(null),U=h.useRef(d),Y=c!=null,re=hZ(c),Q=hZ(s),q=hZ(u),te=h.useCallback(()=>{if(!$.current||!O.current)return;const K={placement:e,strategy:n,middleware:x};Q.current&&(K.platform=Q.current),H7e($.current,O.current,K).then(H=>{const ee={...H,isPositioned:q.current!==!1};fe.current&&!pB(U.current,ee)&&(U.current=ee,Ea.flushSync(()=>{f(ee)}))})},[x,e,n,Q,q]);UM(()=>{u===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,f(K=>({...K,isPositioned:!1})))},[u]);const fe=h.useRef(!1);UM(()=>(fe.current=!0,()=>{fe.current=!1}),[]),UM(()=>{if(L&&($.current=L),F&&(O.current=F),L&&F){if(re.current)return re.current(L,F,te);te()}},[L,F,te,re,Y]);const G=h.useMemo(()=>({reference:$,floating:O,setReference:T,setFloating:I}),[T,I]),ie=h.useMemo(()=>({reference:L,floating:F}),[L,F]),oe=h.useMemo(()=>{const K={position:n,left:0,top:0};if(!ie.floating)return K;const H=o8e(ie.floating,d.x),ee=o8e(ie.floating,d.y);return l?{...K,transform:"translate("+H+"px, "+ee+"px)",...dGe(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:ee}},[n,l,ie.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:te,refs:G,elements:ie,floatingStyles:oe}),[d,te,G,ie,oe])}const uyn=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?qhe({element:r.current,padding:s}).fn(n):{}:r?qhe({element:r,padding:s}).fn(n):{}}}},dyn=(t,e)=>({...B7e(t),options:[t,e]}),fyn=(t,e)=>({...$7e(t),options:[t,e]}),hyn=(t,e)=>({...jtt(t),options:[t,e]}),pyn=(t,e)=>({...U7e(t),options:[t,e]}),myn=(t,e)=>({...z7e(t),options:[t,e]}),xyn=(t,e)=>({...Stt(t),options:[t,e]}),gyn=(t,e)=>({...uyn(t),options:[t,e]});var byn="Arrow",fGe=h.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...a}=t;return i.jsx(Hc.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"})})});fGe.displayName=byn;var yyn=fGe;function vyn(t){const[e,n]=h.useState(void 0);return b2(()=>{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 Nfe="Popper",[hGe,W8]=Q5(Nfe),[wyn,pGe]=hGe(Nfe),mGe=t=>{const{__scopePopper:e,children:n}=t,[r,s]=h.useState(null);return i.jsx(wyn,{scope:e,anchor:r,onAnchorChange:s,children:n})};mGe.displayName=Nfe;var xGe="PopperAnchor",gGe=h.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,a=pGe(xGe,n),o=h.useRef(null),l=du(e,o);return h.useEffect(()=>{a.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:i.jsx(Hc.div,{...s,ref:l})});gGe.displayName=xGe;var Sfe="PopperContent",[Cyn,Nyn]=hGe(Sfe),bGe=h.forwardRef((t,e)=>{var we,je,Fe,Re,Qe,Ye;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=pGe(Sfe,n),[S,T]=h.useState(null),I=du(e,dt=>T(dt)),[L,F]=h.useState(null),$=vyn(L),O=($==null?void 0:$.width)??0,U=($==null?void 0:$.height)??0,Y=r+(a!=="center"?"-"+a:""),re=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},Q=Array.isArray(u)?u:[u],q=Q.length>0,te={padding:re,boundary:Q.filter(jyn),altBoundary:q},{refs:fe,floatingStyles:G,placement:ie,isPositioned:oe,middlewareData:K}=cyn({strategy:"fixed",placement:Y,whileElementsMounted:(...dt)=>D7e(...dt,{animationFrame:g==="always"}),elements:{reference:C.anchor},middleware:[dyn({mainAxis:s+U,alignmentAxis:o}),c&&fyn({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?hyn():void 0,...te}),c&&pyn({...te}),myn({...te,apply:({elements:dt,rects:st,availableWidth:at,availableHeight:He})=>{const{width:qe,height:vt}=st.reference,yt=dt.floating.style;yt.setProperty("--radix-popper-available-width",`${at}px`),yt.setProperty("--radix-popper-available-height",`${He}px`),yt.setProperty("--radix-popper-anchor-width",`${qe}px`),yt.setProperty("--radix-popper-anchor-height",`${vt}px`)}}),L&&gyn({element:L,padding:l}),Ayn({arrowWidth:O,arrowHeight:U}),x&&xyn({strategy:"referenceHidden",...te})]}),[H,ee]=wGe(ie),se=I1(y);b2(()=>{oe&&(se==null||se())},[oe,se]);const pe=(we=K.arrow)==null?void 0:we.x,Se=(je=K.arrow)==null?void 0:je.y,ge=((Fe=K.arrow)==null?void 0:Fe.centerOffset)!==0,[ve,be]=h.useState();return b2(()=>{S&&be(window.getComputedStyle(S).zIndex)},[S]),i.jsx("div",{ref:fe.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:oe?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[(Re=K.transformOrigin)==null?void 0:Re.x,(Qe=K.transformOrigin)==null?void 0:Qe.y].join(" "),...((Ye=K.hide)==null?void 0:Ye.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(Cyn,{scope:n,placedSide:H,onArrowChange:F,arrowX:pe,arrowY:Se,shouldHideArrow:ge,children:i.jsx(Hc.div,{"data-side":H,"data-align":ee,...v,ref:I,style:{...v.style,animation:oe?void 0:"none"}})})})});bGe.displayName=Sfe;var yGe="PopperArrow",Syn={top:"bottom",right:"left",bottom:"top",left:"right"},vGe=h.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,a=Nyn(yGe,r),o=Syn[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(yyn,{...s,ref:n,style:{...s.style,display:"block"}})})});vGe.displayName=yGe;function jyn(t){return t!==null}var Ayn=t=>({name:"transformOrigin",options:t,fn(e){var C,S,T;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]=wGe(n),f={start:"0%",center:"50%",end:"100%"}[d],x=(((S=s.arrow)==null?void 0:S.x)??0)+l/2,g=(((T=s.arrow)==null?void 0:T.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 wGe(t){const[e,n="center"]=t.split("-");return[e,n]}var jfe=mGe,Oz=gGe,Afe=bGe,_fe=vGe,_yn="Portal",Efe=h.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[s,a]=h.useState(!1);b2(()=>a(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?fie.createPortal(i.jsx(Hc.div,{...r,ref:e}),o):null});Efe.displayName=_yn;function Eyn(t,e){return h.useReducer((n,r)=>e[n][r]??n,t)}var V2=t=>{const{present:e,children:n}=t,r=kyn(e),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),a=du(r.ref,Tyn(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:a}):null};V2.displayName="Presence";function kyn(t){const[e,n]=h.useState(),r=h.useRef(null),s=h.useRef(t),a=h.useRef("none"),o=t?"mounted":"unmounted",[l,c]=Eyn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=iO(r.current);a.current=l==="mounted"?u:"none"},[l]),b2(()=>{const u=r.current,d=s.current;if(d!==t){const x=a.current,g=iO(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]),b2(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=g=>{const v=iO(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=iO(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:h.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function iO(t){return(t==null?void 0:t.animationName)||"none"}function Tyn(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 pZ="rovingFocusGroup.onEntryFocus",Pyn={bubbles:!1,cancelable:!0},xP="RovingFocusGroup",[eie,CGe,Iyn]=iGe(xP),[Fyn,NGe]=Q5(xP,[Iyn]),[Oyn,Myn]=Fyn(xP),SGe=h.forwardRef((t,e)=>i.jsx(eie.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(eie.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(Lyn,{...t,ref:e})})}));SGe.displayName=xP;var Lyn=h.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=h.useRef(null),g=du(e,x),y=aGe(a),[v,C]=Iz({prop:o,defaultProp:l??null,onChange:c,caller:xP}),[S,T]=h.useState(!1),I=I1(u),L=CGe(n),F=h.useRef(!1),[$,O]=h.useState(0);return h.useEffect(()=>{const U=x.current;if(U)return U.addEventListener(pZ,I),()=>U.removeEventListener(pZ,I)},[I]),i.jsx(Oyn,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:v,onItemFocus:h.useCallback(U=>C(U),[C]),onItemShiftTab:h.useCallback(()=>T(!0),[]),onFocusableItemAdd:h.useCallback(()=>O(U=>U+1),[]),onFocusableItemRemove:h.useCallback(()=>O(U=>U-1),[]),children:i.jsx(Hc.div,{tabIndex:S||$===0?-1:0,"data-orientation":r,...f,ref:g,style:{outline:"none",...t.style},onMouseDown:mi(t.onMouseDown,()=>{F.current=!0}),onFocus:mi(t.onFocus,U=>{const Y=!F.current;if(U.target===U.currentTarget&&Y&&!S){const re=new CustomEvent(pZ,Pyn);if(U.currentTarget.dispatchEvent(re),!re.defaultPrevented){const Q=L().filter(ie=>ie.focusable),q=Q.find(ie=>ie.active),te=Q.find(ie=>ie.id===v),G=[q,te,...Q].filter(Boolean).map(ie=>ie.ref.current);_Ge(G,d)}}F.current=!1}),onBlur:mi(t.onBlur,()=>T(!1))})})}),jGe="RovingFocusGroupItem",AGe=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:o,...l}=t,c=hB(),u=a||c,d=Myn(jGe,n),f=d.currentTabStopId===u,x=CGe(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:v}=d;return h.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),i.jsx(eie.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:i.jsx(Hc.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:e,onMouseDown:mi(t.onMouseDown,C=>{r?d.onItemFocus(u):C.preventDefault()}),onFocus:mi(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:mi(t.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){d.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const S=Byn(C,d.orientation,d.dir);if(S!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let I=x().filter(L=>L.focusable).map(L=>L.ref.current);if(S==="last")I.reverse();else if(S==="prev"||S==="next"){S==="prev"&&I.reverse();const L=I.indexOf(C.currentTarget);I=d.loop?$yn(I,L+1):I.slice(L+1)}setTimeout(()=>_Ge(I))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:v!=null}):o})})});AGe.displayName=jGe;var Ryn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dyn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Byn(t,e,n){const r=Dyn(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ryn[r]}function _Ge(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function $yn(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Uyn=SGe,zyn=AGe,Hyn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},BC=new WeakMap,aO=new WeakMap,oO={},mZ=0,EGe=function(t){return t&&(t.host||EGe(t.parentNode))},Vyn=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=EGe(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})},Wyn=function(t,e,n,r){var s=Vyn(e,Array.isArray(t)?t:[t]);oO[n]||(oO[n]=new WeakMap);var a=oO[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=(BC.get(x)||0)+1,C=(a.get(x)||0)+1;BC.set(x,v),a.set(x,C),o.push(x),v===1&&y&&aO.set(x,!0),C===1&&x.setAttribute(n,"true"),y||x.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",x,S)}})};return d(e),l.clear(),mZ++,function(){o.forEach(function(f){var x=BC.get(f)-1,g=a.get(f)-1;BC.set(f,x),a.set(f,g),x||(aO.has(f)||f.removeAttribute(r),aO.delete(f)),g||f.removeAttribute(n)}),mZ--,mZ||(BC=new WeakMap,BC=new WeakMap,aO=new WeakMap,oO={})}},kGe=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=Hyn(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Wyn(r,s,n,"aria-hidden")):function(){return null}},Zb=function(){return Zb=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},Zb.apply(this,arguments)};function qyn(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 Gyn(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 TGe=dBe(),xZ=function(){},Mz=h.forwardRef(function(t,e){var n=h.useRef(null),r=h.useState({onScrollCapture:xZ,onWheelCapture:xZ,onTouchMoveCapture:xZ}),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,S=t.as,T=S===void 0?"div":S,I=t.gapMode,L=qyn(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=x,$=DDe([n,e]),O=Zb(Zb({},L),s);return h.createElement(h.Fragment,null,d&&h.createElement(F,{sideCar:TGe,removeScrollBar:u,shards:f,noRelative:g,noIsolation:y,inert:v,setCallbacks:a,allowPinchZoom:!!C,lockRef:n,gapMode:I}),o?h.cloneElement(h.Children.only(l),Zb(Zb({},O),{ref:$})):h.createElement(T,Zb({},O,{className:c,ref:$}),l))});Mz.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Mz.classNames={fullWidth:V_,zeroRight:H_};var tie=!1;if(typeof window<"u")try{var lO=Object.defineProperty({},"passive",{get:function(){return tie=!0,!0}});window.addEventListener("test",lO,lO),window.removeEventListener("test",lO,lO)}catch{tie=!1}var $C=tie?{passive:!1}:!1,Kyn=function(t){return t.tagName==="TEXTAREA"},PGe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Kyn(t)&&n[e]==="visible")},Yyn=function(t){return PGe(t,"overflowY")},Xyn=function(t){return PGe(t,"overflowX")},l8e=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=IGe(t,r);if(s){var a=FGe(t,r),o=a[1],l=a[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Qyn=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Zyn=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},IGe=function(t,e){return t==="v"?Yyn(e):Xyn(e)},FGe=function(t,e){return t==="v"?Qyn(e):Zyn(e)},Jyn=function(t,e){return t==="h"&&e==="rtl"?-1:1},e2n=function(t,e,n,r,s){var a=Jyn(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=FGe(t,l),y=g[0],v=g[1],C=g[2],S=v-C-a*y;(y||S)&&IGe(t,l)&&(f+=S,x+=y);var T=l.parentNode;l=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}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},cO=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},c8e=function(t){return[t.deltaX,t.deltaY]},u8e=function(t){return t&&"current"in t?t.current:t},t2n=function(t,e){return t[0]===e[0]&&t[1]===e[1]},n2n=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},r2n=0,UC=[];function s2n(t){var e=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(r2n++)[0],a=h.useState(Gce)[0],o=h.useRef(t);h.useEffect(function(){o.current=t},[t]),h.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var v=Gyn([t.lockRef.current],(t.shards||[]).map(u8e),!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=h.useCallback(function(v,C){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var S=cO(v),T=n.current,I="deltaX"in v?v.deltaX:T[0]-S[0],L="deltaY"in v?v.deltaY:T[1]-S[1],F,$=v.target,O=Math.abs(I)>Math.abs(L)?"h":"v";if("touches"in v&&O==="h"&&$.type==="range")return!1;var U=l8e(O,$);if(!U)return!0;if(U?F=O:(F=O==="v"?"h":"v",U=l8e(O,$)),!U)return!1;if(!r.current&&"changedTouches"in v&&(I||L)&&(r.current=F),!F)return!0;var Y=r.current||F;return e2n(Y,C,v,Y==="h"?I:L)},[]),c=h.useCallback(function(v){var C=v;if(!(!UC.length||UC[UC.length-1]!==a)){var S="deltaY"in C?c8e(C):cO(C),T=e.current.filter(function(F){return F.name===C.type&&(F.target===C.target||C.target===F.shadowParent)&&t2n(F.delta,S)})[0];if(T&&T.should){C.cancelable&&C.preventDefault();return}if(!T){var I=(o.current.shards||[]).map(u8e).filter(Boolean).filter(function(F){return F.contains(C.target)}),L=I.length>0?l(C,I[0]):!o.current.noIsolation;L&&C.cancelable&&C.preventDefault()}}},[]),u=h.useCallback(function(v,C,S,T){var I={name:v,delta:C,target:S,should:T,shadowParent:i2n(S)};e.current.push(I),setTimeout(function(){e.current=e.current.filter(function(L){return L!==I})},1)},[]),d=h.useCallback(function(v){n.current=cO(v),r.current=void 0},[]),f=h.useCallback(function(v){u(v.type,c8e(v),v.target,l(v,t.lockRef.current))},[]),x=h.useCallback(function(v){u(v.type,cO(v),v.target,l(v,t.lockRef.current))},[]);h.useEffect(function(){return UC.push(a),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:x}),document.addEventListener("wheel",c,$C),document.addEventListener("touchmove",c,$C),document.addEventListener("touchstart",d,$C),function(){UC=UC.filter(function(v){return v!==a}),document.removeEventListener("wheel",c,$C),document.removeEventListener("touchmove",c,$C),document.removeEventListener("touchstart",d,$C)}},[]);var g=t.removeScrollBar,y=t.inert;return h.createElement(h.Fragment,null,y?h.createElement(a,{styles:n2n(s)}):null,g?h.createElement(mBe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function i2n(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const a2n=hBe(TGe,s2n);var kfe=h.forwardRef(function(t,e){return h.createElement(Mz,Zb({},t,{ref:e,sideCar:a2n}))});kfe.classNames=Mz.classNames;var nie=["Enter"," "],o2n=["ArrowDown","PageUp","Home"],OGe=["ArrowUp","PageDown","End"],l2n=[...o2n,...OGe],c2n={ltr:[...nie,"ArrowRight"],rtl:[...nie,"ArrowLeft"]},u2n={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gP="Menu",[Bk,d2n,f2n]=iGe(gP),[Z5,MGe]=Q5(gP,[f2n,W8,NGe]),Lz=W8(),LGe=NGe(),[h2n,q8]=Z5(gP),[p2n,bP]=Z5(gP),RGe=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:a,modal:o=!0}=t,l=Lz(e),[c,u]=h.useState(null),d=h.useRef(!1),f=I1(a),x=aGe(s);return h.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(jfe,{...l,children:i.jsx(h2n,{scope:e,open:n,onOpenChange:f,content:c,onContentChange:u,children:i.jsx(p2n,{scope:e,onClose:h.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:x,modal:o,children:r})})})};RGe.displayName=gP;var m2n="MenuAnchor",Tfe=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Lz(n);return i.jsx(Oz,{...s,...r,ref:e})});Tfe.displayName=m2n;var x2n="MenuPortal",[fNn,DGe]=Z5(x2n,{forceMount:void 0}),fp="MenuContent",[g2n,Pfe]=Z5(fp),BGe=h.forwardRef((t,e)=>{const n=DGe(fp,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,a=q8(fp,t.__scopeMenu),o=bP(fp,t.__scopeMenu);return i.jsx(Bk.Provider,{scope:t.__scopeMenu,children:i.jsx(V2,{present:r||a.open,children:i.jsx(Bk.Slot,{scope:t.__scopeMenu,children:o.modal?i.jsx(b2n,{...s,ref:e}):i.jsx(y2n,{...s,ref:e})})})})}),b2n=h.forwardRef((t,e)=>{const n=q8(fp,t.__scopeMenu),r=h.useRef(null),s=du(e,r);return h.useEffect(()=>{const a=r.current;if(a)return kGe(a)},[]),i.jsx(Ife,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:mi(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),y2n=h.forwardRef((t,e)=>{const n=q8(fp,t.__scopeMenu);return i.jsx(Ife,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),v2n=Dk("MenuContent.ScrollLock"),Ife=h.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=q8(fp,n),S=bP(fp,n),T=Lz(n),I=LGe(n),L=d2n(n),[F,$]=h.useState(null),O=h.useRef(null),U=du(e,O,C.onContentChange),Y=h.useRef(0),re=h.useRef(""),Q=h.useRef(0),q=h.useRef(null),te=h.useRef("right"),fe=h.useRef(0),G=y?kfe:h.Fragment,ie=y?{as:v2n,allowPinchZoom:!0}:void 0,oe=H=>{var we,je;const ee=re.current+H,se=L().filter(Fe=>!Fe.disabled),pe=document.activeElement,Se=(we=se.find(Fe=>Fe.ref.current===pe))==null?void 0:we.textValue,ge=se.map(Fe=>Fe.textValue),ve=I2n(ge,ee,Se),be=(je=se.find(Fe=>Fe.textValue===ve))==null?void 0:je.ref.current;(function Fe(Re){re.current=Re,window.clearTimeout(Y.current),Re!==""&&(Y.current=window.setTimeout(()=>Fe(""),1e3))})(ee),be&&setTimeout(()=>be.focus())};h.useEffect(()=>()=>window.clearTimeout(Y.current),[]),cGe();const K=h.useCallback(H=>{var se,pe;return te.current===((se=q.current)==null?void 0:se.side)&&O2n(H,(pe=q.current)==null?void 0:pe.area)},[]);return i.jsx(g2n,{scope:n,searchRef:re,onItemEnter:h.useCallback(H=>{K(H)&&H.preventDefault()},[K]),onItemLeave:h.useCallback(H=>{var ee;K(H)||((ee=O.current)==null||ee.focus(),$(null))},[K]),onTriggerLeave:h.useCallback(H=>{K(H)&&H.preventDefault()},[K]),pointerGraceTimerRef:Q,onPointerGraceIntentChange:h.useCallback(H=>{q.current=H},[]),children:i.jsx(G,{...ie,children:i.jsx(Cfe,{asChild:!0,trapped:s,onMountAutoFocus:mi(a,H=>{var ee;H.preventDefault(),(ee=O.current)==null||ee.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:i.jsx(Fz,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:x,onDismiss:g,children:i.jsx(Uyn,{asChild:!0,...I,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:F,onCurrentTabStopIdChange:$,onEntryFocus:mi(c,H=>{S.isUsingKeyboardRef.current||H.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(Afe,{role:"menu","aria-orientation":"vertical","data-state":tKe(C.open),"data-radix-menu-content":"",dir:S.dir,...T,...v,ref:U,style:{outline:"none",...v.style},onKeyDown:mi(v.onKeyDown,H=>{const se=H.target.closest("[data-radix-menu-content]")===H.currentTarget,pe=H.ctrlKey||H.altKey||H.metaKey,Se=H.key.length===1;se&&(H.key==="Tab"&&H.preventDefault(),!pe&&Se&&oe(H.key));const ge=O.current;if(H.target!==ge||!l2n.includes(H.key))return;H.preventDefault();const be=L().filter(we=>!we.disabled).map(we=>we.ref.current);OGe.includes(H.key)&&be.reverse(),T2n(be)}),onBlur:mi(t.onBlur,H=>{H.currentTarget.contains(H.target)||(window.clearTimeout(Y.current),re.current="")}),onPointerMove:mi(t.onPointerMove,$k(H=>{const ee=H.target,se=fe.current!==H.clientX;if(H.currentTarget.contains(ee)&&se){const pe=H.clientX>fe.current?"right":"left";te.current=pe,fe.current=H.clientX}}))})})})})})})});BGe.displayName=fp;var w2n="MenuGroup",Ffe=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return i.jsx(Hc.div,{role:"group",...r,ref:e})});Ffe.displayName=w2n;var C2n="MenuLabel",$Ge=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return i.jsx(Hc.div,{...r,ref:e})});$Ge.displayName=C2n;var mB="MenuItem",d8e="menu.itemSelect",Rz=h.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,a=h.useRef(null),o=bP(mB,t.__scopeMenu),l=Pfe(mB,t.__scopeMenu),c=du(e,a),u=h.useRef(!1),d=()=>{const f=a.current;if(!n&&f){const x=new CustomEvent(d8e,{bubbles:!0,cancelable:!0});f.addEventListener(d8e,g=>r==null?void 0:r(g),{once:!0}),sGe(f,x),x.defaultPrevented?u.current=!1:o.onClose()}};return i.jsx(UGe,{...s,ref:c,disabled:n,onClick:mi(t.onClick,d),onPointerDown:f=>{var x;(x=t.onPointerDown)==null||x.call(t,f),u.current=!0},onPointerUp:mi(t.onPointerUp,f=>{var x;u.current||(x=f.currentTarget)==null||x.click()}),onKeyDown:mi(t.onKeyDown,f=>{const x=l.searchRef.current!=="";n||x&&f.key===" "||nie.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Rz.displayName=mB;var UGe=h.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...a}=t,o=Pfe(mB,n),l=LGe(n),c=h.useRef(null),u=du(e,c),[d,f]=h.useState(!1),[x,g]=h.useState("");return h.useEffect(()=>{const y=c.current;y&&g((y.textContent??"").trim())},[a.children]),i.jsx(Bk.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:i.jsx(zyn,{asChild:!0,...l,focusable:!r,children:i.jsx(Hc.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:u,onPointerMove:mi(t.onPointerMove,$k(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:mi(t.onPointerLeave,$k(y=>o.onItemLeave(y))),onFocus:mi(t.onFocus,()=>f(!0)),onBlur:mi(t.onBlur,()=>f(!1))})})})}),N2n="MenuCheckboxItem",zGe=h.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return i.jsx(GGe,{scope:t.__scopeMenu,checked:n,children:i.jsx(Rz,{role:"menuitemcheckbox","aria-checked":xB(n)?"mixed":n,...s,ref:e,"data-state":Mfe(n),onSelect:mi(s.onSelect,()=>r==null?void 0:r(xB(n)?!0:!n),{checkForDefaultPrevented:!1})})})});zGe.displayName=N2n;var HGe="MenuRadioGroup",[S2n,j2n]=Z5(HGe,{value:void 0,onValueChange:()=>{}}),VGe=h.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,a=I1(r);return i.jsx(S2n,{scope:t.__scopeMenu,value:n,onValueChange:a,children:i.jsx(Ffe,{...s,ref:e})})});VGe.displayName=HGe;var WGe="MenuRadioItem",qGe=h.forwardRef((t,e)=>{const{value:n,...r}=t,s=j2n(WGe,t.__scopeMenu),a=n===s.value;return i.jsx(GGe,{scope:t.__scopeMenu,checked:a,children:i.jsx(Rz,{role:"menuitemradio","aria-checked":a,...r,ref:e,"data-state":Mfe(a),onSelect:mi(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});qGe.displayName=WGe;var Ofe="MenuItemIndicator",[GGe,A2n]=Z5(Ofe,{checked:!1}),KGe=h.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,a=A2n(Ofe,n);return i.jsx(V2,{present:r||xB(a.checked)||a.checked===!0,children:i.jsx(Hc.span,{...s,ref:e,"data-state":Mfe(a.checked)})})});KGe.displayName=Ofe;var _2n="MenuSeparator",YGe=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return i.jsx(Hc.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});YGe.displayName=_2n;var E2n="MenuArrow",XGe=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Lz(n);return i.jsx(_fe,{...s,...r,ref:e})});XGe.displayName=E2n;var k2n="MenuSub",[hNn,QGe]=Z5(k2n),w_="MenuSubTrigger",ZGe=h.forwardRef((t,e)=>{const n=q8(w_,t.__scopeMenu),r=bP(w_,t.__scopeMenu),s=QGe(w_,t.__scopeMenu),a=Pfe(w_,t.__scopeMenu),o=h.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=a,u={__scopeMenu:t.__scopeMenu},d=h.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return h.useEffect(()=>d,[d]),h.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),i.jsx(Tfe,{asChild:!0,...u,children:i.jsx(UGe,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":tKe(n.open),...t,ref:Pz(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:mi(t.onPointerMove,$k(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:mi(t.onPointerLeave,$k(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",S=C?-5:5,T=x[C?"left":"right"],I=x[C?"right":"left"];a.onPointerGraceIntentChange({area:[{x:f.clientX+S,y:f.clientY},{x:T,y:x.top},{x:I,y:x.top},{x:I,y:x.bottom},{x:T,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:mi(t.onKeyDown,f=>{var g;const x=a.searchRef.current!=="";t.disabled||x&&f.key===" "||c2n[r.dir].includes(f.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),f.preventDefault())})})})});ZGe.displayName=w_;var JGe="MenuSubContent",eKe=h.forwardRef((t,e)=>{const n=DGe(fp,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,a=q8(fp,t.__scopeMenu),o=bP(fp,t.__scopeMenu),l=QGe(JGe,t.__scopeMenu),c=h.useRef(null),u=du(e,c);return i.jsx(Bk.Provider,{scope:t.__scopeMenu,children:i.jsx(V2,{present:r||a.open,children:i.jsx(Bk.Slot,{scope:t.__scopeMenu,children:i.jsx(Ife,{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:mi(t.onFocusOutside,d=>{d.target!==l.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:mi(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:mi(t.onKeyDown,d=>{var g;const f=d.currentTarget.contains(d.target),x=u2n[o.dir].includes(d.key);f&&x&&(a.onOpenChange(!1),(g=l.trigger)==null||g.focus(),d.preventDefault())})})})})})});eKe.displayName=JGe;function tKe(t){return t?"open":"closed"}function xB(t){return t==="indeterminate"}function Mfe(t){return xB(t)?"indeterminate":t?"checked":"unchecked"}function T2n(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function P2n(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function I2n(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=P2n(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 F2n(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 O2n(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return F2n(n,e)}function $k(t){return e=>e.pointerType==="mouse"?t(e):void 0}var M2n=RGe,L2n=Tfe,R2n=BGe,D2n=Ffe,B2n=$Ge,$2n=Rz,U2n=zGe,z2n=VGe,H2n=qGe,V2n=KGe,W2n=YGe,q2n=XGe,G2n=ZGe,K2n=eKe,Dz="DropdownMenu",[Y2n,pNn]=Q5(Dz,[MGe]),Nf=MGe(),[X2n,nKe]=Y2n(Dz),rKe=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=t,c=Nf(e),u=h.useRef(null),[d,f]=Iz({prop:s,defaultProp:a??!1,onChange:o,caller:Dz});return i.jsx(X2n,{scope:e,triggerId:hB(),triggerRef:u,contentId:hB(),open:d,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(x=>!x),[f]),modal:l,children:i.jsx(M2n,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};rKe.displayName=Dz;var sKe="DropdownMenuTrigger",iKe=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=t,a=nKe(sKe,n),o=Nf(n);return i.jsx(L2n,{asChild:!0,...o,children:i.jsx(Hc.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:Pz(e,a.triggerRef),onPointerDown:mi(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(a.onOpenToggle(),a.open||l.preventDefault())}),onKeyDown:mi(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&a.onOpenToggle(),l.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});iKe.displayName=sKe;var aKe="DropdownMenuContent",oKe=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nKe(aKe,n),a=Nf(n),o=h.useRef(!1);return i.jsx(R2n,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...r,ref:e,onCloseAutoFocus:mi(t.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:mi(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)"}})});oKe.displayName=aKe;var Q2n="DropdownMenuGroup",Z2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(D2n,{...s,...r,ref:e})});Z2n.displayName=Q2n;var J2n="DropdownMenuLabel",evn=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(B2n,{...s,...r,ref:e})});evn.displayName=J2n;var tvn="DropdownMenuItem",lKe=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx($2n,{...s,...r,ref:e})});lKe.displayName=tvn;var nvn="DropdownMenuCheckboxItem",rvn=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(U2n,{...s,...r,ref:e})});rvn.displayName=nvn;var svn="DropdownMenuRadioGroup",ivn=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(z2n,{...s,...r,ref:e})});ivn.displayName=svn;var avn="DropdownMenuRadioItem",ovn=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(H2n,{...s,...r,ref:e})});ovn.displayName=avn;var lvn="DropdownMenuItemIndicator",cvn=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(V2n,{...s,...r,ref:e})});cvn.displayName=lvn;var uvn="DropdownMenuSeparator",dvn=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(W2n,{...s,...r,ref:e})});dvn.displayName=uvn;var fvn="DropdownMenuArrow",hvn=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(q2n,{...s,...r,ref:e})});hvn.displayName=fvn;var pvn="DropdownMenuSubTrigger",mvn=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(G2n,{...s,...r,ref:e})});mvn.displayName=pvn;var xvn="DropdownMenuSubContent",gvn=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Nf(n);return i.jsx(K2n,{...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)"}})});gvn.displayName=xvn;var gZ=rKe,bvn=iKe,bZ=oKe,yZ=lKe,Bz="Popover",[cKe,mNn]=Q5(Bz,[W8]),yP=W8(),[yvn,W2]=cKe(Bz),uKe=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:o=!1}=t,l=yP(e),c=h.useRef(null),[u,d]=h.useState(!1),[f,x]=Iz({prop:r,defaultProp:s??!1,onChange:a,caller:Bz});return i.jsx(jfe,{...l,children:i.jsx(yvn,{scope:e,contentId:hB(),triggerRef:c,open:f,onOpenChange:x,onOpenToggle:h.useCallback(()=>x(g=>!g),[x]),hasCustomAnchor:u,onCustomAnchorAdd:h.useCallback(()=>d(!0),[]),onCustomAnchorRemove:h.useCallback(()=>d(!1),[]),modal:o,children:n})})};uKe.displayName=Bz;var dKe="PopoverAnchor",vvn=h.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=W2(dKe,n),a=yP(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return h.useEffect(()=>(o(),()=>l()),[o,l]),i.jsx(Oz,{...a,...r,ref:e})});vvn.displayName=dKe;var fKe="PopoverTrigger",hKe=h.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=W2(fKe,n),a=yP(n),o=du(e,s.triggerRef),l=i.jsx(Hc.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":bKe(s.open),...r,ref:o,onClick:mi(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:i.jsx(Oz,{asChild:!0,...a,children:l})});hKe.displayName=fKe;var Lfe="PopoverPortal",[wvn,Cvn]=cKe(Lfe,{forceMount:void 0}),pKe=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,a=W2(Lfe,e);return i.jsx(wvn,{scope:e,forceMount:n,children:i.jsx(V2,{present:n||a.open,children:i.jsx(Efe,{asChild:!0,container:s,children:r})})})};pKe.displayName=Lfe;var _j="PopoverContent",mKe=h.forwardRef((t,e)=>{const n=Cvn(_j,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,a=W2(_j,t.__scopePopover);return i.jsx(V2,{present:r||a.open,children:a.modal?i.jsx(Svn,{...s,ref:e}):i.jsx(jvn,{...s,ref:e})})});mKe.displayName=_j;var Nvn=Dk("PopoverContent.RemoveScroll"),Svn=h.forwardRef((t,e)=>{const n=W2(_j,t.__scopePopover),r=h.useRef(null),s=du(e,r),a=h.useRef(!1);return h.useEffect(()=>{const o=r.current;if(o)return kGe(o)},[]),i.jsx(kfe,{as:Nvn,allowPinchZoom:!0,children:i.jsx(xKe,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mi(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),a.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:mi(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:mi(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),jvn=h.forwardRef((t,e)=>{const n=W2(_j,t.__scopePopover),r=h.useRef(!1),s=h.useRef(!1);return i.jsx(xKe,{...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()}})}),xKe=h.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=W2(_j,n),g=yP(n);return cGe(),i.jsx(Cfe,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(Fz,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>x.onOpenChange(!1),children:i.jsx(Afe,{"data-state":bKe(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)"}})})})}),gKe="PopoverClose",Avn=h.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=W2(gKe,n);return i.jsx(Hc.button,{type:"button",...r,ref:e,onClick:mi(t.onClick,()=>s.onOpenChange(!1))})});Avn.displayName=gKe;var _vn="PopoverArrow",Evn=h.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=yP(n);return i.jsx(_fe,{...s,...r,ref:e})});Evn.displayName=_vn;function bKe(t){return t?"open":"closed"}var kvn=uKe,Tvn=hKe,Pvn=pKe,Ivn=mKe;const Fvn=t=>`${t.slice(0,5)}...${t.slice(-4)}`,Ovn=[{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 Mvn(){const[t,e]=h.useState([]),[n,r]=h.useState("All"),[s,a]=h.useState("All"),[o,l]=h.useState(null),[c,u]=h.useState("All"),[d,f]=h.useState("All"),[x,g]=h.useState(!1),[y,v]=h.useState(!1),[C,S]=h.useState(null),[T,I]=h.useState(null),[L,F]=h.useState(""),{setSignModalOpen:$,copyTradeWatchList:O,getCopyTradeWatchList:U,getTrackedWatchList:Y,setIsWhitelist:re,setMushboomerETH:Q,setMushboomerSOL:q}=h.useContext(Qr);h.useEffect(()=>{const K=()=>{const ee="https://dextradata.nftinit.io/api/hyper/top_whales/",se=d==="All"?ee:`${ee}?user_tier=${d}`;Ns.get(se).then(pe=>{var Se;return e(((Se=pe.data)==null?void 0:Se.positions_list)||[])})};K();const H=setInterval(K,3e4);return()=>clearInterval(H)},[d]),h.useEffect(()=>{const K=localStorage.getItem("hyperToken"),H=localStorage.getItem("hyperAddress");!K||!H||(async()=>{var ee,se;try{const pe=await bi(H.toLowerCase(),K);pe!=null&&pe.success&&(re(pe.whitelist),Q(((ee=pe.mushboomer_counts)==null?void 0:ee.eth)||0),q(((se=pe.mushboomer_counts)==null?void 0:se.sol)||0))}catch{}})()},[]),h.useEffect(()=>{localStorage.getItem("hyperToken")&&(U(),Y())},[]);const te=async({walletAddress:K,isFollow:H,isScalper:ee})=>{try{const se=localStorage.getItem("hyperToken"),pe=localStorage.getItem("hyperAddress");if(!se){$(!0);return}const Se=H?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",ge=H?{address:pe?pe.toLowerCase():localAddress,token:se,follow_address:K.toLowerCase()}:{address:pe?pe.toLowerCase():localAddress,token:se},be=await(await fetch(Se,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ge)})).json();if(!be.success){fn.error(be.error_message||"Something went wrong");return}U(),Y(),I(Array.isArray(be==null?void 0:be.data)?[...be.data].sort((we,je)=>new Date(je.created_at||0)-new Date(we.created_at||0)):be==null?void 0:be.data),F(K),S(ee),v(!0)}catch(se){fn.error(se.message||"Something went wrong")}},fe=h.useMemo(()=>[...new Set(t.map(K=>K.coin))],[t]),G=h.useMemo(()=>t.filter(K=>{if(n!=="All"&&K.coin!==n||s!=="All"&&K.direction!==s.toLowerCase()||d!=="All"&&![String(d),id[d].label].includes(String(K.user_tier)))return!1;if(o){const H=Number(K.unrealized_pnl),ee=Math.min(o.min,o.max),se=Math.max(o.min,o.max);if(H<ee||H>se)return!1}return!(c==="Profit"&&Number(K.funding_paid)<=0||c==="Loss"&&Number(K.funding_paid)>=0)}),[t,n,s,o,c,d]),ie=K=>{if(K==null)return"-";const H=Number(K),ee=H<0?"-":"",se=Math.abs(H);return se>=1e9?`${ee}$${(se/1e9).toFixed(2)}B`:se>=1e6?`${ee}$${(se/1e6).toFixed(2)}M`:se>=1e3?`${ee}$${(se/1e3).toFixed(2)}K`:`${ee}$${se.toFixed(2)}`},oe=[{key:"rank",label:"#",width:"46px",render:(K,H,ee)=>i.jsx("span",{className:"text-[#9B9B9B]",children:ee+1})},{key:"wallet",label:"Wallet",width:"210px",render:(K,H)=>{const ee=wfe(H.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/${H.address}`,target:"_blank",onClick:se=>se.stopPropagation(),className:"text-white font-medium hover:text-white w-24",children:Fvn(H.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:(K,H)=>i.jsxs("a",{href:`/terminal/${H.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/${H.coin}.svg`,onError:Zi,className:"w-5 h-5 mr-2"}),H.coin]})},{key:"direction",label:"Direction",width:"150px ",sortable:!0,render:(K,H)=>{const ee=H.direction==="long",se=ee?"LONG":"SHORT",pe=ee?"#67FFBD":"#FF797C",Se=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 ${Se}`,style:{color:pe},children:[i.jsx(Us,{className:`w-3 h-3 ${ee?"rotate-180":""}`,style:{color:pe}}),se]}),i.jsxs("div",{className:`inline-flex items-center px-2 py-1 h-6 rounded-[6px] text-[11px] font-medium ${Se}`,style:{color:pe},children:[H.max_leverage,"X"]})]})}},{key:"notional",label:"Position",sortable:!0,width:"130px",sortValue:K=>Number(K.notional),render:(K,H)=>ie(Number(H.notional))},{key:"szi",label:"Size",sortable:!0,sortValue:K=>Number(K.szi),render:K=>ie(K)},{key:"entry_price",label:"Entry",sortable:!0,sortValue:K=>Number(K.entry_price),render:K=>ie(K)},{key:"market_price",label:"Market",sortable:!0,sortValue:K=>Number(K.market_price),render:K=>ie(K)},{key:"unrealized_pnl",label:"PnL",sortable:!0,sortValue:K=>Math.abs(Number(K.unrealized_pnl)),render:K=>{const H=Number(K)>=0;return i.jsxs("span",{className:`flex items-center ${H?"text-[#3DB380]":"text-[#FF797C]"}`,children:[ie(Math.abs(K)),i.jsx("img",{src:H?N9:S9,className:"ml-[6px] w-[9px] h-[8px]"})]})}},{key:"liq_price",label:"Liq. Price",sortable:!0,sortValue:K=>Number(K.liq_price),render:K=>ie(K)},{key:"funding_paid",label:"Fee",sortable:!0,sortValue:K=>Number(K.funding_paid),render:K=>{const H=Number(K)>=0;return i.jsxs("span",{className:`flex items-center ${H?"text-[#3DB380]":"text-[#FF797C]"}`,children:[ie(Math.abs(K)),i.jsx("img",{src:H?N9:S9,className:"ml-[6px] w-[9px] h-[8px]"})]})}},{key:"action",label:"Action",width:"100px",render:(K,H)=>{const ee=O.some(se=>se.wallet_address===H.address);return i.jsx("div",{onClick:se=>{se.preventDefault(),se.stopPropagation(),te({walletAddress:H.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(V5,{open:y,setOpen:v,copyTradeData:T,copyTradeWallet:L,setCopyTradeWallet:F,isScalper:C,setCopyTradeData:I}),i.jsx(as,{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(K=>!K),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:jct,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(f8e,{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(f8e,{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((K,H)=>i.jsx("div",{className:"animate-pulse bg-[#202020] h-[24px] w-full rounded-md"},H))}):i.jsx(zu,{data:G,columns:oe,rowKey:K=>K.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 vZ({children:t,value:e}){return i.jsx(bvn,{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(g9,{className:"w-4 h-4 shrink-0"})]})})}function f8e({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]=h.useState(""),[y,v]=h.useState("");h.useEffect(()=>{if(x===""&&y===""){l(null);return}const S=x===""?null:Number(x),T=y===""?null:Number(y),I=S??T??0,L=T??S??1/0;l({min:I,max:L,label:`${I<0?"-":""}$${Math.abs(I)} - ${L===1/0?"∞":`${L<0?"-":""}$${Math.abs(L)}`}`})},[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:Sct,className:"w-[21px] h-[21px]"}),i.jsx("span",{className:"font-manrope text-[14px] font-medium",children:"Filters"})]}),i.jsxs(gZ,{children:[i.jsxs(vZ,{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:Zi,className:"w-4 h-4"}),n]})]}),i.jsx(bZ,{sideOffset:6,className:"z-50 min-w-[140px] max-h-[280px] overflow-y-auto rounded-md bg-[#242424] p-2",children:["All",...e].map(S=>i.jsxs(yZ,{onSelect:()=>r(S),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===S?"bg-[#2F2F2F]":""}`,children:[S!=="All"&&i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${S}.svg`,onError:Zi,className:"w-4 h-4"}),S]},S))})]}),i.jsxs(gZ,{children:[i.jsxs(vZ,{value:s!=="All",children:["Side ",i.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-white",children:s})]}),i.jsx(bZ,{sideOffset:6,className:"z-50 rounded-md bg-[#242424] p-2 text-[#A8A8A8]",children:["All","Long","Short"].map(S=>i.jsx(yZ,{onSelect:()=>a(S),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===S?"bg-[#2F2F2F]":""}`,children:S},S))})]}),i.jsxs(gZ,{children:[i.jsxs(vZ,{value:c!=="All",children:["Fee ",i.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-white",children:c})]}),i.jsx(bZ,{sideOffset:6,className:"z-50 rounded-md bg-[#242424] p-2 text-[#A8A8A8]",children:["All","Profit","Loss"].map(S=>i.jsx(yZ,{onSelect:()=>u(S),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===S?"bg-[#2F2F2F]":""}`,children:S},S))})]}),i.jsxs(kvn,{children:[i.jsx(Tvn,{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(g9,{className:"w-4 h-4"})]})}),i.jsx(Pvn,{children:i.jsxs(Ivn,{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((S,T)=>{const I=T===0?x:y,L=T===0?g:v,F=I!=="";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:S}),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:I,onChange:$=>L($.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]"}`})]})]},S)})}),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"}),Ovn.map(S=>i.jsx("button",{onClick:()=>{S.label==="All"?(g(""),v("")):(g(S.min.toString()),v(S.max===1/0?"":S.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)===S.label?"bg-[#2F2F2F] text-white":"text-[#A8A8A8]"} hover:bg-[#2A2A2A] hover:rounded-[6px] hover:p-[9px] hover:text-white hover:border-none`,children:S.label},S.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"}),Rk.map(({id:S,emoji:T,description:I})=>{const L=d===S;return i.jsx("div",{onClick:()=>f(L?"All":S),className:`h-7 w-7 flex items-center justify-center rounded-[8px] text-[18px] cursor-pointer transition-colors ${L?"bg-[#262626]":"hover:bg-[#262626]"}`,children:i.jsx(as,{content:I,children:T})},S)})]})})]})}function Lvn({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(eB,{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(Yie,{className:"w-[10px] h-[10px]",style:{color:c}}):i.jsx(Vl,{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 wZ,$z="HoverCard",[yKe,xNn]=Q5($z,[W8]),Uz=W8(),[Rvn,zz]=yKe($z),vKe=t=>{const{__scopeHoverCard:e,children:n,open:r,defaultOpen:s,onOpenChange:a,openDelay:o=700,closeDelay:l=300}=t,c=Uz(e),u=h.useRef(0),d=h.useRef(0),f=h.useRef(!1),x=h.useRef(!1),[g,y]=Iz({prop:r,defaultProp:s??!1,onChange:a,caller:$z}),v=h.useCallback(()=>{clearTimeout(d.current),u.current=window.setTimeout(()=>y(!0),o)},[o,y]),C=h.useCallback(()=>{clearTimeout(u.current),!f.current&&!x.current&&(d.current=window.setTimeout(()=>y(!1),l))},[l,y]),S=h.useCallback(()=>y(!1),[y]);return h.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(d.current)},[]),i.jsx(Rvn,{scope:e,open:g,onOpenChange:y,onOpen:v,onClose:C,onDismiss:S,hasSelectionRef:f,isPointerDownOnContentRef:x,children:i.jsx(jfe,{...c,children:n})})};vKe.displayName=$z;var wKe="HoverCardTrigger",CKe=h.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=zz(wKe,n),a=Uz(n);return i.jsx(Oz,{asChild:!0,...a,children:i.jsx(Hc.a,{"data-state":s.open?"open":"closed",...r,ref:e,onPointerEnter:mi(t.onPointerEnter,bB(s.onOpen)),onPointerLeave:mi(t.onPointerLeave,bB(s.onClose)),onFocus:mi(t.onFocus,s.onOpen),onBlur:mi(t.onBlur,s.onClose),onTouchStart:mi(t.onTouchStart,o=>o.preventDefault())})})});CKe.displayName=wKe;var Rfe="HoverCardPortal",[Dvn,Bvn]=yKe(Rfe,{forceMount:void 0}),NKe=t=>{const{__scopeHoverCard:e,forceMount:n,children:r,container:s}=t,a=zz(Rfe,e);return i.jsx(Dvn,{scope:e,forceMount:n,children:i.jsx(V2,{present:n||a.open,children:i.jsx(Efe,{asChild:!0,container:s,children:r})})})};NKe.displayName=Rfe;var gB="HoverCardContent",SKe=h.forwardRef((t,e)=>{const n=Bvn(gB,t.__scopeHoverCard),{forceMount:r=n.forceMount,...s}=t,a=zz(gB,t.__scopeHoverCard);return i.jsx(V2,{present:r||a.open,children:i.jsx($vn,{"data-state":a.open?"open":"closed",...s,onPointerEnter:mi(t.onPointerEnter,bB(a.onOpen)),onPointerLeave:mi(t.onPointerLeave,bB(a.onClose)),ref:e})})});SKe.displayName=gB;var $vn=h.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,...l}=t,c=zz(gB,n),u=Uz(n),d=h.useRef(null),f=du(e,d),[x,g]=h.useState(!1);return h.useEffect(()=>{if(x){const y=document.body;return wZ=y.style.userSelect||y.style.webkitUserSelect,y.style.userSelect="none",y.style.webkitUserSelect="none",()=>{y.style.userSelect=wZ,y.style.webkitUserSelect=wZ}}},[x]),h.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]),h.useEffect(()=>{d.current&&Hvn(d.current).forEach(v=>v.setAttribute("tabindex","-1"))}),i.jsx(Fz,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:o,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:mi(a,y=>{y.preventDefault()}),onDismiss:c.onDismiss,children:i.jsx(Afe,{...u,...l,onPointerDown:mi(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)"}})})}),Uvn="HoverCardArrow",zvn=h.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=Uz(n);return i.jsx(_fe,{...s,...r,ref:e})});zvn.displayName=Uvn;function bB(t){return e=>e.pointerType==="touch"?void 0:t()}function Hvn(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 Vvn=vKe,Wvn=CKe,qvn=NKe,Gvn=SKe;const Kvn="#67FFBD",Yvn="#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 Xvn({data:t=[],title:e=""}){const n=h.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:Kvn}}),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:Yvn}}),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(as,{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 Qvn="https://dextradata.nftinit.io/api/hyper/wallet/whale/open_interest/?period=1d",Zvn="https://dextradata.nftinit.io/api/hyper/wallet/whale/tx_summary/?period=1d",Jvn={BTC:"Bitcoin",ETH:"Ethereum",HYPE:"Hyperliquid",SOL:"Solana",XRP:"XRP",PUMP:"Pump",FARTCOIN:"Fartcoin"},ewn=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 twn(){const[t,e]=h.useState(null),[n,r]=h.useState([]),[s,a]=h.useState([]);return h.useEffect(()=>{const o=async()=>{var c,u,d,f,x,g;try{const[y,v]=await Promise.all([Ns.get(Qvn),Ns.get(Zvn)]),C=((u=(c=y.data)==null?void 0:c.position_summary)==null?void 0:u.slice(0,10).map(L=>({coin:L.coin,long:Number(L.long),short:Number(L.short),total:Number(L.total)})))||[],S=((f=(d=v.data)==null?void 0:d.whale_summary)==null?void 0:f.slice(0,10).map(L=>({coin:L.coin,long:Number(L.long_tx_count),short:Number(L.short_tx_count),total:Number(L.total_tx_count)})))||[];r(C),a(S);const T=C[0]||{},I=((g=(x=v.data)==null?void 0:x.whale_summary)==null?void 0:g[0])||{};e([{type:"position",title:"Highest OI",coin:T.coin||"",name:Jvn[T.coin]||T.coin,value:ewn(T.total)},{type:"trader",title:"Most Traded",coin:I.coin||"",name:"Top Trader",value:`${I.whale_count??"-"} Whales | TX: ${I.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(Vvn,{openDelay:0,closeDelay:0,children:[i.jsx(Wvn,{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(qvn,{children:i.jsx(Gvn,{side:"right",align:"start",sideOffset:0,collisionPadding:8,children:i.jsx(Xvn,{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 nwn="https://dextradata.nftinit.io/api/hyper/wallet/whale/top_user_pnl/?period=1d",rwn="https://dextradata.nftinit.io/api/hyper/wallet/whale/high_risk_traders/?period=1d",swn=t=>`${t.slice(0,5)}...${t.slice(-4)}`,iwn=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 awn(){const[t,e]=h.useState(null);return h.useEffect(()=>{const n=async()=>{var s,a,o,l;try{const[c,u]=await Promise.all([Ns.get(nwn),Ns.get(rwn)]),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:swn(g.user_token),wallet:g.user_token,amount:`${Number(g.pnl)>=0?"+":"-"}${iwn(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(rGe,{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(as,{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 NZ(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 own({data:t,lastUpdated:e}){const[n,r]=h.useState(0);return h.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(as,{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:NZ(e)})]}),i.jsx(Lvn,{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(as,{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:NZ(e)})]}),i.jsx(twn,{})]}),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(as,{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:NZ(e)})]}),i.jsx(awn,{})]})]})}function lwn(){const[t,e]=h.useState(null),[n,r]=h.useState(null);return h.useEffect(()=>{const s=document.querySelector("main");return s&&(s.style.background="#050505"),()=>{s&&(s.style.background="")}},[]),i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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:Fae,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(as,{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:Llt,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(lbn,{onData:s=>{e(s),r(new Date)}})}),i.jsx("div",{className:"w-full sm:w-2/3",children:i.jsx(Ibn,{})})]}),i.jsx("div",{className:"mt-4",children:i.jsx(own,{data:t,lastUpdated:n})}),i.jsx("div",{className:"mt-4",children:i.jsx(Mvn,{})})]})]})}const cwn=()=>{const{setSignModalOpen:t}=h.useContext(Qr),{address:e}=ds(),[n,r]=h.useState(Array(6).fill("")),[s,a]=h.useState(""),[o,l]=h.useState(!1),[c,u]=h.useState(!1),[d,f]=h.useState(!1),x=async()=>{try{const S=window.localStorage.getItem("hyperToken"),T=window.localStorage.getItem("hyperAddress");if(!S||n.join("")===""||n.join("").length<6){S?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 I="https://dextrabothypev2.nftinit.io/api/telegram/sign_with_telegram/",L={address:e?e.toLowerCase():T,token:S,temp_password:n.join("")},$=await(await fetch(I,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(L)})).json();$!=null&&$.success?($!=null&&$.telegram_chat_id&&u(!0),r(Array(6).fill("")),fn.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(S){console.error("Error in telegram verify:",S),fn.error(S.message||"Something went wrong!"),a(S.message||"Something went wrong!"),f(!0),l(!1)}},g=(S,T)=>{f(!1);const I=[...n];I[T]=S.target.value.toUpperCase().slice(0,1),r(I),S.target.value.length===1&&T<5&&document.getElementById(`code-input-${T+1}`).focus()},y=S=>{f(!1);const T=S.clipboardData.getData("Text").slice(0,6),I=[...n];for(let F=0;F<T.length;F++)I[F]=T[F].toUpperCase();r(I);const L=document.getElementById(`code-input-${(T==null?void 0:T.length)-1}`);L==null||L.focus(),L==null||L.select()},v=(S,T)=>{var I,L;if(f(!1),S.key==="Backspace"){if(n[T]){const F=[...n];F[T]="",r(F)}else if(T>0){const F=document.getElementById(`code-input-${T-1}`),$=[...n];$[T-1]="",r($),F==null||F.focus()}}else S.key==="ArrowLeft"&&T>0?(I=document.getElementById(`code-input-${T-1}`))==null||I.focus():S.key==="ArrowRight"&&T<5&&((L=document.getElementById(`code-input-${T+1}`))==null||L.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:Wo,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:H9e,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:V9e,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:Tct,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((S,T)=>i.jsx("input",{id:`code-input-${T}`,type:"text",maxLength:"1",value:S,autoComplete:"off",onChange:I=>g(I,T),onKeyDown:I=>v(I,T),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`},T))}),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:S=>{S.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"})})]})]})]})},uwn=()=>{const{isConnected:t,address:e}=ds(),{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}=h.useContext(Qr),[v,C]=h.useState(!!window.localStorage.getItem("hyperToken"));return h.useEffect(()=>{const S=window.localStorage.getItem("hyperToken");C(!!S)},[e,t,n,r]),h.useEffect(()=>{(async()=>{var L,F;const T=window.localStorage.getItem("hyperToken"),I=window.localStorage.getItem("hyperAddress");if(!(!T||!I))try{const $=await bi(I.toLowerCase(),T);$!=null&&$.success?(a($==null?void 0:$.telegram_chat_id),o($==null?void 0:$.subscriber_role),l($==null?void 0:$.subs_expire_day),c((L=$==null?void 0:$.mushboomer_counts)==null?void 0:L.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(za,{children:i.jsxs(Va,{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(cwn,{}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(Az,{})})})]})};function dwn({onRun:t}){const[e,n]=h.useState({wallet:"",pairs:[],equity:"",scale:"",period:"30D",method:"3"}),[r,s]=h.useState([]);h.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(pl,{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 fwn(){const[t,e]=h.useState(0);return h.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 Dfe={};(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),se=ee.getContext("2d");se.fillRect(0,0,1,1);var pe=ee.transferToImageBitmap();try{se.createPattern(pe,"no-repeat")}catch{return!1}return!0}();function c(){}function u(ee){var se=n.exports.Promise,pe=se!==void 0?se:e.Promise;return typeof pe=="function"?new pe(ee):(ee(c,c),null)}var d=function(ee,se){return{transform:function(pe){if(ee)return pe;if(se.has(pe))return se.get(pe);var Se=new OffscreenCanvas(pe.width,pe.height),ge=Se.getContext("2d");return ge.drawImage(pe,0,0),se.set(pe,Se),Se},clear:function(){se.clear()}}}(l,new Map),f=function(){var ee=Math.floor(16.666666666666668),se,pe,Se={},ge=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(se=function(ve){var be=Math.random();return Se[be]=requestAnimationFrame(function we(je){ge===je||ge+ee-1<je?(ge=je,delete Se[be],ve()):Se[be]=requestAnimationFrame(we)}),be},pe=function(ve){Se[ve]&&cancelAnimationFrame(Se[ve])}):(se=function(ve){return setTimeout(ve,ee)},pe=function(ve){return clearTimeout(ve)}),{frame:se,cancel:pe}}(),x=function(){var ee,se,pe={};function Se(ge){function ve(be,we){ge.postMessage({options:be||{},callback:we})}ge.init=function(we){var je=we.transferControlToOffscreen();ge.postMessage({canvas:je},[je])},ge.fire=function(we,je,Fe){if(se)return ve(we,null),se;var Re=Math.random().toString(36).slice(2);return se=u(function(Qe){function Ye(dt){dt.data.callback===Re&&(delete pe[Re],ge.removeEventListener("message",Ye),se=null,d.clear(),Fe(),Qe())}ge.addEventListener("message",Ye),ve(we,Re),pe[Re]=Ye.bind(null,{data:{callback:Re}})}),se},ge.reset=function(){ge.postMessage({reset:!0});for(var we in pe)pe[we](),delete pe[we]}}return function(){if(ee)return ee;if(!r&&a){var ge=["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([ge])))}catch(ve){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",ve),null}Se(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,se){return se?se(ee):ee}function v(ee){return ee!=null}function C(ee,se,pe){return y(ee&&v(ee[se])?ee[se]:g[se],pe)}function S(ee){return ee<0?0:Math.floor(ee)}function T(ee,se){return Math.floor(Math.random()*(se-ee))+ee}function I(ee){return parseInt(ee,16)}function L(ee){return ee.map(F)}function F(ee){var se=String(ee).replace(/[^0-9a-f]/gi,"");return se.length<6&&(se=se[0]+se[0]+se[1]+se[1]+se[2]+se[2]),{r:I(se.substring(0,2)),g:I(se.substring(2,4)),b:I(se.substring(4,6))}}function $(ee){var se=C(ee,"origin",Object);return se.x=C(se,"x",Number),se.y=C(se,"y",Number),se}function O(ee){ee.width=document.documentElement.clientWidth,ee.height=document.documentElement.clientHeight}function U(ee){var se=ee.getBoundingClientRect();ee.width=se.width,ee.height=se.height}function Y(ee){var se=document.createElement("canvas");return se.style.position="fixed",se.style.top="0px",se.style.left="0px",se.style.pointerEvents="none",se.style.zIndex=ee,se}function re(ee,se,pe,Se,ge,ve,be,we,je){ee.save(),ee.translate(se,pe),ee.rotate(ve),ee.scale(Se,ge),ee.arc(0,0,1,be,we,je),ee.restore()}function Q(ee){var se=ee.angle*(Math.PI/180),pe=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:-se+(.5*pe-Math.random()*pe),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 q(ee,se){se.x+=Math.cos(se.angle2D)*se.velocity+se.drift,se.y+=Math.sin(se.angle2D)*se.velocity+se.gravity,se.velocity*=se.decay,se.flat?(se.wobble=0,se.wobbleX=se.x+10*se.scalar,se.wobbleY=se.y+10*se.scalar,se.tiltSin=0,se.tiltCos=0,se.random=1):(se.wobble+=se.wobbleSpeed,se.wobbleX=se.x+10*se.scalar*Math.cos(se.wobble),se.wobbleY=se.y+10*se.scalar*Math.sin(se.wobble),se.tiltAngle+=.1,se.tiltSin=Math.sin(se.tiltAngle),se.tiltCos=Math.cos(se.tiltAngle),se.random=Math.random()+2);var pe=se.tick++/se.totalTicks,Se=se.x+se.random*se.tiltCos,ge=se.y+se.random*se.tiltSin,ve=se.wobbleX+se.random*se.tiltCos,be=se.wobbleY+se.random*se.tiltSin;if(ee.fillStyle="rgba("+se.color.r+", "+se.color.g+", "+se.color.b+", "+(1-pe)+")",ee.beginPath(),o&&se.shape.type==="path"&&typeof se.shape.path=="string"&&Array.isArray(se.shape.matrix))ee.fill(oe(se.shape.path,se.shape.matrix,se.x,se.y,Math.abs(ve-Se)*.1,Math.abs(be-ge)*.1,Math.PI/10*se.wobble));else if(se.shape.type==="bitmap"){var we=Math.PI/10*se.wobble,je=Math.abs(ve-Se)*.1,Fe=Math.abs(be-ge)*.1,Re=se.shape.bitmap.width*se.scalar,Qe=se.shape.bitmap.height*se.scalar,Ye=new DOMMatrix([Math.cos(we)*je,Math.sin(we)*je,-Math.sin(we)*Fe,Math.cos(we)*Fe,se.x,se.y]);Ye.multiplySelf(new DOMMatrix(se.shape.matrix));var dt=ee.createPattern(d.transform(se.shape.bitmap),"no-repeat");dt.setTransform(Ye),ee.globalAlpha=1-pe,ee.fillStyle=dt,ee.fillRect(se.x-Re/2,se.y-Qe/2,Re,Qe),ee.globalAlpha=1}else if(se.shape==="circle")ee.ellipse?ee.ellipse(se.x,se.y,Math.abs(ve-Se)*se.ovalScalar,Math.abs(be-ge)*se.ovalScalar,Math.PI/10*se.wobble,0,2*Math.PI):re(ee,se.x,se.y,Math.abs(ve-Se)*se.ovalScalar,Math.abs(be-ge)*se.ovalScalar,Math.PI/10*se.wobble,0,2*Math.PI);else if(se.shape==="star")for(var st=Math.PI/2*3,at=4*se.scalar,He=8*se.scalar,qe=se.x,vt=se.y,yt=5,Kt=Math.PI/yt;yt--;)qe=se.x+Math.cos(st)*He,vt=se.y+Math.sin(st)*He,ee.lineTo(qe,vt),st+=Kt,qe=se.x+Math.cos(st)*at,vt=se.y+Math.sin(st)*at,ee.lineTo(qe,vt),st+=Kt;else ee.moveTo(Math.floor(se.x),Math.floor(se.y)),ee.lineTo(Math.floor(se.wobbleX),Math.floor(ge)),ee.lineTo(Math.floor(ve),Math.floor(be)),ee.lineTo(Math.floor(Se),Math.floor(se.wobbleY));return ee.closePath(),ee.fill(),se.tick<se.totalTicks}function te(ee,se,pe,Se,ge){var ve=se.slice(),be=ee.getContext("2d"),we,je,Fe=u(function(Re){function Qe(){we=je=null,be.clearRect(0,0,Se.width,Se.height),d.clear(),ge(),Re()}function Ye(){r&&!(Se.width===s.width&&Se.height===s.height)&&(Se.width=ee.width=s.width,Se.height=ee.height=s.height),!Se.width&&!Se.height&&(pe(ee),Se.width=ee.width,Se.height=ee.height),be.clearRect(0,0,Se.width,Se.height),ve=ve.filter(function(dt){return q(be,dt)}),ve.length?we=f.frame(Ye):Qe()}we=f.frame(Ye),je=Qe});return{addFettis:function(Re){return ve=ve.concat(Re),Fe},canvas:ee,promise:Fe,reset:function(){we&&f.cancel(we),je&&je()}}}function fe(ee,se){var pe=!ee,Se=!!C(se||{},"resize"),ge=!1,ve=C(se,"disableForReducedMotion",Boolean),be=a&&!!C(se||{},"useWorker"),we=be?x():null,je=pe?O:U,Fe=ee&&we?!!ee.__confetti_initialized:!1,Re=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,Qe;function Ye(st,at,He){for(var qe=C(st,"particleCount",S),vt=C(st,"angle",Number),yt=C(st,"spread",Number),Kt=C(st,"startVelocity",Number),jt=C(st,"decay",Number),un=C(st,"gravity",Number),vn=C(st,"drift",Number),Hn=C(st,"colors",L),ln=C(st,"ticks",Number),Nn=C(st,"shapes"),dn=C(st,"scalar"),rt=!!C(st,"flat"),nt=$(st),Ut=qe,wn=[],Jt=ee.width*nt.x,Vt=ee.height*nt.y;Ut--;)wn.push(Q({x:Jt,y:Vt,angle:vt,spread:yt,startVelocity:Kt,color:Hn[Ut%Hn.length],shape:Nn[T(0,Nn.length)],ticks:ln,decay:jt,gravity:un,drift:vn,scalar:dn,flat:rt}));return Qe?Qe.addFettis(wn):(Qe=te(ee,wn,je,at,He),Qe.promise)}function dt(st){var at=ve||C(st,"disableForReducedMotion",Boolean),He=C(st,"zIndex",Number);if(at&&Re)return u(function(Kt){Kt()});pe&&Qe?ee=Qe.canvas:pe&&!ee&&(ee=Y(He),document.body.appendChild(ee)),Se&&!Fe&&je(ee);var qe={width:ee.width,height:ee.height};we&&!Fe&&we.init(ee),Fe=!0,we&&(ee.__confetti_initialized=!0);function vt(){if(we){var Kt={getBoundingClientRect:function(){if(!pe)return ee.getBoundingClientRect()}};je(Kt),we.postMessage({resize:{width:Kt.width,height:Kt.height}});return}qe.width=qe.height=null}function yt(){Qe=null,Se&&(ge=!1,e.removeEventListener("resize",vt)),pe&&ee&&(document.body.contains(ee)&&document.body.removeChild(ee),ee=null,Fe=!1)}return Se&&!ge&&(ge=!0,e.addEventListener("resize",vt,!1)),we?we.fire(st,qe,yt):Ye(st,qe,yt)}return dt.reset=function(){we&&we.reset(),Qe&&Qe.reset()},dt}var G;function ie(){return G||(G=fe(null,{useWorker:!0,resize:!0})),G}function oe(ee,se,pe,Se,ge,ve,be){var we=new Path2D(ee),je=new Path2D;je.addPath(we,new DOMMatrix(se));var Fe=new Path2D;return Fe.addPath(je,new DOMMatrix([Math.cos(be)*ge,Math.sin(be)*ge,-Math.sin(be)*ve,Math.cos(be)*ve,pe,Se])),Fe}function K(ee){if(!o)throw new Error("path confetti are not supported in this browser");var se,pe;typeof ee=="string"?se=ee:(se=ee.path,pe=ee.matrix);var Se=new Path2D(se),ge=document.createElement("canvas"),ve=ge.getContext("2d");if(!pe){for(var be=1e3,we=be,je=be,Fe=0,Re=0,Qe,Ye,dt=0;dt<be;dt+=2)for(var st=0;st<be;st+=2)ve.isPointInPath(Se,dt,st,"nonzero")&&(we=Math.min(we,dt),je=Math.min(je,st),Fe=Math.max(Fe,dt),Re=Math.max(Re,st));Qe=Fe-we,Ye=Re-je;var at=10,He=Math.min(at/Qe,at/Ye);pe=[He,0,0,He,-Math.round(Qe/2+we)*He,-Math.round(Ye/2+je)*He]}return{type:"path",path:se,matrix:pe}}function H(ee){var se,pe=1,Se="#000000",ge='"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"?se=ee:(se=ee.text,pe="scalar"in ee?ee.scalar:pe,ge="fontFamily"in ee?ee.fontFamily:ge,Se="color"in ee?ee.color:Se);var ve=10*pe,be=""+ve+"px "+ge,we=new OffscreenCanvas(ve,ve),je=we.getContext("2d");je.font=be;var Fe=je.measureText(se),Re=Math.ceil(Fe.actualBoundingBoxRight+Fe.actualBoundingBoxLeft),Qe=Math.ceil(Fe.actualBoundingBoxAscent+Fe.actualBoundingBoxDescent),Ye=2,dt=Fe.actualBoundingBoxLeft+Ye,st=Fe.actualBoundingBoxAscent+Ye;Re+=Ye+Ye,Qe+=Ye+Ye,we=new OffscreenCanvas(Re,Qe),je=we.getContext("2d"),je.font=be,je.fillStyle=Se,je.fillText(se,dt,st);var at=1/pe;return{type:"bitmap",bitmap:we.transferToImageBitmap(),matrix:[at,0,0,at,-Re*at/2,-Qe*at/2]}}n.exports=function(){return ie().apply(this,arguments)},n.exports.reset=function(){ie().reset()},n.exports.create=fe,n.exports.shapeFromPath=K,n.exports.shapeFromText=H})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),Dfe,!1);const hwn=Dfe.exports;Dfe.exports.create;const pwn=200,mwn={origin:{y:.7}};function U7(t,e){hwn({...mwn,...e,particleCount:Math.floor(pwn*t)})}function xwn(){U7(.25,{spread:26,startVelocity:55}),U7(.2,{spread:60}),U7(.35,{spread:100,decay:.91,scalar:.8}),U7(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),U7(.1,{spread:120,startVelocity:45})}function gwn({result:t,period:e,onBack:n}){const[r,s]=h.useState(!1),[a,o]=h.useState(!1),[l,c]=h.useState({}),u="#00FF91",d="#252525",f=`PnL (${e})`,x=ge=>{navigator.clipboard.writeText(ge),fn.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=ge=>ge>=1e9?`${(ge/1e9).toFixed(0)}B`:ge>=1e6?`${(ge/1e6).toFixed(0)}M`:ge>=1e3?`${(ge/1e3).toFixed(0)}K`:ge.toFixed(0),{main:y,steps:v}=t,C=Object.values(t.steps).flat().map(ge=>({...ge,timestamp:new Date(ge.timestamp).getTime()})).sort((ge,ve)=>ge.timestamp-ve.timestamp),S={};C.forEach(ge=>{S[ge.timestamp]=(S[ge.timestamp]||0)+ge.pnl_this_step});let T=t.main.initial_equity;const I=Object.entries(S).sort((ge,ve)=>ge[0]-ve[0]).map(([ge,ve])=>(T+=ve,[Number(ge),+T.toFixed(2)])),L=I.map(([,ge])=>ge);let F=L[0],$=0;L.forEach(ge=>{ge>F&&(F=ge);const ve=(F-ge)/F;ve>$&&($=ve)});const O=($*100).toFixed(2),U=C.filter(ge=>ge.pnl_this_step>0).length,Y=C.filter(ge=>ge.pnl_this_step<0).length,re=`${(U/C.length*100).toFixed(2)}%`,Q=I.slice(1).map(([,ge],ve)=>{const be=I[ve][1];return(ge-be)/be}),q=ge=>ge.length?ge.reduce((ve,be)=>ve+be,0)/ge.length:0,te=ge=>{const ve=q(ge),be=q(ge.map(we=>(we-ve)**2));return Math.sqrt(be)},fe=(te(Q)?q(Q)/te(Q):0).toFixed(2),G=((y.my_total_equity/y.initial_equity-1)*100).toFixed(2),ie={},oe=ge=>{var ve;return{time:new Date(ge.timestamp).toLocaleTimeString(),pnl:ge.pnl_this_step,coin:ge.coin,activity:{direction:((ve=ge.trader_direction)==null?void 0:ve.toLowerCase())==="long"?"Long":"Short",leverage:ge.trader_leverage},size:ge.trader_szi,posValue:ge.our_target_value,entry:ge.our_pos_entry_price,close:ge.market_price}};C.forEach(ge=>{const ve=new Date(ge.timestamp).toLocaleDateString();ie[ve]=ie[ve]||{rows:[],totalPnl:0},ie[ve].rows.push(oe(ge)),ie[ve].totalPnl+=ge.pnl_this_step});const K=Object.entries(ie).sort((ge,ve)=>new Date(ge[0])-new Date(ve[0]));let H=y.initial_equity;const ee=K.map(([ge,{rows:ve,totalPnl:be}])=>(H+=be,{date:ge,rows:ve,totalPnl:be,equity:H}));h.useEffect(()=>{var ge;if(((ge=t==null?void 0:t.main)==null?void 0:ge.final_pnl)>0){xwn(),o(!0);const ve=setTimeout(()=>o(!1),3e3);return()=>clearTimeout(ve)}},[t]);const se={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:ge=>g(ge)}},dataLabels:{enabled:!1},tooltip:{theme:"dark",x:{format:"dd/MM HH:mm"},y:{formatter:ge=>`$${ge.toFixed(2)}`},marker:{fillColors:[u]}},zoom:{enabled:!1},markers:{size:0,colors:[u]}},pe=[{key:"time",label:"Time",width:"0.7fr"},{key:"pnl",label:"PnL",width:"0.7fr",headerClassName:"flex justify-end",render:ge=>i.jsxs("span",{className:`flex justify-end ${ge<0?"text-[#FF797C]":"text-[#67FFBD]"}`,children:[ge<0?"- $":"$",Math.abs(ge).toFixed(2)]})},{key:"coin",label:"Symbol",sortable:!0,width:"0.7fr",render:(ge,ve)=>i.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${ve.coin}.svg`,onError:Zi,className:"w-5 h-5"}),ve.coin]})},{key:"activity",label:"Direction",width:"1.3fr",render:(ge,ve)=>{const be=ve.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 ${be?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":"text-[#ff787b] bg-[rgba(255,131,117,0.16)]"}`,children:[i.jsx(Us,{className:`w-3 h-3 ${be?"rotate-180 text-[#67ffbd]":"text-[#ff787b]"}`}),`${ve.activity.direction} - ${ve.activity.leverage}x`]})}},{key:"size",label:"Size",width:"0.8fr"},{key:"posValue",label:"Position Value",width:"1fr",render:ge=>`$${ge.toFixed(2)}`},{key:"entry",label:"Entry Price",width:"0.9fr",render:ge=>`$${ge.toLocaleString()}`},{key:"close",label:"Close Price",width:"0.9fr",render:ge=>`$${ge.toLocaleString()}`}],Se=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(eB,{options:{...se,chart:{...se.chart,sparkline:{enabled:!1}}},series:[{name:"Equity",data:I}],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",Se?"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",`${O}%`,"#FF797C"],["Win Rate",re,"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:"●"}),U]})," ",i.jsxs("span",{className:"flex gap-1 items-center",children:[i.jsx("span",{className:"text-[#FF797C]",children:"●"}),Y]})]}),"white"],["Growth Rate",`${G}%`,G<0?"#FF797C":"#67FFBD"],["Sharpe",fe,"white"]].map(([ge,ve,be])=>i.jsxs("div",{children:[i.jsx("div",{className:"text-[#8E8E8E] text-[14px] pb-1",children:ge}),i.jsx("div",{style:{color:be},className:"text-[14px] font-semibold whitespace-nowrap",children:typeof ve=="number"?`$${ve.toFixed(2)}`:ve})]},ge))}),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:kct,alt:"expand",className:"cursor-pointer",onClick:()=>s(!0)})]}),i.jsx(eB,{options:se,series:[{name:"Equity",data:I}],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:ge,rows:ve,totalPnl:be,equity:we})=>{const je=be>=0,Fe=l[ge];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,[ge]:!Fe})),children:[i.jsx("span",{className:"text-left text-white",children:ge}),i.jsxs("span",{className:"text-center text-white",children:["$",we.toFixed(2)]}),i.jsxs("span",{className:`text-right ${je?"text-[#67FFBD]":"text-[#FF797C]"}`,children:[je?"+":"-","$",Math.abs(be).toFixed(2)]})]}),Fe&&i.jsx("div",{className:"overflow-x-auto",children:i.jsx(zu,{columns:pe,data:ve,listHeight:Math.min(ve.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})})]},ge)})})]})]})}const bwn=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()},ywn=()=>{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 vwn(){const[t,e]=h.useState("starter"),[n,r]=h.useState(null),[s,a]=h.useState("30D"),o=h.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){fn.error(x.error_message),e("starter");return}window.history.replaceState(null,"","?"+bwn(l)),a(l.period),r(x),e("result")}catch(f){console.error(f),e("starter"),fn.error("Backtest failed. Please try again.")}},[]);return h.useEffect(()=>{const l=ywn();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(dwn,{onRun:o}),t==="loading"&&i.jsx(fwn,{}),t==="result"&&i.jsx(gwn,{result:n,period:s,onBack:()=>{window.history.replaceState(null,"",window.location.pathname),e("starter")}})]})}const wwn=({tg:t})=>{const{address:e}=ds(),[n,r]=h.useState(!1);return h.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(M5,{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:Hi,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:V9e,alt:""}),i.jsx("div",{className:"justify-start text-black text-sm font-semibold font-['Inter'] leading-none min-w-max",children:"Open Telegram App"})]})]})]})})]})},Cwn=()=>{const[t]=YAe(),e=t==null?void 0:t.get("tg"),{isConnected:n,address:r}=ds(),{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}=h.useContext(Qr),[S,T]=h.useState(!!window.localStorage.getItem("hyperToken"));return h.useEffect(()=>{const I=window.localStorage.getItem("hyperToken");T(!!I)},[r,n,s,a]),h.useEffect(()=>{(async()=>{var $,O;const L=window.localStorage.getItem("hyperToken"),F=window.localStorage.getItem("hyperAddress");if(!(!L||!F))try{const U=await bi(F.toLowerCase(),L);U!=null&&U.success?(l(U==null?void 0:U.telegram_chat_id),c(U==null?void 0:U.subscriber_role),u(U==null?void 0:U.subs_expire_day),d(($=U==null?void 0:U.mushboomer_counts)==null?void 0:$.eth),f((O=U==null?void 0:U.mushboomer_counts)==null?void 0:O.sol),x(U==null?void 0:U.referral_code),g(U==null?void 0:U.refcode),y(U==null?void 0:U.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),v(""),C(""))}catch(U){console.error("Token verification error:",U),console.error(U.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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:S?i.jsx(wwn,{tg:e}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(Az,{})})})]})},h8e="/assets/share1-C-zw_JWP.jpg",Nwn="/assets/share2-DdEku457.jpg",Swn="/assets/share3-CNxpeTYT.jpg",jwn="/assets/share4-DJuI_ZiE.jpg",Awn="/assets/share5-T6uiFcTh.jpg",_wn="/assets/share6-DjS5fdAF.jpg",Ewn="/assets/share7-BaMtg3x6.jpg",kwn="/assets/share8-xyCgNFII.jpg",Twn="/assets/share9-BLclkV1L.jpg",Pwn="/assets/share10-C9sVwYdl.jpg",Iwn="/assets/share11-_FKzaoRV.jpg",Fwn="/assets/share12-DHiXk6_m.jpg",Own="/assets/share13-0mVBxTxA.jpg",Mwn="/assets/share14-B6N7agx8.jpg",Lwn="/assets/share15-D46qu5xc.jpg",Rwn="/assets/share16-B06pZYlo.jpg",Dwn="/assets/share17-C9ObNWuI.jpg",Bwn="/assets/share18-DafUfIIP.jpg",$wn="/assets/share19-DdeHQJDd.jpg",Uwn="/assets/share20-Cx0LCWyZ.jpg",zwn="/assets/lighter-banner-B9jyiBZ3.png",Hwn="#67FFBD",Vwn="https://dextrabothypev2.nftinit.io/api/hyper/fee_calculator_save/";function Wwn({initialWalletAddress:t}){const e=yo(),[n,r]=h.useState(t||""),[s,a]=h.useState(!1),[o,l]=h.useState(null),[c,u]=h.useState(null),[d,f]=h.useState(t||""),[x,g]=h.useState(!1),[y,v]=h.useState(0),[C,S]=h.useState(!1),[T,I]=h.useState(h8e),[L,F]=h.useState(""),[$,O]=h.useState(""),U=h.useRef(!1),Y=h.useRef(null),re=h.useRef(null),Q=h.useRef(0),q=[h8e,Nwn,Swn,jwn,Awn,_wn,Ewn,kwn,Twn,Pwn,Iwn,Fwn,Own,Mwn,Lwn,Rwn,Dwn,Bwn,$wn,Uwn];h.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(/^#/,"")),Ye=window.location.pathname.split("/").filter(Boolean),dt=Ye[Ye.length-1]||"",at=dt&&dt.toLowerCase()!=="hyperliquid-fee-calculator"?decodeURIComponent(dt):"",He=Qe||at;if(He){f(He),r(He);const qe=`${window.location.pathname}#${encodeURIComponent(He)}`;window.history.replaceState(null,"",qe),O(`${window.location.origin}${qe}`),oe(He)}return()=>{Re&&(Re.style.background="")}},[]),h.useEffect(()=>{t&&t.trim()&&oe(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)}`,G=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"numeric"}),ie=async Re=>{if(U.current)return;U.current=!0;const Qe=window.localStorage.getItem("hyperAddress")||"",Ye={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:G()}};Qe&&(Ye.address=Qe);try{await fetch(Vwn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ye)})}catch{}},oe=async Re=>{if(!Re){fn.error("Please enter a wallet address");return}U.current=!1,a(!0),l(null),u(null),g(!1),v(0),S(!1),e(`/hyperliquid-fee-calculator/${Re}`,{replace:!0}),O(`${window.location.origin}/hyperliquid-fee-calculator/${Re}`);try{await Oln(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),S(!0),ie(Qe),e(`/hyperliquid-fee-calculator/${Re}`,{replace:!0}))})}catch(Qe){l(Qe.message||"Failed to calculate fees"),fn.error("Failed to calculate fees"),g(!1),a(!1)}},K=Re=>{f(Re),Re.trim()&&r(Re.trim())},H=(()=>{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(Y.current)try{await document.fonts.ready;const Re=await q1(Y.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{fn.error("Failed to download PNG.")}},se=$||L||"https://app.dextrabot.com/hyperliquid-fee-calculator",pe=`https://x.com/intent/post?text=${encodeURIComponent(H)}&url=${encodeURIComponent(se)}`,[Se,ge]=h.useState({rx:0,ry:0,gx:50,gy:50}),ve=12,be=Re=>{re.current&&(cancelAnimationFrame(Q.current),Q.current=requestAnimationFrame(()=>{const Qe=re.current.getBoundingClientRect(),Ye=(Re.clientX-Qe.left)/Qe.width,dt=(Re.clientY-Qe.top)/Qe.height,st=(Ye-.5)*(ve*2),at=(.5-dt)*(ve*2);ge({rx:Math.max(-12,Math.min(ve,at)),ry:Math.max(-12,Math.min(ve,st)),gx:Ye*100,gy:dt*100})}))},we=()=>{cancelAnimationFrame(Q.current),ge({rx:0,ry:0,gx:50,gy:50})},je=s,Fe=!n.trim();return i.jsxs(za,{children:[i.jsxs(Va,{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(Ya.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:Xj,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:Hwn},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(nWe,{className:"h-5 w-5 text-[#88a296]"})}),i.jsx("input",{type:"text",value:d,onChange:Re=>K(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),O("")},className:"absolute inset-y-0 right-2 flex justify-center items-center h-10 top-[5px]",children:i.jsx(Lde,{className:"h-6 w-6 text-[#8ea79e] hover:text-white transition-colors"})}):null]}),i.jsxs(Ya.button,{whileTap:{scale:.98},onClick:()=>oe(n),disabled:je||Fe,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]":Fe?"bg-[#16211b] text-[#7ea391] cursor-not-allowed border border-[#1e2e27]":"bg[rgba(103,255,189,0.95)]"}`,style:!je&&!Fe?{backgroundColor:"rgba(103,255,189,0.95)",color:"#0b0b0b"}:void 0,children:[i.jsx(dP,{initial:!1,children:je&&i.jsx(Ya.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:g2,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[320px] lg:h-[380px] object-cover"},g2)]})})]})]}),C&&c&&i.jsx(Ya.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:()=>{S(!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(mun,{className:"w-5 h-5"}),"Back"]})}),i.jsxs("div",{className:"shrink-0",children:[i.jsx(qwn,{refCard:Y,refWrap:re,tilt:Se,onMove:be,onLeave:we,feeData:c,selectedImage:T}),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(sSt,{})}),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(pQ,{className:"w-5 h-5 text-[#7a8c86]"})]}),i.jsx("div",{className:"mt-3 grid grid-cols-1 gap-2",children:i.jsx("a",{href:pe,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(ZNt,{})}),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(pQ,{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(tSt,{})}),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(pQ,{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:q.map((Re,Qe)=>i.jsx(Ya.button,{whileHover:{y:-2},whileTap:{scale:.98},onClick:()=>I(Re),className:`rounded-md overflow-hidden border ${T===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:zwn,alt:"Lighter — Zero Fee",className:"h-full w-full cursor-pointer",loading:"eager",decoding:"async",draggable:!1,onClick:()=>{window.location.hash="lighter-farming"}})})]})]})]})}function qwn({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=h.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:Hi,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:Hi,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 p8e=()=>{const{walletAddress:t}=v2(),{setTelegramChatId:e,setSubscriberRole:n,setSubsExpireDay:r,setMushboomerETH:s,setIsWhitelist:a,setMushboomerSOL:o,setIsReferralCode:l,setIsReferralCodeName:c,setHyperToken:u,setHyperAddress:d}=h.useContext(Qr);return h.useEffect(()=>{(async()=>{var y,v;const x=window.localStorage.getItem("hyperToken"),g=window.localStorage.getItem("hyperAddress");if(!(!x||!g))try{const C=await bi(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(za,{children:i.jsxs(Va,{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(Wwn,{initialWalletAddress:t})})})]})};function Gwn(t){return Ol({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 m8e(t){return Ol({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 x8e(t){return Ol({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 g8e(t){return Ol({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 Kwn(t){return Ol({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 Ywn({value:t,onChange:e,options:n=[{value:"extended",label:"Extended"},{value:"hyperliquid",label:"Hyperliquid"}],activeTextColor:r="#1de674",chevronColor:s="#1de674"}){const[a,o]=h.useState(!1),l=h.useRef(null);h.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=h.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:Do,border:`1px solid ${Da}`,color:$i},children:[i.jsx("span",{className:"truncate text-xs font-medium",style:{color:$i},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:Do,border:`1px solid ${Da}`},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":$i},onClick:()=>{e==null||e(u.value),o(!1)},children:u.label},u.value)})})]})}const Xwn="https://api.starknet.extended.exchange/api/v1/user/balance",Qwn="https://express-proxy-delta.vercel.app/proxy?url==",Zwn=t=>t==="extended"?"Extended Wallet":t==="hyperliquid"?"HyperLiquid Wallet":"Lighter Wallet",Jwn=async t=>{var e,n,r;if(!t)return null;try{const s=`${Qwn}${encodeURIComponent(Xwn)}`,o=await(await fetch(s,{headers:{"X-Api-Key":t}})).json().catch(()=>null),l=((e=o==null?void 0:o.data)==null?void 0:e.availableForTrade)??(o==null?void 0:o.availableForTrade)??((n=o==null?void 0:o.data)==null?void 0:n.available_balance)??(o==null?void 0:o.available_balance)??((r=o==null?void 0:o.data)==null?void 0:r.available)??(o==null?void 0:o.available),c=Number(l);return Number.isFinite(c)&&c>=0?c:null}catch{return null}},e3n=async({selectedMarket:t,address:e,token:n})=>{if(!e||!n)return[];if(t==="hyperliquid"){const s=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e.toLowerCase(),token:n,balance:"true"})})).json().catch(()=>null);return(Array.isArray(s==null?void 0:s.data)?s.data:Array.isArray(s)?s:[]).map((o,l)=>{var c,u;return{wallet_id:o.wallet_id??o.id??l,wallet_address:o.wallet_address||o.address||"",wallet_name:o.wallet_name||o.name||`Hyper Wallet ${l+1}`,available_balance:((c=o.balances)==null?void 0:c.hyper_usdc)??((u=o.balances)==null?void 0:u.usdc)??o.available_balance??null,wallet_api_key:null}})}if(t==="extended"){const s=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-extended",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e.toLowerCase(),token:n,balance:"true"})})).json().catch(()=>null);let a=[];return Array.isArray(s)?a=s:Array.isArray(s==null?void 0:s.data)&&(a=s.data),Promise.all(a.map(async(o,l)=>{let c=null;const u=Number(o.available_balance??o.availableForTrade??o.available_for_trade??o.balance??o.available??null);Number.isFinite(u)&&(c=u);const d=o.wallet_id??o.id??l,f=o.wallet_api_key||o.api_key||null;if(f&&c==null){const x=await Jwn(f);x!=null&&(c=x)}return{wallet_id:d,wallet_address:o.wallet_address||o.address||"",wallet_name:o.wallet_name||o.name||`Extended Wallet ${l+1}`,available_balance:c,wallet_api_key:f}}))}return[]},t3n=({selectedMarket:t,selectedWallet:e,wallets:n,extendedBalance:r,hyperliquidBalance:s,hyperAccount:a})=>{var c;if(!e||!e.id)return null;const o=n.find(u=>String(u.wallet_id)===String(e.id));if(!o)return null;if(t==="extended"&&e.apiKey){const u=Number(r==null?void 0:r.availableForTrade);if(Number.isFinite(u))return u}if(t==="hyperliquid"){const u=Number(s);if(Number.isFinite(u))return u;const d=Number((c=a==null?void 0:a.perpsOverview)==null?void 0:c.balance);if(Number.isFinite(d))return d}const l=Number(o.available_balance??o.availableForTrade??o.available_for_trade??o.balance??o.available??null);return Number.isFinite(l)?l:null},Wb="#67FFBD",zM="#ff7073",uO="#60A5FA",b8e="#A78BFA",n3n="#F97316",r3n={KBONK:"BONK",KPEPE:"PEPE",KSHIB:"SHIB",KFLOKI:"FLOKI",KNEIRO:"NEIRO",KDOGS:"DOGS",KLUNC:"LUNC"},s3n=new Set(["KBONK","KPEPE","KSHIB"]),i3n="https://app.hyperliquid.xyz/coins",y8e={SAFE:{icon:"✅",color:Wb,label:"Safe",tooltip:"Order can be safely executed with sufficient collateral buffer"},WARNING:{icon:"⚠️",color:n3n,label:"Warning",tooltip:"Position is approaching liquidation risk, consider reducing leverage or adding collateral"},STOPPED:{icon:"🛑",color:zM,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]=h.useState(!1),[s,a]=h.useState({x:0,y:0}),o=h.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(us,{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"}})]})]})},fg=({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]=h.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},S=F=>{let $=F.target.value;const O=parseFloat($);$!==""&&r!==void 0&&!Number.isNaN(O)&&!Number.isNaN(parseFloat(r))&&O<parseFloat(r)&&($=String(parseFloat(r))),$!==""&&s!==void 0&&!Number.isNaN(O)&&!Number.isNaN(parseFloat(s))&&O>parseFloat(s)&&($=String(parseFloat(s))),n($)},T=()=>{v(!0)},I=C(e),L=x&&(g||I)?g||I:y&&I?I: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:S,onBlur:T,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 ${L?"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})]}),L&&i.jsx("p",{className:"text-[10px] text-[#ff7073] px-1",children:L}),u&&!L&&i.jsx("p",{className:"text-[10px] text-[#666] px-1",children:u})]})},a3n=t=>{const e=String(t||"").toUpperCase();return s3n.has(e)?`1000${e.slice(1)}`:e},Fo=(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)},Lb=(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)}`,o3n=t=>t==null||isNaN(t)?"-":`${t.toFixed(2)}%`,l3n=(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)},sc=t=>String(t||"").toUpperCase().replace(/-USD(T)?$/,"").replace(/\/USD(T)?$/,"").replace(/USD(T)?$/,""),c3n=(t,e=[])=>{const n=sc(t),r=e.find(s=>{var o;const a=sc(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},u3n=(t,e=[])=>{const n=sc(t);return e.find(r=>{var a;const s=sc(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},d3n=({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"})]})]})]})},v8e=({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 f3n(){var Gr,Or;const t=Pl(),e=yfe(),n=e.length===0,r=vfe(),s=r.length===0,a=hP(),o=a.length===0,[l,c]=h.useState("extended"),[u,d]=h.useState([]),[f,x]=h.useState(50),[g,y]=h.useState({}),[v,C]=h.useState("extended"),[S,T]=h.useState("BTC"),[I,L]=h.useState(""),[F,$]=h.useState("long"),[O,U]=h.useState("10"),[Y,re]=h.useState("5"),[Q,q]=h.useState("10"),[te,fe]=h.useState("10"),[G,ie]=h.useState("1500"),[oe,K]=h.useState(!1),[H,ee]=h.useState("1"),[se,pe]=h.useState(""),[Se,ge]=h.useState(!0),[ve,be]=h.useState("0.50"),[we,je]=h.useState("1.1"),[Fe,Re]=h.useState("1"),[Qe,Ye]=h.useState(!0),[dt,st]=h.useState(!0),[at,He]=h.useState(!0),[qe,vt]=h.useState(!0),[yt,Kt]=h.useState("details"),[jt,un]=h.useState([]),[vn,Hn]=h.useState(!1),[ln,Nn]=h.useState([]),[dn,rt]=h.useState(!1),[nt,Ut]=h.useState(null),[wn,Jt]=h.useState(!1),[Vt,xt]=h.useState({}),[We,Pt]=h.useState({}),[Ke,ct]=h.useState(null),[Nt,Ht]=h.useState(null),Rt=h.useRef(!1),hn=h.useRef(!0),yn=h.useRef(0),Cn=H8(l==="hyperliquid"?nt==null?void 0:nt.address:null);h.useEffect(()=>{var nn;if(l!=="hyperliquid"){Ht(null);return}const Lt=Number((nn=Cn==null?void 0:Cn.perpsOverview)==null?void 0:nn.balance);Ht(Number.isFinite(Lt)?Lt:null)},[l,(Gr=Cn==null?void 0:Cn.perpsOverview)==null?void 0:Gr.balance]);const En=l==="extended"?r:l==="hyperliquid"?a:e,Rn=l==="extended"?s:l==="hyperliquid"?o:n,Mn=l==="extended"?"extended_selected_wallet_id":l==="hyperliquid"?"hyperliquid_selected_wallet_id":"lighter_selected_wallet_id",Yn=h.useMemo(()=>`dca_last_coin_${l}`,[l]),Zn=h.useMemo(()=>`dca_settings_${l}`,[l]),Vn=h.useMemo(()=>({baseOrderMargin:"5",dcaOrderMargin:"10",maxDcaOrders:"10",tpTarget:"1",stopLoss:"",priceDeviation:"0.50",dcaSizeMultiplier:"1.1",priceDevMultiplier:"1"}),[]);h.useEffect(()=>{v==="extended"?c("extended"):v==="hyperliquid"&&c("hyperliquid")},[v]),h.useEffect(()=>{const Lt=(t==null?void 0:t.search)||"";if(!Lt)return;const nn=new URLSearchParams(Lt),Ot=String(nn.get("market")||"").toLowerCase();(Ot==="hyperliquid"||Ot==="extended"||Ot==="lighter")&&C(Ot)},[t==null?void 0:t.search]);const tr=yo(),Sn=h.useRef(null),ze=h.useCallback(Lt=>{Sn.current="ui",C(Lt)},[]);h.useEffect(()=>{if(!t||v!=="hyperliquid"&&v!=="extended"||Sn.current!=="ui")return;const Lt=new URLSearchParams(t.search||"");if(String(Lt.get("market")||"").toLowerCase()===v){Sn.current=null;return}Lt.set("market",v);const Ot=Lt.toString(),en=Ot?`?${Ot}`:"";(t.search||"")!==en&&(tr(`${t.pathname}${en}${t.hash||""}`,{replace:!0}),Sn.current=null)},[t==null?void 0:t.pathname,t==null?void 0:t.search,t==null?void 0:t.hash,v,tr]),h.useEffect(()=>{if(typeof window>"u")return;const Lt=window.localStorage.getItem(Zn),nn={...Vn};if(Lt)try{const Ot=JSON.parse(Lt)||{};Object.keys(Vn).forEach(en=>{Ot[en]!==void 0&&Ot[en]!==null&&(nn[en]=String(Ot[en]))})}catch{}re(nn.baseOrderMargin),q(nn.dcaOrderMargin),fe(nn.maxDcaOrders),ee(nn.tpTarget),pe(nn.stopLoss),be(nn.priceDeviation),je(nn.dcaSizeMultiplier),Re(nn.priceDevMultiplier)},[Zn,Vn]),h.useEffect(()=>{if(typeof window>"u")return;const Lt={baseOrderMargin:Y,dcaOrderMargin:Q,maxDcaOrders:te,tpTarget:H,stopLoss:se,priceDeviation:ve,dcaSizeMultiplier:we,priceDevMultiplier:Fe};try{window.localStorage.setItem(Zn,JSON.stringify(Lt))}catch{}},[Zn,Y,Q,te,H,se,ve,we,Fe]);const xe=h.useMemo(()=>{const Lt=new Map;return u.forEach(nn=>{const Ot=sc(nn.value||nn.label||nn.symbol||nn.coin);if(!Ot)return;const en=nn.maxLeverage??nn.max_leverage??nn.leverage??null,Fn=Number(en);Lt.set(Ot,Number.isFinite(Fn)?Fn:null)}),Lt},[u]),Ge=h.useMemo(()=>En.filter(Lt=>{var Ot;return l!=="hyperliquid"?!0:!String(Lt.symbol||Lt.rawSymbol||((Ot=Lt.raw)==null?void 0:Ot.symbol)||Lt.market||Lt.coin||"").toUpperCase().endsWith("-USDH")}).map(Lt=>{var Fn,yr,hr;const nn=sc(Lt.symbol||Lt.rawSymbol||((Fn=Lt.raw)==null?void 0:Fn.symbol)||Lt.market||Lt.coin),Ot=Lt.leverage??Lt.maxLeverage??Lt.max_leverage??(nn?xe.get(nn):null),en=Number.isFinite(Number(Ot))&&Number(Ot)>0?Number(Ot):null;return{...Lt,symbol:Lt.symbol||((yr=Lt.raw)==null?void 0:yr.symbol)||Lt.rawSymbol||Lt.market||"",rawSymbol:Lt.rawSymbol||((hr=Lt.raw)==null?void 0:hr.symbol)||Lt.symbol,leverage:en,maxLeverage:Lt.maxLeverage??Lt.max_leverage??en}}),[En,xe]),_e="https://dextrabothypev2.nftinit.io/api/hyper/dca_bot",{setSignModalOpen:Be,hyperToken:qt,hyperAddress:It}=h.useContext(Qr),[mt,Ft]=h.useState({address:null,token:null}),Tn=h.useCallback(()=>mt,[mt]),[kn,Gt]=h.useState(!1),mn=Lt=>{if(!Lt)return null;const nn=String(Lt);return nn==="null"||nn==="undefined"?null:nn};h.useEffect(()=>{const Lt=()=>{if(typeof window>"u")return;const Ot=mn(It||window.localStorage.getItem("hyperAddress")),en=mn(qt||window.localStorage.getItem("hyperToken"));Ft({address:Ot,token:en}),(!Ot||!en)&&(Gt(!1),Nn([]),Ut(null),yn.current=0)};Lt(),window.addEventListener("localStorageUpdated",Lt),window.addEventListener("storage",Lt);const nn=setInterval(()=>{if(typeof window>"u")return;const Ot=mn(It||window.localStorage.getItem("hyperAddress")),en=mn(qt||window.localStorage.getItem("hyperToken"));Ft(Fn=>Fn.address===Ot&&Fn.token===en?Fn:{address:Ot,token:en}),(!Ot||!en)&&(Gt(!1),Nn([]),Ut(null),yn.current=0)},1500);return()=>{window.removeEventListener("localStorageUpdated",Lt),window.removeEventListener("storage",Lt),clearInterval(nn)}},[qt,It]),h.useEffect(()=>{const Lt=!!mt.token,nn=!!mt.address;Gt(Lt&&nn)},[mt]),h.useEffect(()=>()=>{hn.current=!1},[]);const gt=h.useCallback(async()=>{if(Rt.current)return;const Lt=mt.address,nn=mt.token;if(!Lt||!nn){Rt.current=!1,rt(!1);return}const Ot=Date.now();if(!(Ot-yn.current<4500)){yn.current=Ot,Rt.current=!0,rt(!0);try{const en=await e3n({selectedMarket:l,address:Lt,token:nn});if(!hn.current)return;Nn(en),en.length>0?Ut(Fn=>{const yr=typeof window<"u"?window.localStorage.getItem(Mn):null,hr=(Fn==null?void 0:Fn.id)??yr,lt=hr&&en.find(Ct=>String(Ct.wallet_id)===String(hr))||en[0];return lt?{id:lt.wallet_id,address:lt.wallet_address,apiKey:lt.wallet_api_key}:null}):Ut(null)}catch(en){console.error("Error loading wallets:",en),hn.current&&Nn([])}finally{Rt.current=!1,hn.current&&rt(!1)}}},[mt.address,mt.token,l,Mn]);h.useEffect(()=>{kn&>()},[kn,gt]),h.useEffect(()=>{mt.address&&mt.token?(Gt(!0),gt()):(Gt(!1),Nn([]),Ut(null),yn.current=0)},[mt.address,mt.token,gt]),h.useEffect(()=>{const Lt=()=>gt();return window.addEventListener("localStorageUpdated",Lt),window.addEventListener("storage",Lt),()=>{window.removeEventListener("localStorageUpdated",Lt),window.removeEventListener("storage",Lt)}},[gt]),h.useEffect(()=>{yn.current=0,Nn([]),Ut(null),ct(null),Ht(null)},[l]),h.useEffect(()=>{K(!1)},[nt==null?void 0:nt.id,l]);const Wt=h.useMemo(()=>t3n({selectedMarket:l,selectedWallet:nt,wallets:ln,extendedBalance:Ke,hyperliquidBalance:Nt,hyperAccount:Cn}),[l,nt,ln,Ke,Nt,Cn]),jn=h.useCallback(async()=>{const Lt=mt.address,nn=mt.token;if(!Lt||!nn){un([]);return}Hn(!0);try{const en=await(await fetch(`${_e}/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Lt.toLowerCase(),token:nn,source_market:l})})).json().catch(()=>null),yr=(Array.isArray(en==null?void 0:en.data)?en.data:en!=null&&en.data?[en.data]:[]).filter(hr=>hr?l?String(hr.source_market||"").toLowerCase()===String(l||"").toLowerCase()?!0:l==="hyper"&&!hr.source_market:!0:!1);un(yr)}catch(Ot){console.error("Error loading bots:",Ot),un([])}finally{Hn(!1)}},[Tn,_e,l]);h.useEffect(()=>{jn()},[jn,mt.address,mt.token,l]);const kt=h.useCallback(async()=>{var Ot,en,Fn;const{address:Lt,token:nn}=Tn();if(!Lt||!nn||!nt||!nt.id){fn.error("Please connect your wallet and select a wallet.");return}Jt(!0);try{const yr=(Ot=S==null?void 0:S.toUpperCase())==null?void 0:Ot.trim(),hr=l==="hyperliquid"&&(Ce!=null&&Ce.rawSymbol)?String(Ce.rawSymbol):a3n(yr);let lt=null;if(l==="lighter")try{const le=await(await fetch("https://mainnet.zklighter.elliot.ai/api/v1/funding-rates")).json().catch(()=>null);if(le!=null&&le.funding_rates&&Array.isArray(le.funding_rates)){const Me=le.funding_rates.find(ft=>String(ft.symbol||"").toUpperCase().trim()===yr);Me&&Me.market_id!=null?(lt=Me.market_id,console.log(`✅ Found market_id ${lt} for coin ${yr} from funding-rates API (exchange: ${Me.exchange})`)):(console.warn(`❌ Coin ${yr} not found in funding-rates API`),console.log("Sample available symbols:",le.funding_rates.slice(0,20).map(ft=>ft.symbol)))}else console.warn("No funding_rates array in API response")}catch(pt){console.error("Error fetching funding-rates API:",pt),lt=g[yr]||null,lt&&console.log(`Using cached market_id ${lt} for coin ${yr}`)}if(lt===null){if(l==="extended"&&(!En||!En.length)){fn.error("Extended markets are loading. Please try again in a moment."),Jt(!1);return}lt=c3n(S,En)}if(lt===null&&l!=="extended"&&l!=="hyperliquid"){console.error("Market not found for coin:",yr),fn.error(`Unable to find market index for ${yr}. Please make sure the coin is available on ${l}.`),Jt(!1);return}lt!=null;const Ct=ln.find(pt=>String(pt.wallet_id)===String(nt.id));if(!Ct||!Ct.wallet_id){fn.error("Unable to find selected wallet. Please select a wallet again."),Jt(!1);return}const On=Math.max(1,Math.min(Number(f)||100,Number(O)||1)),qn=u3n(S,En),_r=String(S||"").toUpperCase(),jr=Number((qn==null?void 0:qn.maxLeverage)??(qn==null?void 0:qn.leverage)??(qn==null?void 0:qn.max_leverage)??f??0),Fr=l==="extended"&&jr>0?Math.min(jr,On||jr):On,nr=parseFloat(H)||0,vr=Number(I)||Number(qn==null?void 0:qn.markPrice)||Number(qn==null?void 0:qn.lastPrice)||Number(qn==null?void 0:qn.last)||null,Yr=Number(((en=qn==null?void 0:qn.tradingConfig)==null?void 0:en.minOrderSize)??(qn==null?void 0:qn.minOrderSize)),dr=Number.isFinite(Yr)&&Yr>0&&Number.isFinite(vr)&&vr>0?Yr*vr:null;if(l==="hyperliquid"){const pt=Number((qn==null?void 0:qn.last)??vr??0),le=parseFloat(Y)||0,Me=(qn==null?void 0:qn.sizeDecimalsInfo)??((Fn=qn==null?void 0:qn.raw)==null?void 0:Fn.szDecimals)??0,ft=Number.isFinite(Number(Me))&&Number(Me)>=0?Math.floor(Number(Me)):0,ut=Number.isFinite(pt)&&pt>0?le*Fr/pt:null,on=Number.isFinite(ut)?Number(ut.toFixed(ft)):null,bn=Number.isFinite(pt)&&Number.isFinite(on)?pt*on:null;if(!Number.isFinite(bn)||bn<10){fn.error("Minimum order size is $10 (Base Order & DCA Order). Increase order size or leverage."),Jt(!1);return}}if(l==="extended"&&dr!=null){const pt=parseFloat(Y)||0,le=parseFloat(Q)||0,Me=pt*Fr,ft=le*Fr;if(Me<dr||ft<dr){const ut=[];Me<dr&&ut.push("Base Order"),ft<dr&&ut.push("DCA Order");const on=ut.length===1?` (${ut[0]})`:ut.length===2?" (Base Order & DCA Order)":"";fn.error(`Minimum order size for ${_r} is $${dr.toFixed(2)}${on}. Increase order size or leverage.`),Jt(!1);return}}const rs={direction:F,leverage:Fr,base_amount_usd:parseFloat(Y)||0,safety_amount_usd:parseFloat(Q)||0,max_safety_orders:parseInt(te)||0,price_deviation:parseFloat(ve)||.5,step_scale:parseFloat(Fe)||1,volume_scale:parseFloat(we)||1.5,tp_percent:nr,stop_loss_percent:se?parseFloat(se):0};l!=="extended"&<!=null&&(rs.market_index=Number.isFinite(Number(lt))?Number(lt):lt);const gs={address:Lt.toLowerCase(),token:nn,wallet_id:Ct.wallet_id,source_market:l,bot_params:rs,coin:hr},At=await(await fetch(`${_e}/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(gs)})).json().catch(()=>null);At!=null&&At.success?(fn.success("DCA Bot started successfully!"),await jn(),Kt("bots")):fn.error((At==null?void 0:At.error_message)||"Failed to start bot. Please try again.")}catch(yr){console.error("Error starting bot:",yr),fn.error("Error starting bot. Please try again.")}finally{Jt(!1)}},[Tn,nt,l,S,En,g,ln,F,O,Y,Q,te,ve,we,Fe,H,se,jn,_e]);h.useCallback(async Lt=>{const{address:nn,token:Ot}=Tn();if(!nn||!Ot||!nt||!nt.id){fn.error("Please connect your wallet and select a wallet.");return}const en=ln.find(Fn=>String(Fn.wallet_id)===String(nt.id));if(!en||!en.wallet_id){fn.error("Unable to find selected wallet. Please select a wallet again.");return}xt(Fn=>({...Fn,[Lt]:!0}));try{const yr=await(await fetch(`${_e}/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:nn.toLowerCase(),token:Ot,wallet_id:en.wallet_id,source_market:l,coin:S})})).json().catch(()=>null);yr!=null&&yr.success?await jn():fn.error((yr==null?void 0:yr.error_message)||"Failed to stop bot. Please try again.")}catch(Fn){console.error("Error stopping bot:",Fn),fn.error("Error stopping bot. Please try again.")}finally{xt(Fn=>({...Fn,[Lt]:!1}))}},[Tn,nt,l,S,ln,jn,_e]);const cn=h.useCallback(async(Lt,nn,Ot={})=>{const{address:en,token:Fn}=Tn();if(!en||!Fn){fn.error("Please connect your wallet.");return}xt(yr=>({...yr,[Lt]:!0})),un(yr=>yr.map(hr=>hr.id===Lt||hr.bot_id===Lt?{...hr,is_deleted:nn,...Ot}:hr));try{const hr=await(await fetch(`${_e}/update/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:en.toLowerCase(),token:Fn,bot_id:Lt,update_params:{is_deleted:nn,...Ot}})})).json().catch(()=>null);if(hr!=null&&hr.success)await jn(),nn&&fn.success("DCA Bot has been stopped.");else{await jn();const lt=(hr==null?void 0:hr.error_message)||(hr==null?void 0:hr.message)||(hr==null?void 0:hr.detail)||(hr==null?void 0:hr.error),Ct=nn?"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.";fn.error(lt||Ct)}}catch(yr){console.error("Error updating bot:",yr),await jn(),fn.error(nn?"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{xt(yr=>({...yr,[Lt]:!1}))}},[Tn,jn,_e]);h.useCallback(async Lt=>{const{address:nn,token:Ot}=Tn();if(!nn||!Ot){fn.error("Please connect your wallet.");return}if(confirm("Are you sure you want to delete this bot? This action cannot be undone.")){Pt(en=>({...en,[Lt]:!0})),un(en=>en.filter(Fn=>Fn.id!==Lt&&Fn.bot_id!==Lt));try{const en=await fetch(`${_e}/update/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:nn.toLowerCase(),token:Ot,bot_id:Lt,update_params:{permanent_delete:!0,is_deleted:!0}})}),Fn=await en.json().catch(()=>null);if(console.log("Delete bot response:",Fn),console.log("Response status:",en.status),Fn!=null&&Fn.success)await jn();else{console.log("Trying delete endpoint as fallback...");const yr=await fetch(`${_e}/delete/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:nn.toLowerCase(),token:Ot,bot_id:Lt})}),hr=await yr.json().catch(()=>null);if(console.log("Delete endpoint response:",hr),hr!=null&&hr.success)await jn();else{await jn();const lt=(hr==null?void 0:hr.error_message)||(Fn==null?void 0:Fn.error_message)||(hr==null?void 0:hr.message)||(Fn==null?void 0:Fn.message)||(hr==null?void 0:hr.detail)||(Fn==null?void 0:Fn.detail)||`Failed to delete bot. Status: ${yr.status||en.status}`;console.error("Delete bot error:",lt,{data:Fn,deleteData:hr}),fn.error(lt)}}}catch(en){console.error("Error deleting bot:",en),await jn(),fn.error(`Error deleting bot: ${en.message||"Please try again."}`)}finally{Pt(en=>({...en,[Lt]:!1}))}}},[Tn,jn,_e]),h.useEffect(()=>{let Lt=!1;async function nn(){try{const en=await(await fetch("https://mainnet.zklighter.elliot.ai/api/v1/funding-rates")).json().catch(()=>null);if(Lt||!(en!=null&&en.funding_rates))return;const Fn={};en.funding_rates.filter(yr=>yr.exchange==="lighter").forEach(yr=>{if(yr.symbol&&yr.market_id!=null){const hr=String(yr.symbol).toUpperCase().trim();Fn[hr]=yr.market_id}}),Lt||y(Fn)}catch(Ot){console.error("Error loading market IDs from funding-rates API:",Ot),Lt||y({})}}return nn(),()=>{Lt=!0}},[]),h.useEffect(()=>{let Lt=!1;async function nn(){try{const en=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=lighter_fr")).json().catch(()=>null);if(Lt)return;let Fn=[];Array.isArray(en)?Fn=en:Array.isArray(en==null?void 0:en.data)?Fn=en.data:Array.isArray(en==null?void 0:en.coins)&&(Fn=en.coins);const yr=Fn.map(hr=>({value:String(hr.value||hr.label||hr.symbol||hr.coin||"").toUpperCase(),label:hr.label||hr.value||hr.symbol||hr.coin,maxLeverage:hr.maxLeverage||50}));Lt||d(yr)}catch{Lt||d([])}}return nn(),()=>{Lt=!0}},[]),h.useEffect(()=>{var lt;if(!En.length)return;const Lt=sc(S);if(Lt?En.some(Ct=>sc(Ct.symbol)===Lt):!1)return;const Ot=typeof window<"u"?window.localStorage.getItem(Yn):null,en=sc(Ot),Fn=Ot&&en?En.some(Ct=>sc(Ct.symbol)===en):!1,yr=En[0],hr=Fn?en:sc((yr==null?void 0:yr.symbol)||((lt=yr==null?void 0:yr.raw)==null?void 0:lt.symbol)||(yr==null?void 0:yr.rawSymbol));T(hr||"BTC")},[En,S,Yn]);const Ce=h.useMemo(()=>{const Lt=sc(S);return Lt&&(En.find(nn=>sc(nn.symbol)===Lt)||En.find(nn=>{var Ot;return sc(((Ot=nn.raw)==null?void 0:Ot.symbol)||nn.rawSymbol)===Lt}))||null},[En,S]),m=h.useMemo(()=>{const Lt=sc(S);if(!Lt)return null;const nn=r3n[Lt]||Lt;if((Ce==null?void 0:Ce.kind)==="hip3"&&(Ce!=null&&Ce.builder)){const Ot=String(nn).replace(/-USDC$/,"").replace(/-USDH$/,"").replace(/-USD$/,"");return`${Ce.builder}:${Ot}`}return nn},[S,Ce]),p=h.useMemo(()=>{let Lt=sc(S);return Lt?(l==="hyperliquid"&&(Lt=Lt.replace(/-USDC.*/,"")),jt.find(nn=>{var en,Fn;let Ot=sc(nn.coin||nn.symbol||((en=nn.bot_params)==null?void 0:en.coin)||((Fn=nn.bot_params)==null?void 0:Fn.symbol));return Ot?(l==="hyperliquid"&&(Ot.includes(":")&&(Ot=Ot.split(":")[1]),Ot=Ot.replace(/-USDC.*/,"")),!nn.is_deleted&&Ot===Lt):!1})||null):null},[jt,S,l]),N=h.useMemo(()=>{const Lt=jt.filter(Ot=>!Ot.is_deleted),nn=jt.filter(Ot=>Ot.is_deleted);return[...Lt,...nn]},[jt]),A=Number(I)||Number(Ce==null?void 0:Ce.markPrice)||Number(Ce==null?void 0:Ce.lastPrice)||Number(Ce==null?void 0:Ce.last)||null,k=Number(((Or=Ce==null?void 0:Ce.tradingConfig)==null?void 0:Or.minOrderSize)??(Ce==null?void 0:Ce.minOrderSize)),P=l==="extended"&&Number.isFinite(k)&&k>0&&Number.isFinite(A)&&A>0?k*A:null,D=Math.max(1,Number(O)||1),V=parseFloat(Y)||0,Z=parseFloat(Q)||0,ce=V*D,ue=Z*D,me=l==="extended"&&P!=null&&ce<P,Ne=l==="extended"&&P!=null&&ue<P,Ie=me||Ne,Xe=h.useMemo(()=>{var yr;if(l!=="hyperliquid")return{hyperBelowMinUi:!1};const Lt=Number((Ce==null?void 0:Ce.last)||I||0),nn=(Ce==null?void 0:Ce.sizeDecimalsInfo)??((yr=Ce==null?void 0:Ce.raw)==null?void 0:yr.szDecimals)??0,Ot=Number.isFinite(Number(nn))&&Number(nn)>=0?Math.floor(Number(nn)):0,en=Number.isFinite(Lt)&&Lt>0?ce/Lt:null;Number.isFinite(en)&&Number(en.toFixed(Ot));const Fn=Number.isFinite(Lt)&&Number.isFinite(en)?Lt*en:null;return{hyperBelowMinUi:!Number.isFinite(Fn)||Fn<10}},[l,Ce,I,ce]).hyperBelowMinUi,Oe=Lt=>{if(P==null||!Number.isFinite(D)||D<=0)return"Minimum order size not met";const nn=P/D,Ot=Math.abs(D-Math.round(D))<1e-6?Math.round(D):Number(D.toFixed(2));return`${Lt} must be at least $${nn.toFixed(2)} (min. $${P.toFixed(2)} notional ÷ ${Ot}x leverage)`};h.useEffect(()=>{const Lt=u.find(en=>en.value===S),nn=l==="extended"||l==="hyperliquid"?(Ce==null?void 0:Ce.maxLeverage)??(Ce==null?void 0:Ce.leverage)??(Ce==null?void 0:Ce.max_leverage)??50:Lt==null?void 0:Lt.maxLeverage,Ot=Number(nn);Number.isFinite(Ot)&&Ot>0&&(x(Ot),U(en=>{const Fn=parseInt(en)||1;return String(Math.min(Ot,Math.max(1,Fn)))}))},[S,u,Ce,l]),h.useEffect(()=>{if(l!=="extended"||!(nt!=null&&nt.apiKey)){ct(null);return}let Lt=!1;const nn=async()=>{var en,Fn,yr,hr;try{const lt=`https://express-proxy-delta.vercel.app/proxy?url=${encodeURIComponent("https://api.starknet.extended.exchange/api/v1/user/balance")}`,On=await(await fetch(lt,{headers:{"X-Api-Key":nt.apiKey}})).json().catch(()=>null);if(Lt)return;const qn=((en=On==null?void 0:On.data)==null?void 0:en.availableForTrade)??(On==null?void 0:On.availableForTrade)??((Fn=On==null?void 0:On.data)==null?void 0:Fn.available_balance)??(On==null?void 0:On.available_balance)??((yr=On==null?void 0:On.data)==null?void 0:yr.available)??(On==null?void 0:On.available),_r=Number(qn),jr=((hr=On==null?void 0:On.data)==null?void 0:hr.equity)??(On==null?void 0:On.equity),Fr=Number(jr);ct({availableForTrade:Number.isFinite(_r)&&_r>=0?_r:null,equity:Number.isFinite(Fr)?Fr:null,raw:On})}catch{Lt||ct(null)}};nn();const Ot=setInterval(nn,2e4);return()=>{Lt=!0,clearInterval(Ot)}},[l,nt==null?void 0:nt.apiKey]),h.useEffect(()=>{if(ie(1500),l!=="extended"&&l!=="hyperliquid")return;const Lt=l==="extended"?Ke==null?void 0:Ke.equity:Nt;Number.isFinite(Lt)&&!oe&&ie(String(l==="extended"?Lt:Lt==null?void 0:Lt.toFixed(2)))},[Ke==null?void 0:Ke.equity,Nt,l,oe]);const $e=h.useRef(S),ae=h.useRef(!1);h.useEffect(()=>{const Lt=$e.current!==S,nn=!ae.current&&!I;if((Lt||nn)&&(Ce!=null&&Ce.last)&&Ce.last>0){$e.current=S,ae.current=!0;const Ot=l3n(Ce.last,Ce.priceDecimals);L(Number(Ce.last).toFixed(Ot))}},[S,Ce==null?void 0:Ce.last,I]);const he=h.useCallback(Lt=>{let nn=sc(Lt);if(l==="hyperliquid"&&String(Lt||"").includes(":")){const Ot=En.find(en=>{var yr;const Fn=String(en.rawSymbol||((yr=en.raw)==null?void 0:yr.symbol)||"").toUpperCase();return Fn&&Fn===String(Lt||"").toUpperCase()});Ot&&(nn=sc(Ot.symbol||Ot.coin||Ot.rawSymbol))}T(nn),typeof window<"u"&&window.localStorage.setItem(Yn,nn)},[Yn,En,l]),Pe=h.useCallback(Lt=>{K(!0),ie(Lt)},[]),Ve=h.useCallback(Lt=>{L(Lt)},[]),Te=Rn,Ze=F==="smart",it=h.useCallback(Lt=>{const nn=parseFloat(O)||10,Ot=.6/nn,en=parseFloat(I)||0,Fn=parseFloat(Y)||0,yr=parseFloat(Q)||0,hr=parseInt(te)||0,lt=parseFloat(G)||1/0,Ct=parseFloat(ve)||0,On=parseFloat(we)||1.1,qn=parseFloat(Fe)||1,_r=parseFloat(H)||0,jr=parseFloat(se)||100,Fr=Lt==="smart",nr=Lt==="long";if(Fr)return{orders:[],metrics:null};if(en<=0||Fn<=0)return{orders:[],metrics:null};let vr=Fn;for(let Ur=1;Ur<=hr;Ur++)vr+=yr*Math.pow(On,Ur-1);const Yr=[];let dr=0,rs=0,gs=0,ms=0,At=0,pt=0,le=!1,Me=null;const ft=lt,ut=Fn*nn,on=ut/en;dr=Fn,rs=ut,gs=on,dr>lt&&(le=!0,Me=0);const bn=nr?(en*gs-ft)/(gs*(1-Ot)):(ft+en*gs)/(gs*(1+Ot)),Gn=nr?en*(1+_r/100):en*(1-_r/100);let rr="SAFE";bn<=0||(nr&&bn>=en||!nr&&bn<=en)&&(rr="LIQUIDATED"),le&&(rr="WARNING",pt++);const Jn=on*en*Ot,Xn=ft/Jn,Zr=nr?(Gn-en)*on:(en-Gn)*on;Yr.push({label:"Base",deviation:0,price:en,margin:Fn,positionValue:ut,coins:on,totalCoins:on,totalMargin:dr,avgEntry:en,tpPrice:Gn,tpProfit:Zr,liqPrice:bn,healthRatio:Xn,status:rr});let $r=!1,wr=bn,pr=en,ar=Gn;for(let Ur=1;Ur<=hr;Ur++){Ur===1?ms=Ct:ms+=Ct*Math.pow(qn,Ur-1);const bs=nr?en*(1-ms/100):en*(1+ms/100);if($r){Yr.push({label:`DCA ${Ur}`,deviation:ms,price:bs,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:"CANCELLED"});continue}if(bs<=0){$r=!0,Yr.push({label:`DCA ${Ur}-${hr}`,deviation:ms,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:hr-Ur+1,isLong:nr});break}const Sr=yr*Math.pow(On,Ur-1),Pn=Sr*nn,Ln=Pn/bs,ht=dr+Sr;ht>lt&&!le&&(le=!0,Me=Ur),dr=ht,rs+=Pn,gs+=Ln;const Yt=rs/gs,lr=nr?(Yt*gs-ft)/(gs*(1-Ot)):(ft+Yt*gs)/(gs*(1+Ot));if(nr?lr>0&&bs<=lr:lr>0&&bs>=lr){$r=!0,Yr.push({label:"💀 Liq",deviation:null,price:wr,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:pr,tpPrice:ar,tpProfit:null,liqPrice:wr,healthRatio:null,status:"LIQUIDATED"});for(let ls=Ur;ls<=hr;ls++){let hs=0;for(let Ps=1;Ps<=ls;Ps++)Ps===1?hs=Ct:hs+=Ct*Math.pow(qn,Ps-1);const vs=nr?en*(1-hs/100):en*(1+hs/100),vi=vs>0;Yr.push({label:`DCA ${ls}`,deviation:hs,price:vi?vs:null,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:vi?"CANCELLED":"EXCEEDED"})}break}const Mr=nr?lr>=Yt:lr<=Yt,Lr=nr?Yt*(1+_r/100):Yt*(1-_r/100),ss=jr>=100?null:nr?Yt*(1-jr/100):Yt*(1+jr/100),ys=nr?(bs-Yt)*gs:(Yt-bs)*gs,Bt=ft+ys,mr=gs*bs*Ot,er=Bt/mr;let qr="SAFE";if(Mr){$r=!0,Yr.push({label:`DCA ${Ur}`,deviation:ms,price:bs,margin:Sr,positionValue:Pn,coins:Ln,totalCoins:gs,totalMargin:dr,avgEntry:Yt,tpPrice:null,tpProfit:null,liqPrice:lr,healthRatio:null,status:"LIQUIDATED"});for(let ls=Ur+1;ls<=hr;ls++){let hs=0;for(let Ps=1;Ps<=ls;Ps++)Ps===1?hs=Ct:hs+=Ct*Math.pow(qn,Ps-1);const vs=nr?en*(1-hs/100):en*(1+hs/100),vi=vs>0;Yr.push({label:`DCA ${ls}`,deviation:hs,price:vi?vs:null,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:vi?"CANCELLED":"EXCEEDED"})}break}else ss!==null&&(nr&&bs<=ss||!nr&&bs>=ss)?(qr="STOPPED",$r=!0):er<1.5?(qr="WARNING",pt++):At++;const xs=nr?(Lr-Yt)*gs:(Yt-Lr)*gs;wr=lr,pr=Yt,ar=Lr,Yr.push({label:`DCA ${Ur}`,deviation:ms,price:bs,margin:Sr,positionValue:Pn,coins:Ln,totalCoins:gs,totalMargin:dr,avgEntry:Yt,tpPrice:Lr,tpProfit:xs,liqPrice:lr,healthRatio:er,status:qr})}const Vr=[...Yr].reverse().find(Ur=>Ur.status!=="CANCELLED")||Yr[Yr.length-1];return{orders:Yr,metrics:{totalMargin:dr,totalPositionValue:rs,liquidationPrice:Vr.liqPrice,breakEvenPrice:Vr.avgEntry,safeCount:At,warningCount:pt,budgetOk:!le,budgetExceededAt:Me,leverage:nn,requiredBudget:vr}}},[I,O,Y,Q,te,G,ve,we,Fe,H,se]),wt=h.useMemo(()=>it(F),[it,F]),Dt=h.useMemo(()=>wt.orders.filter(Lt=>Lt.status!=="CANCELLED").map(Lt=>({name:Lt.label,orderPrice:Qe&&Lt.price!=null&&Lt.price>0?Lt.price:null,avgEntry:dt&&Lt.avgEntry!=null&&Lt.avgEntry>0?Lt.avgEntry:null,tpPrice:at&&Lt.tpPrice!=null&&Lt.tpPrice>0?Lt.tpPrice:null,liqPrice:qe&&Lt.liqPrice!=null&&Lt.liqPrice>0?Lt.liqPrice:null,status:Lt.status})),[wt.orders,Qe,dt,at,qe]),Qt=h.useMemo(()=>{const Lt=[];if(Dt.forEach(Fn=>{Fn.orderPrice!=null&&Lt.push(Fn.orderPrice),Fn.avgEntry!=null&&Lt.push(Fn.avgEntry),Fn.tpPrice!=null&&Lt.push(Fn.tpPrice)}),Lt.length===0)return["auto","auto"];const nn=Math.min(...Lt),Ot=Math.max(...Lt),en=(Ot-nn)*.1;return[Math.max(0,nn-en),Ot+en]},[Dt]),xn=Lt=>{const{cx:nn,cy:Ot,payload:en}=Lt;return en.status==="LIQUIDATED"&&nn&&Ot?i.jsx("text",{x:nn,y:Ot,textAnchor:"middle",dominantBaseline:"middle",fontSize:14,children:"💀"}):null},pn=Lt=>{switch(Lt){case"orderPrice":Ye(!Qe);break;case"avgEntry":st(!dt);break;case"tpPrice":He(!at);break;case"liqPrice":vt(!qe);break}},An=Lt=>{const{payload:nn}=Lt;return i.jsx("div",{className:"flex flex-wrap justify-center gap-2 sm:gap-4 mt-2",children:nn.map((Ot,en)=>{const Fn=Ot.dataKey==="orderPrice"?Qe:Ot.dataKey==="avgEntry"?dt:Ot.dataKey==="tpPrice"?at:Ot.dataKey==="liqPrice"?qe:!0;return i.jsxs("button",{onClick:()=>pn(Ot.dataKey),className:`flex items-center gap-1.5 text-xs px-2 py-1 rounded transition-all ${Fn?"opacity-100":"opacity-40"}`,style:{color:Ot.color},children:[i.jsx("span",{className:"w-3 h-0.5",style:{backgroundColor:Ot.color}}),Ot.value]},en)})})},{orders:or,metrics:$t}=wt,bt=or.filter(Lt=>Lt.status!=="CANCELLED"),rn=h.useMemo(()=>{var Ct,On;if(!Ze)return null;const Lt=it("long"),nn=it("short"),Ot=(Ct=Lt.metrics)==null?void 0:Ct.safeCount,en=(On=nn.metrics)==null?void 0:On.safeCount,Fn=Lt.orders.some(qn=>qn.status==="LIQUIDATED"),yr=nn.orders.some(qn=>qn.status==="LIQUIDATED"),hr=Number.isFinite(Ot)&&Number.isFinite(en)?Math.max(Ot,en):null;let lt=!1;return Number.isFinite(Ot)&&Number.isFinite(en)?Ot>en?lt=Fn:en>Ot?lt=yr:lt=Fn&&yr:lt=Fn||yr,{safeOrders:hr,hasLiquidation:lt}},[it,Ze]),ur=h.useMemo(()=>Ze?!!(rn!=null&&rn.hasLiquidation):bt.some(Lt=>Lt.status==="LIQUIDATED"),[Ze,bt,rn==null?void 0:rn.hasLiquidation]),gr=h.useMemo(()=>{if(!ur)return null;const Lt=Ze?rn==null?void 0:rn.safeOrders:$t==null?void 0:$t.safeCount,nn=Number.isFinite(Lt)?Lt:0,Ot=parseInt(te)||0;return`Liquidation occurs before completing all DCA orders. Safe orders: ${nn} of ${Ot}. Reduce leverage, widen spacing, or lower max DCA orders.`},[ur,Ze,rn==null?void 0:rn.safeOrders,$t==null?void 0:$t.safeCount,te]),br=h.useMemo(()=>{const Lt=Ze?rn==null?void 0:rn.safeOrders:$t==null?void 0:$t.safeCount,nn=parseInt(te);return!Number.isFinite(Lt)||!Number.isFinite(nn)?null:nn>Lt?`Only ${Lt} of ${nn} DCA orders are currently safe. Increase budget, reduce leverage, or lower Max DCA Orders.`:null},[Ze,rn==null?void 0:rn.safeOrders,$t==null?void 0:$t.safeCount,te]),Br=({variant:Lt="desktop"})=>{const nn=Lt==="desktop"?"px-4 py-5":"p-3";return i.jsxs("div",{className:`${nn} 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(x8e,{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(g8e,{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(m8e,{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(Gwn,{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(g8e,{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(Kwn,{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(Ywn,{value:v,onChange:ze})]})}),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:[Zwn(l),i.jsx(Uh,{content:"Select the wallet to use for this DCA bot. The bot will execute trades using this wallet.",children:"?"})]}),kn?dn?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(pP,{wallets:ln,value:nt&&nt.id?String(nt.id):"",onChange:Lt=>{const nn=ln.find(Ot=>String(Ot.wallet_id)===String(Lt));nn&&(Ut({id:nn.wallet_id,address:nn.wallet_address,apiKey:nn.wallet_api_key}),typeof window<"u"&&window.localStorage.setItem(Mn,String(nn.wallet_id)))},selectedBalance:Wt,mode:l}):i.jsx("div",{className:"w-full",children:i.jsx(om,{onClick:()=>Be(!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:`${i3n}/${m||"BTC"}.svg`,alt:S||"coin",className:"w-6 h-6 rounded-full bg-[#161616] border border-[#1c2a24]",loading:"lazy",onError:Lt=>wm(Lt)}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(ffe,{markets:Ge,value:S,onChange:he,loading:Te,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:()=>$("short"),className:`py-2 px-3 rounded-lg text-sm font-medium transition-all border flex items-center justify-center gap-1 ${F==="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:()=>$("long"),className:`py-2 px-3 rounded-lg text-sm font-medium transition-all border flex items-center justify-center gap-1 ${F==="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:()=>$("smart"),className:`py-2 px-3 rounded-lg text-sm font-medium transition-all border flex items-center justify-center gap-1 ${F==="smart"?"bg-[#a78bfa]/20 border-[#a78bfa] text-[#d7c8ff]":"bg-[#161616] border-[#1c2a24] text-[#7f7b9f] hover:border-[#a78bfa]/50"}`,children:[i.jsx(x8e,{className:"w-4 h-4"}),"Smart"]})]})]}),i.jsx("div",{className:"col-span-2",children:i.jsx(d3n,{value:O,onChange:U,min:1,max:f,tooltip:`Position multiplier. 10x leverage means $100 margin controls $1,000 position. Max leverage for ${S}: ${f}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(fg,{label:"Base Order Margin",value:Y,onChange:re,step:"1",min:"1",suffix:"$",tooltip:"Initial margin for the first position opened at Entry Price.",validate:(Lt,nn)=>!nn||isNaN(Lt)?"Required":Lt<1?"Must be at least 1":l==="extended"&&P!=null&&Lt*D<P?Oe("Base Order Margin"):null}),i.jsx(fg,{label:"DCA Order Margin",value:Q,onChange:q,step:"1",min:"1",suffix:"$",tooltip:"Starting margin for DCA orders.",validate:(Lt,nn)=>!nn||isNaN(Lt)?"Required":Lt<1?"Must be at least 1":l==="extended"&&P!=null&&Lt*D<P?Oe("DCA Order Margin"):null}),i.jsx(fg,{label:"Max DCA Orders",value:te,onChange:fe,step:"1",max:"50",tooltip:"Maximum number of DCA orders to place after the Base Order.",validate:(Lt,nn)=>!nn||isNaN(Lt)?"Required":Lt<1?"Minimum 1":Lt>50?"Maximum 50":null,forceError:ur||!!br,forceErrorMessage:gr||br}),i.jsx(fg,{label:"Available to Trade",value:Wt!=null?String(Wt==null?void 0:Wt.toFixed(2)):"",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(fg,{label:"Take Profit",value:H,onChange:ee,step:"0.1",suffix:"%",tooltip:"Target profit % calculated from the weighted average entry price."}),i.jsx(fg,{label:"Stop Loss",value:se,onChange:pe,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:()=>ge(!Se),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: ",ve,"% • Dev Mult: ",Fe,"x • Size: ",we,"x"]})]}),Se?i.jsx(bun,{className:"w-4 h-4 text-[#67FFBD]"}):i.jsx(Z_,{className:"w-4 h-4 text-[#67FFBD]"})]}),i.jsx(dP,{children:Se&&i.jsx(Ya.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(fg,{label:"Price Deviation",value:ve,onChange:be,step:"0.1",suffix:"%",tooltip:"Initial price change % from Entry Price to trigger DCA."}),i.jsx(fg,{label:"DCA Order Size Multiplier",value:we,onChange:je,step:"0.1",suffix:"x",tooltip:"Multiplier for each DCA order's margin."}),i.jsx(fg,{label:"Price Deviation Multiplier",value:Fe,onChange:Re,step:"0.05",suffix:"x",tooltip:"Multiplier for price gaps between DCA orders."})]})})})]}),(()=>{const Lt=I&&!isNaN(parseFloat(I))&&parseFloat(I)>0,nn=Y&&!isNaN(parseFloat(Y))&&parseFloat(Y)>=1,Ot=Q&&!isNaN(parseFloat(Q))&&parseFloat(Q)>=1,en=te&&!isNaN(parseInt(te))&&parseInt(te)>=1,Fn=G&&!isNaN(parseFloat(G))&&parseFloat(G)>0,yr=Lt&&nn&&Ot&&en&&Fn,hr=Ie,lt=jr=>{const Fr=parseFloat(I)||0,nr=parseFloat(Y)||0,vr=parseFloat(Q)||0,Yr=parseInt(te)||0,dr=parseFloat(G)||1/0,rs=parseFloat(we)||1.1;if(Fr<=0||nr<=0)return null;let gs=nr,ms=0,At=gs>dr;At||(ms+=1);for(let le=1;le<=Yr;le++){const Me=vr*Math.pow(rs,le-1);gs+=Me,!At&&gs>dr&&(At=!0),At||(ms+=1)}return{budgetOk:gs<=dr,safeCount:ms}},Ct=Ze?{long:lt(),short:lt()}:null,On=Ze&&(Ct==null?void 0:Ct.long)&&(Ct==null?void 0:Ct.short)&&Ct.long.budgetOk&&Ct.short.budgetOk&&Ct.long.safeCount>0&&Ct.short.safeCount>0&&!hr,qn=Ze?yr&&On:yr&&$t&&$t.budgetOk&&$t.safeCount>0&&!hr&&!Xe;let _r=null;if(!yr)_r="Please fill in all required fields";else if(Xe)_r="Minimum order size is $10 (Base Order & DCA Order). Increase order size or leverage.";else if(hr&&P!=null){const jr=[];me&&jr.push("Base Order"),Ne&&jr.push("DCA Order");const Fr=jr.length===1?` (${jr[0]})`:jr.length===2?" (Base Order & DCA Order)":"";_r=`Minimum order size for ${String(S||"").toUpperCase()} is $${P.toFixed(2)}${Fr}. Increase order size or leverage.`}else!Ze&&$t&&!$t.budgetOk?_r="Budget exceeded - increase budget or reduce orders":!Ze&&$t&&$t.safeCount===0?_r="No safe orders - reduce leverage or increase budget":Ze&&(!(Ct!=null&&Ct.long)||!(Ct!=null&&Ct.short)||!Ct.long.budgetOk||!Ct.short.budgetOk)?_r="Budget exceeded in Smart mode - adjust margin or orders":Ze&&(Ct!=null&&Ct.long)&&(Ct!=null&&Ct.short)&&(Ct.long.safeCount===0||Ct.short.safeCount===0)&&(_r="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 jr=(p==null?void 0:p.id)||(p==null?void 0:p.bot_id),Fr=jr&&Vt[jr]===!0,nr=jr&&We[jr]===!0,vr=!!p,Yr=vr?Fr||nr:!qn||wn||!nt||!nt.id,dr=()=>{vr&&jr?cn(jr,!0):kt()};return i.jsx("button",{onClick:dr,disabled:Yr,className:`w-full py-2.5 rounded-lg text-sm font-semibold transition-all flex items-center justify-center gap-2 ${vr?"bg-[#ff7073] text-black hover:bg-[#ff8a8d]":qn&&nt&&nt.id&&!wn?"bg-[#67FFBD] text-[#101010] hover:bg-[#9FFFDA]":"bg-[#333] text-[#666] cursor-not-allowed"} disabled:opacity-60 disabled:cursor-not-allowed`,children:vr?Fr?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"]}):wn?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"]})})})(),_r&&i.jsx("p",{className:"text-xs text-[#ff7073] text-center mt-2",children:_r}),(!nt||!nt.id)&&i.jsxs("p",{className:"text-xs text-[#ff7073] text-center mt-2",children:["Please select a"," ",(l==null?void 0:l.charAt(0).toUpperCase())+l.slice(1)," ","wallet first"]}),i.jsxs("p",{className:"text-xs text-[#555] text-center mt-2",children:["Bot will execute orders on"," ",l.charAt(0).toUpperCase()+l.slice(1)," ","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(m8e,{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:"📚"})]})})]})]}),$t&&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:["$",Fo($t.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:["$",Fo($t.totalPositionValue)]}),i.jsxs("div",{className:"text-xs text-[#555]",children:[$t.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:Wb},children:[$t.safeCount,"/",parseInt(te)||0]})]})]})]})}),!Ze&&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(uze,{width:"100%",height:"100%",children:i.jsxs(Man,{data:Dt.length>0?Dt:[{name:"No Data",orderPrice:null,avgEntry:null,tpPrice:null,liqPrice:null}],margin:{top:10,right:20,left:10,bottom:5},children:[i.jsx(nVe,{strokeDasharray:"3 3",stroke:"#1c2a24"}),i.jsx(D8,{dataKey:"name",stroke:"#666",fontSize:10,interval:0,angle:Dt.length>6?-45:0,textAnchor:Dt.length>6?"end":"middle",height:Dt.length>6?50:30,tickFormatter:Lt=>Lt==="Base"?"B":Lt.startsWith("DCA")?`D${Lt.split(" ")[1]}`:Lt.includes("Liq")?"💀":Lt}),i.jsx(B8,{stroke:"#666",fontSize:10,tickFormatter:Lt=>`$${Fo(Lt)}`,domain:Qt,allowDataOverflow:!0}),i.jsx(sm,{contentStyle:{backgroundColor:"#101010",border:"1px solid #333",borderRadius:"6px",fontSize:"11px"},formatter:(Lt,nn)=>[Lb(Lt),nn],labelFormatter:Lt=>Lt==="B"?"Base Order":Lt.startsWith("D")?`DCA ${Lt.slice(1)}`:Lt}),i.jsx(k3,{content:An}),i.jsx(U0,{type:"monotone",dataKey:"orderPrice",name:"Order Price",stroke:Wb,strokeWidth:2,dot:{fill:Wb,r:3},connectNulls:!0}),i.jsx(U0,{type:"monotone",dataKey:"avgEntry",name:"Avg Entry",stroke:uO,strokeWidth:2,dot:{fill:uO,r:2},connectNulls:!0}),i.jsx(U0,{type:"monotone",dataKey:"tpPrice",name:"TP",stroke:b8e,strokeWidth:1.5,strokeDasharray:"4 4",dot:!1,connectNulls:!0}),i.jsx(U0,{type:"monotone",dataKey:"liqPrice",name:"Liq",stroke:zM,strokeWidth:1.5,strokeDasharray:"4 4",dot:xn,connectNulls:!0})]})})}),i.jsxs("div",{className:"text-xs text-[#555] text-center mt-2",children:["B = Base Order • D1-D",te," = 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:()=>Kt("details"),className:`flex-1 px-4 py-3 text-sm font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${yt==="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:()=>Kt("bots"),className:`flex-1 px-4 py-3 text-sm font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${yt==="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"})]}),yt==="details"&&(Ze?i.jsx(Br,{variant:"desktop"}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"px-4 py-3",children:i.jsx(v8e,{entryPrice:I,onEntryPriceChange:Ve,maxBudget:G,onBudgetChange:Pe})}),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 (",S,")"]}),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:bt.map((Lt,nn)=>{const Ot=y8e[Lt.status];if(Lt.status==="EXCEEDED"){const en=Lt.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:Ot.icon}),i.jsxs("span",{className:"text-sm",children:[i.jsx("span",{className:"font-medium",children:Lt.label})," ","— ",en]})]})})},nn)}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:Lt.label}),i.jsx("td",{className:"px-3 py-2 text-right",children:Lt.deviation!=null?o3n(Lt.deviation):"-"}),i.jsx("td",{className:"px-3 py-2 text-right",children:Lb(Lt.price)}),i.jsx("td",{className:"px-3 py-2 text-right hidden lg:table-cell",children:Lt.margin!=null?`$${Fo(Lt.margin)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right hidden xl:table-cell",children:Lt.positionValue!=null?`$${Fo(Lt.positionValue)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right",children:Lt.coins!=null?Fo(Lt.coins,4):"-"}),i.jsx("td",{className:"px-3 py-2 text-right hidden lg:table-cell",children:Lt.totalMargin!=null?`$${Fo(Lt.totalMargin)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right",style:{color:uO},children:Lb(Lt.avgEntry)}),i.jsx("td",{className:"px-3 py-2 text-right hidden lg:table-cell",style:{color:b8e},children:Lb(Lt.tpPrice)}),i.jsx("td",{className:"px-3 py-2 text-right",style:{color:Wb},children:Lt.tpProfit!=null?`$${Fo(Lt.tpProfit)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right",style:{color:Lt.liqPrice<=0?Wb:zM},children:Lb(Lt.liqPrice,!0)}),i.jsx("td",{className:"px-3 py-2 text-center",children:i.jsx(Uh,{content:Ot.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:`${Ot.color}15`,color:Ot.color},children:Ot.icon})})})]},nn)})})]}),bt.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"})]})]})]})),yt==="bots"&&i.jsx("div",{className:"p-4",children:vn?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..."})]}):N.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:N.map(Lt=>{const nn=!Lt.is_deleted,Ot=Lt.bot_params||{},en=Lt.created_at?new Date(Lt.created_at):null,Fn=en?(()=>{const _r=Date.now()-en.getTime(),jr=Math.floor(_r/(1e3*60*60)),Fr=Math.floor(jr/24);return Fr>0?`${Fr}d ago`:jr>0?`${jr}h ago`:`${Math.floor(_r/(1e3*60))}m ago`})():null,yr=Ot.direction==="long"?"Long":Ot.direction==="short"?"Short":"Smart",hr=Ot.price_deviation??Ot.priceDeviation??0,lt=Ot.step_scale??Ot.price_dev_multiplier??Ot.priceDevMultiplier??0,Ct=Ot.volume_scale??Ot.dca_size_multiplier??Ot.dcaSizeMultiplier??0,On=Ot.tp_percent??Ot.tp_target??Ot.take_profit_percent??0,qn=Ot.stop_loss_percent??Ot.stop_loss??0;return Ot.market_index??Ot.marketIndex,Ot.coin_idx??Ot.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:[Lt.coin||S," DCA Bot"]}),nn?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"})]}),Fn&&i.jsx("span",{className:"text-[11px] text-[#7c7c7c]",children:Fn})]}),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 ${Ot.direction==="long"?"text-[#67FFBD]":Ot.direction==="short"?"text-[#ff7073]":"text-[#A78BFA]"}`,children:yr})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Leverage:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Ot.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:["$",Fo(Ot.base_amount_usd||Ot.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:["$",Fo(Ot.safety_amount_usd||Ot.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:Ot.max_safety_orders||Ot.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:[Fo(hr),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Price Deviation Multiplier:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Fo(lt),"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:[Fo(Ct),"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Take Profit:"}),i.jsxs("span",{className:"ml-1 text-[#67FFBD]",children:[Fo(On),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Stop Loss:"}),i.jsxs("span",{className:"ml-1 text-[#ff7073]",children:[Fo(qn),"%"]})]}),Fn&&i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Created:"}),i.jsx("span",{className:"ml-1 text-white",children:Fn})]})]}),i.jsx("div",{className:"mt-4",children:i.jsx("button",{onClick:()=>cn(Lt.id||Lt.bot_id,nn),disabled:Vt[Lt.id||Lt.bot_id]||We[Lt.id||Lt.bot_id],className:`w-full py-2 rounded-lg text-sm font-semibold transition-colors ${nn?"bg-[#ff7073] text-black hover:bg-[#ff8a8d]":"bg-[#67FFBD] text-black hover:bg-[#8bffd0]"} disabled:opacity-60 disabled:cursor-not-allowed`,children:Vt[Lt.id||Lt.bot_id]?nn?"Stopping...":"Starting...":nn?"Stop Bot":"Start Bot"})})]},Lt.id||Lt.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:()=>Kt("details"),className:`flex-1 px-3 py-2 text-xs font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${yt==="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:()=>Kt("bots"),className:`flex-1 px-3 py-2 text-xs font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${yt==="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"})]}),yt==="details"&&(Ze?i.jsx(Br,{variant:"mobile"}):i.jsxs("div",{className:"p-3 space-y-2",children:[i.jsx(v8e,{className:"w-full",entryPrice:I,onEntryPriceChange:Ve,maxBudget:G,onBudgetChange:Pe}),bt.map((Lt,nn)=>{const Ot=y8e[Lt.status];if(Lt.status==="EXCEEDED"){const en=Lt.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:Ot.icon}),i.jsxs("span",{className:"text-sm",children:[i.jsx("span",{className:"font-medium",children:Lt.label})," ","— ",en]})]})},nn)}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:Lt.label}),i.jsx(Uh,{content:Ot.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:`${Ot.color}15`,color:Ot.color},children:Ot.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:Lb(Lt.price)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Size:"}),i.jsx("span",{children:Lt.coins!=null?`${Fo(Lt.coins,4)} ${S}`:"-"})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Avg Entry:"}),i.jsx("span",{style:{color:uO},children:Lb(Lt.avgEntry)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Liq:"}),i.jsx("span",{style:{color:Lt.liqPrice<=0?Wb:zM},children:Lb(Lt.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:Wb},className:"font-medium",children:Lt.tpProfit!=null?`$${Fo(Lt.tpProfit)}`:"-"})]})]})]},nn)})]})),yt==="bots"&&i.jsx("div",{className:"p-3",children:vn?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..."})]}):N.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:N.map(Lt=>{const nn=!Lt.is_deleted,Ot=Lt.bot_params||{},en=Lt.created_at?new Date(Lt.created_at):null,Fn=en?(()=>{const Fr=Date.now()-en.getTime(),nr=Math.floor(Fr/(1e3*60*60)),vr=Math.floor(nr/24);return vr>0?`${vr}d ago`:nr>0?`${nr}h ago`:`${Math.floor(Fr/(1e3*60))}m ago`})():null,yr=Ot.direction==="long"?"Long":Ot.direction==="short"?"Short":"Smart",hr=Ot.price_deviation??Ot.priceDeviation??0,lt=Ot.step_scale??Ot.price_dev_multiplier??Ot.priceDevMultiplier??0,Ct=Ot.volume_scale??Ot.dca_size_multiplier??Ot.dcaSizeMultiplier??0,On=Ot.tp_percent??Ot.tp_target??Ot.take_profit_percent??0,qn=Ot.stop_loss_percent??Ot.stop_loss??0,_r=Ot.market_index??Ot.marketIndex,jr=Ot.coin_idx??Ot.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:[Lt.coin||S," DCA"]}),nn?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"})]}),Fn&&i.jsx("span",{className:"text-[10px] text-[#7c7c7c]",children:Fn})]}),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 ${Ot.direction==="long"?"text-[#67FFBD]":Ot.direction==="short"?"text-[#ff7073]":"text-[#A78BFA]"}`,children:yr})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Leverage:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Ot.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:["$",Fo(Ot.base_amount_usd||Ot.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:["$",Fo(Ot.safety_amount_usd||Ot.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:Ot.max_safety_orders||Ot.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:[Fo(hr),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Price Deviation Multiplier:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Fo(lt),"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:[Fo(Ct),"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"TP:"}),i.jsxs("span",{className:"ml-1 text-[#67FFBD]",children:[Fo(On),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"SL:"}),i.jsxs("span",{className:"ml-1 text-[#ff7073]",children:[Fo(qn),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Market:"}),i.jsx("span",{className:"ml-1 text-white",children:_r??"-"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Coin Idx:"}),i.jsx("span",{className:"ml-1 text-white",children:jr??"-"})]}),Fn&&i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Created:"}),i.jsx("span",{className:"ml-1 text-white",children:Fn})]})]}),i.jsx("div",{className:"mt-3",children:i.jsx("button",{onClick:()=>cn(Lt.id||Lt.bot_id,nn),disabled:Vt[Lt.id||Lt.bot_id]||We[Lt.id||Lt.bot_id],className:`w-full py-1.5 rounded-lg text-[11px] font-semibold transition-colors ${nn?"bg-[#ff7073] text-black hover:bg-[#ff8a8d]":"bg-[#67FFBD] text-black hover:bg-[#8bffd0]"} disabled:opacity-60 disabled:cursor-not-allowed`,children:Vt[Lt.id||Lt.bot_id]?"...":nn?"Stop Bot":"Start Bot"})})]},Lt.id||Lt.bot_id)})})})]})})]})]})})}const h3n=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setIsWhitelist:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setHyperToken:c,setHyperAddress:u}=h.useContext(Qr);return h.useEffect(()=>{(async()=>{var g,y;const f=window.localStorage.getItem("hyperToken"),x=window.localStorage.getItem("hyperAddress");if(!(!f||!x))try{const v=await bi(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(za,{children:i.jsxs(Va,{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(f3n,{})})})]})},z7=({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..."})]}),yB="/assets/subscribeAnimation-oYDBxlRF.mp4",p3n=()=>{const{setSignModalOpen:t,setTelegramChatId:e,setSubscriberRole:n,setSubsExpireDay:r,setMushboomerETH:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setIsWhitelist:c,setHyperToken:u,setHyperAddress:d}=h.useContext(Qr),{address:f}=ds(),[x,g]=h.useState(1),[y,v]=h.useState(""),[C,S]=h.useState(""),[T,I]=h.useState(!1),[L,F]=h.useState(!1),[$,O]=h.useState(""),[U,Y]=h.useState(0),[re,Q]=h.useState(0),[q,te]=h.useState(!1),fe=be=>/^\d*$/.test(be),G=be=>{["e","E","+","-"].includes(be.key)&&be.preventDefault()},ie=h.useMemo(()=>{if(x==="")return!1;const be=Number(x);return Number.isInteger(be)&&be>=1},[x]),H=(be=>{const[we,je]=be.split(" "),[Fe,Re,Qe]=we.split("-").map(Number),[Ye,dt]=je.split(":").map(Number);return new Date(Date.UTC(Qe,Re-1,Fe,Ye-3,dt))})("29-11-2025 23:59");h.useState(()=>new Date().getTime()>=H.getTime());const ee=h.useRef(U);h.useEffect(()=>{ee.current=U},[U]);const se=h.useRef(0);h.useEffect(()=>{se.current=re},[re]);const pe=async()=>{var je,Fe;const be=window.localStorage.getItem("hyperToken"),we=window.localStorage.getItem("hyperAddress");if(!(!be||!we))try{const Re=await bi(we.toLowerCase(),be);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((Fe=Re==null?void 0:Re.mushboomer_counts)==null?void 0:Fe.sol),o(Re==null?void 0:Re.referral_code),l(Re==null?void 0:Re.refcode),c(Re==null?void 0:Re.whitelist),u(be),d(we),v(Re==null?void 0:Re.farming_tools),Y(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.")}};h.useEffect(()=>{q&&pe()},[q]),h.useEffect(()=>{const be=localStorage.getItem("hyperToken"),we=localStorage.getItem("hyperAddress");te(!!(be&&we));const je=setInterval(()=>{const Fe=localStorage.getItem("hyperToken"),Re=localStorage.getItem("hyperAddress");te(!!(Fe&&Re))},800);return()=>clearInterval(je)},[]);const Se=async()=>new Tl(window.ethereum).eth.getAccounts(we=>we),ge=async(be="subscribe",we=24,je=5e3)=>{we<=0||(await new Promise(Fe=>setTimeout(Fe,je)),await pe(),be==="subscribe"&&ee.current===se.current?ge(be,we-1,je):pe())},ve=async be=>{const we=window.localStorage.getItem("hyperToken"),je=window.localStorage.getItem("hyperAddress");if(!we||!f){t(!0);return}S(""),Q(ee.current),se.current=ee.current,F(!0),I(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(Qe){console.error("Failed to switch network",Qe),I(!1);return}const Fe=new Tl(window.ethereum);var Re=await Se();if(Re.length>0?Re=Re[0]:Re=void 0,Re){const Ye=be*.12,dt=Fe.utils.toWei(Ye.toString(),"ether"),st={from:Re,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:dt};await Fe.eth.sendTransaction(st).then(at=>{console.log("txHash :>> ",at),I(!1),O(at.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:we,payment_tx:at.transactionHash,payment_role:"farming_tools",tx_qty:Number(x)})}),pe(),ge("subscribe")}).catch(at=>{console.log(at),at.code===-32003||at.message.includes("insufficient funds")?S("Insufficient funds."):at.message==="MetaMask Tx Signature: User denied transaction signature."&&F(!1)})}else await Fe.eth.requestAccounts()};return window.localStorage.getItem("hyperToken"),i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:L,setOpen:F,transactionHash:$,transactionLoading:T,paymentPresaleRole:!(U<=re),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:yB,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[284px] lg:h-[284px] object-cover"},yB)}),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(be=>{const we=Number(be||0);return we>1?String(we-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:be=>{const we=be.target.value.trim();if(we==="")return g("");fe(we)&&g(we)},onKeyDown:G,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(be=>{const we=Number(be||0);return String(we+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!==""&&!ie&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),ie&&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:be=>{be.preventDefault(),ie&&ve(x)},className:`text-[10px] sm:text-xs xl:text-[13px] font-semibold text-gray-200 select-none border rounded-md px-4 py-2 ${ie?"border-[#8861FF] bg-[#7446FF] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy Now"})]})})]})]})},m3n=()=>{ds();const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setIsWhitelist:l,setHyperToken:c,setHyperAddress:u}=h.useContext(Qr);return h.useEffect(()=>{(async()=>{var g,y;const f=window.localStorage.getItem("hyperToken"),x=window.localStorage.getItem("hyperAddress");if(!(!f||!x))try{const v=await bi(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(za,{children:i.jsxs(Va,{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(p3n,{})})]})},jKe=({open:t,setOpen:e,makerStatus:n,isStatusWallet:r,info:s,modalLoading:a})=>i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Hi,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"})})]})]})})})})})]}),x3n=({fetchInfoOnOpen:t,setIsFilterWallet:e})=>{const[n,r]=h.useState([]),[s,a]=h.useState(""),[o,l]=h.useState(""),[c,u]=h.useState(""),[d,f]=h.useState([]),[x,g]=h.useState([]),[y,v]=h.useState(!1),[C,S]=h.useState(!1),[T,I]=h.useState(!1);h.useState(!1);const[L,F]=h.useState(""),[$,O]=h.useState(!1),[U,Y]=h.useState(null),[re,Q]=h.useState(""),[q,te]=h.useState(!1);h.useState(!1);const[fe,G]=h.useState([]),[ie,oe]=h.useState("");h.useState("");const[K,H]=h.useState(100),[ee,se]=h.useState("NEUTRAL"),[pe,Se]=h.useState("AGGRESSIVE"),[ge,ve]=h.useState("");h.useState(""),h.useState("");const[be,we]=h.useState(!1),[je,Fe]=h.useState(!1),[Re,Qe]=h.useState(!1),{setSignModalOpen:Ye,setTelegramChatId:dt,setSubscriberRole:st,setMushboomerETH:at,setMushboomerSOL:He,setIsReferralCode:qe,setIsReferralCodeName:vt,setIsWhitelist:yt,setHyperToken:Kt,setHyperAddress:jt}=h.useContext(Qr),un="https://dextrabothypev2.nftinit.io",vn="https://api.hyperliquid.xyz/info",Hn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};h.useEffect(()=>{async function mt(){var Ft;if(open)try{const kn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=hyper")).json();if(kn!=null&&kn.coins){const Gt=(Ft=kn==null?void 0:kn.coins)==null?void 0:Ft.map(gt=>{const Wt=(gt==null?void 0:gt.value)||"",jn=Hn[Wt]||Wt,kt=jn==="xyz:MSTR"?"":`https://app.hyperliquid.xyz/coins/${jn}.svg`;return{...gt,icon:kt}}),mn=kn.coins.filter(gt=>gt.value.includes(":")).map(gt=>{const[Wt,jn]=gt.value.split(":");return jn});f(Gt),g(mn)}}catch(Tn){console.error("Failed to fetch coin list:",Tn)}}mt()},[]);const ln=mt=>{var Ft;return((Ft=d.find(Tn=>Tn.label===mt))==null?void 0:Ft.maxLeverage)??100},Nn=mt=>({HL_FEE:15e-5,BUILDER_FEE:2e-4,GROW_RATE:(x==null?void 0:x.includes(mt))?.1:1}),dn=(mt,Ft)=>{if(!mt||!Ft)return"";const{HL_FEE:Tn,BUILDER_FEE:kn,GROW_RATE:Gt}=Nn(Ft);return(Number(mt)*(Tn+kn*Gt)).toFixed(0)},rt=(mt,Ft)=>{if(!mt||!Ft)return"";const{HL_FEE:Tn,BUILDER_FEE:kn,GROW_RATE:Gt}=Nn(Ft);return(Number(mt)/(Tn+kn*Gt)).toFixed(0)},nt=mt=>mt===""||mt===null?"":Number(mt).toLocaleString("en-US"),Ut=mt=>mt?mt.replace(/,/g,""):"",wn=mt=>{if(mt==null||mt==="")return"0.00";const Ft=Number(mt);return Number.isNaN(Ft)?"0.00":Ft.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})},Jt=mt=>/^\d*$/.test(mt),Vt=mt=>/^\d*\.?\d{0,6}$/.test(mt),xt=mt=>{["e","E","+","-"].includes(mt.key)&&mt.preventDefault()};h.useEffect(()=>{if(!o)return;const mt=ln(o),Ft=Number(ie);!Number.isNaN(Ft)&&Ft>mt&&oe(String(mt)),!Number.isNaN(Ft)&&Ft<1&&ie!==""&&oe("1")},[o]);const We=h.useMemo(()=>{if(!U||!ie||!ge)return"";const mt=pe==="NORMAL"?.02:pe==="PASSIVE"?.05:.1,Ft=Number(U)*Number(ie),Tn=Number(ge)*mt;return Ft>Tn?"":"Insufficient margin to create order, please increase your margin."},[U,ie,ge,pe]),Pt=h.useMemo(()=>{if(ie==="")return!1;const mt=Number(ie),Ft=ln(o);return Number.isInteger(mt)&&mt>=1&&mt<=Ft},[ie,o,d]);h.useEffect(()=>{if(!o)return;const mt=ln(o),Ft=Number(ie);!Number.isNaN(Ft)&&Ft>mt&&oe(String(mt)),!Number.isNaN(Ft)&&Ft<1&&ie!==""&&oe("1")},[o]);const Ke=h.useMemo(()=>{if(K==="")return!1;const mt=Number(K);return Number.isNaN(mt)?!1:mt===0?!0:mt>=0},[K]),ct=h.useMemo(()=>{if(ge==="")return!1;const mt=Number(ge);return!Number.isNaN(mt)&&mt>0},[ge]),Nt=h.useMemo(()=>n.map(mt=>{const Ft=(mt==null?void 0:mt.wallet_name)??(mt==null?void 0:mt.name)??(mt==null?void 0:mt.label)??String(mt==null?void 0:mt.wallet_id),Tn=(mt==null?void 0:mt.version)===3?`${Ft} - (API-AGENT) Wallet`:Ft;return{value:(mt==null?void 0:mt.wallet_id)??(mt==null?void 0:mt.id)??(mt==null?void 0:mt.value)??"",label:Tn,raw:mt}}),[n]),Ht=h.useMemo(()=>{var mt;return(mt=Nt.find(Ft=>String(Ft.value)===String(s)))==null?void 0:mt.raw},[Nt,s]),Rt=h.useMemo(()=>{const mt=Ht||{};return mt.address||mt.evm_address||mt.wallet_address||mt.public_address||mt.eth_address||mt.addr||null},[Ht]),hn=s!==""&&o!==""&&q&&Pt&&ct&&!We&&(ee==="LONG"||ee==="SHORT"||ee==="NEUTRAL")&&(pe==="AGGRESSIVE"||pe==="NORMAL"||pe==="PASSIVE");h.useEffect(()=>{const mt=localStorage.getItem("hyperToken"),Ft=localStorage.getItem("hyperAddress");te(!!(mt&&Ft));const Tn=setInterval(()=>{const kn=localStorage.getItem("hyperToken"),Gt=localStorage.getItem("hyperAddress");te(!!(kn&&Gt))},800);return()=>clearInterval(Tn)},[]),h.useEffect(()=>{F(""),q&&En()},[q]),h.useEffect(()=>{Rt?yn(Rt):(Y(null),Q(""),G([]))},[Rt]),h.useEffect(()=>{q&&(t(),Ge())},[q]);async function yn(mt){var Ft;try{Q(""),O(!0),Y(null);const kn=await(await fetch(vn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:mt})})).json();Y((Ft=kn==null?void 0:kn.marginSummary)==null?void 0:Ft.accountValue)}catch(Tn){Q(Tn.message||"Failed to load USDC balance.")}finally{O(!1)}}function Cn(){const mt=Rt||window.localStorage.getItem("hyperAddress");mt&&yn(mt)}async function En(){try{v(!0);const mt=window.localStorage.getItem("hyperToken"),Ft=window.localStorage.getItem("hyperAddress");if(!mt||!Ft){te(!1),Ye(!0);return}const kn=await(await fetch(`${un}/api/wallet/confirmed-list`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Ft.toLowerCase(),token:mt})})).json();kn!=null&&kn.success?r((kn==null?void 0:kn.data)||[]):F((kn==null?void 0:kn.error_message)||"Failed to load wallets.")}catch(mt){F(mt.message||"Wallet list error.")}finally{v(!1)}}async function Rn(){if(!q){Ye(!0);return}if(hn)try{I(!0),F(""),Qe(!0);const mt=window.localStorage.getItem("hyperToken"),Ft=window.localStorage.getItem("hyperAddress");if(!mt||!Ft){te(!1),Ye(!0);return}const Tn={coin:c,leverage:Number(ie),volume:Number(ge),orderBookDepth:1,perOrderPosValue:pe==="PASSIVE"?2:pe==="NORMAL"?5:10,direction:ee,executionMode:pe,budget:Number(K)},kn={address:Ft.toLowerCase(),token:mt,wallet_id:Number(s),source_market:"hyper",bot_params:Tn,coin:o},mn=await(await fetch(`${un}/api/hyper/mmbot/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(kn)})).json();mn!=null&&mn.success?(t(),fn.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((mn==null?void 0:mn.error_message)||"Start failed."),fn.error((mn==null?void 0:mn.error_message)||"Save failed."))}catch(mt){F(mt.message||"An error occurred while saving.")}finally{I(!1),Fe(!1),Qe(!1)}}const Mn=32,Yn={control:(mt,Ft)=>({...mt,backgroundColor:"#242424",borderColor:Ft.isFocused?"#67FFBD":"#353535",minHeight:Mn,height:Mn,boxShadow:"none",cursor:"pointer",alignItems:"center",minWidth:"max-content"}),valueContainer:mt=>({...mt,height:Mn,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:mt=>({...mt,height:Mn}),input:mt=>({...mt,color:"#FFFFFF",margin:0,padding:0}),singleValue:mt=>({...mt,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:mt=>({...mt,color:"#7F7F7F",fontSize:"12px"}),menu:mt=>({...mt,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:mt=>({...mt,paddingTop:0,paddingBottom:0,maxHeight:180}),option:(mt,Ft)=>({...mt,backgroundColor:Ft.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:Mn,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:mt=>({...mt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:mt=>({...mt,backgroundColor:"#353535"})},Zn=({max:mt})=>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:[mt,"x"]}),Vn=()=>i.jsx("div",{className:"px-2 py-0.5 rounded-md bg-[#0f1b1b] text-[#67ffbd] text-[10px] font-semibold",children:"xyz"}),tr=mt=>{var Tn;const Ft=x==null?void 0:x.includes(mt.data.label);return i.jsx(ba.Option,{...mt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Tn=mt.data)!=null&&Tn.icon?i.jsx("img",{src:mt.data.icon,alt:mt.data.label,className:"w-4 h-4",onError:kn=>kn.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:mt.data.label}),Ft&&i.jsx(Vn,{}),i.jsx(Zn,{max:mt.data.maxLeverage})]})})},Sn=mt=>{var Tn;const Ft=x==null?void 0:x.includes(mt.data.label);return i.jsx(ba.SingleValue,{...mt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Tn=mt.data)!=null&&Tn.icon?i.jsx("img",{src:mt.data.icon,alt:mt.data.label,className:"w-4 h-4",onError:kn=>kn.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:mt.data.label}),Ft&&i.jsx(Vn,{}),i.jsx(Zn,{max:mt.data.maxLeverage})]})})},ze=(mt,Ft)=>{if(l(mt),u(Ft),K===""&&ge===""){H(100),ve(rt(100,mt));return}if(K===""&&ge!==""){H(dn(ge,mt));return}if(K!==""&&ge===""){ve(rt(K,mt));return}H(dn(ge,mt))},xe=d,Ge=async()=>{var Tn,kn;const mt=window.localStorage.getItem("hyperToken"),Ft=window.localStorage.getItem("hyperAddress");if(!(!mt||!Ft))try{S(!0);const Gt=await bi(Ft.toLowerCase(),mt);Gt!=null&&Gt.success?(dt(Gt==null?void 0:Gt.telegram_chat_id),st(Gt==null?void 0:Gt.subscriber_role),at((Tn=Gt==null?void 0:Gt.mushboomer_counts)==null?void 0:Tn.eth),He((kn=Gt==null?void 0:Gt.mushboomer_counts)==null?void 0:kn.sol),qe(Gt==null?void 0:Gt.referral_code),vt(Gt==null?void 0:Gt.refcode),yt(Gt==null?void 0:Gt.whitelist),Kt(mt),jt(Ft),S(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),Kt(""),jt(""),S(!1))}catch(Gt){console.error("Token verification error:",Gt),console.error(Gt.message||"An unknown error occurred."),S(!1)}},_e=mt=>i.jsxs(ba.MenuList,{...mt,children:[i.jsxs("div",{onClick:()=>{mt.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"}),mt.children]}),Be=y||T,qt=!1,It=ln(o);return i.jsxs(i.Fragment,{children:[be&&Ea.createPortal(i.jsx("div",{className:"fixed inset-0 z-[999999999]",children:i.jsx(M5,{open:be,setOpen:we,handleListRequest:En,handlePageChange:()=>{}})}),document.body),i.jsx(jKe,{open:je,setOpen:Fe,makerStatus:Rn,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(pl,{styles:Yn,isDisabled:Be||y||qt,isLoading:y,options:Nt,components:{MenuList:_e},setIsGenWalletModal:we,value:Nt.find(mt=>String(mt.value)===String(s))||null,onChange:mt=>{a((mt==null?void 0:mt.value)??""),e((mt==null?void 0:mt.value)??"")},placeholder:q?y?"Loading...":"Select":"Connect to select",isSearchable:!0,onMenuOpen:()=>{q||Ye(!0)},menuIsOpen:q?void 0:!1}),!q&&i.jsx("button",{type:"button",onClick:()=>Ye(!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(pl,{styles:Yn,components:{Option:tr,SingleValue:Sn},isDisabled:Be||qt,options:xe,value:xe.find(mt=>mt.label===o)||null,onChange:mt=>ze((mt==null?void 0:mt.label)??"",(mt==null?void 0:mt.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:ie,onChange:mt=>{const Ft=mt.target.value.trim();if(Ft==="")return oe("");Jt(Ft)&&oe(Ft)},onKeyDown:xt,inputMode:"numeric",autoComplete:"off",placeholder:o?`1–${It}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${ie===""?"border-[#353535]":Pt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Be||qt})]}),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:nt(K),onChange:mt=>{let Ft=Ut(mt.target.value);if(Ft===""){H(""),ve("");return}if(Vt(Ft)){H(Ft);const Tn=rt(Ft,o);ve(Tn)}},onKeyDown:xt,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] ${K===""?"border-[#353535]":Ke?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Be||qt})]})]}),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:nt(ge),onChange:mt=>{let Ft=Ut(mt.target.value);if(Ft===""){ve(""),H("");return}if(Vt(Ft)){ve(Ft);const Tn=dn(Ft,o);H(Tn)}},onKeyDown:xt,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] ${ge===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Be||qt})]})]}),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:()=>se("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",Be||qt?"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:()=>se("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",Be||qt?"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:()=>se("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",Be||qt?"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":pe==="AGGRESSIVE",onClick:()=>Se("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",Be||qt?"cursor-not-allowed":"cursor-pointer",pe==="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 ",pe==="AGGRESSIVE"?" ✓":""]})}),i.jsx("button",{"aria-pressed":pe==="NORMAL",onClick:()=>Se("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",Be||qt?"cursor-not-allowed":"cursor-pointer",pe==="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 ",pe==="NORMAL"?" ✓":""]})}),i.jsx("button",{"aria-pressed":pe==="PASSIVE",onClick:()=>Se("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",Be||qt?"cursor-not-allowed":"cursor-pointer",pe==="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 ",pe==="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:[q&&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...":re?"—":wn(U??"0")}),i.jsx("div",{onClick:Cn,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(t1,{className:`w-4 h-4 ${$?"animate-spin":""}`})})]}),We&&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:Wo,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:[We+" ",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:jm,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:()=>{Fe(!0)},disabled:!hn||Be,className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!hn||Be?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer"}`,children:T?"Loading...":"Start"})})})]})]})},g3n=({isOpen:t,onClose:e,children:n,fullscreen:r=!1,blurBackground:s=!1})=>{const[a,o]=h.useState(t),[l,c]=h.useState(!1);h.useEffect(()=>{if(t)o(!0),requestAnimationFrame(()=>c(!0));else{c(!1);const d=setTimeout(()=>o(!1),300);return()=>clearTimeout(d)}},[t]),h.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?Ea.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},b3n=({data:t,shareModalOpen:e,setShareModalOpen:n})=>{var C,S,T,I,L;const{isReferralCodeName:r}=h.useContext(Qr),[s,a]=h.useState(Ha),[o,l]=h.useState(!0),c=h.useRef(null),u=async()=>{if(c.current)try{await document.fonts.ready,await new Promise(O=>setTimeout(O,500));const F=await q1(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($),fn.success("PNG successfully downloaded!")}catch(F){console.error("Error generating PNG:",F),fn.error("Failed to download PNG.")}},d=async F=>{l(!0);try{const O=await(await fetch(`https://api.allorigins.win/raw?url=${encodeURIComponent(F)}`)).blob();return new Promise((U,Y)=>{const re=new FileReader;re.onloadend=()=>U(re.result),re.onerror=Y,re.readAsDataURL(O)})}catch($){throw console.error("Image conversion failed:",$),$}finally{l(!1)}};h.useEffect(()=>{t!=null&&t.coin&&d(`https://app.hyperliquid.xyz/coins/${t==null?void 0:t.coin}.svg`).then(F=>a(F)).catch(()=>a(Ha))},[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: $${((S=(C=t==null?void 0:t.bot_params)==null?void 0:C.volume)==null?void 0:S.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(g3n,{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:Xj,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:["$",(T=t==null?void 0:t.bot_params)!=null&&T.volume?zs((I=t==null?void 0:t.bot_params)==null?void 0:I.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||Ha,alt:"",className:"rounded-full w-8 h-8",onError:F=>Zi(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:((L=t==null?void 0:t.bot_params)==null?void 0:L.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"})]})]})})})},y3n=({data:t,setData:e,loading:n,error:r,fetchInfoOnOpen:s,isFilterWallet:a})=>{var dn,rt;h.useContext(Qr);const{isConnected:o,address:l}=ds(),[c,u]=h.useState([]),[d,f]=h.useState(null),[x,g]=h.useState(!1);h.useState(!1);const[y,v]=h.useState(!1),[C,S]=h.useState(!1),[T,I]=h.useState({}),[L,F]=h.useState(!1),[$,O]=h.useState({id:"",walletAddress:"",isDeleted:!1}),[U,Y]=h.useState(!1),[re,Q]=h.useState(""),[q,te]=h.useState([]),[fe,G]=h.useState([]),[ie,oe]=h.useState([]),[K,H]=h.useState(!1),[ee,se]=h.useState(!1),[pe,Se]=h.useState(!1),[ge,ve]=h.useState(!1),be=h.useRef(null),we=h.useRef(null),je=h.useRef(null),Fe=h.useRef(null),[Re,Qe]=h.useState(!1),Ye="tag",[dt,st]=h.useState(Ye),at=nt=>{if(!y){let Ut=t;a&&(Ut=Ut==null?void 0:Ut.filter(Jt=>String(Jt==null?void 0:Jt.wallet_id)===String(a)));const wn=Ut==null?void 0:Ut.filter(Jt=>{var Vt,xt,We,Pt,Ke,ct,Nt,Ht;if(q.length>0){const Rt=q.includes("HyperLiquid")&&(Jt==null?void 0:Jt.source_market)==="hyper",hn=q.includes("Lighter")&&(Jt==null?void 0:Jt.source_market)==="lighter";if(!Rt&&!hn)return!1}if(fe.length>0){const Rt=fe.includes("Short")&&((Vt=Jt==null?void 0:Jt.bot_params)==null?void 0:Vt.direction)==="SHORT",hn=fe.includes("Neutral")&&((xt=Jt==null?void 0:Jt.bot_params)==null?void 0:xt.direction)==="NEUTRAL",yn=fe.includes("Long")&&((We=Jt==null?void 0:Jt.bot_params)==null?void 0:We.direction)==="LONG";if(!Rt&&!hn&&!yn)return!1}if(ie.length>0){const Rt=ie.includes("Aggressive")&&((Pt=Jt==null?void 0:Jt.bot_params)==null?void 0:Pt.executionMode)==="AGGRESSIVE",hn=ie.includes("Normal")&&((Ke=Jt==null?void 0:Jt.bot_params)==null?void 0:Ke.executionMode)==="NORMAL",yn=ie.includes("Passive")&&((ct=Jt==null?void 0:Jt.bot_params)==null?void 0:ct.executionMode)==="PASSIVE";if(!Rt&&!hn&&!yn)return!1}return!(Re&&(Jt!=null&&Jt.is_deleted)||re&&!((Ht=(Nt=Jt==null?void 0:Jt.bot_params)==null?void 0:Nt.coin)!=null&&Ht.toLowerCase().includes(re.toLowerCase())))});return wn==null?void 0:wn.sort((Jt,Vt)=>{var Yn,Zn,Vn,tr,Sn,ze,xe,Ge,_e,Be,qt,It,mt,Ft;const xt=((Zn=(Yn=Jt==null?void 0:Jt.bot_params)==null?void 0:Yn.coin)==null?void 0:Zn.toUpperCase())||"",We=((tr=(Vn=Vt==null?void 0:Vt.bot_params)==null?void 0:Vn.coin)==null?void 0:tr.toUpperCase())||"",Pt=(Jt==null?void 0:Jt.wallet_id)||0,Ke=(Vt==null?void 0:Vt.wallet_id)||0,ct=Number(((Sn=Jt==null?void 0:Jt.bot_params)==null?void 0:Sn.volume)||0),Nt=Number(((ze=Vt==null?void 0:Vt.bot_params)==null?void 0:ze.volume)||0),Ht=Number(((xe=Jt==null?void 0:Jt.bot_params)==null?void 0:xe.volume)||0),Rt=Number(((Ge=Vt==null?void 0:Vt.bot_params)==null?void 0:Ge.volume)||0),hn=Number(((_e=Jt==null?void 0:Jt.bot_params)==null?void 0:_e.volume)||0),yn=Number(((Be=Vt==null?void 0:Vt.bot_params)==null?void 0:Be.volume)||0),Cn=Number(((qt=Jt==null?void 0:Jt.bot_params)==null?void 0:qt.leverage)||0),En=Number(((It=Vt==null?void 0:Vt.bot_params)==null?void 0:It.leverage)||0),Rn=Number(((mt=Jt==null?void 0:Jt.bot_params)==null?void 0:mt.budget)||0),Mn=Number(((Ft=Vt==null?void 0:Vt.bot_params)==null?void 0:Ft.budget)||0);return nt==="coin"?xt<We?-1:xt>We?1:0:nt==="-coin"?xt>We?-1:xt<We?1:0:nt==="account"?Pt>Ke?-1:Pt<Ke?1:0:nt==="-account"?Pt<Ke?-1:Pt>Ke?1:0:nt==="volume"?ct-Nt:nt==="-volume"?Nt-ct:nt==="order"?Ht-Rt:nt==="-order"?Rt-Ht:nt==="perOrder"?hn-yn:nt==="-perOrder"?yn-hn:nt==="leverage"?Cn-En:nt==="-leverage"?En-Cn:nt==="budget"?Rn-Mn:nt==="-budget"?Mn-Rn:0})}return t},He=h.useRef(null),qe=["Short","Neutral","Long"],vt=["Aggressive","Normal","Passive"],yt=nt=>{G(Ut=>Ut.includes(nt)?Ut.filter(wn=>wn!==nt):[...Ut,nt])},Kt=nt=>{oe(Ut=>Ut.includes(nt)?Ut.filter(wn=>wn!==nt):[...Ut,nt])};h.useEffect(()=>{function nt(Ut){be.current&&!be.current.contains(Ut.target)&&se(!1),we.current&&!we.current.contains(Ut.target)&&Se(!1),Fe.current&&!Fe.current.contains(Ut.target)&&ve(!1),je.current&&!je.current.contains(Ut.target)&&H(!1)}return document.addEventListener("mousedown",nt),()=>document.removeEventListener("mousedown",nt)},[]);const jt=async({id:nt,walletAddress:Ut,isDeleted:wn})=>{try{const Jt=window.localStorage.getItem("hyperToken"),Vt=window.localStorage.getItem("hyperAddress");if(!Jt||!Vt||!nt){fn.error("Something went wrong!");return}Y(!0),Ut&&I(ct=>({...ct,[Ut]:!0}));const xt="https://dextrabothypev2.nftinit.io/api/hyper/mmbot/update/",We={is_deleted:!wn},Ke=await(await fetch(xt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:l?l.toLowerCase():Vt,token:Jt,bot_id:Number(nt),update_params:We})})).json();Ke.success?(e((Ke==null?void 0:Ke.data)||[]),fn.success("Action completed successfully.")):fn.error(Ke.error_message),F(!1)}catch{fn.error("Something went wrong")}finally{Y(!1),I(Jt=>({...Jt,[Ut]:!1}))}},un=async()=>{try{const nt=window.localStorage.getItem("hyperToken"),Ut=window.localStorage.getItem("hyperAddress");if(!nt||!Ut)return;const Vt=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():Ut,token:nt})})).json();Vt.success&&u((Vt==null?void 0:Vt.data)||[])}catch(nt){fn.error(nt.message||"Something went wrong")}finally{}};h.useEffect(()=>{un();const nt=setInterval(()=>{un()},15e3);return()=>clearInterval(nt)},[t]);const vn=h.useMemo(()=>{const nt={};return c==null||c.forEach(Ut=>{Ut!=null&&Ut.id&&(nt[Ut.id]=Ut.bot_params)}),nt},[c]);h.useEffect(()=>{const nt=localStorage.getItem("hyperToken"),Ut=localStorage.getItem("hyperAddress");S(!!(nt&&Ut));const wn=setInterval(()=>{const Jt=localStorage.getItem("hyperToken"),Vt=localStorage.getItem("hyperAddress");S(!!(Jt&&Vt))},800);return()=>clearInterval(wn)},[]);const Hn={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]"}},ln=()=>i.jsx(t1,{className:"w-4 h-4 text-yellow-400"}),Nn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs(i.Fragment,{children:[i.jsx(jKe,{open:L,setOpen:F,makerStatus:jt,isStatusWallet:$,info:"table",modalLoading:U}),i.jsx(b3n,{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:Ec,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:He,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(hi,{title:"Coin",sortKey:"coin",sortOption:dt,setSortOption:st,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>H(!K),className:`${re?"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(xd,{className:`w-4 h-4 ${re?"text-blue-500":"text-white"}`})}),K&&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:()=>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"})})]}),i.jsx("input",{type:"text",value:re,onChange:nt=>Q(nt.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(hi,{title:"Leverage",sortKey:"leverage",sortOption:dt,setSortOption:st,isFilterIcon:!1})})}),i.jsx("th",{scope:"col",className:"bg-[#090909] h-10 px-1 min-w-[110px] z-[7]",children:i.jsx(hi,{title:"Volume",sortKey:"volume",sortOption:dt,setSortOption:st,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#090909] h-10 px-1 min-w-[120px] z-[8]",children:i.jsx(hi,{title:"Budget",sortKey:"budget",sortOption:dt,setSortOption:st,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:()=>Se(!pe),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(xd,{className:`w-4 h-4 ${fe.length>0?"text-blue-500":"text-white"}`})}),pe&&i.jsxs("div",{ref:we,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:()=>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"})})]}),qe==null?void 0:qe.map(nt=>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(nt),onChange:()=>yt(nt),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(nt)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:fe.includes(nt)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),nt]},nt))]})]})]})}),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:()=>ve(!ge),className:`${ie.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(xd,{className:`w-4 h-4 ${ie.length>0?"text-blue-500":"text-white"}`})}),ge&&i.jsxs("div",{ref:Fe,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:()=>oe(""),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"})})]}),vt==null?void 0:vt.map(nt=>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:ie.includes(nt),onChange:()=>Kt(nt),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 ${ie.includes(nt)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:ie.includes(nt)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),nt]},nt))]})]})]})}),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(ka,{})})})}):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(El,{})})})}):((dn=at(dt))==null?void 0:dn.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:Yl,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."})})]})})})})}):(rt=at(dt))==null?void 0:rt.map((nt,Ut)=>{var Ht,Rt,hn,yn,Cn,En,Rn,Mn,Yn,Zn,Vn,tr,Sn,ze;const wn=!!(nt!=null&&nt.is_deleted),Jt=wn?"bg-[#3c1518]/70 border-[#ff6b6b]/60 text-[#ffd4d1] hover:bg-[#571f24]/80":"bg-[#123424]/70 border-[#2bd27c]/50 text-[#9cf7cb] hover:bg-[#185134]/80",Vt=vn[nt==null?void 0:nt.id]||{},xt=(Vt==null?void 0:Vt.status)||(nt!=null&&nt.is_deleted?"completed":"started"),We=Hn[xt],Pt=xt==="completed",Ke=Pt?"↻":wn?"▶":"⏹",ct=Vt!=null&&Vt.volume_usd?Vt.current_volume/Vt.volume_usd*100:0,Nt=Math.min(100,Math.max(0,ct));return i.jsxs("tr",{className:`relative group hover:bg-[#151515] h-[56px] border-b border-white/5 text-white transition-opacity ${wn?"opacity-60":"opacity-100"}`,children:[i.jsx("td",{scope:"row",className:`${Ut%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/${nt==null?void 0:nt.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/${Nn[(Ht=nt==null?void 0:nt.bot_params)==null?void 0:Ht.coin]||((hn=(Rt=nt==null?void 0:nt.bot_params)==null?void 0:Rt.coin)==null?void 0:hn.split("/")[0])}.svg`||Ha,alt:(yn=nt==null?void 0:nt.bot_params)==null?void 0:yn.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:xe=>Zi(xe)})}),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 qt;const xe=((qt=nt==null?void 0:nt.bot_params)==null?void 0:qt.coin)||"",Ge=xe.includes(":"),_e=Ge?xe.split(":")[1]:xe,Be=Ge?xe.split(":")[0]:null;return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:_e}),Be&&i.jsx("span",{className:"text-[8px] bg-[#233] text-[#67FFBD] px-1 py-[0.5px] rounded-md w-fit mt-[1px]",children:Be})]})})()})})]})})})}),i.jsx("td",{scope:"row",className:`${Ut%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:(nt==null?void 0:nt.source_market)==="lighter"?i.jsx(as,{content:"Lighter",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx(yf,{className:"w-4 h-4 text-[#fff]"}),i.jsx("p",{children:nt==null?void 0:nt.wm_name})]})}):(nt==null?void 0:nt.source_market)==="hyper"?i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(as,{content:"Hyperliquid",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("img",{src:O1,alt:"",className:"w-4 h-4 text-[#fff]"}),i.jsx("p",{children:nt==null?void 0:nt.wm_name})]})})}):i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(as,{content:"Dextrabot",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("img",{src:Hi,alt:"",className:"w-4 h-4 text-[#fff]"}),i.jsx("p",{children:nt==null?void 0:nt.wm_name})]})})})})})}),i.jsx("td",{scope:"row",className:`${Ut%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(sa,{info1:(Cn=nt==null?void 0:nt.bot_params)!=null&&Cn.leverage?`${(En=nt==null?void 0:nt.bot_params)==null?void 0:En.leverage}x`:"--",info1_Color:"text-white",rowTwo:!1})})})}),i.jsx("td",{scope:"row",className:`${Ut%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(sa,{info1:(Rn=nt==null?void 0:nt.bot_params)!=null&&Rn.volume?`$${(Yn=(Mn=nt==null?void 0:nt.bot_params)==null?void 0:Mn.volume)==null?void 0:Yn.toLocaleString("en-US")}`:"--",info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:`${Ut%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(sa,{info1:(Zn=nt==null?void 0:nt.bot_params)!=null&&Zn.budget?`$${(tr=(Vn=nt==null?void 0:nt.bot_params)==null?void 0:Vn.budget)==null?void 0:tr.toLocaleString("en-US")}`:"--",info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:`${Ut%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(sa,{info1:(Sn=nt==null?void 0:nt.bot_params)==null?void 0:Sn.direction,info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:`${Ut%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(sa,{info1:(ze=nt==null?void 0:nt.bot_params)==null?void 0:ze.executionMode,info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:`${Ut%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:Nt>=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:`${Nt||0}%`,backgroundColor:Nt>=100?"#3ec78c":"#d68b38"}}),i.jsxs("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] font-bold",style:{color:Nt>=100?"#d0ffd9":"#ffcb8a"},children:[Nt?Nt.toFixed(0):"0","%"]})]})})})})})}),i.jsx("td",{scope:"row",className:`${Ut%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(sa,{info1:We==null?void 0:We.label,info1_Color:We==null?void 0:We.color,rowTwo:!1})})})})}),i.jsx("td",{className:`${Ut%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:T[nt.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:()=>{O({id:Number(nt==null?void 0:nt.id),walletAddress:nt==null?void 0:nt.wm_address,isDeleted:Pt?!0:nt==null?void 0:nt.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 ${Pt?"bg-[#2d2d2d] border-[#444]":Jt}`,title:Ke,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:Pt?i.jsx(ln,{}):i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:Ke})})})})}),i.jsx("td",{className:`${Ut%2==0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222] pr-4`,children:i.jsx("div",{onClick:()=>{f(nt),g(!0)},className:"pl-1 flex flex-col items-end gap-2 font-manrope cursor-pointer",children:i.jsx(rst,{className:"w-5 h-5 text-white"})})})]},Ut)}):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:Yl,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."})})]})})})})})})]})})})]})]})},v3n="https://dextrabothypev2.nftinit.io",w3n=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState([]),[s,a]=h.useState(""),[o,l]=h.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(`${v3n}/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(zT,{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:j2,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(Ya.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(x3n,{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(y3n,{data:n,setData:r,loading:t,error:s,fetchInfoOnOpen:c,isFilterWallet:o})})})]})]})},dO="#67FFBD",C3n=({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(Ya.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(ka,{})]}):i.jsxs("div",{className:"relative h-full w-full flex justify-center items-center overflow-hidden rounded-[16px] bg-black",children:[i.jsx(Ya.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(Ya.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:g2,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[260px] object-cover bg-black"},g2)]}),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:dO},children:"Early Access"}),i.jsxs("div",{className:"text-lg font-semibold",children:["Enter ",i.jsx("span",{style:{color:dO},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:dO},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:dO},children:a})]})]})]})]})})},N3n=()=>{const{setSignModalOpen:t}=h.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"})})]})]})})]})},S3n=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setMushboomerETH:n,setIsWhitelist:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setHyperToken:l,setHyperAddress:c,setSignModalOpen:u}=h.useContext(Qr),[d,f]=h.useState(!1),[x,g]=h.useState(!1),[y,v]=h.useState(""),[C,S]=h.useState(!1),[T,I]=h.useState(""),[L,F]=h.useState(!1);h.useEffect(()=>{const O=localStorage.getItem("hyperToken"),U=localStorage.getItem("hyperAddress");f(!!(O&&U));const Y=setInterval(()=>{const re=localStorage.getItem("hyperToken"),Q=localStorage.getItem("hyperAddress");f(!!(re&&Q))},800);return()=>clearInterval(Y)},[]),h.useEffect(()=>{(async()=>{var re,Q;const U=window.localStorage.getItem("hyperToken"),Y=window.localStorage.getItem("hyperAddress");if(!(!U||!Y))try{F(!0);const q=await bi(Y.toLowerCase(),U);q!=null&&q.success?(t(q==null?void 0:q.telegram_chat_id),e(q==null?void 0:q.subscriber_role),n((re=q==null?void 0:q.mushboomer_counts)==null?void 0:re.eth),s((Q=q==null?void 0:q.mushboomer_counts)==null?void 0:Q.sol),a(q==null?void 0:q.referral_code),o(q==null?void 0:q.refcode),r(q==null?void 0:q.whitelist),g(q==null?void 0:q.mm_hyper_alpha_code),F(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),l(""),c(""),F(!1))}catch(q){console.error("Token verification error:",q),F(!1)}})()},[d]);const $=async()=>{var Y,re,Q,q;const O=window.localStorage.getItem("hyperToken"),U=window.localStorage.getItem("hyperAddress");if(!y.trim()){fn.error("Please enter your alpha code");return}if(!O||!U){u(!0);return}S(!0),I("");try{const te={address:U==null?void 0:U.toLowerCase(),token:O,alpha_code:y.trim(),source_market:"hyper",app_type:"mm_bot"},G=(await Ns.post("https://dextrabothypev2.nftinit.io/api/subscriber/alpha_code/set/",te)).data||{};if(G.success){const ie=G.message||"Alpha code added successfully";fn.success(`${ie}`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}}),I(ie),g(!0)}else{const ie=G.error_message||G.message||"This alpha code is invalid";fn.success(`${ie}.`,{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"}}),I(ie)}}catch(te){const fe=((re=(Y=te==null?void 0:te.response)==null?void 0:Y.data)==null?void 0:re.error_message)||((q=(Q=te==null?void 0:te.response)==null?void 0:Q.data)==null?void 0:q.message)||te.message||"Failed to validate alpha code";fn.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"}}),I(fe)}finally{S(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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(w3n,{}):i.jsx(C3n,{code:y,onCodeChange:v,onSubmit:$,loading:C,loadingCheckAccount:L,message:T}):i.jsx(N3n,{})})})]})},j3n=({data:t,refreshAgent:e,loadingCheckAccount:n,slotCount:r})=>{var G,ie,oe;const s=t==null?void 0:t.subs_expire_date,[a,o]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState(!1),[f,x]=h.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(yf,{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(lDe,{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:W9e},apex:{name:"Apex",type:"img",src:"https://omni.apex.exchange/assets/logo_content-CY9uyFbz.svg"}},v={lighter:{name:"Lighter",type:"component",src:i.jsx(yf,{className:"w-6 h-6 text-white"})}},C=["aster","basedapp","apex","extended"],S=(t==null?void 0:t.slots_info)||{},T=Object.fromEntries(Object.entries(S).filter(([K])=>!C.includes(K))),I=Object.values(T).reduce((K,H)=>K+H.total_qty,0),L=Object.values(T).reduce((K,H)=>K+H.active_qty,0),F=(((G=t==null?void 0:t.copy_trade_slots_info)==null?void 0:G.using_slot_count)||0)+(((ie=t==null?void 0:t.copy_trade_slots_info)==null?void 0:ie.total_slot_count)||0),$=((oe=t==null?void 0:t.copy_trade_slots_info)==null?void 0:oe.using_slot_count)||0,O=((t==null?void 0:t.bot_slots_info)||[]).find(K=>String((K==null?void 0:K.bot_type)||"").toLowerCase()==="grid_bot"&&String((K==null?void 0:K.source_market)||"").toLowerCase()==="lighter")||{},U=(O==null?void 0:O.total_slot_count)||0,Y=(O==null?void 0:O.using_subs_slot_count)||0,re=(O==null?void 0:O.using_extra_slot_count)||0,Q=Y+re,q=Q+U,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&&Ea.createPortal(i.jsx(vue,{open:l,setOpen:c,oldSlotCount:f,checkAccountTrade:n,tradeMarket:"copyTrade"}),document.body),u&&Ea.createPortal(i.jsx(D5,{open:u,setOpen:d,oldSlotCount:Q,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:Xj,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(t1,{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(z7,{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(z7,{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:`${q===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(z7,{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:[Q,"/",q," 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 ${Q>0?"bg-green-400 shadow-green-400/50 shadow-sm":"bg-white/20"}`}),i.jsx("span",{className:Q>0?"text-green-400 font-semibold":"text-white/40",children:Q}),i.jsx("span",{className:"text-white/30",children:"/"}),i.jsx("span",{className:"text-white/60",children:q})]}),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:`${q>0?Q/q*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(z7,{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:[L,"/",I," Active"]})]}),i.jsx("div",{className:"space-y-2",children:Object.entries(T).filter(([K])=>!C.includes(K)).map(([K,H])=>{var ee,se,pe;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:`${K==="apex"?"h-6":K==="basedapp"?"h-3.5":K==="pacifica"?"h-5":K==="variational"?"h-3":"h-3.5"} flex items-center justify-center`,children:[((ee=y[K])==null?void 0:ee.type)==="img"&&i.jsx("img",{src:y[K].src,alt:y[K].name,className:"w-full h-full"}),((se=y[K])==null?void 0:se.type)==="component"&&y[K].component]}),K==="lighter"&&i.jsx("span",{className:"font-medium text-white/80 -ml-3",children:((pe=y[K])==null?void 0:pe.name)||K})]}),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 ${H.active_qty>0?"bg-green-400 shadow-lg shadow-green-400/50":"bg-white/20"}`}),i.jsx("span",{className:H.active_qty>0?"text-green-400 font-semibold":"text-white/40",children:H.active_qty}),i.jsx("span",{className:"text-white/30",children:"/"}),i.jsx("span",{className:"text-white/60",children:H.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:`${H.active_qty/H.total_qty*100}%`}})})]})]},K)})})]}),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(z7,{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."})]})]})},A3n=()=>{const{setSignModalOpen:t,setTelegramChatId:e,setSubscriberRole:n,setSubsExpireDay:r,setMushboomerETH:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setIsWhitelist:c,setHyperToken:u,setHyperAddress:d}=h.useContext(Qr),{address:f}=ds(),[x,g]=h.useState(1),[y,v]=h.useState({}),[C,S]=h.useState(""),[T,I]=h.useState(""),[L,F]=h.useState(!1),[$,O]=h.useState(!1),[U,Y]=h.useState(""),[re,Q]=h.useState(0),[q,te]=h.useState(0),[fe,G]=h.useState(!1),[ie,oe]=h.useState(0),[K,H]=h.useState(!1),ee=dt=>/^\d*$/.test(dt),se=dt=>{["e","E","+","-"].includes(dt.key)&&dt.preventDefault()},pe=h.useMemo(()=>{if(x==="")return!1;const dt=Number(x);return Number.isInteger(dt)&&dt>=1},[x]),ve=(dt=>{const[st,at]=dt.split(" "),[He,qe,vt]=st.split("-").map(Number),[yt,Kt]=at.split(":").map(Number);return new Date(Date.UTC(vt,qe-1,He,yt-3,Kt))})("29-11-2025 23:59");h.useState(()=>new Date().getTime()>=ve.getTime());const be=h.useRef(re);h.useEffect(()=>{be.current=re},[re]);const we=h.useRef(0);h.useEffect(()=>{we.current=q},[q]);const je=async()=>{var at,He,qe;const dt=window.localStorage.getItem("hyperToken"),st=window.localStorage.getItem("hyperAddress");if(!(!dt||!st))try{H(!0);const vt=await bi(st.toLowerCase(),dt);vt!=null&&vt.success?(e(vt==null?void 0:vt.telegram_chat_id),n(vt==null?void 0:vt.subscriber_role),r(vt==null?void 0:vt.subs_expire_day),s((at=vt==null?void 0:vt.mushboomer_counts)==null?void 0:at.eth),a((He=vt==null?void 0:vt.mushboomer_counts)==null?void 0:He.sol),o(vt==null?void 0:vt.referral_code),l(vt==null?void 0:vt.refcode),c(vt==null?void 0:vt.whitelist),u(dt),d(st),S(vt==null?void 0:vt.farming_tools),Q(Number((vt==null?void 0:vt.subs_expire_day)||0)),v(vt),H(!1),oe(((qe=vt==null?void 0:vt.copy_trade_slots_info)==null?void 0:qe.extra_slot_count)||0)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),u(""),d(""),H(!1))}catch(vt){console.error("Token verification error:",vt),console.error(vt.message||"An unknown error occurred."),H(!1)}};h.useEffect(()=>{fe&&je()},[fe]),h.useEffect(()=>{const dt=localStorage.getItem("hyperToken"),st=localStorage.getItem("hyperAddress");G(!!(dt&&st));const at=setInterval(()=>{const He=localStorage.getItem("hyperToken"),qe=localStorage.getItem("hyperAddress");G(!!(He&&qe))},800);return()=>clearInterval(at)},[]);const Fe=async()=>new Tl(window.ethereum).eth.getAccounts(st=>st),Re=async(dt="subscribe",st=24,at=5e3)=>{st<=0||(await new Promise(He=>setTimeout(He,at)),await je(),dt==="subscribe"&&be.current===we.current?Re(dt,st-1,at):je())},Qe=async dt=>{const st=window.localStorage.getItem("hyperToken"),at=window.localStorage.getItem("hyperAddress");if(!st||!f){t(!0);return}I(""),te(be.current),we.current=be.current,O(!0),F(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(vt){console.error("Failed to switch network",vt),F(!1);return}const He=new Tl(window.ethereum);var qe=await Fe();if(qe.length>0?qe=qe[0]:qe=void 0,qe){const yt=dt*.12,Kt=He.utils.toWei(yt.toString(),"ether"),jt={from:qe,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:Kt};await He.eth.sendTransaction(jt).then(un=>{console.log("txHash :>> ",un),F(!1),Y(un.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():at,token:st,payment_tx:un.transactionHash,payment_role:"farming_tools",tx_qty:Number(x)})}),je(),Re("subscribe")}).catch(un=>{console.log(un),un.code===-32003||un.message.includes("insufficient funds")?I("Insufficient funds."):un.message==="MetaMask Tx Signature: User denied transaction signature."&&O(!1)})}else await He.eth.requestAccounts()},Ye=()=>{je()};return window.localStorage.getItem("hyperToken"),i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:$,setOpen:O,transactionHash:U,transactionLoading:L,paymentPresaleRole:!(re<=q),errorFunds:T,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(j3n,{data:y,refreshAgent:Ye,loadingCheckAccount:K,slotCount:ie})})})}),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:yB,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[284px] lg:h-[284px] object-cover"},yB)}),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 st=Number(dt||0);return st>1?String(st-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 st=dt.target.value.trim();if(st==="")return g("");ee(st)&&g(st)},onKeyDown:se,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 st=Number(dt||0);return String(st+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!==""&&!pe&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),pe&&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(),pe&&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 ${pe?"border-[#8861FF] bg-[#7446FF] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy Now"})]})})]})]})},_3n=()=>{ds();const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setIsWhitelist:l,setHyperToken:c,setHyperAddress:u}=h.useContext(Qr);return h.useEffect(()=>{(async()=>{var g,y;const f=window.localStorage.getItem("hyperToken"),x=window.localStorage.getItem("hyperAddress");if(!(!f||!x))try{const v=await bi(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(za,{children:i.jsxs(Va,{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(A3n,{})})})]})},E3n="https://dextrabothypev2.nftinit.io/api/hyper/funding_stats/",w8e=[{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}],hg=[{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"}],C8e={extended:"ext",lighter:"lit",hyperliquid:"hyp",variational:"var",aster:"ast",paradex:"par"},N8e=(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},S8e=({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:bT,alt:t.name,className:`${e} rounded`});case"lighter":return i.jsx(yf,{className:e});case"hyperliquid":return i.jsx("img",{src:Fae,alt:t.name,className:e});case"aster":return i.jsx(Wj,{className:e});case"paradex":return i.jsx("img",{src:yT,alt:t.name,className:`${e} rounded`});default:return null}},k3n=()=>{const t=yo(),[e,n]=h.useState([]),[r,s]=h.useState(!0),[a,o]=h.useState(null),[l,c]=h.useState(""),[u,d]=h.useState({key:"best_arb_apr",direction:"desc"}),[f,x]=h.useState(null),[g,y]=h.useState("1h"),[v,C]=h.useState(()=>{const G=localStorage.getItem("fundingSelectedExchanges");if(G)try{const oe=JSON.parse(G).filter(K=>hg.some(H=>H.id===K));return oe.length>0?oe:hg.map(K=>K.id)}catch{return hg.map(ie=>ie.id)}return hg.map(ie=>ie.id)}),[S,T]=h.useState(!1),I=h.useRef(!0),L=h.useRef(null);h.useEffect(()=>{localStorage.setItem("fundingSelectedExchanges",JSON.stringify(v))},[v]);const F=(G,ie,oe)=>{const K=C8e[ie],H=C8e[oe];K&&H&&t(`/funding-history/${K}-${H}-${G.toLowerCase()}`)};h.useEffect(()=>{const G=async()=>{try{const K=await(await fetch(E3n)).json();K.success&&Array.isArray(K.data)?(n(K.data),x(K.updated_at),o(null)):I.current&&o("Failed to fetch data")}catch(oe){I.current&&o(oe.message||"Failed to fetch data")}finally{I.current&&(s(!1),I.current=!1)}};G();const ie=setInterval(G,5e3);return()=>clearInterval(ie)},[]),h.useEffect(()=>{const G=ie=>{L.current&&!L.current.contains(ie.target)&&T(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[]);const $=G=>{C(ie=>ie.includes(G)?ie.length===1?ie:ie.filter(oe=>oe!==G):[...ie,G])},O=G=>{if(!G)return"";const ie=G.endsWith("Z")?G:G+"Z";return new Date(ie).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})},U=h.useMemo(()=>{let G=e;if(l.trim()){const ie=l.toLowerCase();G=e.filter(oe=>oe.ticker.toLowerCase().includes(ie))}return G=G.filter(ie=>v.some(oe=>{var K,H;return(H=(K=ie.marketplaces)==null?void 0:K[oe])==null?void 0:H.available})),u.key&&(G=[...G].sort((ie,oe)=>{var ee,se,pe,Se;let K,H;if(u.key==="ticker")return K=ie.ticker,H=oe.ticker,u.direction==="asc"?K.localeCompare(H):H.localeCompare(K);if(u.key==="best_arb_apr")K=N8e(ie,v),H=N8e(oe,v);else if(u.key.startsWith("mp_")){const ge=u.key.replace("mp_","");K=parseFloat((se=(ee=ie.marketplaces)==null?void 0:ee[ge])==null?void 0:se.hourly_rate)||0,H=parseFloat((Se=(pe=oe.marketplaces)==null?void 0:pe[ge])==null?void 0:Se.hourly_rate)||0}else K=parseFloat(ie[u.key])||0,H=parseFloat(oe[u.key])||0;return u.direction==="asc"?K-H:H-K})),G},[e,l,u,v]),Y=G=>{d(ie=>ie.key===G?ie.direction==="asc"?{key:G,direction:"desc"}:ie.direction==="desc"?{key:null,direction:null}:{key:G,direction:"asc"}:{key:G,direction:"desc"})},re=G=>{if(u.key===G){if(u.direction==="asc")return i.jsx(o2,{className:"inline ml-1 text-[#67FFBD]"});if(u.direction==="desc")return i.jsx(a2,{className:"inline ml-1 text-[#67FFBD]"})}return i.jsx(l2,{className:"inline ml-1 text-gray-500"})},Q=G=>G>=0?"text-[#4ade80]":"text-[#f87171]",q=()=>{const G=w8e.find(ie=>ie.label===g);return G?G.multiplier:1},te=G=>{const ie=v.filter(be=>{var we,je;return(je=(we=G.marketplaces)==null?void 0:we[be])==null?void 0:je.available});if(ie.length<2)return null;let oe=1/0,K=-1/0,H=null,ee=null;for(const be of ie){const we=parseFloat(G.marketplaces[be].hourly_rate)||0;we<oe&&(oe=we,H=be),we>K&&(K=we,ee=be)}const se=(K-oe)*8760*100;if(se<=0||H===ee)return null;let pe;se>=100?pe=`${se.toFixed(2)}%`:se>=1?pe=`${se.toFixed(2)}%`:pe=`${se.toFixed(4)}%`;const Se=hg.find(be=>be.id===H),ge=hg.find(be=>be.id===ee),ve=`${(ge==null?void 0:ge.name.toLowerCase())||ee}/${(Se==null?void 0:Se.name.toLowerCase())||H}`;return{apr:se,apr_fmt:pe,long_mp:H,short_mp:ee,long_rate:G.marketplaces[H].hourly_rate,short_rate:G.marketplaces[ee].hourly_rate,pair:ve}},fe=G=>{const ie=q(),K=(parseFloat(G)||0)*ie*100;return Math.abs(K)>=100?`${K.toFixed(0)}%`:Math.abs(K)>=1?`${K.toFixed(2)}%`:`${K.toFixed(4)}%`};return i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{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 ",O(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(nWe,{className:"h-4 w-4 text-gray-500"})}),i.jsx("input",{type:"text",value:l,onChange:G=>c(G.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(Lde,{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:w8e.map(G=>i.jsx("button",{onClick:()=>y(G.label),className:`px-2.5 py-1 text-[10px] font-medium uppercase rounded transition-colors ${g===G.label?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":"text-gray-400 hover:text-white hover:bg-neutral-800"}`,children:G.label},G.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:[U.length," of ",e.length," markets"]}),i.jsx("div",{className:"w-px h-4 bg-neutral-700"}),i.jsxs("div",{className:"relative",ref:L,children:[i.jsxs("button",{onClick:()=>T(!S),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(Z_,{className:`w-3.5 h-3.5 transition-transform ${S?"rotate-180":""}`})]}),S&&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:hg.map(G=>i.jsxs("div",{onClick:()=>$(G.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(G.id)?"bg-emerald-500 border-emerald-500":"border-neutral-600"}`,children:v.includes(G.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(S8e,{exchange:G,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-xs",children:G.name})]},G.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:()=>Y("ticker"),children:["Market ",re("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:()=>Y("best_arb_apr"),children:["Best Arb APR ",re("best_arb_apr")]}),hg.filter(G=>v.includes(G.id)).map(G=>i.jsx("th",{className:"px-4 py-3 cursor-pointer hover:text-white transition-colors font-medium w-[180px] min-w-[180px]",onClick:()=>Y(`mp_${G.id}`),children:i.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[i.jsx(S8e,{exchange:G,className:"w-3.5 h-3.5"}),i.jsx("span",{children:G.name}),re(`mp_${G.id}`)]})},G.id))]})}),i.jsx("tbody",{children:r?Array.from({length:15}).map((G,ie)=>i.jsx("tr",{className:"border-b border-neutral-800/50",children:Array.from({length:3+v.length}).map((oe,K)=>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"})},K))},ie)):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})}):U.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"})}):U.map(G=>{const ie=te(G)||{};return i.jsxs("tr",{onClick:()=>{ie.long_mp&&ie.short_mp&&F(G.ticker,ie.long_mp,ie.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/${G.ticker}.svg`,alt:G.ticker,className:"w-5 h-5 rounded-full",onError:oe=>{oe.target.style.display="none"}}),i.jsx("span",{className:"text-sm text-white",children:G.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:oe=>{oe.stopPropagation(),console.log("Start bot for",G.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(wun,{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:ie.apr_fmt||"—"}),ie.pair&&i.jsx("span",{className:"text-[9px] text-gray-500 uppercase tracking-wide",children:ie.pair})]})}),hg.filter(oe=>v.includes(oe.id)).map(oe=>{var ve;const K=(ve=G.marketplaces)==null?void 0:ve[oe.id],H=K==null?void 0:K.available,ee=K==null?void 0:K.hourly_rate,se=parseFloat(ee)||0,pe=ie.long_mp===oe.id,Se=ie.short_mp===oe.id,ge=pe||Se;return i.jsx("td",{className:"px-2 py-2 w-[180px] min-w-[180px]",children:H?i.jsxs("div",{className:`flex flex-col items-center py-1.5 px-2 rounded ${ge?Se?"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 ${Q(se)}`,children:fe(ee)}),i.jsx("div",{className:"h-4 flex items-center",children:ge&&i.jsx("span",{className:`text-[9px] font-bold tracking-wide ${Se?"text-red-400":"text-emerald-400"}`,children:Se?"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"})]})},oe.id)})]},G.ticker)})})]})})]})]})};function to(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 M3(t,e){return t.width===e.width&&t.height===e.height}var T3n=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 P3n(t){return new T3n(t)}var I3n=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=to({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 to({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=to(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;M3(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=to(this._transformBitmapSize(e,this._canvasElementClientSize)),s=M3(this.bitmapSize,r)?null:r;n===null&&s===null||n!==null&&s!==null&&M3(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}O3n().then(function(n){return n?e._initResizeObserver():e._initDevicePixelRatioObservable()})},t.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var n=j8e(this._canvasElement);if(n===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=P3n(n),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){var e,n;if(this._canvasElement!==null){var r=j8e(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?M3n(a[0],s):to({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=to({width:s.inlineSize,height:s.blockSize});e._suggestNewBitmapSize(a)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function F3n(t,e){if(e.type==="device-pixel-content-box")return new I3n(t,e.transform,e.options);throw new Error("Unsupported binding target")}function j8e(t){return t.ownerDocument.defaultView}function O3n(){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 M3n(t,e){return to({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 L3n=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 C5(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 L3n(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 AKe={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 A8e,_8e;function Ej(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 _Ke(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 vf(t){if(t===void 0)throw new Error("Value is undefined");return t}function cs(t){if(t===null)throw new Error("Value is null");return t}function Ly(t){return cs(vf(t))}(function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved"})(A8e||(A8e={})),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"}(_8e||(_8e={}));class kl{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 kj(t){return typeof t=="number"&&isFinite(t)}function Uk(t){return typeof t=="number"&&t%1==0}function vP(t){return typeof t=="string"}function fO(t){return typeof t=="boolean"}function Qg(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"?Qg(s):s);return n}function R3n(t){return t!==null}function rie(t){return t===null?void 0:t}const EKe="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function vB(t,e,n){return e===void 0&&(e=EKe),`${n=n!==void 0?`${n} `:""}${t}px ${e}`}class D3n{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=vB(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 SZ(t){return t<0?0:t>255?255:Math.round(t)||0}function E8e(t){return .199*t[0]+.687*t[1]+.114*t[2]}class B3n{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:E8e(n)>160?"black":"white"}}J(e){return E8e(this.K(e))}tt(e,n,r){const[s,a,o,l]=this.K(e),[c,u,d,f]=this.K(n),x=[SZ(s+r*(c-s)),SZ(a+r*(u-a)),SZ(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 $3n{constructor(){this.it=[]}st(e){this.it=e}nt(e,n,r){this.it.forEach(s=>{s.nt(e,n,r)})}}class J5{nt(e,n,r){e.useBitmapCoordinateSpace(s=>this.et(s,n,r))}}class U3n extends J5{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 z3n(){return{ot:[{_t:0,ut:0,wt:0,gt:0}],vt:"",dt:"",ft:0,ct:0,lt:null}}const H3n={from:0,to:1};class V3n{constructor(e,n,r){this.Mt=new $3n,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(z3n),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=H3n):l.lt=null})}}class W3n extends J5{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,Ej(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,Ej(e,this.Yt.Kt.Xt),_Ke(e,c,0,n.width))}}class q3n{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 W3n(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 Hz(t,e,n,r,s,a){t.save(),t.globalCompositeOperation="copy",t.fillStyle=a,t.fillRect(e,n,r,s),t.restore()}function k8e(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 T8e(t,e,n,r,s,a,o=0,l=[0,0,0,0],c=""){if(t.save(),!o||!c||c===a)return k8e(t,e,n,r,s,l),t.fillStyle=a,t.fill(),void t.restore();const u=o/2;var d;k8e(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 kKe(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 P8e{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?T8e(u,f.oi,f._i,f.ui,f.ci,o,f.di,[f.ft,0,0,f.ft],o):T8e(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,S=n.k,T=r.Di(a,C),I=Math.ceil(r.Vi(a,C)),L=S+x+g,F=n.S+y+v+I+d,$=Math.max(1,Math.floor(u));let O=Math.round(L*u);O%2!=$%2&&(O+=1);const U=f>0?Math.max(1,Math.floor(f*c)):0,Y=Math.round(F*c),re=Math.round(d*c),Q=this.ei.Ii??this.ei.Bi,q=Math.round(Q*u)-Math.floor(.5*u),te=Math.floor(q+$/2-O/2),fe=te+O,G=s==="right",ie=G?l.width-f:f,oe=G?o.width-U:U;let K,H,ee;return G?(K=oe-Y,H=oe-re,ee=ie-d-y-f):(K=oe+Y,H=oe+re,ee=ie+d+y),{li:G,ai:{_i:te,mi:q,Si:fe,ui:Y,ci:O,ft:2*c,di:U,oi:K,fi:oe,wi:H,gi:$,bi:o.width},xi:{_i:te/u,Si:fe/u,Ci:ee,yi:T}}}}class Vz{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||P8e)(this.Ei,this.Ai),this.Oi=new(e||P8e)(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 G3n extends Vz{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 K3n=/[1-9]/g;class TKe{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,cs(this.Yt).ri,K3n))));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=cs(this.Yt);x.fillStyle=v.Z;const C=Math.round(u*g),S=Math.round(0*y),T=Math.round(d*g),I=Math.round(f*y),L=Math.round(2*g);if(x.beginPath(),x.moveTo(C,S),x.lineTo(C,I-L),x.arcTo(C,I,C+L,I,L),x.lineTo(T-L,I),x.arcTo(T,I,T,I-L,L),x.lineTo(T,S),x.fill(),v.pi){const F=Math.round(v.Bi*g),$=S,O=Math.round(($+n.C)*y);x.fillStyle=v.R;const U=Math.max(1,Math.floor(g)),Y=Math.floor(.5*g);x.fillRect(F-Y,$,U,O-$)}}),e.useMediaCoordinateSpace(({context:x})=>{const g=cs(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 Y3n{constructor(e,n,r){this.xt=!0,this.Gt=new TKe,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(cs(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 PKe=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 I8e;(function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden",t[t.MagnetOHLC=3]="MagnetOHLC"})(I8e||(I8e={}));class X3n extends PKe{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===cs(this.yt).Ps())return{gt:c,Bi:l};{const u=cs(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 Y3n(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 q3n(this,e),this.gs.set(e,n));let r=this.Ms.get(e);return r||(r=new V3n(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(R3n),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 G3n(this,n,r),e.set(n,s)),s}}function Wz(t){return t==="left"||t==="right"}class Jc{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 Jc(2)}static gn(){return new Jc(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 F8e=".";function Zg(t,e){if(!kj(t))return"n/a";if(!Uk(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 qz{constructor(e,n){if(n||(n=1),kj(e)&&Uk(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=F8e+Zg(+o.toFixed(this.xn)*this.Mn,a)}else r=Math.round(r*n)/n,a>0&&(s=F8e+Zg(0,a));return r.toFixed(0)+s}}class IKe extends qz{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class Q3n{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 Z3n=/[2-9]/g;class wB{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||Z3n,a=String(n).replace(s,"0");if(this.Dn.has(a))return vf(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 J3n{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 FKe{constructor(e,n,r){this.Wn=e,this.On=new wB(50),this.Fn=n,this.O=r,this.W=-1,this.Gt=new J3n(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 e5n extends J5{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),Ej(e,this.Yt.Xt),_Ke(e,a,0,n.width))}}class Bfe{constructor(e){this.Zn={ut:0,R:"rgba(0, 0, 0, 0)",ct:1,Xt:0,Vt:!1},this.Gn=new e5n,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 t5n extends Bfe{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 n5n extends J5{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 r5n=[{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 s5n{constructor(e){this.Gt=new n5n,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 r5n)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 i5n extends Bfe{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 a5n extends Vz{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 O8e(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 Cd{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 Cd(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 Cd(O8e(Math.min,this.$e(),e.$e(),-1/0),O8e(Math.max,this.qe(),e.qe(),1/0))}je(e){if(!kj(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){kj(e)&&(this.Fe+=e,this.We+=e)}Xe(){return{minValue:this.We,maxValue:this.Fe}}static Ze(e){return e===null?null:new Cd(e.minValue,e.maxValue)}}class CB{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 CB(Cd.Ze(e.priceRange),e.margins)}}class o5n extends Bfe{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 l5n extends Vz{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 c5n{constructor(e,n){this.ge=e,this.ys=n,this.er=new o5n(e,this),this.Wn=new l5n(e,this),this.rr=new FKe(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 u5n extends PKe{constructor(e){super(),this.ts=e}Qt(){return this.ts}}const d5n={Bar:(t,e,n,r)=>{const s=e.upColor,a=e.downColor,o=cs(t(n,r)),l=Ly(o.Ft[0])<=Ly(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=cs(t(n,r)),f=Ly(d.Ft[0])<=Ly(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:cs(t(n,r)).R??e.color}),Area:(t,e,n,r)=>{const s=cs(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=cs(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=cs(t(n,r));return{cr:s.R??e.color,vt:s.R??e.color}},Histogram:(t,e,n,r)=>({cr:cs(t(n,r)).R??e.color})};class f5n{constructor(e){this.kr=(n,r)=>r!==void 0?r.Ft:this.ge.Xs().Pr(n),this.ge=e,this.Tr=d5n[e.Rr()]}Dr(e,n){return this.Tr(this.kr,this.ge.N(),e,n)}}function OKe(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 Tj=OKe.bind(null,!0),MKe=OKe.bind(null,!1);var M8e;(function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"})(M8e||(M8e={}));const Rb=30;class h5n{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=hO(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 Tj(this.Vr,e,(n,r)=>n.Re<r)}Zr(e){return MKe(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=cs(this.Lr()),o=cs(this.Ks()),l=Math.max(e,a),c=Math.min(n,o),u=Math.ceil(l/Rb)*Rb,d=Math.max(u,Math.floor(c/Rb)*Rb);{const x=this.Xr(l),g=this.Zr(Math.min(c,u,n));s=hO(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+=Rb){const g=Math.floor(x/Rb);let y=f.get(g);if(y===void 0){const v=this.Xr(g*Rb),C=this.Zr((g+1)*Rb-1);y=this.Gr(v,C,r),f.set(g,y)}s=hO(s,y)}{const x=this.Xr(d),g=this.Zr(c);s=hO(s,this.Gr(x,g,r))}return s}}function hO(t,e){return t===null?e:e===null?t:{Jr:Math.min(t.Jr,e.Jr),Qr:Math.max(t.Qr,e.Qr)}}class p5n{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 m5n{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 p5n(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 LKe{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 m5n(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 x5n=class extends LKe{us(){return[]}};class g5n{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 L8e{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 g5n(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 RKe(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 b5n{constructor(e,n){this.Gt=new TKe,this._h=e,this.uh=n}Tt(){return this.Gt.ht({Qi:this.uh.Qi(),...RKe(this._h)}),this.Gt}}class y5n extends Vz{constructor(e,n){super(),this._h=e,this.Yi=n}qi(e,n,r){const s=RKe(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 v5n extends LKe{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 b5n(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 y5n(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 L8e(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 L8e(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 jZ(t,e,n,r){t.forEach(s=>{e(s).forEach(a=>{a.rh()===n&&r.push(a)})})}function AZ(t){return t.Ws()}function w5n(t){return t.wh()}function C5n(t){return t.gh()}const N5n=["Area","Line","Baseline"];class Gz extends u5n{constructor(e,n,r,s,a){super(e),this.Yt=new h5n,this.er=new i5n(this),this.bh=[],this.Sh=new t5n(this),this.xh=null,this.Ch=null,this.yh=null,this.kh=[],this.ys=r,this.Ph=n;const o=new a5n(this);this.vs=[o],this.rr=new FKe(o,this,e),N5n.includes(this.Ph)&&(this.xh=new s5n(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 f5n(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 c5n(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=[];jZ(this.kh,AZ,"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),jZ(this.kh,AZ,"normal",e),e}Jh(){return this.Qh(AZ,"bottom")}ta(e){return this.Qh(w5n,e)}ia(e){return this.Qh(C5n,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 CB.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 cs(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 v5n(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!Wz(this.Wt().wa())}na(e,n){if(!Uk(e)||!Uk(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 Cd(s.Jr,s.Qr):null,o=null;if(this.Rr()==="Histogram"){const l=this.ys.base,c=new Cd(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 Cd(c.priceRange.minValue,c.priceRange.maxValue);a=a!==null?a.vn(u):u}c!=null&&c.margins&&(o=c.margins)}),new CB(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 Q3n(this.ys.priceFormat.precision);break;case"percent":this.ha=new IKe(this.ys.priceFormat.precision);break;default:{const e=Math.pow(10,this.ys.priceFormat.precision);this.ha=new qz(e,this.ys.priceFormat.minMove*e)}}this.es!==null&&this.es.ga()}Qh(e,n){const r=[];return jZ(this.kh,e,n,r),r}}const S5n=[3],j5n=[0,1,2,3];class A5n{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 Gz).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=Ly(f.zt()),C=this.ys.mode===3?j5n:S5n;return d.concat(C.map(S=>x.Nt(y.Ft[S],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 i9(t,e,n){return Math.min(Math.max(t,e),n)}function pO(t,e,n){return e-t<=n}class _5n extends J5{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=cs(this.Yt);if(o.Sa){e.strokeStyle=o.xa,Ej(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,Ej(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 E5n{constructor(e){this.Gt=new _5n,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 k5n{constructor(e){this.sh=new E5n(e)}lr(){return this.sh}}const _Z={Ia:4,Ba:1e-4};function w4(t,e){const n=100*(t-e)/e;return e<0?-n:n}function T5n(t,e){const n=w4(t.$e(),e),r=w4(t.qe(),e);return new Cd(n,r)}function a9(t,e){const n=100*(t-e)/e+100;return e<0?-n:n}function P5n(t,e){const n=a9(t.$e(),e),r=a9(t.qe(),e);return new Cd(n,r)}function NB(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 o9(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 H7(t,e){if(t===null)return null;const n=NB(t.$e(),e),r=NB(t.qe(),e);return new Cd(n,r)}function C_(t,e){if(t===null)return null;const n=o9(t.$e(),e),r=o9(t.qe(),e);return new Cd(n,r)}function EZ(t){if(t===null)return _Z;const e=Math.abs(t.qe()-t.$e());if(e>=1||e<1e-15)return _Z;const n=Math.ceil(Math.abs(Math.log10(e))),r=_Z.Ia+n;return{Ia:r,Ba:1/Math.pow(10,r)}}class kZ{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=pO(a,s,1e-14)&&a>s+1e-14,x=pO(a,r*l,1e-14),g=pO(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];pO(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 R8e{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 kZ(this.Aa,[2,2.5,2]),o=new kZ(this.Aa,[2,2,2.5]),l=new kZ(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=Ly(this.Yi.Qe());return this.Yi.Ga()&&(s=C_(s,this.Yi.Qa())),s.$e()-n<e&&r-s.qe()<e}}function DKe(t){return t.slice().sort((e,n)=>cs(e.hs())-cs(n.hs()))}var D8e;(function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"})(D8e||(D8e={}));const B8e=new IKe,$8e=new qz(100,1);class I5n{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 kl,this._l=new kl,this.ul=[],this.cl=null,this.dl=null,this.fl=null,this.pl=null,this.vl=null,this.ha=$8e,this.ml=EZ(null),this.wl=e,this.ys=n,this.gl=r,this.Ml=s,this.bl=a,this.Sl=new R8e(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=vf(e.scaleMargins.top),r=vf(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=o9(a.$e(),o),c=o9(a.qe(),o);return isFinite(l)&&isFinite(c)}(this.Ge,this.ml)?(r=C_(this.Ge,this.ml),r!==null&&this.Vl(r)):this.ys.autoScale=!0),e.ie===1&&e.ie!==n.ie&&(r=H7(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=w4(e,n):this.Rl()&&(e=a9(e,n)),this.Cl(e,n)}Hl(e,n,r){this.Ol();const s=this.Ll(),a=cs(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 S=C;g!==null&&(S=g(v.gt,n));const T=s+d*(S-o),I=u?T:this.tl-1-T;v.ut=I}}$l(e,n,r){this.Ol();const s=this.Ll(),a=cs(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,S=v.Yh,T=v.jh,I=v.Kh;g!==null&&(C=g(v.qh,n),S=g(v.Yh,n),T=g(v.jh,n),I=g(v.Kh,n));let L=s+d*(C-o),F=u?L:this.tl-1-L;v.ql=F,L=s+d*(S-o),F=u?L:this.tl-1-L,v.Yl=F,L=s+d*(T-o),F=u?L:this.tl-1-L,v.jl=F,L=s+d*(I-o),F=u?L:this.tl-1-L,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=DKe(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=cs(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=cs(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=cs(this.Qe()).Ue()))}ho(e){if(this.Pl()||this.vl===null)return;const n=cs(this.Qe()).Ye()/(this.El()-1);let r=e-this.vl;this.Dl()&&(r*=-1);const s=r*n,a=cs(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(w4(e,n));case 3:return this.ra().format(a9(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,cs(this.cl).ra())}Vh(e,n){return e=w4(e,n),this.lo(e,B8e)}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=$8e,this.Le()?(this.ha=B8e,n=100):this.Rl()?(this.ha=new qz(100,1),n=100):this.cl!==null&&(this.ha=this.cl.ra()),this.Sl=new R8e(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?NB(e,this.ml):e;const r=cs(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=cs(this.Qe()),a=s.$e()+s.Ye()*((r-this.Ll())/(this.El()-1));return this.Ga()?o9(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=H7(f,this.ml);break;case 2:f=T5n(f,u.Ft);break;case 3:f=P5n(f,u.Ft)}if(n=n===null?f:n.vn(cs(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=C_(n,this.ml)),n=new Cd(n.$e()-u,n.qe()+u),this.Ga()&&(n=H7(n,this.ml))}if(this.Ga()){const c=C_(n,this.ml),u=EZ(c);if(o=u,l=this.ml,o.Ia!==l.Ia||o.Ba!==l.Ba){const d=this.sl!==null?C_(this.sl,this.ml):null;this.ml=u,n=H7(c,u),d!==null&&(this.sl=H7(d,u))}}this.Vl(n)}else this.Ge===null&&(this.Vl(new Cd(-.5,.5)),this.ml=EZ(null));var o,l}Ul(){return this.Le()?w4:this.Rl()?a9:this.Ga()?e=>NB(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 U8e(t){return t instanceof Gz}class z8e{constructor(e,n){this.ul=[],this.do=new Map,this.tl=0,this.fo=0,this.po=1e3,this.dl=null,this.vo=new kl,this.kh=[],this.uh=e,this.ts=n,this.mo=new k5n(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=cs(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)?vf(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(U8e)}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=cs(e.Wt()).wa();if(this.do.has(s)){const o=vf(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=DKe(this.ul)),this.dl}qo(e,n){n=i9(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(U8e)}Yo(){return this.vo}jo(){return this.mo}ua(e){this.kh.push(new x5n(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),!Wz(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,...Qg(n)},s=new I5n(e,r,this.ts.N().layout,this.ts.N().localization,this.ts.Xi());return s.Al(this.$t()),s}}function mO(t){return{Xo:t.Xo,Zo:{Kn:t.Go.externalId},Jo:t.Go.cursorStyle}}function F5n(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 O5n(t){return t.Ws!==void 0}function BKe(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 mO(s);for(const a of r){if(s&&s.Xo===a&&s.Go.zOrder!=="bottom"&&!s.Go.isBackground)return mO(s);if(O5n(a)){const o=F5n(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 mO(s)}return s!=null&&s.Go?mO(s):null}class M5n{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(vf(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 l9{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 H8e(t,e){return t===null||e===null?t===e:t.He(e)}class L5n{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(Tj(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=vf(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 S=l[u],T=S.index;if(!(T<C&&a(S))){x=T;break}u++,s.push(S),g=T,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 Y4{constructor(e){this.m_=e}w_(){return this.m_===null?null:new l9(Math.floor(this.m_.Uh()),Math.ceil(this.m_.bi()))}g_(){return this.m_}static M_(){return new Y4(null)}}function R5n(t,e){return t.weight>e.weight?t:e}class D5n{constructor(e,n,r,s){this.fo=0,this.b_=null,this.S_=[],this.vl=null,this.pl=null,this.x_=new L5n,this.C_=new Map,this.y_=Y4.M_(),this.k_=!0,this.P_=new kl,this.T_=new kl,this.R_=new kl,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=Tj(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=cs(this.Z_()),a=cs(this.G_());return{from:cs(this.ss(Math.max(s,n))),to:cs(this.ss(Math.min(a,r)))}}J_(e){return{from:cs(this.U_(e.from,!0)),to:cs(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()||!Uk(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=cs(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=i9(this.fo-e,0,this.fo),r=i9(this.fo-cs(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_=cs(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 l9(e,n+this.ys.rightOffset))}Pu(e){const n=new l9(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(Y4.M_());const e=this.iu(),n=this.fo/this.z_,r=this.E_+e,s=new l9(r-n+1,r);this.Du(new Y4(s))}Q_(){const e=i9(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 M5n(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,H8e(n.w_(),this.y_.w_())||this.P_.p(),H8e(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 V8e,W8e,q8e,G8e,K8e;(function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"})(V8e||(V8e={}));class B5n{constructor(e,n,r){this.zu=[],this.Lu=[],this.fo=0,this.Ou=null,this.Nu=new kl,this.Wu=new kl,this.Fu=null,this.Hu=e,this.ys=n,this.i_=r,this.bl=new B3n(this.ys.layout.colorParsers),this.Uu=new D3n(this),this.uh=new D5n(this,n.timeScale,this.ys.localization,r),this.Ct=new X3n(this,n.crosshair),this.$u=new A5n(n.crosshair),this.qu(0),this.zu[0].Po(2e3),this.Yu=this.ju(0),this.Ku=this.ju(1)}Bh(){this.Xu(Jc.gn())}ar(){this.Xu(Jc.wn())}Zh(){this.Xu(new Jc(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=BKe(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,cs(a)),l=this.uh.U_(n,!0),c=this.uh.qt(cs(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 z8e}(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=cs(n);this.Lu.splice(r,1),s.Jl(e),e.m&&e.m(),this.uh.O_(),this.kc(s)}Ih(e,n){const r=cs(this.Hn(e));r.Jl(e,!0),r.Zl(e,n,!0)}ku(){const e=Jc.wn();e.rn(),this.Xu(e)}Pc(e){const n=Jc.wn();n.ln(e),this.Xu(n)}cn(){const e=Jc.wn();e.cn(),this.Xu(e)}dn(e){const n=Jc.wn();n.dn(e),this.Xu(n)}fn(e){const n=Jc.wn();n.fn(e),this.Xu(n)}_n(e){const n=Jc.wn();n._n(e),this.Xu(n)}hn(){const e=Jc.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=cs(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 z8e(this.uh,this);this.zu.push(n);const r=Jc.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 Jc(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),Wz(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 sie(t){return!kj(t)&&!vP(t)}function $Ke(t){return kj(t)}(function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"})(W8e||(W8e={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(q8e||(q8e={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(G8e||(G8e={})),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"}(K8e||(K8e={}));const Y8e=t=>t.getUTCFullYear();function $5n(t,e,n){return e.replace(/yyyy/g,(r=>Zg(Y8e(r),4))(t)).replace(/yy/g,(r=>Zg(Y8e(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=>Zg((s=>s.getUTCMonth()+1)(r),2))(t)).replace(/dd/g,(r=>Zg((s=>s.getUTCDate())(r),2))(t))}class UKe{constructor(e="yyyy-MM-dd",n="default"){this.Ac=e,this.Ec=n}s_(e){return $5n(e,this.Ac,this.Ec)}}class U5n{constructor(e){this.zc=e||"%h:%m:%s"}s_(e){return this.zc.replace("%h",Zg(e.getUTCHours(),2)).replace("%m",Zg(e.getUTCMinutes(),2)).replace("%s",Zg(e.getUTCSeconds(),2))}}const z5n={Lc:"yyyy-MM-dd",Oc:"%h:%m:%s",Nc:" ",Wc:"default"};class H5n{constructor(e={}){const n={...z5n,...e};this.Fc=new UKe(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 xO(t){return 60*t*60*1e3}function TZ(t){return 60*t*1e3}const gO=[{$c:(X8e=1,1e3*X8e),qc:10},{$c:TZ(1),qc:20},{$c:TZ(5),qc:21},{$c:TZ(30),qc:22},{$c:xO(1),qc:30},{$c:xO(3),qc:31},{$c:xO(6),qc:32},{$c:xO(12),qc:33}];var X8e;function Q8e(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=gO.length-1;n>=0;--n)if(Math.floor(e.getTime()/gO[n].$c)!==Math.floor(t.getTime()/gO[n].$c))return gO[n].qc;return 0}function PZ(t){let e=t;if(vP(t)&&(e=$fe(t)),!sie(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 Z8e(t){if(!$Ke(t))throw new Error("time must be of type isUTCTimestamp");return{Yc:t}}function $fe(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 J8e(t){vP(t.time)&&(t.time=$fe(t.time))}class eAe{options(){return this.ys}setOptions(e){this.ys=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?function(n){n.forEach(J8e)}(e):J8e(e)}createConverterToInternalObj(e){return cs(function(n){return n.length===0?null:sie(n[0].time)||vP(n[0].time)?PZ:Z8e}(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 $Ke(n=e)?Z8e(n):sie(n)?PZ(n):PZ($fe(n));var n}updateFormatter(e){if(!this.ys)return;const n=e.dateFormat;this.ys.timeScale.timeVisible?this.Kc=new H5n({Lc:n,Oc:this.ys.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",Nc:" ",Wc:e.locale}):this.Kc=new UKe(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(R5n,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=Q8e(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=Q8e(new Date(1e3*r[0].time.Yc),u)}})(e,n)}static Xc(e){return nh({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const Pj=typeof window<"u";function tAe(){return!!Pj&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function IZ(){return!!Pj&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function iie(t){return t+t%2}function V5n(t){Pj&&window.chrome!==void 0&&t.addEventListener("mousedown",e=>{if(e.button===1)return e.preventDefault(),!1})}class Kz{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=!IZ(),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=FZ(e.changedTouches,cs(this.xd));if(n===null||(this.Sd=bO(e),this.md!==null)||this.Md)return;this.gd=!0;const r=this.Vd(u0(n),cs(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),zC(e)}}}Jd(e){if(e.button!==0)return;const n=this.Vd(u0(e),cs(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=FZ(e.changedTouches,cs(this.xd));if(n===null&&e.touches.length===0&&(n=e.changedTouches[0]),n===null)return;this.xd=null,this.Sd=bO(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&&zC(e));this.Qc===0&&zC(e),e.touches.length===0&&this.ed&&(this.ed=!1,zC(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),tAe()&&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=bO(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;tAe()&&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})}IZ()&&(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}),V5n(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=nAe(e.touches[0],e.touches[1])/this.wd;this.Ad.pf(this.md,n),zC(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=nAe(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=!IZ()}hf(e){const n=FZ(e.touches,cs(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:bO(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"&&zC(e)}}}}function nAe(t,e){const n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function zC(t){t.cancelable&&t.preventDefault()}function u0(t){return{_t:t.pageX,ut:t.pageY}}function bO(t){return t.timeStamp||performance.now()}function FZ(t,e){for(let n=0;n<t.length;++n)if(t[n].identifier===e)return t[n];return null}class W5n{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 to({width:this.Vf.Nf().width,height:1})}Wf(){return to({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 Kz(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=i9(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 OZ(t,e){return t.sp-e.sp}function MZ(t,e,n){const r=(t.sp-e.sp)/(t.wt-e.wt);return Math.sign(r)*Math.min(Math.abs(r),n)}class q5n{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=MZ(this.np,this.ep,this.up),a=OZ(this.np,this.ep),o=[s],l=[a];if(r+=a,this.rp!==null){const u=MZ(this.ep,this.rp,this.up);if(Math.sign(u)===Math.sign(s)){const d=OZ(this.ep,this.rp);if(o.push(u),l.push(d),r+=d,this.hp!==null){const f=MZ(this.rp,this.hp,this.up);if(Math.sign(f)===Math.sign(s)){const x=OZ(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=cs(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-cs(this.ap).wt;return Math.min(n,this.lp)}}class G5n{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 N5(t,e){const n=cs(t.ownerDocument).createElement("canvas");t.appendChild(n);const r=F3n(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 S5(t){var e;t.width=1,t.height=1,(e=t.getContext("2d"))==null||e.clearRect(0,0,1,1)}function aie(t,e,n,r){t.ih&&t.ih(e,n,r)}function HM(t,e,n,r){t.nt(e,n,r)}function oie(t,e,n,r){const s=t(n,r);for(const a of s){const o=a.Tt(r);o!==null&&e(o)}}function LZ(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 rAe(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 S=s;S<t.length;S++)t[S].Fi(t[S].Wi()+e*C);o-=C}}else s=l,o=e===1?x-d-f:f-(x+d)}}class sAe{constructor(e,n,r,s){this.Yi=null,this.kp=null,this.Pp=!1,this.Tp=new wB(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=LZ("normal",s),this.Lp=LZ("top",s),this.Op=LZ("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=N5(this.Ef,to({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=N5(this.Ef,to({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 Kz(this.Wp.canvasElement,l,{Xd:()=>!this.ys.handleScroll.vertTouchDrag,Zd:()=>!0})}m(){this.Pf.m(),this.Wp.unsubscribeSuggestedBitmapSizeChanged(this.Ap),S5(this.Wp.canvasElement),this.Wp.dispose(),this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),S5(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=cs(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 iie(Math.ceil(n.S+n.C+n.I+n.B+5+c))}Kp(e){this.kp!==null&&M3(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 cs(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,cs(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=C5(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=C5(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?Hz(e,0,0,r,s,o):kKe(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)}rAe(s,1,this.kp.height,n),rAe(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(cs(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(cs(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 vB(this.gl.fontSize,this.gl.fontFamily)}}function K5n(t,e){var n;return((n=t.Jh)==null?void 0:n.call(t,e))??[]}function iAe(t,e){var n;return((n=t.Ws)==null?void 0:n.call(t,e))??[]}function aAe(t,e){var n;return((n=t.us)==null?void 0:n.call(t,e))??[]}function Y5n(t,e){var n;return((n=t.Xh)==null?void 0:n.call(t,e))??[]}class Ufe{constructor(e,n){this.kp=to({width:0,height:0}),this.hv=null,this.av=null,this.lv=null,this.ov=null,this._v=!1,this.uv=new kl,this.cv=new kl,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=N5(r,to({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=N5(r,to({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 Kz(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),S5(this.Wp.canvasElement),this.Wp.dispose(),this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),S5(this.Np.canvasElement),this.Np.dispose(),this.gv!==null&&(this.gv.Yo().u(this),this.gv.m()),this.Pf.m()}Xf(){return cs(this.gv)}yv(e){var n;this.gv!==null&&this.gv.Yo().u(this),this.gv=e,this.gv!==null&&this.gv.Yo().i(Ufe.prototype.Mv.bind(this),this,!0),this.Cv(),this.gp.If().indexOf(this)===this.gp.If().length-1?(this.lv=this.lv??new G5n(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(cs(e))}if(this.av!==null){const e=this.gv.Ao();this.av._s(cs(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=cs(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:BKe(r,e,n)}Wv(e,n){cs(n==="left"?this.hv:this.av).Kp(to({width:e,height:this.kp.height}))}Nf(){return this.kp}Kp(e){M3(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=cs(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=C5(this.Np,n);s!==null&&(s.useBitmapCoordinateSpace(a=>{this.Jp(a)}),this.gv&&(this.Hv(s,K5n),this.Uv(s),this.Hv(s,iAe),this.Hv(s,aAe)))}this.Wp.applySuggestedBitmapSize();const r=C5(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,Y5n),this.Hv(r,aAe))}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?Hz(e,0,0,r,s,l):kKe(e,0,0,r,s,o,l)}Uv(e){const n=cs(this.gv),r=n.jo().lr().Tt(n);r!==null&&r.nt(e,!1)}$v(e){this.jv(e,iAe,HM,this.ts().sc())}Hv(e,n){const r=cs(this.gv),s=r.Dt(),a=r.Ko();for(const o of a)this.jv(e,n,aie,o);for(const o of s)this.jv(e,n,aie,o);for(const o of a)this.jv(e,n,HM,o);for(const o of s)this.jv(e,n,HM,o)}jv(e,n,r,s){const a=cs(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;oie(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 sAe(this,e.N(),s,"left"),this.Sv.appendChild(this.hv.Of())),r&&this.av===null&&(this.av=new sAe(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,cs(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)cs(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 q5n(.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 oAe{constructor(e,n,r,s,a){this.xt=!0,this.kp=to({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=N5(this.Ef,to({width:16,height:16})),this.Np.subscribeSuggestedBitmapSizeChanged(this.Ip)}m(){this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),S5(this.Np.canvasElement),this.Np.dispose()}Of(){return this.Ef}Nf(){return this.kp}Kp(e){M3(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=C5(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}){Hz(e,0,0,n.width,n.height,this.tm())}}function zfe(t){return e=>{var n;return((n=e.ia)==null?void 0:n.call(e,t))??[]}}const X5n=zfe("normal"),Q5n=zfe("top"),Z5n=zfe("bottom");class J5n{constructor(e,n){this.im=null,this.sm=null,this.M=null,this.nm=!1,this.kp=to({width:0,height:0}),this.rm=new kl,this.Tp=new wB(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=N5(this.lm,to({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=N5(this.lm,to({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 Kz(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),S5(this.Wp.canvasElement),this.Wp.dispose(),this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),S5(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){M3(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(to({width:n,height:e.height})),this.sm!==null&&this.sm.Kp(to({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=C5(this.Np,n);s!==null&&(s.useBitmapCoordinateSpace(a=>{this.Jp(a),this.Qp(a),this.gm(s,Z5n)}),this.iv(s),this.gm(s,X5n)),this.im!==null&&this.im.Zp(e),this.sm!==null&&this.sm.Zp(e)}this.Wp.applySuggestedBitmapSize();const r=C5(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,Q5n))}gm(e,n){const r=this.gp.Qt().js();for(const s of r)oie(n,a=>aie(a,e,!1,void 0),s,void 0);for(const s of r)oie(n,a=>HM(a,e,!1,void 0),s,void 0)}Jp({context:e,bitmapSize:n}){Hz(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 vB(this.W(),this.ys.fontFamily)}xm(){return vB(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 wB,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 oAe("left",n,r,s,a),this.hm.appendChild(this.im.Of())),n.rightPriceScale.visible&&this.sm===null&&(this.sm=new oAe("right",n,r,s,a),this.am.appendChild(this.sm.Of()))}}var LAe;const e6n=!!Pj&&!!navigator.userAgentData&&navigator.userAgentData.brands.some(t=>t.brand.includes("Chromium"))&&!!Pj&&((LAe=navigator==null?void 0:navigator.userAgentData)!=null&&LAe.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);class t6n{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 kl,this.cv=new kl,this.Wu=new kl,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),RZ(this.ys)&&this.zm(!0),this.ts=new B5n(this.Hu.bind(this),this.ys,r),this.Qt().nc().i(this.Lm.bind(this),this),this.Om=new J5n(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=[],cs(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 to({width:c-c%2,height:u-u%2})}(to({width:e,height:n}));this.tl=s.height,this.fo=s.width;const a=this.tl+"px",o=this.fo+"px";cs(this.pp).style.height=a,cs(this.pp).style.width=o,this.Bm.style.height=a,this.Bm.style.width=o,r?this.Ym(Jc.gn(),performance.now()):this.ts.Bh()}Zp(e){e===void 0&&(e=Jc.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=RZ(this.ys);this.ts.hr(e);const r=RZ(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=cs(n.getContext("2d"));return this.Zm(r),n}Gm(e){return e==="left"&&!this.Jm()||e==="right"&&!this.Qm()||this.Cm.length===0?0:cs(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 vf(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=cs(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+=cs(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+=cs(s.Yv()).Wf().width);const o=(l,c,u)=>{cs(l==="left"?this.Om._m():this.Om.um()).Ff(cs(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=cs(s.qv()).Wf().width),this.Om.Ff(e,c,r),c+=l.width,this.Qm()&&o("right",c,r)}r+=l.height}return to({width:n,height:r})}ew(){let e=0,n=0,r=0;for(const C of this.Cm)this.Jm()&&(n=Math.max(n,cs(C.qv()).qp(),this.ys.leftPriceScale.minimumWidth)),this.Qm()&&(r=Math.max(r,cs(C.Yv()).qp(),this.ys.rightPriceScale.minimumWidth)),e+=C.ko();n=iie(n),r=iie(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 S=this.Cm[C];S.yv(this.ts.$s()[C]);let T=0,I=0;I=C===this.Cm.length-1?Math.ceil((x-y)*v)/v:Math.round(S.ko()*g*v)/v,T=Math.max(I,2),y+=T,S.Kp(to({width:o,height:T})),this.Jm()&&S.Wv(n,"left"),this.Qm()&&S.Wv(r,"right"),S.Xf()&&this.ts.ec(S.Xf(),T)}this.Om.fm(to({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 e6n?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=vf(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 Ufe(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 W5n(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 Gz?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 RZ(t){return!!(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function n6n(t){return t.open===void 0&&t.value===void 0}function r6n(t){return function(e){return e.open!==void 0}(t)||function(e){return e.value!==void 0}(t)}function lAe(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 s6n(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 i6n(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 a6n(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 o6n(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 l6n(t,e,n,r,s){const a=vf(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 V7(t){return t.Ft!==void 0}function cAe(t,e){return e.customValues!==void 0&&(t.bw=e.customValues),t}function Vv(t){return(e,n,r,s,a,o)=>function(l,c){return c?c(l):n6n(l)}(r,o)?cAe({wt:e,Re:n,dw:s},r):cAe(t(e,n,r,s,a),r)}function uAe(t){return{Candlestick:Vv(o6n),Bar:Vv(a6n),Area:Vv(s6n),Baseline:Vv(i6n),Histogram:Vv(lAe),Line:Vv(lAe),Custom:Vv(l6n)}[t]}function dAe(t){return{Re:0,Sw:new Map,Hh:t}}function fAe(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 hAe(t){let e;return t.forEach(n=>{e===void 0&&(e=n.dw)}),vf(e)}class c6n{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=uAe(e.Rr()),f=e.da(),x=e.pa();o=n.map((g,y)=>{const v=u(g.time),C=this.i_.key(v);let S=this.yw.get(C);S===void 0&&(S=dAe(v),this.yw.set(C,S),s=!0);const T=d(v,S.Re,g,c[y],f,x);return S.Sw.set(e,T),T})}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:hAe(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=fAe(c,d),x=fAe(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=dAe(a),this.yw.set(this.i_.key(a),l));const u=uAe(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:V7(x),Aw:r};if(!c)return this.Bw(e,-1,g);const y={timeWeight:0,time:l.Hh,pointData:l,originalTime:hAe(l.Sw)},v=Tj(this.Tw,this.i_.key(y.time),(C,S)=>this.i_.key(C.time)<S);this.Tw.splice(v,0,y);for(let C=v;C<this.Tw.length;++C)DZ(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)?V7(n)&&r.push(n):V7(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=Tj(s,r,(o,l)=>o.Re<l);V7(n)?s[a]=n:s.splice(a,1)}Vw(e,n){n.length!==0?(this.kw.set(e,n.filter(V7)),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,DZ(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)DZ(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 DZ(t,e){t.Re=e,t.Sw.forEach(n=>{n.Re=e})}function u6n(t,e){return t.wt<e}function d6n(t,e){return e<t.wt}function f6n(t,e,n){const r=e.Uh(),s=e.bi(),a=Tj(t,r,u6n),o=MKe(t,s,d6n);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 zKe{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=f6n(this.qw,r,this.jw),this.tg(e,n,s.Ft),this.ig())}}class h6n{constructor(e,n){this.sg=e,this.Yi=n}nt(e,n,r){this.sg.draw(e,this.Yi,n,r)}}class p6n extends zKe{constructor(e,n,r){super(e,n,!1),this.sh=r,this.Xw=new h6n(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,rie(this.Yw))}ig(){this.sh.update({bars:this.qw.map(m6n),barSpacing:this.Qn.At().lu(),visibleRange:this.Yw},this.Jn.N())}}function m6n(t){return{x:t._t,time:t.wt,originalData:t.ng,barColor:t.cr}}const x6n={color:"#2196f3"},g6n=(t,e,n)=>{const r=Ly(n);return new p6n(t,e,r)};function Hfe(t){const e={value:t.Ft[3],time:t.dw};return t.bw!==void 0&&(e.customValues=t.bw),e}function pAe(t){const e=Hfe(t);return t.R!==void 0&&(e.color=t.R),e}function b6n(t){const e=Hfe(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 y6n(t){const e=Hfe(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 HKe(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 v6n(t){const e=HKe(t);return t.R!==void 0&&(e.color=t.R),e}function w6n(t){const e=HKe(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 lie(t){return{Area:b6n,Line:pAe,Baseline:y6n,Histogram:pAe,Bar:v6n,Candlestick:w6n,Custom:C6n}[t]}function C6n(t){const e=t.dw;return{...t.se,time:e}}const N6n={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},S6n={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},j6n={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:EKe,panes:{enableResize:!0,separatorColor:"#E0E3EB",separatorHoverColor:"rgba(178, 181, 189, 0.2)"},attributionLogo:!0,colorSpace:"srgb",colorParsers:[]},BZ={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},A6n={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 mAe(){return{width:0,height:0,autoSize:!1,layout:j6n,crosshair:N6n,grid:S6n,overlayPriceScales:{...BZ},leftPriceScale:{...BZ,visible:!1},rightPriceScale:{...BZ,visible:!0},timeScale:A6n,localization:{locale:Pj?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 VKe{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 Wz(this.eg)?this.Df.Gm(this.eg):0}setVisibleRange(e){this.setAutoScale(!1),this.Yi().Nl(new Cd(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 cs(this.Df.Qt().tc(this.eg,this.rg)).Wt}}class _6n{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 VKe(this.Df,e,this.paneIndex())}}const E6n={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class xAe{constructor(e){this.ir=e}applyOptions(e){this.ir.hr(e)}options(){return this.ir.N()}lg(){return this.ir}}class k6n{constructor(e,n,r,s,a,o){this.og=new kl,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 Y4(new l9(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=cs(r.Lr()),l=cs(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:lie(this.seriesType())(r)}data(){const e=lie(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 Qg(this.Jn.N())}priceScale(){return this.ug.priceScale(this.Jn.Wt().wa(),this.getPane().paneIndex())}createPriceLine(e){const n=nh(Qg(E6n),e),r=this.Jn.Oh(n);return new xAe(r)}removePriceLine(e){this.Jn.Nh(e.lg())}priceLines(){return this.Jn.Wh().map(e=>new xAe(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=cs(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 T6n{constructor(e,n,r){this.vg=new kl,this.T_=new kl,this.rm=new kl,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{...Qg(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 P6n(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 gAe(t){return function(e){if(fO(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;fO(r)&&(e.handleScale.axisPressedMouseMove={time:r,price:r}),fO(s)&&(e.handleScale.axisDoubleClickReset={time:s,price:s})}const n=e.handleScroll;fO(n)&&(e.handleScroll={horzTouchDrag:n,vertTouchDrag:n,mouseWheel:n,pressedMouseMove:n})}(t),t}class I6n{constructor(e,n,r){this.Mg=new Map,this.bg=new Map,this.Sg=new kl,this.xg=new kl,this.Cg=new kl,this.zu=new WeakMap,this.yg=new c6n(n);const s=r===void 0?Qg(mAe()):nh(Qg(mAe()),gAe(r));this.kg=n,this.Df=new t6n(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 T6n(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:{...x6n,...a.defaultOptions()},Rg:g6n,Dg:a}))(Ly(e));return this.Vg(s,n,r)}addSeries(e,n={},r=0){return this.Vg(e,n,r)}removeSeries(e){const n=vf(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 VKe(this.Df,e,n)}timeScale(){return this.Tg}applyOptions(e){this.Df.hr(gAe(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),P6n(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(Qg(AKe),Qg(e.defaultOptions),n),a=e.Rg,o=new Gz(this.Df.Qt(),e.type,s,a,e.Dg);this.Df.Qt().xc(o,r);const l=new k6n(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 vf(this.bg.get(e))}Pg(e){const n=new Map;e.ww.forEach((s,a)=>{const o=a.Rr(),l=lie(o)(s);if(o!=="Custom")Fu(r6n(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 _6n(this.Df,r=>this.Ag(r),e,this),this.zu.set(e,n)),n}}function F6n(t){if(vP(t)){const e=document.getElementById(t);return Fu(e!==null,`Cannot find element in DOM with id=${t}`),e}return t}function O6n(t,e,n){const r=F6n(t),s=new I6n(r,e,n);return e.setOptions(s.options()),s}function M6n(t,e){return O6n(t,new eAe,eAe.Xc(e))}class WKe extends zKe{constructor(e,n){super(e,n,!0)}tg(e,n,r){n.su(this.qw,rie(this.Yw)),e.Hl(this.qw,r,rie(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 L6n(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[S,T]=R6n(e,v-1,v);l.bezierCurveTo(S._t*c,S.ut*u,T._t*c,T.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 bAe=6;function $Z(t,e){return{_t:t._t-e._t,ut:t.ut-e.ut}}function yAe(t,e){return{_t:t._t/e,ut:t.ut/e}}function R6n(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=yAe($Z(t[n],t[r]),bAe),{_t:a._t+o._t,ut:a.ut+o.ut}),$Z(t[n],yAe($Z(t[s],t[e]),bAe))]}function D6n(t,e){const n=t.context;n.strokeStyle=e,n.stroke()}class B6n extends J5{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,Ej(u,l),u.lineJoin="round";const d=this.Wg.bind(this);a!==void 0&&L6n(e,n,a,r,s,d,D6n),c&&function(f,x,g,y,v){if(y.to-y.from<=0)return;const{horizontalPixelRatio:C,verticalPixelRatio:S,context:T}=f;let I=null;const L=Math.max(1,Math.floor(C))%2/2,F=g*S+L;for(let $=y.to-1;$>=y.from;--$){const O=x[$];if(O){const U=v(f,O);U!==I&&(T.beginPath(),I!==null&&T.fill(),T.fillStyle=U,I=U);const Y=Math.round(O._t*C)+L,re=O.ut*S;T.moveTo(Y,re),T.arc(Y,re,F,0,2*Math.PI)}}T.fill()}(e,n,c,r,d)}}class $6n extends B6n{Wg(e,n){return n.vt}}class U6n extends WKe{constructor(){super(...arguments),this.Xw=new $6n}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 z6n={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 H6n extends J5{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 V6n extends WKe{constructor(){super(...arguments),this.Xw=new H6n}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,cs(this.Jn.zt()).Ft)};this.Xw.ht(e)}}const W6n={type:"Histogram",isBuiltIn:!0,defaultOptions:{color:"#26a69a",base:0},Rg:(t,e)=>new V6n(t,e)};({...AKe});const q6n="https://dextrabothypev2.nftinit.io/api/hyper/funding_rate_history/",G6n="https://dextrabothypev2.nftinit.io/api/hyper/funding_stats/",vAe={ext:"extended",lit:"lighter",hyp:"hyperliquid",var:"variational",ast:"aster",par:"paradex"},wAe={extended:"ext",lighter:"lit",hyperliquid:"hyp",variational:"var",aster:"ast",paradex:"par"},HC={extended:"Extended",lighter:"Lighter",hyperliquid:"Hyperliquid",variational:"Variational",aster:"Aster",paradex:"Paradex"},cie=[{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"}],yO=({exchangeId:t,className:e="w-4 h-4"})=>{const n=cie.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:bT,alt:n.name,className:`${e} rounded`});case"lighter":return i.jsx(yf,{className:e});case"hyperliquid":return i.jsx("img",{src:Fae,alt:n.name,className:e});case"aster":return i.jsx(Wj,{className:e});case"paradex":return i.jsx("img",{src:yT,alt:n.name,className:`${e} rounded`});default:return null}},K6n=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}):"",Y6n=()=>{const{pair:t}=v2(),e=yo(),[n,r]=h.useState([]),[s,a]=h.useState(!0),[o,l]=h.useState(null),[c,u]=h.useState(null),[d,f]=h.useState([]),x=h.useRef(),g=h.useRef(),[y,v]=h.useState(!1),[C,S]=h.useState(!1),[T,I]=h.useState(!1),L=h.useRef(null),F=h.useRef(null),$=h.useRef(null),O=ke.useMemo(()=>{if(!t)return null;const q=t.toLowerCase().split("-");if(q.length<3)return null;const te=q[0],fe=q[1],G=q.slice(2).join("-").toUpperCase(),ie=vAe[te],oe=vAe[fe];return!ie||!oe?null:{longSide:ie,shortSide:oe,ticker:G}},[t]);h.useEffect(()=>{const q=te=>{L.current&&!L.current.contains(te.target)&&v(!1),F.current&&!F.current.contains(te.target)&&S(!1),$.current&&!$.current.contains(te.target)&&I(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);const U=(q,te,fe)=>{const G=wAe[q],ie=wAe[te];e(`/funding-history/${G}-${ie}-${fe.toLowerCase()}`)},Y=()=>{O&&U(O.shortSide,O.longSide,O.ticker)};h.useEffect(()=>{if(!O){l("Invalid URL parameters"),a(!1);return}(async()=>{try{a(!0);const fe=await(await fetch(q6n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({long_side:O.longSide,short_side:O.shortSide,ticker:O.ticker})})).json();if(fe.success&&Array.isArray(fe.data)){const G=[...fe.data].sort((ie,oe)=>Number(ie.timestamp)-Number(oe.timestamp));r(G),l(null)}else l("Failed to fetch funding history data")}catch(te){l(te.message||"Failed to fetch data")}finally{a(!1)}})()},[O]),h.useEffect(()=>{if(!O)return;const q=async()=>{var fe,G;try{const oe=await(await fetch(G6n)).json();if(oe.success&&Array.isArray(oe.data)){const K=oe.data.map(ee=>ee.ticker).sort();f(K);const H=oe.data.find(ee=>ee.ticker===O.ticker);if(H){const ee=(fe=H.marketplaces)==null?void 0:fe[O.longSide],se=(G=H.marketplaces)==null?void 0:G[O.shortSide];if(ee!=null&&ee.available&&(se!=null&&se.available)){const pe=parseFloat(ee.hourly_rate)||0,Se=parseFloat(se.hourly_rate)||0,ge=(Se-pe)*8760*100;u({apr:ge,longRate:pe*100,shortRate:Se*100,updatedAt:oe.updated_at})}else u(null)}else u(null)}}catch(ie){console.error("Failed to fetch live data:",ie)}};q();const te=setInterval(q,5e3);return()=>clearInterval(te)},[O]),h.useEffect(()=>{if(!x.current||s||o||n.length===0)return;const q=x.current,te=M6n(q,{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:K=>{const H=new Date(K*1e3);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(H)},priceFormatter:K=>`${K.toFixed(2)}%`}});g.current=te;const fe=te.addSeries(W6n,{priceFormat:{type:"custom",formatter:K=>`${K.toFixed(2)}%`},priceLineVisible:!1,lastValueVisible:!1}),G=n.map(K=>({time:Number(K.timestamp),value:K.total_apr,color:K.total_apr>=0?"rgba(52, 211, 153, 0.6)":"rgba(248, 113, 113, 0.6)"}));fe.setData(G);const ie=te.addSeries(z6n,{color:"#9ca3af",lineWidth:1.5,priceFormat:{type:"custom",formatter:K=>`${K.toFixed(2)}%`},priceLineVisible:!1,lastValueVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBackgroundColor:"#ffffff",crosshairMarkerBorderColor:"#0f0f0f"}),oe=n.map(K=>({time:Number(K.timestamp),value:K.total_apr}));return ie.setData(oe),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:K=>new Date(K*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"})}),te.timeScale().fitContent(),()=>{te.remove()}},[n,s,o]);const re=ke.useMemo(()=>{if(n.length===0)return null;const q=n.map(H=>H.total_apr),te=q.reduce((H,ee)=>H+ee,0)/q.length,fe=Math.max(...q),G=Math.min(...q),ie=q[q.length-1],oe=q.filter(H=>H>0).length,K=q.filter(H=>H<0).length;return{avg:te,max:fe,min:G,latest:ie,positive:oe,negative:K,total:q.length}},[n]);if(!O)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(Ga,{to:"/funding",className:"text-neutral-300 hover:text-white transition-colors text-sm",children:"← Back to Funding Rates"})]});const Q=ke.useMemo(()=>{if(n.length===0)return null;const q=new Date(Number(n[0].timestamp)*1e3),te=new Date(Number(n[n.length-1].timestamp)*1e3);return{start:q.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(za,{children:i.jsxs(Va,{children:[i.jsxs("title",{children:[O.ticker," Funding History -"," ",HC[O.longSide]," /"," ",HC[O.shortSide]," - Dextrabot"]}),i.jsx("meta",{name:"description",content:`Historical funding rate arbitrage APR for ${O.ticker} between ${HC[O.longSide]} and ${HC[O.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(Ga,{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(lun,{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/${O.ticker}.svg`,alt:O.ticker,className:"w-5 h-5 rounded-full",onError:q=>{q.target.style.display="none"}}),i.jsxs("h1",{className:"text-sm text-white tracking-wide",children:[O.ticker,i.jsx("span",{className:"text-gray-400 ml-1.5",children:"Funding History"})]})]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[Q&&i.jsxs("span",{className:"text-gray-400 text-[10px]",children:[Q.start," — ",Q.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 ",K6n(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:()=>I(!T),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/${O.ticker}.svg`,alt:O.ticker,className:"w-5 h-5 rounded-full",onError:q=>{q.target.style.display="none"}}),i.jsx("span",{className:"text-white text-sm",children:O.ticker})]}),i.jsx(Z_,{className:`w-4 h-4 text-gray-400 transition-transform ${T?"rotate-180":""}`})]})}),T&&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(q=>i.jsxs("button",{onClick:()=>{U(O.longSide,O.shortSide,q),I(!1)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left hover:bg-neutral-800 transition-colors ${q===O.ticker?"bg-neutral-800":""}`,children:[i.jsx("img",{src:`https://cdn.extended.exchange/crypto/${q}.svg`,alt:q,className:"w-5 h-5 rounded-full",onError:te=>{te.target.style.display="none"}}),i.jsx("span",{className:"text-white text-sm",children:q})]},q))})]}),i.jsx("div",{className:"border-t border-neutral-800 my-4"}),i.jsxs("div",{className:"relative",ref:L,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(yO,{exchangeId:O.longSide,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:HC[O.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(Z_,{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:cie.filter(q=>q.id!==O.shortSide).map(q=>i.jsxs("button",{onClick:()=>{U(q.id,O.shortSide,O.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 ${q.id===O.longSide?"bg-neutral-800":""}`,children:[i.jsx(yO,{exchangeId:q.id,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:q.name})]},q.id))})]}),i.jsx("div",{className:"flex justify-center",children:i.jsx("button",{onClick:Y,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(uun,{className:"w-4 h-4 text-gray-400 rotate-90"})})}),i.jsxs("div",{className:"relative",ref:F,children:[i.jsx("button",{onClick:()=>S(!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(yO,{exchangeId:O.shortSide,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:HC[O.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(Z_,{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:cie.filter(q=>q.id!==O.longSide).map(q=>i.jsxs("button",{onClick:()=>{U(O.longSide,q.id,O.ticker),S(!1)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left hover:bg-neutral-800 transition-colors ${q.id===O.shortSide?"bg-neutral-800":""}`,children:[i.jsx(yO,{exchangeId:q.id,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:q.name})]},q.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:"—"})]}),re&&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 ${re.avg>=0?"text-emerald-400":"text-red-400"}`,children:[re.avg>=0?"+":"",re.avg.toFixed(2),i.jsx("span",{className:"text-xl text-gray-400",children:"%"})]})]}),i.jsx("div",{className:"border-t border-neutral-800 my-4"}),re&&!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 ${re.latest>=0?"text-emerald-400":"text-red-400"}`,children:[re.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:[re.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:[re.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:[(re.positive/re.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:O&&(O.longSide==="variational"||O.longSide==="paradex"||O.shortSide==="variational"||O.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"}})})]})]})]})]})},X6n=()=>{const{setSignModalOpen:t,setTelegramChatId:e,setSubscriberRole:n,setSubsExpireDay:r,setMushboomerETH:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setIsWhitelist:c,setHyperToken:u,setHyperAddress:d}=h.useContext(Qr),{address:f}=ds(),[x,g]=h.useState(1),[y,v]=h.useState(""),[C,S]=h.useState(!1),[T,I]=h.useState(!1),[L,F]=h.useState(""),[$,O]=h.useState(0),[U,Y]=h.useState(0),[re,Q]=h.useState(!1),[q,te]=h.useState(!1),fe=Se=>/^\d*$/.test(Se),G=Se=>{["e","E","+","-"].includes(Se.key)&&Se.preventDefault()},ie=h.useMemo(()=>{if(x==="")return!1;const Se=Number(x);return Number.isInteger(Se)&&Se>=1},[x]),oe=h.useRef($);h.useEffect(()=>{oe.current=$},[$]);const K=h.useRef(0);h.useEffect(()=>{K.current=U},[U]);const H=async()=>{var ve,be;const Se=window.localStorage.getItem("hyperToken"),ge=window.localStorage.getItem("hyperAddress");if(!(!Se||!ge))try{te(!0);const we=await bi(ge.toLowerCase(),Se);we!=null&&we.success?(e(we==null?void 0:we.telegram_chat_id),n(we==null?void 0:we.subscriber_role),r(we==null?void 0:we.subs_expire_day),s((ve=we==null?void 0:we.mushboomer_counts)==null?void 0:ve.eth),a((be=we==null?void 0:we.mushboomer_counts)==null?void 0:be.sol),o(we==null?void 0:we.referral_code),l(we==null?void 0:we.refcode),c(we==null?void 0:we.whitelist),u(Se),d(ge),O(Number((we==null?void 0:we.subs_expire_day)||0)),te(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),u(""),d(""),te(!1))}catch(we){console.error("Token verification error:",we),console.error(we.message||"An unknown error occurred."),te(!1)}};h.useEffect(()=>{re&&H()},[re]),h.useEffect(()=>{const Se=localStorage.getItem("hyperToken"),ge=localStorage.getItem("hyperAddress");Q(!!(Se&&ge));const ve=setInterval(()=>{const be=localStorage.getItem("hyperToken"),we=localStorage.getItem("hyperAddress");Q(!!(be&&we))},800);return()=>clearInterval(ve)},[]);const ee=async()=>new Tl(window.ethereum).eth.getAccounts(ge=>ge),se=async(Se="subscribe",ge=24,ve=5e3)=>{ge<=0||(await new Promise(be=>setTimeout(be,ve)),await H(),Se==="subscribe"&&oe.current===K.current?se(Se,ge-1,ve):H())},pe=async Se=>{const ge=window.localStorage.getItem("hyperToken"),ve=window.localStorage.getItem("hyperAddress");if(!ge||!f){t(!0);return}v(""),Y(oe.current),K.current=oe.current,I(!0),S(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(je){console.error("Failed to switch network",je),S(!1);return}const be=new Tl(window.ethereum);var we=await ee();if(we.length>0?we=we[0]:we=void 0,we){const Fe=Se*.09,Re=be.utils.toWei(Fe.toString(),"ether"),Qe={from:we,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:Re};await be.eth.sendTransaction(Qe).then(Ye=>{console.log("txHash :>> ",Ye),S(!1),F(Ye.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():ve,token:ge,payment_tx:Ye.transactionHash,payment_role:"farming_tools",tx_qty:Number(x)})}),H(),se("subscribe")}).catch(Ye=>{console.log(Ye),Ye.code===-32003||Ye.message.includes("insufficient funds")?v("Insufficient funds."):Ye.message==="MetaMask Tx Signature: User denied transaction signature."&&I(!1)})}else await be.eth.requestAccounts()};return i.jsxs(i.Fragment,{children:[T&&Ea.createPortal(i.jsx(_d,{open:T,setOpen:I,transactionHash:L,transactionLoading:C,paymentPresaleRole:!($<=U),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(Se=>{const ge=Number(Se||0);return ge>1?String(ge-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:Se=>{const ge=Se.target.value.trim();if(ge==="")return g("");fe(ge)&&g(ge)},onKeyDown:G,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(Se=>{const ge=Number(Se||0);return String(ge+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!==""&&!ie&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),ie&&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:Se=>{Se.preventDefault(),ie&&pe(x)},className:`text-[10px] sm:text-xs xl:text-[13px] font-semibold text-gray-200 select-none border rounded-md px-4 py-2 ${ie?"border-[#8861FF] bg-[#7446FF] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy Now"})]})},Q6n=({open:t,setOpen:e})=>{const{subsExpireDay:n}=h.useContext(Qr),r=()=>{const s=Date.now(),a=localStorage.getItem("hyperAddress");localStorage.setItem(`lighterCopyTradeDismissedAt_${a}`,s.toString()),e(!1)};return i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{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:Na,alt:"close"})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Hi,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(X6n,{})]})})]})})})})]})},Z6n=({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(L0,{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(L0,{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(L0,{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(L0,{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(Wj,{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:bT,url:"/discover-wallets#variational-farming"},{key:"paradexBot",title:"Paradex Farming Bot",desc:"Farm points on Paradex exchange.",icon:yT,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:Oae,url:"/discover-wallets#apex-farming"}],a=o=>{if(!o)return null;if(ke.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(ha,{open:t,onClose:n,className:"relative z-50",children:[i.jsx(fa,{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(Ji,{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:Na,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))})})]})})]})},J6n=({open:t,setOpen:e})=>null,eCn=({open:t,setOpen:e,onConfirm:n,modalLoading:r,active:s,confirmDisabled:a,modalDataInfo:o})=>{const l=o||{},c=[(l==null?void 0:l.bot_version)&&{label:"Bot Version",value:l.bot_version,type:(l==null?void 0:l.bot_version)=="V1"?"Live Version":"Beta Version"},(l==null?void 0:l.market_period)&&{label:"Market Period",value:l.market_period},(l==null?void 0:l.coin)&&{label:"Coin",value:l.coin},(l==null?void 0:l.side)&&{label:"Side",value:l.side},(l==null?void 0:l.balance)!==""&&(l==null?void 0:l.balance)!==void 0&&{label:"Bet Size ($)",value:l.balance},(l==null?void 0:l.budget)!==""&&(l==null?void 0:l.budget)!==void 0&&{label:"Max Loss ($)",value:l.budget},(l==null?void 0:l.cycles)!==""&&(l==null?void 0:l.cycles)!==void 0&&{label:"Max Cycles",value:l.cycles},(l==null?void 0:l.buy_price)!==""&&(l==null?void 0:l.buy_price)!==void 0&&{label:"Entry Price",value:l.buy_price},(l==null?void 0:l.slippage)!==""&&(l==null?void 0:l.slippage)!==void 0&&{label:"Min Price Distance",value:l.slippage},(l==null?void 0:l.repeat)&&{label:"Re-Buy at Entry",value:l.repeat.toUpperCase()},(l==null?void 0:l.ptb_check)!==""&&(l==null?void 0:l.ptb_check)!==void 0&&{label:"P2B Check",value:l.ptb_check},(l==null?void 0:l.timeleft)!==""&&(l==null?void 0:l.timeleft)!==void 0&&{label:"Entry Time Start (sec)",value:l.timeleft},(l==null?void 0:l.timeleft_stop)!==""&&(l==null?void 0:l.timeleft_stop)!==void 0&&{label:"Entry Time Stop (sec)",value:l.timeleft_stop},(l==null?void 0:l.tp)!==""&&(l==null?void 0:l.tp)!==void 0&&(l==null?void 0:l.tp_price_type)!==""&&(l==null?void 0:l.tp_price_type)!==void 0&&{label:`Take Profit ${(l==null?void 0:l.tp_price_type)==="cent"?"(¢)":"(%)"}`,value:l.tp,type:l==null?void 0:l.tp_type},(l==null?void 0:l.sl)!==""&&(l==null?void 0:l.sl)!==void 0&&(l==null?void 0:l.sl_price_type)!==""&&(l==null?void 0:l.sl_price_type)!==void 0&&{label:`Stop Loss ${(l==null?void 0:l.sl_price_type)==="cent"?"(¢)":"(%)"}`,value:l.sl,type:l==null?void 0:l.sl_type},(l==null?void 0:l.sl_slippage)!==""&&(l==null?void 0:l.sl_slippage)!==void 0&&{label:"SL Min Price Distance",value:l.sl_slippage},(l==null?void 0:l.api_key)!==""&&(l==null?void 0:l.api_key)!==void 0?{label:"Auto Claim",value:"ACTIVE"}:{label:"Auto Claim",value:"INACTIVE"}].filter(Boolean);return i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{transition:!0,className:"relative transform overflow-hidden bg-[radial-gradient(circle_at_top,_rgba(96,125,150,1),_rgba(18,20,23,1)_42%,_rgba(10,12,14,2)_100%)] text-left shadow-2xl shadow-black/50 border border-[#2a2f36] 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-[30px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-center gap-7 w-[420px] max-w-[90vw] h-max relative rounded-[30px] pt-4 pb-8 px-8",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-4 top-4",children:i.jsx("span",{className:"w-9 h-9 rounded-full p-[10px] flex justify-center items-center bg-white/5 hover:bg-white/10 border border-white/10 transition",children:i.jsx("img",{className:"w-full h-full",src:Na})})}),i.jsx("div",{className:"pt-2",children:i.jsx("div",{className:"w-20 h-20 rounded-3xl bg-gradient-to-tr from-[#7af8d3] via-[#7a7eff] to-[#ff69d6] p-[0.2px] shadow-[0_10px_40px_rgba(0,0,0,0.55)]",children:i.jsx("div",{className:"w-full h-full rounded-[26px] bg-[#111118] flex items-center justify-center",children:i.jsx("img",{src:Hi,alt:"",className:"w-[70%] h-[70%] object-contain drop-shadow-[0_0_12px_rgba(255,255,255,0.35)]"})})})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-3",children:[i.jsx("div",{className:"w-full text-center text-white text-[22px] font-semibold leading-7 -mt-3",children:l!=null&&l.coin?`${l.coin} PolyMarket Bot`:"Are you sure?"}),i.jsx("div",{className:"w-full text-center text-white/70 text-[15px] font-medium leading-5",children:s?"Do you want to stop this bot?":"Do you want to start this bot?"}),(c==null?void 0:c.length)>0&&i.jsx("ul",{className:"mt-3 w-full max-w-[360px] space-y-2",children:c==null?void 0:c.map((u,d)=>{var f;return i.jsxs("li",{className:"flex items-center gap-3 px-2",children:[i.jsx("span",{className:"h-[10px] w-[10px] rounded-full bg-[#67ffbd] shadow-[0_0_10px_rgba(103,255,189,1)]"}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsxs("span",{className:"text-[14px] font-medium text-white/75",children:[u.label,":"]}),i.jsx("span",{className:"text-[14px] font-semibold text-white px-3 py-1 rounded-xl bg-white/6 border border-white/10 backdrop-blur-sm shadow-[0_8px_24px_rgba(0,0,0,0.25)]",children:u.value}),u.type&&i.jsx("span",{className:"text-[13px] font-semibold text-[#dbe5f5] px-3 py-1 rounded-xl bg-[#12161c] border border-[#2b2f36] backdrop-blur-sm shadow-[0_8px_24px_rgba(0,0,0,0.25)]",children:(f=u.type)==null?void 0:f.toUpperCase()})]})]},d)})})]}),i.jsxs("div",{className:"flex items-center justify-center gap-3 w-full max-w-[320px] pt-1",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"h-10 px-5 rounded-xl border border-white/25 bg-white/5 hover:bg-white/10 text-white text-[14px] font-semibold inline-flex items-center justify-center cursor-pointer transition",children:"Cancel"}),i.jsx("div",{onClick:u=>{r||a||(u.preventDefault(),n==null||n())},className:`h-10 px-6 rounded-xl border flex items-center justify-center cursor-pointer transition text-[14px] font-semibold ${r||a?"bg-[#444] border-[#666] text-white/70 cursor-not-allowed":s?"bg-[#ff4c4c] border-[#ff8080] hover:brightness-110 text-white":"bg-gradient-to-r from-[#7c5bff] to-[#a14dff] border-transparent shadow-[0_10px_30px_rgba(114,92,255,0.5)] hover:brightness-110 text-white"}`,children:r?i.jsx("span",{className:"animate-pulse",children:"Loading..."}):i.jsx("span",{children:s?"Stop":"Start"})})]})]})})})})]})},UZ=({titles:t,title_1:e,title_2:n})=>{const r=Array.isArray(t)&&t.length>0&&t;return i.jsx("div",{className:"flex flex-col gap-1 max-w-[240px] rounded-[12px] border border-[rgba(133,133,133,0.32)] bg-[#272729] shadow-[0_4px_4px_#050505] backdrop-blur-[18px] text-white text-[11px] leading-[14px] tracking-[-0.005em] font-normal px-[10px] py-[8px]",style:{fontFamily:"Inter, sans-serif"},children:r==null?void 0:r.map((s,a)=>i.jsx("div",{className:"font-semibold text-[#eaf7ff] leading-[16px]",children:s},`${a}-${s}`))})},tCn=400,nCn=100;function rCn({date:t}){const[e,n]=h.useState(vo(t));return h.useEffect(()=>{const r=setInterval(()=>{n(vo(t))},1e3);return()=>clearInterval(r)},[t]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:e.dateTime})}const sCn=({connected:t,activeBotId:e,socketLogs:n,setSocketLogs:r,logsLoading:s=!1,isRunning:a})=>{const[o,l]=h.useState(!1),c=h.useRef(null),u=h.useRef(null),d=h.useRef({}),x=localStorage.getItem("isDatePolyMarketFormat")||"date",[g,y]=h.useState(x);h.useEffect(()=>{localStorage.setItem("isDatePolyMarketFormat",g)},[g]);const v=window.localStorage.getItem("hyperAddress"),C=v&&v.length>12?`${v.slice(0,6)}...${v.slice(-4)}`:v,S=F=>{var $,O,U;return(($=F==null?void 0:F.data)==null?void 0:$.slot_number)??(F==null?void 0:F.slot_number)??((U=(O=F==null?void 0:F.data)==null?void 0:O.data)==null?void 0:U.slot_number)},T=F=>{const $=S(F);if($==null||$==="")return!1;const O=String($).trim().toLowerCase();return O!=="undefined"&&O!=="null"&&O!=="nan"},I=F=>{let $={timestamp:null,message:"",level:"INFO",type:"INFO",data:{}};if(typeof F=="string")try{F=JSON.parse(F)}catch{return $.message=F,$.timestamp=new Date().toISOString(),$}return typeof F=="object"&&F!==null&&($.timestamp=F.timestamp||F.time||F.created_at||new Date().toISOString(),$.message=F.message||F.msg||F.text||F.description||"",$.type=F.type||F.event_type||F.level||"INFO",$.level=F.level||$.type,F.data?$.data=F.data:$.data=F),$};h.useEffect(()=>{if(!Array.isArray(n)||n.length===0){d.current={};return}const F={};n.forEach($=>{const O=S($==null?void 0:$.data);if(O==null||String(O).trim()==="")return;const U=String(O),Y=Number($==null?void 0:$.sequence);!Number.isNaN(Y)&&Y>0&&(F[U]=Math.max(F[U]||0,Y))}),d.current=F},[n]),h.useEffect(()=>{const F=window.localStorage.getItem("hyperAddress"),$=window.localStorage.getItem("hyperToken");if(!F||!$){if(c.current){try{c.current.disconnect()}catch{}c.current=null}r([]),d.current={},l(!1),u.current=null;return}if(c.current){const O=c.current;u.current&&u.current!==F&&(console.log("Unsubscribing from:",u.current),O.emit("unsubscribe_poly",{login_address:u.current})),console.log("Subscribing",F),O.emit("subscribe_poly",{login_address:F})}else{const O=K0("https://dextrabothypesocketv2.nftinit.io/");c.current=O,O.on("connect",()=>{l(!0),console.log("Socket.IO connected"),O.emit("subscribe_poly",{login_address:F})}),O.on("disconnect",()=>{console.log("Socket.IO disconnected"),l(!1)}),O.on("connect_error",U=>{console.error("Socket.IO connection error:",U),l(!1)}),O.onAny((U,...Y)=>{}),O.on("poly_get_message",U=>{const Y=I(U);if(!T(Y))return;const re=String(S(Y)),Q=(d.current[re]||0)+1;d.current[re]=Q,r(q=>{const te={timestamp:Y.timestamp,data:Y,sequence:Q},fe=q.filter(H=>T(H==null?void 0:H.data)),G=[],ie=[];return fe.forEach(H=>{String(S(H==null?void 0:H.data))===re?G.push(H):ie.push(H)}),[...[te,...G].slice(0,nCn),...ie].sort((H,ee)=>{var se,pe;return new Date((ee==null?void 0:ee.timestamp)||((se=ee==null?void 0:ee.data)==null?void 0:se.timestamp)||0).getTime()-new Date((H==null?void 0:H.timestamp)||((pe=H==null?void 0:H.data)==null?void 0:pe.timestamp)||0).getTime()}).slice(0,tCn)})})}return u.current=F,()=>{c.current&&(c.current.disconnect(),c.current=null)}},[t]);const L=n==null?void 0:n.filter(F=>{const $=S(F==null?void 0:F.data);return String($)===String(e)});return i.jsx(i.Fragment,{children:t&&i.jsxs("div",{className:`${a?"pl-4 pr-3 py-4":"p-6"} flex flex-col gap-3 rounded-2xl border border-[#2a2f36] bg-[radial-gradient(circle_at_top,_rgba(96,165,250,0.08),_rgba(18,20,23,0.92)_45%,_rgba(10,12,14,0.98)_100%)] shadow-[0_24px_70px_rgba(0,0,0,0.5)] font-manrope`,children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{className:"flex flex-col gap-1 min-w-0",children:i.jsxs("div",{className:"flex flex-col items-start sm:flex-row sm:items-center gap-2 min-w-0",children:[i.jsx("h2",{className:`${a?"text-[14px]":"text-xl"} font-semibold text-white`,children:"Market Activity"}),i.jsx("span",{className:`text-[8px] sm:text-[10px] uppercase tracking-[0.2em] px-1 sm:px-2 py-0.5 sm:py-1 rounded-full border ${o?"border-green-500/40 text-green-400 bg-green-950":"border-red-500/40 text-red-400 bg-red-950"}`,children:o?"Connected":"Disconnected"})]})}),i.jsxs("div",{className:"shrink-0 flex flex-col items-start sm:flex-row sm:items-center gap-1.5 text-[10px] text-[#9a9a9a]",children:[i.jsx("span",{className:"uppercase tracking-[0.12em] text-[#7f8794]",children:"Login Address:"}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"font-mono text-[11px] text-[#c7cfda]",children:C}),!!v&&i.jsx("img",{onClick:()=>{navigator.clipboard.writeText(v),fn.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:io,alt:"Copy login address",className:"cursor-pointer w-3.5 h-3.5 opacity-80 hover:opacity-100"})]})]})]}),i.jsx("div",{className:`${a?"max-h-[440px]":"p-4 border border-[#1e2936] max-h-[500px]"} rounded-lg bg-[#0a0f16] overflow-y-auto`,children:L.length===0?i.jsx("div",{className:"text-center text-[#6b7280] text-sm py-8",children:s?"Loading logs...":"Waiting for socket messages..."}):i.jsx("div",{className:"flex flex-col gap-2",children:L.map((F,$)=>{const O=F.data,U=(O==null?void 0:O.timestamp)||F.timestamp,Y=(O==null?void 0:O.message)||"",re=(O==null?void 0:O.type)||(O==null?void 0:O.level)||"INFO",Q=String(re).replace(/_/g," "),q=(O==null?void 0:O.data)||{},te=(q==null?void 0:q.coin)||"",fe=q!=null&&q.operation?String(q.operation).replace(/_/g," "):"",G=(q==null?void 0:q.funder_address)||"",ie=(q==null?void 0:q.outcome)||"",oe=(q==null?void 0:q.side)||"",K=ie||oe,H=q==null?void 0:q.sl_percent,ee=q==null?void 0:q.per_trade_balance,se=q==null?void 0:q.timeleft_trigger,pe=q==null?void 0:q.timeleft_stop,Se=q==null?void 0:q.tp_percent,ge=q==null?void 0:q.max_cycles,ve=q==null?void 0:q.total_budget,be=q==null?void 0:q.min_pd,we=be!=null&&be!==""&&!Number.isNaN(Number(be))?Number(be)*100:void 0,je=q==null?void 0:q.buy_price,Fe=je!=null&&je!==""&&!Number.isNaN(Number(je))?Number((Number(je)*100).toFixed(0)):void 0,Re=ie&&oe&&String(ie).toLowerCase()!==String(oe).toLowerCase(),Qe=H!==void 0||ee!==void 0||se!==void 0||pe!==void 0||Se!==void 0||ge!==void 0||ve!==void 0||Fe!==void 0,Ye=Q==="STARTED"?"bg-green-900/50 text-green-300 border-green-700/50":Q==="ERROR"?"bg-red-900/50 text-red-300 border-red-700/50":Q==="WARNING"?"bg-yellow-900/50 text-yellow-300 border-yellow-700/50":Q==="SUCCESS"?"bg-blue-900/50 text-blue-300 border-blue-700/50":"bg-gray-900/50 text-gray-300 border-gray-700/50";return i.jsxs("div",{className:"rounded-md bg-[#12161c] border border-[#2b2f36] p-3 hover:border-[#3a3a3a] transition",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-[#60a5fa] font-semibold text-xs",children:["#",F.sequence??L.length-$]}),i.jsx("span",{className:`text-[9px] uppercase tracking-wider px-2 py-0.5 rounded border font-semibold ${Ye}`,children:Q}),te&&i.jsx("span",{className:"text-[9px] uppercase tracking-wider px-2 py-0.5 rounded border border-purple-700/50 bg-purple-900/50 text-purple-300 font-semibold",children:te}),G&&i.jsxs("div",{className:"flex items-center gap-1 text-[10px]",children:[i.jsx("span",{className:"text-[#c9c9c9]",children:"Funder:"}),i.jsxs("span",{className:"text-[#fff] font-mono",children:[G.slice(0,6),"...",G.slice(-4)]}),i.jsx("img",{onClick:dt=>{dt.stopPropagation(),navigator.clipboard.writeText(G),fn.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:io,alt:"",className:"cursor-pointer w-3.5 h-3.5"})]})]}),i.jsx("div",{onClick:()=>{y(g=="time"?"date":"time")},className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight cursor-pointer",children:g=="time"?i.jsx(rCn,{date:U}):Nht(U)})]}),i.jsx("div",{className:"flex justify-between items-center gap-2 w-full",children:fe&&i.jsxs("div",{className:"flex items-start md:items-center gap-1 text-[12px]",children:[i.jsx("span",{className:"text-[#c9c9c9]",children:"Operation:"}),i.jsx("span",{className:`${fe==="BOT STARTUP ERROR"?"animate-pulse":"hidden"}`,children:i.jsx("img",{src:Wo,alt:"Dextrabot",className:"w-4 h-4"})}),i.jsxs("div",{className:"flex flex-col items-start md:flex-row md:items-center md:justify-start gap-1",children:[i.jsx("span",{className:`${fe==="BOT STARTUP ERROR"?"text-[#fca5a5] animate-pulse":fe!=null&&fe.includes("BUY")||fe!=null&&fe.includes("SELL")?"text-[#fca5a5]":"text-[#60a5fa]"} font-inter min-w-max`,children:fe}),i.jsxs("span",{className:`${a?"text-[11px]":"text-[12px]"} text-[#e5e7eb] leading-none`,children:["(",Y,")"]}),(fe||G||K)&&i.jsx("div",{className:"flex flex-wrap gap-2 text-[10px]",children:K&&i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-[#c9c9c9]",children:"Side:"}),i.jsx("span",{className:"text-[#fca5a5] font-inter uppercase",children:K}),Re&&i.jsxs("span",{className:"text-[#9ca3af] font-inter",children:["(",oe,")"]})]})})]})]})}),Qe&&!a&&i.jsx("div",{className:"hidden sm:block mt-2 pt-2 border-t border-[#2b2f36]",children:i.jsxs("div",{className:"flex flex-wrap gap-2 text-[10px]",children:[ve!==void 0&&i.jsxs("div",{className:"rounded-md border border-[#2b2f36] bg-[#0f141b] px-2 py-1.5",children:[i.jsx("div",{className:"text-[#6b7280] uppercase tracking-wider",children:"Max Loss ($)"}),i.jsxs("div",{className:"text-[#fda4af] font-semibold text-[11px] font-inter",children:["$",ve||"--"]})]}),ee!==void 0&&i.jsxs("div",{className:"rounded-md border border-[#2b2f36] bg-[#0f141b] px-2 py-1.5",children:[i.jsx("div",{className:"text-[#6b7280] uppercase tracking-wider",children:"Bet Size ($)"}),i.jsxs("div",{className:"text-[#93c5fd] font-semibold text-[11px] font-inter",children:["$",ee||"--"]})]}),ge!==void 0&&i.jsxs("div",{className:"rounded-md border border-[#2b2f36] bg-[#0f141b] px-2 py-1.5",children:[i.jsx("div",{className:"text-[#6b7280] uppercase tracking-wider",children:"Max Cycles"}),i.jsx("div",{className:"text-[#f9a8d4] font-semibold text-[11px] font-inter",children:ge||"--"})]}),se!==void 0&&pe!==void 0&&i.jsxs("div",{className:"rounded-md border border-[#2b2f36] bg-[#0f141b] px-2 py-1.5",children:[i.jsx("div",{className:"text-[#6b7280] uppercase tracking-wider",children:"Entry Time Window"}),i.jsxs("div",{className:"text-[#c4b5fd] font-semibold text-[11px] font-inter",children:[pe||"--","sec -",se||"-"," ","sec"]})]}),Fe!==void 0&&i.jsxs("div",{className:"rounded-md border border-[#2b2f36] bg-[#0f141b] px-2 py-1.5",children:[i.jsx("div",{className:"text-[#6b7280] uppercase tracking-wider",children:"Entry Price"}),i.jsx("div",{className:"text-[#fcd34d] font-semibold text-[11px] font-inter",children:Fe||"--"})]}),we!==void 0&&i.jsxs("div",{className:"rounded-md border border-[#2b2f36] bg-[#0f141b] px-2 py-1.5",children:[i.jsx("div",{className:"text-[#6b7280] uppercase tracking-wider",children:"Min Price Distance"}),i.jsx("div",{className:"text-[#fcd34d] font-semibold text-[11px] font-inter",children:we||"--"})]}),Se!==void 0&&i.jsxs("div",{className:"rounded-md border border-[#2b2f36] bg-[#0f141b] px-2 py-1.5",children:[i.jsx("div",{className:"text-[#6b7280] uppercase tracking-wider",children:"Take Profit"}),i.jsxs("div",{className:"text-[#86efac] font-semibold text-[11px] font-inter",children:[Se||"--","%"]})]}),H!==void 0&&i.jsxs("div",{className:"rounded-md border border-[#2b2f36] bg-[#0f141b] px-2 py-1.5",children:[i.jsx("div",{className:"text-[#6b7280] uppercase tracking-wider",children:"Stop Loss (%)"}),i.jsxs("div",{className:"text-[#fca5a5] font-semibold text-[11px] font-inter",children:[H||"--","%"]})]})]})})]},$)})})})]})})},iCn=({open:t,onCancel:e,onStart:n,inputValue:r,modalDataInfo:s,title:a="⚠️ Late-Start Warning (≤120s)",description:o="Starting the bot in the last 120 seconds or less can result in no fills.",valueLabel:l="Your Entry Time Start",valueSuffix:c="sec",recommendation:u="Recommended: greater than 120 seconds",bullets:d=["Liquidity on Polymarket often dries up in the final moments.","If there are no matching orders, the bot cannot fill, even if it is working correctly.","This is a market limitation, not a bot issue."]})=>i.jsxs(ha,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(fa,{transition:!0,style:{backgroundColor:"rgba(1, 5, 7, 0.66)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-200 data-[leave]:duration-150 backdrop-blur-[1.5px]"}),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 sm:p-5",children:i.jsxs(Ji,{className:"w-full max-w-[520px] rounded-[20px] border border-[#5f4a17] bg-[radial-gradient(circle_at_top_left,rgba(110,83,24,0.24)_0%,rgba(18,14,8,0.97)_42%,rgba(8,8,8,1)_100%)] shadow-[0_24px_56px_rgba(0,0,0,0.62)] p-5 sm:p-6",children:[i.jsx("div",{className:"text-[11px] tracking-[0.24em] font-extrabold text-[#ffd76a]",children:"WARNING"}),i.jsx("div",{className:"mt-2 text-white text-[20px] leading-[1.1] font-semibold",children:a}),i.jsx("div",{className:"mt-2 text-[#a8b7b3] text-[12px] leading-6",children:o}),i.jsxs("div",{className:"mt-3 rounded-xl border border-[#6b5718] bg-[#1a1407] px-3.5 py-2",children:[i.jsx("div",{className:"text-[11px] tracking-[0.15em] text-[#e2c97a] uppercase font-semibold",children:l}),i.jsxs("div",{className:"mt-1 text-[17px] leading-none font-bold text-[#ffd76a]",children:[r||s,c]})]}),i.jsx("div",{className:"mt-5 space-y-1 text-[#e2ddd1] text-[13px] sm:text-[14px] leading-6",children:d.map(f=>i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"mt-[8px] h-[6px] w-[6px] rounded-full bg-[#ffd76a]"}),i.jsx("p",{children:f})]},f))}),i.jsx("div",{className:"mt-6 flex items-center justify-end gap-3",children:i.jsx("button",{type:"button",onClick:n,className:"h-10 min-w-[104px] px-5 rounded-[12px] bg-gradient-to-r from-[#ffd76a] to-[#e4b84f] text-[#2b1f08] text-[14px] font-bold hover:brightness-105 transition shadow-[0_8px_24px_rgba(228,184,79,0.35)]",children:"I understand"})})]})})})]});function zZ({content:t,children:e,align:n="center"}){const r=h.useRef(null),s=h.useRef(null),a=h.useRef(null),o=h.useRef(null);return h.useEffect(()=>{const l=()=>{var c;(c=o.current)==null||c.hide()};return document.addEventListener("scroll",l,!0),()=>{document.removeEventListener("scroll",l,!0)}},[]),h.useEffect(()=>{if(!r.current)return;const l=m8(r.current,{content:"",allowHTML:!0,followCursor:!0,plugins:[dMe],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",theme:"custom"});return o.current=l,()=>{if(l.destroy(),o.current=null,a.current){const c=a.current;setTimeout(()=>{c.unmount()},0),a.current=null}s.current=null}},[]),h.useEffect(()=>{const l=o.current;if(l){if(h.isValidElement(t)){s.current||(s.current=document.createElement("div"),a.current=die.createRoot(s.current)),a.current.render(t),l.setContent(s.current);return}if(a.current){const c=a.current;setTimeout(()=>{c.unmount()},0),a.current=null,s.current=null}l.setContent(`
<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>
`)}},[n,t]),h.isValidElement(e)?h.cloneElement(e,{ref:r}):i.jsx("span",{ref:r,children:e})}const vO="https://dextrabothypev2.nftinit.io",W7=120,VC=80,Wv={ENTRY_TIME_START:"entry_time_start",ENTRY_PRICE:"entry_price"},aCn=[{value:"5m",label:"5 min"},{value:"15m",label:"15 min"},{value:"1h",label:"1 hour"},{value:"4h",label:"4 hour"},{value:"1d",label:"1 day"}],qKe={"5m":300,"15m":900,"1h":3600,"4h":14400,"1d":86400},oCn={"5m":5,"15m":15,"1h":60,"4h":240,"1d":1440},lCn=(t,e="15m")=>{if(t==null)return e;const n=String(t).trim().toLowerCase();if(Object.hasOwn(qKe,n))return n;const r=Number(t);return r===5?"5m":r===15?"15m":r===60?"1h":r===240?"4h":r===1440?"1d":n==="60m"?"1h":n==="240m"?"4h":n==="1440m"?"1d":e},cCn=t=>oCn[t]??15,uie={bot_version:"v2",market_period:"15m",coin:"btc",side:"up",budget:"",ptb_check:"",balance:"",cycles:"",tp:"",tp_price_type:"percentage",tp_type:"limit",sl:"",sl_price_type:"percentage",sl_type:"limit",buy_price:"",min_pd:"10",min_pd_tpsl:"",timeleft:"",timeleft_stop:"",repeat:"no",pkey:"",funder_address:"",api_key:"",api_secret:"",api_pass:""},uCn=()=>Array(4).fill(null).map(()=>({...uie})),dCn=[1,2,3,4],GKe=t=>{var e,n,r;return((n=(e=t==null?void 0:t.data)==null?void 0:e.data)==null?void 0:n.slot_number)??((r=t==null?void 0:t.data)==null?void 0:r.slot_number)??(t==null?void 0:t.slot_number)},fCn=t=>{const e={};return[...t].sort((n,r)=>new Date((n==null?void 0:n.timestamp)||0).getTime()-new Date((r==null?void 0:r.timestamp)||0).getTime()).map(n=>{const r=String(GKe(n)??""),s=(e[r]||0)+1;return e[r]=s,{...n,sequence:s}}).sort((n,r)=>new Date((r==null?void 0:r.timestamp)||0).getTime()-new Date((n==null?void 0:n.timestamp)||0).getTime())},Db=({show:t=!0})=>t?i.jsx("span",{className:"ml-1 text-[11px] leading-none text-[#7f8794]",children:"*"}):null,wO=({index:t,title:e,children:n})=>i.jsxs("section",{className:"pt-1",children:[i.jsxs("div",{className:"mb-2 flex items-center gap-2 border-b border-white/5 pb-1.5",children:[i.jsx("span",{className:"inline-flex h-4 min-w-4 items-center justify-center text-[10px] font-semibold text-[#6f93c7]",children:t}),i.jsx("h3",{className:"text-[10px] sm:text-[11px] font-semibold uppercase tracking-[0.22em] text-[#60a5fa]",children:e})]}),i.jsx("div",{className:"flex flex-col gap-2.5",children:n})]}),CO="border-[#ff8a3d]/60 focus:border-[#ff8a3d]/70 shadow-[0_0_0_1px_rgba(255,138,61,0.10)]",hCn=({startValue:t,stopValue:e,max:n,disabled:r=!1,min:s=0,onStartChange:a,onStopChange:o,onStartDragEnd:l,children:c})=>{const u=h.useRef(null),[d,f]=h.useState(null),x=Number(t),g=Number(e),y=t!==""&&!Number.isNaN(x),v=e!==""&&!Number.isNaN(g),C=y?x:n,S=v?g:0,T=n>0?Math.max(0,Math.min(100,C/n*100)):0,I=n>0?Math.max(0,Math.min(100,S/n*100)):0,L=100-T,F=100-I,$=`${Math.round(C)}s`,O=`${Math.round(S)}s`,U=Math.abs(L-F)<14,Y=L<=F,re=U?Y?-16:16:0,Q=U?Y?16:-16:0,q=(G,ie,oe)=>Math.min(oe,Math.max(ie,G));h.useEffect(()=>{if(!d||r)return;const G=oe=>{if(!u.current||n<=0)return;const K=u.current.getBoundingClientRect(),H=q((oe.clientX-K.left)/K.width,0,1),ee=Math.round(n*(1-H)),se=q(ee,s,n);if(se!=null){if(d==="start"&&a){const pe=v?g+1:s;a(q(se,pe,n))}if(d==="stop"&&o){const pe=y?Math.max(s,x-1):n;o(q(se,s,pe))}}},ie=()=>{const oe=d;f(null),oe==="start"&&(l==null||l())};return window.addEventListener("pointermove",G),window.addEventListener("pointerup",ie),()=>{window.removeEventListener("pointermove",G),window.removeEventListener("pointerup",ie)}},[d,r,n,s,y,v,x,g,a,o,l]);const te=G=>ie=>{r||(ie.preventDefault(),ie.stopPropagation(),f(G))},fe=G=>{if(r||!u.current||n<=0)return;G.preventDefault();const ie=u.current.getBoundingClientRect(),oe=q((G.clientX-ie.left)/ie.width,0,1),K=Math.round(n*(1-oe)),H=q(K,s,n),ee=Math.abs(H-C),se=Math.abs(H-S),pe=ee<=se?"start":"stop";if(pe==="start"&&a){const Se=v?g+1:s;a(q(H,Se,n)),f("start");return}if(pe==="stop"&&o){const Se=y?Math.max(s,x-1):n;o(q(H,s,Se)),f("stop")}};return i.jsx("div",{className:"rounded-[12px] border border-white/10 bg-[#0b1016]/35 p-3",children:i.jsxs("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-center xl:gap-5",children:[c?i.jsx("div",{className:"xl:w-fit xl:max-w-[380px] shrink-0",children:c}):null,i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{ref:u,onPointerDown:fe,className:`relative h-11 px-4 ${r?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsx("div",{className:"absolute -top-2 z-10 rounded-full border border-[#6f93c7]/35 bg-[#111722] px-2 py-0.5 text-[10px] text-[#c7d8f3] tabular-nums",style:{left:`calc(16px + (100% - 32px) * ${L/100} - 20px)`,transform:`translateX(${re}px)`},children:$}),i.jsx("div",{className:"absolute -top-2 z-10 rounded-full border border-[#c96a2f]/30 bg-[#17120e] px-2 py-0.5 text-[10px] text-[#f1c5a6] tabular-nums",style:{left:`calc(16px + (100% - 28px) * ${F/100} - 20px)`,transform:`translateX(${Q}px)`},children:O}),i.jsx("div",{className:"absolute inset-x-4 top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-white/10"}),i.jsx("div",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-gradient-to-r from-[#6f93c7] to-[#c96a2f]",style:{left:`calc(16px + (100% - 32px) * ${Math.min(L,F)/100})`,width:`calc((100% - 32px) * ${Math.abs(L-F)/100})`,opacity:.95}}),i.jsx("div",{onPointerDown:te("start"),className:`absolute top-1/2 h-4 w-4 -translate-y-1/2 rounded-full border-[3px] border-[#6f93c7] bg-[#0b1016] shadow-[0_0_0_4px_rgba(111,147,199,0.18)] opacity-100 ${r?"cursor-not-allowed":"cursor-ew-resize"}`,style:{left:`calc(16px + (100% - 32px) * ${L/100} - 8px)`}}),i.jsx("div",{onPointerDown:te("stop"),className:`absolute top-1/2 h-4 w-4 -translate-y-1/2 rounded-full border-[3px] border-[#c96a2f] bg-[#0b1016] shadow-[0_0_0_4px_rgba(201,106,47,0.14)] opacity-100 ${r?"cursor-not-allowed":"cursor-ew-resize"}`,style:{left:`calc(16px + (100% - 32px) * ${F/100} - 8px)`}})]}),i.jsxs("div",{className:"-mt-2.5 flex items-center justify-between text-[10px] leading-none text-[#7f8794] tabular-nums",children:[i.jsxs("span",{children:[n,"s"]}),i.jsx("span",{children:"0s"})]})]})]})})},pCn=()=>{var Tn,kn;const{setSignModalOpen:t}=h.useContext(Qr),[e,n]=h.useState(!1),[r,s]=h.useState([]),[a,o]=h.useState(0),[l,c]=h.useState("bot-1"),[u,d]=h.useState(Array(4).fill(null).map(()=>({...uie}))),f={...uie,...u[a]||{}},[x,g]=h.useState(Array(4).fill(!1)),y=x[a],[v,C]=h.useState(!1),[S,T]=h.useState(!1),[I,L]=h.useState(null),[F,$]=h.useState(!1),[O,U]=h.useState(!1),[Y,re]=h.useState(!1),[Q,q]=h.useState(""),[te,fe]=h.useState(!1),[G,ie]=h.useState(!1),[oe,K]=h.useState(null),[H,ee]=h.useState(null),[se,pe]=h.useState(Array(4).fill(null)),[Se,ge]=h.useState(Array(4).fill(null)),ve=h.useRef(null),be=h.useRef(null),[we,je]=h.useState(!1),[Fe,Re]=h.useState(!1),[Qe,Ye]=h.useState(!1),[dt,st]=h.useState(!1),at=h.useRef(null),He=h.useRef(null),qe=h.useRef(null),vt=h.useRef(null);h.useEffect(()=>{const Gt=localStorage.getItem("hyperToken"),mn=localStorage.getItem("hyperAddress");n(!!(Gt&&mn));const gt=setInterval(()=>{const Wt=localStorage.getItem("hyperToken"),jn=localStorage.getItem("hyperAddress");n(!!(Wt&&jn))},800);return()=>clearInterval(gt)},[]),h.useEffect(()=>{const Gt=mn=>{at.current&&!at.current.contains(mn.target)&&st(!1),He.current&&!He.current.contains(mn.target)&&je(!1),qe.current&&!qe.current.contains(mn.target)&&Re(!1),vt.current&&!vt.current.contains(mn.target)&&Ye(!1)};return document.addEventListener("mousedown",Gt),()=>document.removeEventListener("mousedown",Gt)},[]);const yt=h.useMemo(()=>{if(f.buy_price==="")return!1;const Gt=Number(f.buy_price);return Number.isNaN(Gt)?!1:f.side==="all"?Gt>0&&Gt<=99:Gt>=0&&Gt<=99},[f.buy_price,f.side]),Kt=h.useMemo(()=>{if(f.min_pd==="")return!1;const Gt=Number(f.min_pd);return Number.isNaN(Gt)?!1:Gt>=0&&Gt<=99},[f.min_pd]),jt=h.useMemo(()=>{if(f.min_pd_tpsl==="")return!1;const Gt=Number(f.min_pd_tpsl);return Number.isNaN(Gt)?!1:Gt>=0&&Gt<=99},[f.min_pd_tpsl]),un=qKe[f.market_period]??900;h.useEffect(()=>{const Gt=String(f.timeleft??"").trim(),mn=String(f.timeleft_stop??"").trim();if(!Gt&&!mn)return;const gt=Gt===""?null:Number(Gt),Wt=mn===""?null:Number(mn),jn=gt!=null&&!Number.isNaN(gt),kt=Wt!=null&&!Number.isNaN(Wt);let cn=jn?Math.min(Math.max(0,gt),un):Gt,Ce=kt?Math.min(Math.max(0,Wt),un):mn;const m=typeof cn=="number"?String(cn):Gt,p=typeof Ce=="number"?String(Ce):mn;m===Gt&&p===mn||d(N=>{const A=[...N];return A[a]={...A[a],timeleft:m,timeleft_stop:p},A})},[f.market_period,f.timeleft,f.timeleft_stop,un,a]);const vn=h.useMemo(()=>{if(f.timeleft==="")return!1;const Gt=Number(f.timeleft);if(Number.isNaN(Gt))return!1;if(!(f.timeleft_stop!==""))return Gt>=10&&Gt<=un;const gt=Number(f.timeleft_stop);return Number.isNaN(gt)?!1:Gt>10&&Gt<=un&&Gt>gt},[f.timeleft,f.timeleft_stop,un]),Hn=h.useMemo(()=>{if(f.timeleft_stop==="")return!1;const Gt=Number(f.timeleft_stop);if(Number.isNaN(Gt)||Gt<10||Gt>un)return!1;if(f.timeleft==="")return!0;const mn=Number(f.timeleft);return Number.isNaN(mn)?!1:Gt<mn},[f.timeleft_stop,f.timeleft,un]),ln=`Entry Time Start must be between 10 and ${un} seconds, and Start must be greater than Stop.`,Nn=`Entry Time values must be between 10 and ${un} seconds, and Stop must be smaller than Start.`,dn=h.useMemo(()=>/^0x[a-fA-F0-9]{40}$/.test(f.funder_address),[f.funder_address]),rt=h.useMemo(()=>String(f.pkey||"").trim().length>60,[f.pkey]),nt=h.useMemo(()=>{if(!f.buy_price||!f.balance)return"";const Gt=Number(f.buy_price)+Number(f.min_pd||0),gt=(Gt>99?99/100:Gt/100)*5,Wt=f.balance;return gt<=Wt?"":"The calculated order value exceeds your Bet Size. Lower the Entry Price or increase the Bet Size."},[f.buy_price,f.balance,f.min_pd]),Ut=h.useMemo(()=>!f.buy_price||!f.min_pd||Number(f.buy_price)+Number(f.min_pd||0)<=99?"":"The sum of Entry Price and Min Price Distance must not exceed 99.",[f.buy_price,f.min_pd]),wn=!nt&&!Ut&&e&&f.coin&&f.market_period&&f.side&&f.balance&&(f.side!=="all"||f.buy_price!=="")&&dn&&rt&&f.funder_address&&rt&&(f.buy_price===""||yt)&&(f.min_pd===""||Kt)&&(f.min_pd_tpsl===""||jt)&&(f.timeleft===""||vn)&&(f.timeleft_stop===""||Hn)&&(f.api_key&&f.api_secret&&f.api_pass||!f.api_key&&!f.api_secret&&!f.api_pass),Jt=[{value:"btc",label:"BTC"},{value:"eth",label:"ETH"},{value:"sol",label:"SOL"},{value:"xrp",label:"XRP"}],Vt=aCn,xt=[{value:"up",label:"UP"},{value:"down",label:"DOWN"},{value:"all",label:"ALL"}],We=[{value:"v1",label:"V1 (Live Version)"},{value:"v2",label:"V2 (Beta Version)"}],Pt=(Gt,mn)=>{var gt;return((gt=Gt.find(Wt=>Wt.value===mn))==null?void 0:gt.label)||"Select"},Ke=Gt=>/^(0|[1-9]\d*)(\.\d{0,2})?$/.test(Gt),ct=Gt=>/^\d*$/.test(Gt),Nt=Gt=>{["e","E","+","-"].includes(Gt.key)&&Gt.preventDefault()},Ht=new Set(["budget","ptb_check","balance","tp","sl","min_pd","min_pd_tpsl"]),Rt=new Set(["cycles","timeleft","timeleft_stop","buy_price"]),hn=Gt=>mn=>{let gt=mn.target.value;if(Rt.has(Gt)){let Wt=gt.trim();if(Wt!==""&&(Wt.startsWith("0")&&(Wt=Wt.replace(/^0+/,"")||"0"),!ct(Wt)))return;gt=Wt}if(Ht.has(Gt)){let Wt=gt.trim();if(Wt!==""&&(Wt.startsWith(".")&&(Wt=`0${Wt}`),!Ke(Wt)))return;gt=Wt}if(Gt==="timeleft"){const Wt=Number(gt),jn=gt!==""&&!Number.isNaN(Wt)&&Wt<=W7&&se[a]===gt;pe(kt=>{const cn=[...kt];return cn[a]=jn?gt:null,cn})}if(Gt==="buy_price"){const Wt=Number(gt),jn=gt!==""&&!Number.isNaN(Wt)&&Wt>=VC&&Se[a]===gt;ge(kt=>{const cn=[...kt];return cn[a]=jn?gt:null,cn})}d(Wt=>{const jn=[...Wt];return jn[a]={...jn[a],[Gt]:Ht.has(Gt)||Rt.has(Gt)||Gt==="bot_version"||Gt==="market_period"||Gt==="coin"||Gt==="side"||Gt==="tp_type"||Gt==="tp_price_type"||Gt==="sl_type"||Gt==="sl_price_type"||Gt==="pkey"||Gt==="funder_address"||Gt==="api_key"||Gt==="api_secret"||Gt==="api_pass"||Gt==="repeat"?gt:gt===""?"":Number(gt)},jn})},yn=()=>{if(Be)return;const Gt=String(f.timeleft??"").trim();if(!Gt)return;const mn=Number(Gt);Number.isNaN(mn)||mn>W7||se[a]!==Gt&&(ee(Gt),K(Wv.ENTRY_TIME_START),ie(!0))},Cn=Gt=>{const mn=Number(Gt)===un?"":String(Gt);hn("timeleft")({target:{value:mn}})},En=Gt=>{const mn=Number(Gt)===0?"":String(Gt);hn("timeleft_stop")({target:{value:mn}})},Rn=()=>{if(Be)return;const Gt=String(f.buy_price??"").trim();if(!Gt)return;const mn=Number(Gt);Number.isNaN(mn)||mn<VC||Se[a]!==Gt&&(ee(Gt),K(Wv.ENTRY_PRICE),ie(!0))};h.useEffect(()=>{f.bot_version==="v1"&&(f.tp_price_type==="percentage"&&f.sl_price_type==="percentage"||d(Gt=>{const mn=[...Gt];return mn[a]={...mn[a],tp_price_type:"percentage",sl_price_type:"percentage"},mn}))},[f.bot_version,f.tp_price_type,f.sl_price_type,a]);const Mn=()=>{if(oe===Wv.ENTRY_TIME_START){const Gt=H??String(f.timeleft??"").trim();pe(mn=>{const gt=[...mn];return gt[a]=Gt||null,gt})}if(oe===Wv.ENTRY_PRICE){const Gt=H??String(f.buy_price??"").trim();ge(mn=>{const gt=[...mn];return gt[a]=Gt||null,gt})}ie(!1),ee(null),K(null)},Yn=()=>{const Gt=oe;ie(!1),ee(null),K(null),!Be&&(requestAnimationFrame(()=>{var mn,gt;if(Gt===Wv.ENTRY_PRICE){(mn=be.current)==null||mn.focus({preventScroll:!0});return}(gt=ve.current)==null||gt.focus({preventScroll:!0})}),setTimeout(()=>{var mn,gt;if(Gt===Wv.ENTRY_PRICE){(mn=be.current)==null||mn.focus({preventScroll:!0});return}(gt=ve.current)==null||gt.focus({preventScroll:!0})},220))},Zn=(Gt,mn)=>{if(!Gt)return;const gt=Gt,Wt=(gt==null?void 0:gt.bot_params)||gt;d(jn=>{const kt=[...jn],cn=Wt==null?void 0:Wt.market_period,Ce=lCn(cn,kt[mn].market_period),m=String((Wt==null?void 0:Wt.bot_version)||"").trim().toLowerCase(),p=m==="v2"?"v2":"v1";return kt[mn]={...kt[mn],bot_version:p,market_period:Ce,coin:(Wt==null?void 0:Wt.coin)??kt[mn].coin,side:(Wt==null?void 0:Wt.side)??kt[mn].side,budget:(Wt==null?void 0:Wt.budget)??"",ptb_check:(Wt==null?void 0:Wt.ptb_check)??"",balance:(Wt==null?void 0:Wt.balance)??"",cycles:(Wt==null?void 0:Wt.cycles)??"",tp:(Wt==null?void 0:Wt.tp)??"",tp_price_type:String((Wt==null?void 0:Wt.tp_price_type)||"").toLowerCase()==="cent"?"cent":"percentage",tp_type:String((Wt==null?void 0:Wt.tp_type)||"")==="market"?"market":"limit",sl:(Wt==null?void 0:Wt.sl)??"",sl_price_type:String((Wt==null?void 0:Wt.sl_price_type)||"").toLowerCase()==="cent"?"cent":"percentage",sl_type:String((Wt==null?void 0:Wt.sl_type)||"")==="market"?"market":"limit",buy_price:(Wt==null?void 0:Wt.buy_price)??"",min_pd:(Wt==null?void 0:Wt.min_pd)??"",min_pd_tpsl:(Wt==null?void 0:Wt.min_pd_tpsl)??"",timeleft:(Wt==null?void 0:Wt.timeleft)??"",timeleft_stop:(Wt==null?void 0:Wt.timeleft_stop)??"",repeat:(Wt==null?void 0:Wt.repeat)??"no",pkey:(Wt==null?void 0:Wt.pkey)??"",funder_address:(Wt==null?void 0:Wt.funder_address)??"",api_key:(Wt==null?void 0:Wt.api_key)??"",api_secret:(Wt==null?void 0:Wt.api_secret)??"",api_pass:(Wt==null?void 0:Wt.api_pass)??""},kt})},Vn=async({silent:Gt=!1}={})=>{try{Gt||U(!0);const mn=window.localStorage.getItem("hyperToken"),gt=window.localStorage.getItem("hyperAddress"),jn=await(await fetch(`${vO}/api/hyper/polymarket_bot/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:gt,token:mn})})).json();if(!(jn!=null&&jn.success)){g(Array(4).fill(!1));return}const kt=Array.isArray(jn==null?void 0:jn.data)?jn.data:[],cn=Array(4).fill(null),Ce=Array(4).fill(!1);kt.forEach(m=>{const p=Number(m==null?void 0:m.slot_number);p>=1&&p<=4&&(cn[p-1]=m,Ce[p-1]=!(m!=null&&m.is_deleted))}),g(Ce),cn.forEach((m,p)=>{m&&Zn(m,p)})}catch(mn){console.error(mn)}finally{Gt||U(!1)}},tr=async()=>{const Gt=window.localStorage.getItem("hyperToken"),mn=window.localStorage.getItem("hyperAddress");if(!Gt||!mn)return re(!1),s([]),[];re(!0);const gt=dCn.map(async jn=>{const cn=await(await fetch(`${vO}/api/hyper/polymarket_bot/logs/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:mn.toLowerCase(),token:Gt,slot_number:jn})})).json(),m=(Array.isArray(cn==null?void 0:cn.data)?cn.data:[]).map(p=>{const N=p!=null&&p.data&&typeof p.data=="object"?p.data:{},A={...p,data:{...N,slot_number:(N==null?void 0:N.slot_number)??(p==null?void 0:p.slot_number)??jn}};return{timestamp:(A==null?void 0:A.timestamp)??(A==null?void 0:A.insert_date),data:A}});return s(p=>{const N=String(jn),A=p.filter(k=>String(GKe(k)??"")!==N);return fCn([...m,...A])}),{slotNumber:jn,response:cn}}),Wt=await Promise.allSettled(gt);return re(!1),Wt},Sn=async()=>{var Gt,mn;try{if($(!0),q(""),f.buy_price!==""&&!yt){q("Buy Price must be between 0 and 99.");return}if(f.min_pd!==""&&!Kt){q("MPD must be between 0 and 99.");return}if(f.min_pd_tpsl!==""&&!jt){q("SL MPD must be between 0 and 99.");return}if(f.timeleft!==""&&!vn){q(ln);return}if(f.timeleft_stop!==""&&!Hn){q(Nn);return}const gt=window.localStorage.getItem("hyperToken"),Wt=window.localStorage.getItem("hyperAddress");if(!gt||!Wt){q("Please connect your account first.");return}if(!dn){q("Funder address format is invalid.");return}if(!rt){q("Please enter a valid private key.");return}const jn={bot_version:f.bot_version,market_period:cCn(f.market_period),coin:f.coin,side:f.side,budget:f.budget===""?null:Number(f.budget),ptb_check:f.ptb_check===""?null:Number(f.ptb_check),balance:f.balance===""?null:Number(f.balance),cycles:f.cycles===""?null:Number(f.cycles),tp:f.tp===""?null:Number(f.tp),sl:f.sl===""?null:Number(f.sl),buy_price:f.buy_price===""?null:Number(f.buy_price),min_pd:f.min_pd===""?null:Number(f.min_pd),min_pd_tpsl:f.min_pd_tpsl===""?null:Number(f.min_pd_tpsl),timeleft:f.timeleft===""?null:Number(f.timeleft),timeleft_stop:f.timeleft_stop===""?null:Number(f.timeleft_stop),repeat:f.repeat,pkey:f.pkey||void 0,funder_address:f.funder_address||void 0,api_key:f.api_key||void 0,api_secret:f.api_secret||void 0,api_pass:f.api_pass||void 0,...f.tp!==""?{tp_type:(Gt=f.tp_type)==null?void 0:Gt.toLowerCase()}:{tp_type:null},...f.sl!==""?{sl_type:(mn=f.sl_type)==null?void 0:mn.toLowerCase()}:{sl_type:null},...f.bot_version==="v2"?{tp_price_type:f.tp_price_type||"percentage",sl_price_type:f.sl_price_type||"percentage"}:{}},kt={address:Wt.toLowerCase(),token:gt,coin:f.coin,bot_params:jn,slot_number:l.split("-")[1]&&Number(l.split("-")[1])},Ce=await(await fetch(`${vO}/api/hyper/polymarket_bot/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(kt)})).json();if(!(Ce!=null&&Ce.success)){q((Ce==null?void 0:Ce.error_message)||"Start failed."),fn.error((Ce==null?void 0:Ce.error_message)||"Start failed."),fe(!1);return}g(m=>{const p=[...m];return p[a]=!0,p}),fe(!1),await Vn()}catch(gt){q(gt.message||"Start request failed."),fe(!1)}finally{$(!1)}},ze=async()=>{try{$(!0),q("");const Gt=window.localStorage.getItem("hyperToken"),mn=window.localStorage.getItem("hyperAddress"),gt={address:mn.toLowerCase(),token:Gt,coin:f.coin,slot_number:l.split("-")[1]&&Number(l.split("-")[1])};if(!Gt&&!mn&&(!f.pkey||!f.funder_address)){q("Provide pkey and funder address to stop.");return}if(!dn){q("Funder address format is invalid.");return}if(f.pkey&&!rt){q("Please enter a valid private key.");return}const jn=await(await fetch(`${vO}/api/hyper/polymarket_bot/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(gt)})).json();if(!(jn!=null&&jn.success)){Vn(),q((jn==null?void 0:jn.error_message)||"Stop failed."),fe(!1);return}g(kt=>{const cn=[...kt];return cn[a]=!1,cn}),fe(!1),await Vn()}catch(Gt){q(Gt.message||"Stop request failed.")}finally{$(!1)}},xe=Gt=>{if(Gt.preventDefault(),!y&&!wn&&e){q("Please fill required fields before starting.");return}fe(!0)};h.useEffect(()=>{e?(Vn(),tr()):(d(uCn()),g(Array(4).fill(!1)),pe(Array(4).fill(null)),ge(Array(4).fill(null)),ie(!1),ee(null),K(null),q(""),C(!1),T(!1),st(!1),je(!1),Re(!1),Ye(!1),re(!1))},[e]),h.useEffect(()=>{if(!e||!x.some(Boolean))return;const Gt=setInterval(()=>{Vn({silent:!0})},5e3);return()=>clearInterval(Gt)},[e,x]);const Ge={bot_version:String((f==null?void 0:f.bot_version)||"").toUpperCase(),market_period:(f==null?void 0:f.market_period)!==void 0&&(f==null?void 0:f.market_period)!==null?String(f.market_period).toUpperCase():"",coin:(Tn=f==null?void 0:f.coin)==null?void 0:Tn.toUpperCase(),side:(kn=f==null?void 0:f.side)==null?void 0:kn.toUpperCase(),budget:f.budget,ptb_check:f.ptb_check,balance:f.balance,cycles:f.cycles,tp:f.tp,tp_price_type:f.tp_price_type||"percentage",tp_type:f.tp_type,sl:f.sl,sl_price_type:f.sl_price_type||"percentage",sl_type:f.sl_type,buy_price:f.buy_price,slippage:f.min_pd,sl_slippage:f.min_pd_tpsl,timeleft:f.timeleft,timeleft_stop:f.timeleft_stop,repeat:f.repeat,funder_address:f.funder_address,api_key:f.api_key,api_secret:f.api_secret,api_pass:f.api_pass},_e=h.useMemo(()=>x.filter(Boolean).length,[x]),Be=y||F||O,qt=Be||!String(f.sl||"").trim()||f.sl_type==="market",It=!String(f.sl||"").trim()||f.sl_type==="market";h.useEffect(()=>{It&&f.min_pd_tpsl!==""&&d(Gt=>{const mn=Gt[a];if(!mn||mn.min_pd_tpsl==="")return Gt;const gt=[...Gt];return gt[a]={...mn,min_pd_tpsl:""},gt})},[a,f.min_pd_tpsl,It]);const mt=i.jsx(sCn,{socketLogs:r,setSocketLogs:s,logsLoading:Y,connected:e,activeBotId:l&&Number(l.split("-")[1]),isRunning:y}),Ft=oe===Wv.ENTRY_PRICE?{title:`⚠️ High-Price Liquidity Warning (≥${VC}c)`,description:`Entering positions at ${VC}c or higher can result in no fills.`,valueLabel:"Your Entry Price",valueSuffix:"c",recommendation:`Recommended: below ${VC}c`,bullets:[`Liquidity above ${VC}c on Polymarket is often very thin.`,"If there are no matching orders, the bot cannot fill, even though it is working correctly.","This is a market liquidity limitation, not a bot issue."],modalDataInfo:f.buy_price}:{title:`⚠️ Late-Start Warning (≤${W7}s)`,description:`Starting the bot in the last ${W7} seconds or less can result in no fills.`,valueLabel:"Your Entry Time Start",valueSuffix:"sec",recommendation:`Recommended: greater than ${W7} seconds`,bullets:["Liquidity on Polymarket often dries up in the final moments.","If there are no matching orders, the bot cannot fill, even if it is working correctly.","This is a market limitation, not a bot issue."],modalDataInfo:f.timeleft};return i.jsxs("div",{className:"flex justify-center items-start w-full px-2 sm:px-4 font-manrope",children:[i.jsx(eCn,{open:te,setOpen:fe,onConfirm:y?ze:Sn,modalLoading:F,active:y,confirmDisabled:!y&&!wn,modalDataInfo:Ge}),i.jsx(iCn,{open:G,onCancel:Yn,onStart:Mn,inputValue:H,modalDataInfo:Ft.modalDataInfo,title:Ft.title,description:Ft.description,valueLabel:Ft.valueLabel,valueSuffix:Ft.valueSuffix,recommendation:Ft.recommendation,bullets:Ft.bullets}),i.jsx("div",{className:`w-full pt-2 ${y?"max-w-[1440px]":"max-w-[1440px] pb-6"}`,children:i.jsxs("div",{className:"flex flex-col gap-5 rounded-2xl border border-[#2a2f36] bg-[radial-gradient(circle_at_top,_rgba(96,165,250,0.08),_rgba(18,20,23,0.92)_45%,_rgba(10,12,14,0.98)_100%)] p-5 md:px-7 md:py-4 shadow-[0_24px_70px_rgba(0,0,0,0.5)]",children:[i.jsx("div",{className:"flex flex-col gap-2",children:i.jsxs("div",{className:"flex justify-between items-center gap-1",children:[i.jsx("div",{className:"flex flex-col",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:lL,alt:"Standx Logo",className:"w-6 h-6 rounded-md"}),i.jsx("h1",{className:"text-[18px] sm:text-[22px] leading-[30px] font-semibold text-white",children:"Polymarket Bot"}),i.jsx("span",{className:"rounded-full bg-white/5 border border-white/10 px-3 py-1 text-[11px] font-semibold text-[#9dd6ff] hidden sm:block",children:"Dextrabot"}),i.jsx(as,{content:`Configure the bot parameters, start the strategy, or stop an
active session. Settings sync from the latest bot info.`,children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`hidden sm:block text-[11px] uppercase tracking-[0.2em] px-3 py-1 rounded-full border ${y?"border-[#60a5fa]/40 text-[#fff] bg-[#164bb4]":"border-[#2f2f2f] text-[#b0b0b0] bg-[#151515]"}`,children:`${l.toUpperCase()} ${y?"Running":"Idle"}`}),i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C]",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/dextrabot/polymarket-bots/5-minutes-and-15-minutes-crypto-markets","_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:j2,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("form",{onSubmit:xe,className:`grid grid-cols-1 items-start gap-5 ${y?"lg:grid-cols-[0.95fr_1.25fr]":"lg:grid-cols-[1.25fr_0.9fr]"}`,children:[i.jsxs("div",{className:"flex flex-col gap-5 min-w-0 pt-1",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center sm:flex-row sm:justify-between sm:items-center gap-1.5",children:[i.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:["Bot-1","Bot-2","Bot-3","Bot-4"].map((Gt,mn)=>{const gt=a===mn,Wt=x[mn];return i.jsx("button",{type:"button",onClick:()=>{o(mn),c(Gt.toLowerCase())},className:`h-9 px-4 rounded-md border text-[11px] font-semibold uppercase tracking-[0.18em] transition shadow-sm ${gt?"border-[#60a5fa]/80 bg-[#3971d7] text-[#fff] transition-all duration-200 scale-105":"border-[#4b5563] bg-[#1a212b] text-[#e2e8f0] hover:border-[#60a5fa]/60 hover:text-white hover:bg-[#223045]"} `,children:i.jsxs("span",{className:"flex items-center gap-2",children:[Gt,Wt&>?i.jsx("span",{className:"grid h-4 w-4 place-items-center rounded-full bg-[#2dd4bf] text-[#0b1a16]",children:i.jsx("svg",{viewBox:"0 0 16 16",className:"h-3 w-3",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}):Wt&&!gt&&i.jsx("span",{className:" rounded-full bg-[#2dd4bf] w-2 h-2"})]})},Gt)})}),i.jsxs("span",{className:"text-[10px] uppercase tracking-[0.18em] px-2.5 py-1 rounded-full border border-[#1f3a2a] text-[#cbd5e1] bg-[#0f1512] shadow-[0_0_0_1px_rgba(34,197,94,0.12),0_4px_12px_rgba(0,0,0,0.28)]",children:["Active Bots"," ",i.jsx("span",{className:"text-[#4ade80] font-bold text-[11px]",children:`${_e}/4`})]})]}),i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(wO,{index:"1",title:"Core Settings",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsxs("span",{className:"flex items-center text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:[y?"Version":"Bot Version",i.jsx(Db,{})]}),i.jsxs("div",{className:`${y?"gap-0.5":"gap-1"} flex items-center`,children:[i.jsx(as,{content:"Bot engine version.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})}),i.jsx(T0,{label:"NEW",tone:"emerald"})]})]}),i.jsxs("div",{className:"relative",ref:at,children:[i.jsxs("button",{type:"button",onClick:()=>{Be||(st(Gt=>!Gt),je(!1),Re(!1),Ye(!1))},disabled:Be,className:"h-9 w-full rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] disabled:opacity-80 disabled:cursor-not-allowed flex items-center justify-between",children:[i.jsx("span",{children:Pt(We,f.bot_version)}),i.jsx("svg",{className:`h-4 w-4 transition ${dt?"rotate-180":""}`,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),dt&&!Be&&i.jsx("div",{className:"absolute z-20 mt-2 px-2 w-full rounded-xl border border-[#22324a] bg-[#0a0f16] shadow-[0_20px_44px_rgba(0,0,0,0.6)]",children:i.jsx("div",{className:"py-2",children:We.map(Gt=>i.jsx("button",{type:"button",onClick:()=>{hn("bot_version")({target:{value:Gt.value}}),st(!1)},className:`w-full px-4 py-2 mb-1 text-left text-[13px] font-semibold tracking-[0.08em] transition bg-[#111827] ${f.bot_version===Gt.value?"bg-[#123a66] text-[#e8f2ff]":"text-[#c6d4ea] hover:bg-[#0f2c52] hover:text-white"}`,children:Gt.label},Gt.value))})})]})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsxs("span",{className:"flex items-center text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:[y?"M. Period":"Market Period",i.jsx(Db,{})]}),i.jsx(as,{content:"Market timeframe for this strategy.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsxs("div",{className:"relative",ref:He,children:[i.jsxs("button",{type:"button",onClick:()=>{Be||(je(Gt=>!Gt),st(!1),Re(!1),Ye(!1))},disabled:Be,className:"h-9 w-full rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] disabled:opacity-80 disabled:cursor-not-allowed flex items-center justify-between",children:[i.jsx("span",{children:Pt(Vt,f.market_period)}),i.jsx("svg",{className:`h-4 w-4 transition ${we?"rotate-180":""}`,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),we&&!Be&&i.jsx("div",{className:"absolute z-20 mt-2 px-2 w-full rounded-xl border border-[#22324a] bg-[#0a0f16] shadow-[0_20px_44px_rgba(0,0,0,0.6)]",children:i.jsx("div",{className:"py-2",children:Vt.map(Gt=>i.jsx("button",{type:"button",onClick:()=>{hn("market_period")({target:{value:Gt.value}}),je(!1)},className:`w-full px-4 py-2 mb-1 text-left text-[13px] font-semibold tracking-[0.08em] transition bg-[#111827] ${f.market_period===Gt.value?"bg-[#123a66] text-[#e8f2ff]":"text-[#c6d4ea] hover:bg-[#0f2c52] hover:text-white"}`,children:Gt.label},Gt.value))})})]})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsxs("span",{className:"flex items-center text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:["Coin",i.jsx(Db,{})]}),i.jsx(as,{content:"Market asset to trade.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsxs("div",{className:"relative",ref:qe,children:[i.jsxs("button",{type:"button",onClick:()=>{Be||(Re(Gt=>!Gt),st(!1),je(!1),Ye(!1))},disabled:Be,className:"h-9 w-full rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] disabled:opacity-80 disabled:cursor-not-allowed flex items-center justify-between",children:[i.jsx("span",{className:"uppercase",children:((f==null?void 0:f.market_period)==="5m",Pt(Jt,f.coin))}),i.jsx("svg",{className:`h-4 w-4 transition ${Fe?"rotate-180":""}`,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Fe&&!Be&&i.jsx("div",{className:"absolute z-20 mt-2 px-2 w-full rounded-xl border border-[#22324a] bg-[#0a0f16] shadow-[0_20px_44px_rgba(0,0,0,0.6)]",children:i.jsx("div",{className:"py-2",children:((f==null?void 0:f.market_period)==="5m",Jt).map(Gt=>i.jsx("button",{type:"button",onClick:()=>{hn("coin")({target:{value:Gt.value}}),Re(!1)},className:`w-full px-4 py-2 mb-1 text-left text-[13px] font-semibold tracking-[0.08em] uppercase transition bg-[#111827] ${f.coin===Gt.value?"bg-[#123a66] text-[#e8f2ff]":"text-[#c6d4ea] hover:bg-[#0f2c52] hover:text-white"}`,children:Gt.label},Gt.value))})})]})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsxs("span",{className:"flex items-center text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:[y?"Side":"Side (Up / Down)",i.jsx(Db,{})]}),i.jsx(as,{content:"Direction of the bet.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsxs("div",{className:"relative",ref:vt,children:[i.jsxs("button",{type:"button",onClick:()=>{Be||(Ye(Gt=>!Gt),st(!1),je(!1),Re(!1))},disabled:Be,className:"h-9 w-full rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] disabled:opacity-80 disabled:cursor-not-allowed flex items-center justify-between",children:[i.jsx("span",{className:"uppercase",children:Pt(xt,f.side)}),i.jsx("svg",{className:`h-4 w-4 transition ${Qe?"rotate-180":""}`,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Qe&&!Be&&i.jsx("div",{className:"absolute z-20 mt-2 px-2 w-full rounded-xl border border-[#22324a] bg-[#0a0f16] shadow-[0_20px_44px_rgba(0,0,0,0.6)]",children:i.jsx("div",{className:"py-2",children:xt.map(Gt=>i.jsx("button",{type:"button",onClick:()=>{hn("side")({target:{value:Gt.value}}),Ye(!1)},className:`w-full px-4 py-2 mb-1 text-left text-[13px] font-semibold tracking-[0.08em] uppercase transition bg-[#111827] ${f.side===Gt.value?"bg-[#123a66] text-[#e8f2ff]":"text-[#c6d4ea] hover:bg-[#0f2c52] hover:text-white"}`,children:Gt.label},Gt.value))})})]})]})]})}),i.jsx(wO,{index:"2",title:"Risk Management",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsxs("span",{className:"flex items-center text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:["Bet Size ($)",i.jsx(Db,{})]}),i.jsx(as,{content:"Amount wagered per bet.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsx("input",{value:f.balance,onChange:hn("balance"),onKeyDown:Nt,inputMode:"decimal",autoComplete:"off",placeholder:"",disabled:Be,className:`h-9 rounded-[8px] bg-[#0b1016]/50 border text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed ${f.balance===""||!f.balance?CO:"border-white/10"}`}),(f.balance===""||!f.balance)&&i.jsx("div",{className:"text-[#FF797C] text-[10px] -mt-1",children:"Bet Size ($) is required"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:"Max Loss ($)"}),i.jsx(as,{content:"Bot stops when net realized PnL reaches this loss.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsx("input",{value:f.budget,onChange:hn("budget"),onKeyDown:Nt,inputMode:"decimal",autoComplete:"off",placeholder:"",disabled:Be,className:"h-9 rounded-[8px] bg-[#0b1016]/50 border text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed border-white/10"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:"Max Cycles"}),i.jsx(zZ,{content:i.jsx(UZ,{titles:["Maximum number of bets for this market.","Bot may stop earlier if Max Loss is reached."]}),children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsx("input",{value:f.cycles,onChange:hn("cycles"),inputMode:"numeric",autoComplete:"off",placeholder:"",disabled:Be,className:"h-9 rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed"})]})]})}),i.jsxs(wO,{index:"3",title:"Entry Logic",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2 relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsxs("span",{className:"flex items-center text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:["Entry Price",i.jsx(Db,{show:f.side==="all"})]}),i.jsx(zZ,{content:i.jsx(UZ,{titles:["Up/Down -> Min: 0 Max: 99","All -> Min: 1 Max: 99","Target entry price."]}),children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsx("input",{ref:be,value:f.buy_price,onChange:hn("buy_price"),onBlur:Rn,inputMode:"numeric",autoComplete:"off",placeholder:"",disabled:Be,className:`h-9 rounded-[8px] bg-[#0b1016]/50 border text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed ${(f.buy_price===""||!f.buy_price)&&f.side==="all"?CO:"border-white/10"}`}),f.buy_price!==""&&!yt&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be between"," ",f.side==="all"?1:0," and 99."]}),(f.buy_price===""||!f.buy_price)&&f.side==="all"&&i.jsx("div",{className:"text-[#FF797C] text-[10px] -mt-1",children:"Entry Price is required"}),nt&&!y&&i.jsxs("div",{className:"flex justify-start items-center gap-2 text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#353535] rounded-md px-3 py-1.5 min-w-max",children:[i.jsx("img",{src:Wo,alt:"Dextrabot"}),i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:nt})]}),Ut&&!y&&i.jsxs("div",{className:"flex justify-start items-center gap-2 text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#353535] rounded-md px-3 py-1.5 min-w-max",children:[i.jsx("img",{src:Wo,alt:"Dextrabot"}),i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:Ut})]})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:y?"MPD":"Min Price Distance"}),i.jsx(as,{content:"Minimum distance required between the current market price and your target entry price before a trade is allowed.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsx("input",{value:f.min_pd,onChange:hn("min_pd"),onKeyDown:Nt,inputMode:"decimal",autoComplete:"off",placeholder:"",disabled:Be,className:"h-9 rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed"}),f.min_pd!==""&&!Kt&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Value must be between 0 and 99."})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:y?"Rebuy Entry":"Re-Buy at Entry"}),i.jsx(as,{content:"Place a new bet when price returns to the entry price.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx("button",{type:"button",onClick:()=>hn("repeat")({target:{value:"yes"}}),disabled:Be,className:`h-9 rounded-lg border text-[12px] font-semibold uppercase tracking-[0.18em] transition ${f.repeat==="yes"?"border-[#2dd4bf]/50 bg-[#0f1716] text-[#9ff1df]":"border-[#2b2f36] bg-[#12161c] text-[#9a9a9a] hover:border-[#2c3645] hover:text-white"} ${Be?"opacity-50 cursor-not-allowed":""}`,children:"Yes"}),i.jsx("button",{type:"button",onClick:()=>hn("repeat")({target:{value:"no"}}),disabled:Be,className:`h-9 rounded-lg border text-[12px] font-semibold uppercase tracking-[0.18em] transition ${f.repeat==="no"?"border-[#ff7b2c]/50 bg-[#1a120f] text-[#ffd2b2]":"border-[#2b2f36] bg-[#12161c] text-[#9a9a9a] hover:border-[#2c3645] hover:text-white"} ${Be?"opacity-50 cursor-not-allowed":""}`,children:"No"})]})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:"P2B Check"}),i.jsx(as,{content:"Price-to-Buy (P2B) control threshold. The bot validates the pre-entry price condition based on this value.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsx("input",{value:f.ptb_check,onChange:hn("ptb_check"),onKeyDown:Nt,inputMode:"decimal",autoComplete:"off",placeholder:"Coming Soon",disabled:!0,className:"h-9 rounded-[8px] border border-[#f59e0b]/35 bg-[linear-gradient(90deg,rgba(146,64,14,0.28),rgba(120,53,15,0.2))] text-[#fcd9aa] px-2.5 text-[11px] font-medium outline-none transition focus:border-[#f59e0b]/55 focus:ring-1 focus:ring-[#f59e0b]/20 hover:border-[#f59e0b]/50 placeholder:text-[#f6c57d] disabled:opacity-95 disabled:cursor-not-allowed"})]})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:"Entry Time Window (sec)"}),i.jsx(zZ,{content:i.jsx(UZ,{titles:["5M -> Min: 10 Max: 300","15M -> Min: 10 Max: 900","1H -> Min: 10 Max: 3600","4H -> Min: 10 Max: 14400","1D -> Min: 10 Max: 86400","Start must be greater than Stop."]}),children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsx(hCn,{startValue:f.timeleft,stopValue:f.timeleft_stop,max:un,disabled:Be,onStartChange:Cn,onStopChange:En,onStartDragEnd:yn,children:i.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-start md:gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-9 text-[10px] uppercase tracking-[0.14em] text-[#9aa6b6]",children:"Start"}),i.jsx("input",{ref:ve,value:f.timeleft,onChange:hn("timeleft"),onBlur:yn,inputMode:"numeric",autoComplete:"off",placeholder:"",disabled:Be,className:"h-9 w-full md:w-[72px] rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed"})]}),i.jsx("div",{className:"text-[11px] text-[#7f8794] text-center shrink-0",children:"to"}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-8 text-[10px] uppercase tracking-[0.14em] text-[#9aa6b6] shrink-0 md:hidden",children:"Stop"}),i.jsx("input",{value:f.timeleft_stop,onChange:hn("timeleft_stop"),inputMode:"numeric",autoComplete:"off",placeholder:"",disabled:Be,className:"h-9 w-full md:w-[72px] rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 px-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed"})]}),i.jsx("span",{className:"w-8 text-[10px] uppercase tracking-[0.14em] text-[#9aa6b6] shrink-0 hidden md:block",children:"Stop"})]})}),f.timeleft!==""&&!vn&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:ln}),f.timeleft_stop!==""&&!Hn&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:Nn})]})]}),i.jsx(wO,{index:"4",title:"Exit Logic",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-between items-center gap-1",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:y?`TP (${f.tp_price_type==="cent"?"¢":"%"})`:`Take Profit (${f.tp_price_type==="cent"?"¢":"%"})`}),i.jsx(as,{content:"Close the bet when this target is reached. You can define the value as percentage (%) or cent (¢).",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsxs("select",{value:f.tp_type,onChange:hn("tp_type"),className:`${Be?"cursor-not-allowed":"cursor-pointer"} h-7 rounded-md bg-[#0d1218]/70 border border-[#202733] px-2 text-[10px] font-bold font-manrope tracking-[0.08em] text-[#dbe5f5] outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] disabled:opacity-80 disabled:cursor-not-allowed`,disabled:Be,children:[i.jsx("option",{value:"limit",children:"Limit"}),i.jsx("option",{value:"market",children:"Market"})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:f.tp,onChange:hn("tp"),onKeyDown:Nt,inputMode:"decimal",autoComplete:"off",placeholder:"",disabled:Be,className:"h-9 w-full rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 pr-[66px] pl-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed"}),f.bot_version==="v2"&&i.jsxs("select",{value:f.tp_price_type,onChange:hn("tp_price_type"),disabled:Be,className:`${Be?"cursor-not-allowed":"cursor-pointer"} absolute right-1 top-1/2 h-7 -translate-y-1/2 rounded-md border border-[#2a3444] bg-[#111827] px-2 text-[12px] font-bold tracking-[0.08em] text-[#dbe5f5] outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] disabled:opacity-80 disabled:cursor-not-allowed`,children:[i.jsx("option",{value:"percentage",children:"%"}),i.jsx("option",{value:"cent",children:"¢"})]})]})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex justify-between items-center gap-1",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:y?`SL (${f.sl_price_type==="cent"?"¢":"%"})`:`Stop Loss (${f.sl_price_type==="cent"?"¢":"%"})`}),i.jsx(as,{content:"Close the bet when this loss is reached. You can define the value as percentage (%) or cent (¢).",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsxs("select",{value:f.sl_type,onChange:hn("sl_type"),className:`${Be?"cursor-not-allowed":"cursor-pointer"} h-7 rounded-md bg-[#0d1218]/70 border border-[#202733] px-2 text-[10px] font-bold font-manrope tracking-[0.08em] text-[#dbe5f5] outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] disabled:opacity-80 disabled:cursor-not-allowed`,disabled:Be,children:[i.jsx("option",{value:"limit",children:"Limit"}),i.jsx("option",{value:"market",children:"Market"})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:f.sl,onChange:hn("sl"),onKeyDown:Nt,inputMode:"decimal",autoComplete:"off",placeholder:"",disabled:Be,className:"h-9 w-full rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 pr-[66px] pl-2.5 text-[11px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed"}),f.bot_version==="v2"&&i.jsxs("select",{value:f.sl_price_type,onChange:hn("sl_price_type"),disabled:Be,className:`${Be?"cursor-not-allowed":"cursor-pointer"} absolute right-1 top-1/2 h-7 -translate-y-1/2 rounded-md border border-[#2a3444] bg-[#111827] px-2 text-[12px] font-bold tracking-[0.08em] text-[#dbe5f5] outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] disabled:opacity-80 disabled:cursor-not-allowed`,children:[i.jsx("option",{value:"percentage",children:"%"}),i.jsx("option",{value:"cent",children:"¢"})]})]})]}),i.jsxs("div",{className:`flex flex-col mt-2 gap-3 ${!String(f.sl||"").trim()||f.sl_type==="market"?"opacity-50 cursor-not-allowed":""}`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#c9c9c9]",children:y?"SL MPD":"SL Min Price Distance"}),i.jsx(as,{content:"Maximum allowed execution price distance for Stop Loss. This field is only active after entering a Stop Loss (%) value and when SL Type is set to Limit (it stays disabled for Market).",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})]}),i.jsx("input",{value:f.min_pd_tpsl,onChange:hn("min_pd_tpsl"),onKeyDown:Nt,inputMode:"decimal",autoComplete:"off",placeholder:"",disabled:qt,className:`h-9 rounded-[8px] bg-[#0b1016]/50 border border-white/10 text-white/95 px-2.5 text-[11px] font-medium outline-none transition placeholder:text-[#5f6a79] disabled:opacity-90 disabled:cursor-not-allowed ${qt?"":"focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645]"}`}),f.min_pd_tpsl!==""&&!qt&&!jt&&i.jsx("div",{className:"text-[#FF797C] text-[11px] -mt-1",children:"Value must be between 0 and 99."})]})]})})]})]}),i.jsx("div",{className:y?"hidden":"min-w-0 order-1 lg:col-start-2",children:y?null:i.jsxs("div",{className:"flex flex-col gap-4 rounded-2xl border border-[#243245] bg-gradient-to-b from-[#141b26] to-[#0f141c] p-5",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("label",{className:"flex items-center text-xs uppercase tracking-[0.2em] text-[#c9c9c9]",children:["Private Key",i.jsx(Db,{})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("input",{type:v?"text":"password",value:f.pkey,onChange:hn("pkey"),placeholder:"0x...",disabled:Be,className:`h-9 flex-1 rounded-md bg-[#0d1218]/70 border text-white px-2.5 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed ${f.pkey===""||!f.pkey?CO:"border-[#202733]"}`}),i.jsx("button",{type:"button",onClick:()=>{f.pkey&&(navigator.clipboard.writeText(f.pkey),L("pkey"),setTimeout(()=>L(null),1500))},className:"relative h-7 w-7 min-w-7 rounded-md border border-[#202733] bg-[#0d1218]/70 text-[#c4c4c4] hover:border-[#2c3645] hover:text-white transition",title:"Copy Private Key",children:I==="pkey"?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"absolute left-1/2 top-1/2 w-3.5 h-3.5 -translate-x-1/2 -translate-y-1/2 text-[#2dd4bf]",children:i.jsx("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"})}):i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"absolute left-1/2 top-1/2 w-3.5 h-3.5 -translate-x-1/2 -translate-y-1/2",children:[i.jsx("path",{d:"M7 3.5A1.5 1.5 0 0 1 8.5 2h3.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12A1.5 1.5 0 0 1 17 6.622V12.5a1.5 1.5 0 0 1-1.5 1.5h-1v-3.379a3 3 0 0 0-.879-2.121L10.5 5.379A3 3 0 0 0 8.379 4.5H7v-1Z"}),i.jsx("path",{d:"M4.5 6A1.5 1.5 0 0 0 3 7.5v9A1.5 1.5 0 0 0 4.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L9.44 6.439A1.5 1.5 0 0 0 8.378 6H4.5Z"})]})}),i.jsx("button",{type:"button",onClick:()=>C(Gt=>!Gt),className:"h-7 px-2.5 rounded-md border border-[#202733] bg-[#0d1218]/70 text-[10px] uppercase tracking-[0.2em] text-[#c4c4c4] hover:border-[#2c3645] hover:text-white transition disabled:opacity-80 disabled:cursor-not-allowed",children:v?"Hide":"Show"})]}),f.pkey&&!rt&&i.jsx("span",{className:"text-[11px] text-[#ff6b6b]",children:"Please enter a valid private key."}),(f.pkey===""||!f.pkey)&&i.jsx("div",{className:"text-[#FF797C] text-[10px] -mt-1",children:"Private Key is required"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("label",{className:"flex items-center text-xs uppercase tracking-[0.2em] text-[#c9c9c9]",children:["Polymarket Address",i.jsx(Db,{})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("input",{type:"text",value:f.funder_address,onChange:hn("funder_address"),placeholder:"0x...",disabled:Be,className:`h-9 flex-1 rounded-md bg-[#0d1218]/70 border text-white px-2.5 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed ${f.funder_address===""||!f.funder_address?CO:"border-[#202733]"}`}),i.jsx("button",{type:"button",onClick:()=>{f.funder_address&&(navigator.clipboard.writeText(f.funder_address),L("funder"),setTimeout(()=>L(null),1500))},className:"relative h-7 w-7 min-w-7 rounded-md border border-[#202733] bg-[#0d1218]/70 text-[#c4c4c4] hover:border-[#2c3645] hover:text-white transition",title:"Copy Funder Address",children:I==="funder"?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"absolute left-1/2 top-1/2 w-3.5 h-3.5 -translate-x-1/2 -translate-y-1/2 text-[#2dd4bf]",children:i.jsx("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"})}):i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"absolute left-1/2 top-1/2 w-3.5 h-3.5 -translate-x-1/2 -translate-y-1/2",children:[i.jsx("path",{d:"M7 3.5A1.5 1.5 0 0 1 8.5 2h3.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12A1.5 1.5 0 0 1 17 6.622V12.5a1.5 1.5 0 0 1-1.5 1.5h-1v-3.379a3 3 0 0 0-.879-2.121L10.5 5.379A3 3 0 0 0 8.379 4.5H7v-1Z"}),i.jsx("path",{d:"M4.5 6A1.5 1.5 0 0 0 3 7.5v9A1.5 1.5 0 0 0 4.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L9.44 6.439A1.5 1.5 0 0 0 8.378 6H4.5Z"})]})})]}),f.funder_address&&!dn&&i.jsx("span",{className:"text-[11px] text-[#ff6b6b]",children:"Invalid address. Format: 0x + 40 hex chars."}),(f.funder_address===""||!f.funder_address)&&i.jsx("div",{className:"text-[#FF797C] text-[10px] -mt-1",children:"Polymarket Address is required"})]}),i.jsxs("div",{className:"flex flex-col gap-2 rounded-xl border border-[#2b2f36] bg-[#10151d] p-3",children:[i.jsxs("div",{className:"flex flex-col items-start gap-1 w-full",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[i.jsx("span",{className:"text-xs uppercase tracking-[0.2em] text-[#c9c9c9]",children:"API Credentials"}),i.jsx("button",{type:"button",onClick:()=>T(Gt=>!Gt),className:"h-7 px-3 rounded-md border border-[#202733] bg-[#0d1218]/70 text-[10px] uppercase tracking-[0.2em] text-[#c4c4c4] hover:border-[#2c3645] hover:text-white transition",children:S?"Hide":"Show"})]}),i.jsx("p",{className:"text-[11px] text-[#9aa4b2]",children:"This is required for the automated claim process."})]}),i.jsxs("div",{className:"flex flex-col gap-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://polymarket.com/settings?tab=builder",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsx("input",{type:S?"text":"password",value:f.api_key,onChange:hn("api_key"),placeholder:"API key",disabled:Be,className:"h-9 rounded-md bg-[#0d1218]/70 border border-[#202733] text-white px-4 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Secret"}),i.jsx("input",{type:S?"text":"password",value:f.api_secret,onChange:hn("api_secret"),placeholder:"API secret",disabled:Be,className:"h-9 rounded-md bg-[#0d1218]/70 border border-[#202733] text-white px-4 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Passphrase"}),i.jsx("input",{type:S?"text":"password",value:f.api_pass,onChange:hn("api_pass"),placeholder:"API passphrase",disabled:Be,className:"h-9 rounded-md bg-[#0d1218]/70 border border-[#202733] text-white px-4 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-1 focus:ring-white/5 hover:border-[#2c3645] placeholder:text-[#5f6a79] disabled:opacity-80 disabled:cursor-not-allowed"})]})]}),e?i.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[i.jsx("button",{type:"submit",disabled:F||O||!y&&!wn,className:`h-10 px-6 rounded-lg text-white text-[13px] font-semibold tracking-[0.02em] transition ${y?"bg-[#ff5f2c]":!y&&!wn?"bg-[#2a2a2a] border-[#3a3a3a]":"bg-[#7446FF] border border-[#8861FF]"} ${F||O||!y&&!wn?"opacity-60 cursor-not-allowed":"hover:opacity-90"}`,children:F||O?"Please wait...":y?"Stop":"Start"}),i.jsx("span",{className:"text-xs text-[#7a7a7a]",children:y?"Bot is running. Click to stop.":"Click start to run the bot."})]}):i.jsx("button",{type:"button",onClick:()=>t(!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"}),Q&&i.jsx("div",{className:"text-xs text-[#ff6b6b] -mt-1",children:Q})]})}),i.jsx("div",{className:`min-w-0 ${y?"order-1 lg:col-start-2":"order-2 lg:col-span-2"}`,children:i.jsxs("div",{className:"flex flex-col gap-3",children:[mt,y&&i.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-[#243245] bg-gradient-to-b from-[#141b26] to-[#0f141c] p-4",children:[i.jsx("button",{type:"submit",disabled:F||O,className:`h-10 px-6 rounded-lg text-white text-[13px] font-semibold tracking-[0.02em] transition ${F||O?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#ff5f2c] hover:opacity-90"}`,children:F||O?"Please wait...":"Stop"}),i.jsx("span",{className:"text-xs text-[#7a7a7a]",children:"Bot is running. Click to stop."}),Q&&i.jsx("div",{className:"text-xs text-[#ff6b6b]",children:Q})]})]})})]})]})})]})},NO="#67FFBD",KKe=({code:t,onCodeChange:e,onSubmit:n,loading:r,loadingCheckAccount:s,message:a,connected:o})=>{const l=r||s||!t.trim(),{setSignModalOpen:c}=h.useContext(Qr);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(Ya.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(ka,{})]}):i.jsx("div",{style:{backgroundImage:`url(${window.location.pathname==="/polymarket"?Fct:Oct})`,backgroundSize:"cover",backgroundPosition:"center"},className:"relative h-screen w-full flex justify-center items-center overflow-hidden rounded-[16px]",children:i.jsxs(Ya.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 -mt-10",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:g2,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[260px] object-cover bg-black"},g2)]}),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:"Polymarket 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:u=>e(u.target.value.toUpperCase()),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),n())},placeholder:`${window.location.pathname==="/polymarket"?"POLY-XXXXX":"POLYDCA-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]"}),o?i.jsx("button",{type:"button",onClick:n,disabled:l,className:`h-10 px-4 rounded-md text-[13px] font-semibold transition-colors ${l?"bg-[#101613] text-white/40 cursor-not-allowed":"text-black hover:opacity-90"}`,style:l?void 0:{backgroundColor:NO},children:r?"Checking…":"Access"}):i.jsx("button",{type:"button",onClick:()=>c(!0),className:"inline-flex items-center justify-center h-10 px-4 rounded-md text-[13px] font-semibold border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})]}),(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})]})]})]})})})},mCn=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setMushboomerETH:n,setIsWhitelist:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setHyperToken:l,setHyperAddress:c}=h.useContext(Qr),[u,d]=h.useState(!1),[f,x]=h.useState(!1),[g,y]=h.useState(""),[v,C]=h.useState(!1),[S,T]=h.useState(""),[I,L]=h.useState(!1);h.useEffect(()=>{const $=localStorage.getItem("hyperToken"),O=localStorage.getItem("hyperAddress");d(!!($&&O));const U=setInterval(()=>{const Y=localStorage.getItem("hyperToken"),re=localStorage.getItem("hyperAddress");d(!!(Y&&re))},800);return()=>clearInterval(U)},[]),h.useEffect(()=>{(async()=>{var Y,re;const O=window.localStorage.getItem("hyperToken"),U=window.localStorage.getItem("hyperAddress");if(!(!O||!U))try{L(!0);const Q=await bi(U.toLowerCase(),O);Q!=null&&Q.success?(t(Q==null?void 0:Q.telegram_chat_id),e(Q==null?void 0:Q.subscriber_role),n((Y=Q==null?void 0:Q.mushboomer_counts)==null?void 0:Y.eth),s((re=Q==null?void 0:Q.mushboomer_counts)==null?void 0:re.sol),a(Q==null?void 0:Q.referral_code),o(Q==null?void 0:Q.refcode),r(Q==null?void 0:Q.whitelist),x(Q==null?void 0:Q.polymarket_alpha_code),L(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),l(""),c(""),L(!1))}catch(Q){console.error("Token verification error:",Q),L(!1)}})()},[u]);const F=async()=>{var U,Y,re,Q;const $=window.localStorage.getItem("hyperToken"),O=window.localStorage.getItem("hyperAddress");if(!g.trim()){fn.error("Please enter your alpha code");return}if(!$||!O){setSignModalOpen(!0);return}C(!0),T("");try{const q={address:O==null?void 0:O.toLowerCase(),token:$,alpha_code:g.trim(),source_market:"polymarket",app_type:"side_bot"},fe=(await Ns.post("https://dextrabothypev2.nftinit.io/api/subscriber/alpha_code/set_polymarket/",q)).data||{};if(fe.success){const G=fe.message||"Alpha code added successfully";fn.success(`${G}`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}}),T(G),x(!0)}else{const G=fe.error_message||fe.message||"This alpha code is invalid";fn.success(`${G}.`,{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(G)}}catch(q){const te=((Y=(U=q==null?void 0:q.response)==null?void 0:U.data)==null?void 0:Y.error_message)||((Q=(re=q==null?void 0:q.response)==null?void 0:re.data)==null?void 0:Q.message)||q.message||"Failed to validate alpha code";fn.success(`${te}.`,{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(te)}finally{C(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{children:[i.jsx("title",{children:"Polymarket | Automated Market Making | Dextrabot"}),i.jsx("meta",{name:"description",content:`Automate market making on PolyMarket. Generate trading volume and provide liquidity 24/7.
`}),i.jsx("meta",{property:"og:title",content:"PolyMarket MM | Automated Market Making | Dextrabot"}),i.jsx("meta",{property:"og:description",content:`Automate market making on PolyMarket. 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/polymarket"})]})}),i.jsx("div",{style:{minHeight:"calc(100vh - 5rem)"},className:"flex justify-center items-start w-full h-full pb-6 bg-gradient-to-b from-[#0b0f14] via-[#07090c] to-[#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 px-2",children:f&&u?i.jsx(pCn,{}):i.jsx(KKe,{code:g,onCodeChange:y,onSubmit:F,loading:v,loadingCheckAccount:I,message:S,connected:u})})})]})},xCn=({open:t,setOpen:e,makerStatus:n,isStatusWallet:r,info:s,modalLoading:a,active:o,modalDataInfo:l})=>{const c=l||{},u=[(c==null?void 0:c.spread)&&`Spread: ${c.spread} bps`,(c==null?void 0:c.per_side)&&`Active Orders: ${c.per_side} per side`,(c==null?void 0:c.order_size)&&`Order size: ${c.order_size} ${c.coin?c.coin:""}`.trim(),(c==null?void 0:c.max_per_side)&&`Max net position: ${c.max_per_side} orders`,(c==null?void 0:c.tp_sl)&&`TP-SL: ${c.tp_sl} bps`,(c==null?void 0:c.budget)&&`Budget: ${c.budget} loss limit`,(c==null?void 0:c.leverage)&&`Leverage: ${c.leverage}x`].filter(Boolean);return i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{transition:!0,className:"relative transform overflow-hidden bg-gradient-to-b from-[#1c1c1f] to-[#0f0f12] text-left shadow-2xl shadow-black/50 border border-[#2a2a32] 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-[30px]",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-7 w-[420px] max-w-[90vw] h-max relative rounded-[30px] pt-8 pb-8 px-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-4 top-4",children:i.jsx("span",{className:"w-9 h-9 rounded-full p-[10px] flex justify-center items-center bg-white/5 hover:bg-white/10 border border-white/10 transition",children:i.jsx("img",{className:"w-full h-full",src:Na})})}),i.jsx("div",{className:"pt-2",children:i.jsx("div",{className:"w-20 h-20 rounded-3xl bg-gradient-to-tr from-[#7af8d3] via-[#7a7eff] to-[#ff69d6] p-[0.2px] shadow-[0_10px_40px_rgba(0,0,0,0.55)]",children:i.jsx("div",{className:"w-full h-full rounded-[26px] bg-[#111118] flex items-center justify-center",children:i.jsx("img",{src:Hi,alt:"",className:"w-[70%] h-[70%] object-contain drop-shadow-[0_0_12px_rgba(255,255,255,0.35)]"})})})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-3",children:[i.jsx("div",{className:"w-full text-center text-white text-[22px] font-semibold leading-7",children:c!=null&&c.coin?`${c.coin} Market Maker`:"Are you sure?"}),i.jsx("div",{className:"w-full text-center text-white/70 text-[15px] font-medium leading-5",children:o?"Do you want to stop this StandX operation?":"Do you want to start this StandX operation?"}),(u==null?void 0:u.length)>0&&i.jsx("ul",{className:"mt-3 w-full max-w-[360px] space-y-2",children:u==null?void 0:u.map((d,f)=>{const x=d.split(":"),g=x.length>1,y=g?x[0].trim():"",v=g?x.slice(1).join(":").trim():d;return i.jsxs("li",{className:"flex items-center gap-3 px-2",children:[i.jsx("span",{className:"h-[10px] w-[10px] rounded-full bg-[#67ffbd] shadow-[0_0_10px_rgba(103,255,189,1)]"}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g&&i.jsxs("span",{className:"text-[14px] font-medium text-white/75",children:[y,":"]}),i.jsx("span",{className:"text-[14px] font-semibold text-white px-3 py-1 rounded-xl bg-white/6 border border-white/10 backdrop-blur-sm shadow-[0_8px_24px_rgba(0,0,0,0.25)]",children:v})]})]},f)})})]}),i.jsxs("div",{className:"flex items-center justify-center gap-3 w-full max-w-[320px] pt-1",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"h-10 px-5 rounded-xl border border-white/25 bg-white/5 hover:bg-white/10 text-white text-[14px] font-semibold inline-flex items-center justify-center cursor-pointer transition",children:"Cancel"}),i.jsx("div",{onClick:d=>{a||(d.preventDefault(),s==="settings"?n():n(r))},className:`h-10 px-6 rounded-xl border flex items-center justify-center cursor-pointer transition text-[14px] font-semibold ${a?"bg-[#444] border-[#666] text-white/70 cursor-not-allowed":o?"bg-[#ff4c4c] border-[#ff8080] hover:brightness-110 text-white":"bg-gradient-to-r from-[#7c5bff] to-[#a14dff] border-transparent shadow-[0_10px_30px_rgba(114,92,255,0.5)] hover:brightness-110 text-white"}`,children:a?i.jsx("span",{className:"animate-pulse",children:"Loading..."}):i.jsx("span",{children:o?"Stop":"Start"})})]})]})})})})})]})};function gCn(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var HZ={exports:{}};const bCn={},yCn=Object.freeze(Object.defineProperty({__proto__:null,default:bCn},Symbol.toStringTag,{value:"Module"})),vCn=CQe(yCn);var CAe;function wCn(){return CAe||(CAe=1,function(t){(function(e){var n=function(ze){var xe,Ge=new Float64Array(16);if(ze)for(xe=0;xe<ze.length;xe++)Ge[xe]=ze[xe];return Ge},r=function(){throw new Error("no PRNG")},s=new Uint8Array(16),a=new Uint8Array(32);a[0]=9;var o=n(),l=n([1]),c=n([56129,1]),u=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),g=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function y(ze,xe,Ge,_e){ze[xe]=Ge>>24&255,ze[xe+1]=Ge>>16&255,ze[xe+2]=Ge>>8&255,ze[xe+3]=Ge&255,ze[xe+4]=_e>>24&255,ze[xe+5]=_e>>16&255,ze[xe+6]=_e>>8&255,ze[xe+7]=_e&255}function v(ze,xe,Ge,_e,Be){var qt,It=0;for(qt=0;qt<Be;qt++)It|=ze[xe+qt]^Ge[_e+qt];return(1&It-1>>>8)-1}function C(ze,xe,Ge,_e){return v(ze,xe,Ge,_e,16)}function S(ze,xe,Ge,_e){return v(ze,xe,Ge,_e,32)}function T(ze,xe,Ge,_e){for(var Be=_e[0]&255|(_e[1]&255)<<8|(_e[2]&255)<<16|(_e[3]&255)<<24,qt=Ge[0]&255|(Ge[1]&255)<<8|(Ge[2]&255)<<16|(Ge[3]&255)<<24,It=Ge[4]&255|(Ge[5]&255)<<8|(Ge[6]&255)<<16|(Ge[7]&255)<<24,mt=Ge[8]&255|(Ge[9]&255)<<8|(Ge[10]&255)<<16|(Ge[11]&255)<<24,Ft=Ge[12]&255|(Ge[13]&255)<<8|(Ge[14]&255)<<16|(Ge[15]&255)<<24,Tn=_e[4]&255|(_e[5]&255)<<8|(_e[6]&255)<<16|(_e[7]&255)<<24,kn=xe[0]&255|(xe[1]&255)<<8|(xe[2]&255)<<16|(xe[3]&255)<<24,Gt=xe[4]&255|(xe[5]&255)<<8|(xe[6]&255)<<16|(xe[7]&255)<<24,mn=xe[8]&255|(xe[9]&255)<<8|(xe[10]&255)<<16|(xe[11]&255)<<24,gt=xe[12]&255|(xe[13]&255)<<8|(xe[14]&255)<<16|(xe[15]&255)<<24,Wt=_e[8]&255|(_e[9]&255)<<8|(_e[10]&255)<<16|(_e[11]&255)<<24,jn=Ge[16]&255|(Ge[17]&255)<<8|(Ge[18]&255)<<16|(Ge[19]&255)<<24,kt=Ge[20]&255|(Ge[21]&255)<<8|(Ge[22]&255)<<16|(Ge[23]&255)<<24,cn=Ge[24]&255|(Ge[25]&255)<<8|(Ge[26]&255)<<16|(Ge[27]&255)<<24,Ce=Ge[28]&255|(Ge[29]&255)<<8|(Ge[30]&255)<<16|(Ge[31]&255)<<24,m=_e[12]&255|(_e[13]&255)<<8|(_e[14]&255)<<16|(_e[15]&255)<<24,p=Be,N=qt,A=It,k=mt,P=Ft,D=Tn,V=kn,Z=Gt,ce=mn,ue=gt,me=Wt,Ne=jn,Ie=kt,Le=cn,Xe=Ce,Oe=m,$e,ae=0;ae<20;ae+=2)$e=p+Ie|0,P^=$e<<7|$e>>>25,$e=P+p|0,ce^=$e<<9|$e>>>23,$e=ce+P|0,Ie^=$e<<13|$e>>>19,$e=Ie+ce|0,p^=$e<<18|$e>>>14,$e=D+N|0,ue^=$e<<7|$e>>>25,$e=ue+D|0,Le^=$e<<9|$e>>>23,$e=Le+ue|0,N^=$e<<13|$e>>>19,$e=N+Le|0,D^=$e<<18|$e>>>14,$e=me+V|0,Xe^=$e<<7|$e>>>25,$e=Xe+me|0,A^=$e<<9|$e>>>23,$e=A+Xe|0,V^=$e<<13|$e>>>19,$e=V+A|0,me^=$e<<18|$e>>>14,$e=Oe+Ne|0,k^=$e<<7|$e>>>25,$e=k+Oe|0,Z^=$e<<9|$e>>>23,$e=Z+k|0,Ne^=$e<<13|$e>>>19,$e=Ne+Z|0,Oe^=$e<<18|$e>>>14,$e=p+k|0,N^=$e<<7|$e>>>25,$e=N+p|0,A^=$e<<9|$e>>>23,$e=A+N|0,k^=$e<<13|$e>>>19,$e=k+A|0,p^=$e<<18|$e>>>14,$e=D+P|0,V^=$e<<7|$e>>>25,$e=V+D|0,Z^=$e<<9|$e>>>23,$e=Z+V|0,P^=$e<<13|$e>>>19,$e=P+Z|0,D^=$e<<18|$e>>>14,$e=me+ue|0,Ne^=$e<<7|$e>>>25,$e=Ne+me|0,ce^=$e<<9|$e>>>23,$e=ce+Ne|0,ue^=$e<<13|$e>>>19,$e=ue+ce|0,me^=$e<<18|$e>>>14,$e=Oe+Xe|0,Ie^=$e<<7|$e>>>25,$e=Ie+Oe|0,Le^=$e<<9|$e>>>23,$e=Le+Ie|0,Xe^=$e<<13|$e>>>19,$e=Xe+Le|0,Oe^=$e<<18|$e>>>14;p=p+Be|0,N=N+qt|0,A=A+It|0,k=k+mt|0,P=P+Ft|0,D=D+Tn|0,V=V+kn|0,Z=Z+Gt|0,ce=ce+mn|0,ue=ue+gt|0,me=me+Wt|0,Ne=Ne+jn|0,Ie=Ie+kt|0,Le=Le+cn|0,Xe=Xe+Ce|0,Oe=Oe+m|0,ze[0]=p>>>0&255,ze[1]=p>>>8&255,ze[2]=p>>>16&255,ze[3]=p>>>24&255,ze[4]=N>>>0&255,ze[5]=N>>>8&255,ze[6]=N>>>16&255,ze[7]=N>>>24&255,ze[8]=A>>>0&255,ze[9]=A>>>8&255,ze[10]=A>>>16&255,ze[11]=A>>>24&255,ze[12]=k>>>0&255,ze[13]=k>>>8&255,ze[14]=k>>>16&255,ze[15]=k>>>24&255,ze[16]=P>>>0&255,ze[17]=P>>>8&255,ze[18]=P>>>16&255,ze[19]=P>>>24&255,ze[20]=D>>>0&255,ze[21]=D>>>8&255,ze[22]=D>>>16&255,ze[23]=D>>>24&255,ze[24]=V>>>0&255,ze[25]=V>>>8&255,ze[26]=V>>>16&255,ze[27]=V>>>24&255,ze[28]=Z>>>0&255,ze[29]=Z>>>8&255,ze[30]=Z>>>16&255,ze[31]=Z>>>24&255,ze[32]=ce>>>0&255,ze[33]=ce>>>8&255,ze[34]=ce>>>16&255,ze[35]=ce>>>24&255,ze[36]=ue>>>0&255,ze[37]=ue>>>8&255,ze[38]=ue>>>16&255,ze[39]=ue>>>24&255,ze[40]=me>>>0&255,ze[41]=me>>>8&255,ze[42]=me>>>16&255,ze[43]=me>>>24&255,ze[44]=Ne>>>0&255,ze[45]=Ne>>>8&255,ze[46]=Ne>>>16&255,ze[47]=Ne>>>24&255,ze[48]=Ie>>>0&255,ze[49]=Ie>>>8&255,ze[50]=Ie>>>16&255,ze[51]=Ie>>>24&255,ze[52]=Le>>>0&255,ze[53]=Le>>>8&255,ze[54]=Le>>>16&255,ze[55]=Le>>>24&255,ze[56]=Xe>>>0&255,ze[57]=Xe>>>8&255,ze[58]=Xe>>>16&255,ze[59]=Xe>>>24&255,ze[60]=Oe>>>0&255,ze[61]=Oe>>>8&255,ze[62]=Oe>>>16&255,ze[63]=Oe>>>24&255}function I(ze,xe,Ge,_e){for(var Be=_e[0]&255|(_e[1]&255)<<8|(_e[2]&255)<<16|(_e[3]&255)<<24,qt=Ge[0]&255|(Ge[1]&255)<<8|(Ge[2]&255)<<16|(Ge[3]&255)<<24,It=Ge[4]&255|(Ge[5]&255)<<8|(Ge[6]&255)<<16|(Ge[7]&255)<<24,mt=Ge[8]&255|(Ge[9]&255)<<8|(Ge[10]&255)<<16|(Ge[11]&255)<<24,Ft=Ge[12]&255|(Ge[13]&255)<<8|(Ge[14]&255)<<16|(Ge[15]&255)<<24,Tn=_e[4]&255|(_e[5]&255)<<8|(_e[6]&255)<<16|(_e[7]&255)<<24,kn=xe[0]&255|(xe[1]&255)<<8|(xe[2]&255)<<16|(xe[3]&255)<<24,Gt=xe[4]&255|(xe[5]&255)<<8|(xe[6]&255)<<16|(xe[7]&255)<<24,mn=xe[8]&255|(xe[9]&255)<<8|(xe[10]&255)<<16|(xe[11]&255)<<24,gt=xe[12]&255|(xe[13]&255)<<8|(xe[14]&255)<<16|(xe[15]&255)<<24,Wt=_e[8]&255|(_e[9]&255)<<8|(_e[10]&255)<<16|(_e[11]&255)<<24,jn=Ge[16]&255|(Ge[17]&255)<<8|(Ge[18]&255)<<16|(Ge[19]&255)<<24,kt=Ge[20]&255|(Ge[21]&255)<<8|(Ge[22]&255)<<16|(Ge[23]&255)<<24,cn=Ge[24]&255|(Ge[25]&255)<<8|(Ge[26]&255)<<16|(Ge[27]&255)<<24,Ce=Ge[28]&255|(Ge[29]&255)<<8|(Ge[30]&255)<<16|(Ge[31]&255)<<24,m=_e[12]&255|(_e[13]&255)<<8|(_e[14]&255)<<16|(_e[15]&255)<<24,p=Be,N=qt,A=It,k=mt,P=Ft,D=Tn,V=kn,Z=Gt,ce=mn,ue=gt,me=Wt,Ne=jn,Ie=kt,Le=cn,Xe=Ce,Oe=m,$e,ae=0;ae<20;ae+=2)$e=p+Ie|0,P^=$e<<7|$e>>>25,$e=P+p|0,ce^=$e<<9|$e>>>23,$e=ce+P|0,Ie^=$e<<13|$e>>>19,$e=Ie+ce|0,p^=$e<<18|$e>>>14,$e=D+N|0,ue^=$e<<7|$e>>>25,$e=ue+D|0,Le^=$e<<9|$e>>>23,$e=Le+ue|0,N^=$e<<13|$e>>>19,$e=N+Le|0,D^=$e<<18|$e>>>14,$e=me+V|0,Xe^=$e<<7|$e>>>25,$e=Xe+me|0,A^=$e<<9|$e>>>23,$e=A+Xe|0,V^=$e<<13|$e>>>19,$e=V+A|0,me^=$e<<18|$e>>>14,$e=Oe+Ne|0,k^=$e<<7|$e>>>25,$e=k+Oe|0,Z^=$e<<9|$e>>>23,$e=Z+k|0,Ne^=$e<<13|$e>>>19,$e=Ne+Z|0,Oe^=$e<<18|$e>>>14,$e=p+k|0,N^=$e<<7|$e>>>25,$e=N+p|0,A^=$e<<9|$e>>>23,$e=A+N|0,k^=$e<<13|$e>>>19,$e=k+A|0,p^=$e<<18|$e>>>14,$e=D+P|0,V^=$e<<7|$e>>>25,$e=V+D|0,Z^=$e<<9|$e>>>23,$e=Z+V|0,P^=$e<<13|$e>>>19,$e=P+Z|0,D^=$e<<18|$e>>>14,$e=me+ue|0,Ne^=$e<<7|$e>>>25,$e=Ne+me|0,ce^=$e<<9|$e>>>23,$e=ce+Ne|0,ue^=$e<<13|$e>>>19,$e=ue+ce|0,me^=$e<<18|$e>>>14,$e=Oe+Xe|0,Ie^=$e<<7|$e>>>25,$e=Ie+Oe|0,Le^=$e<<9|$e>>>23,$e=Le+Ie|0,Xe^=$e<<13|$e>>>19,$e=Xe+Le|0,Oe^=$e<<18|$e>>>14;ze[0]=p>>>0&255,ze[1]=p>>>8&255,ze[2]=p>>>16&255,ze[3]=p>>>24&255,ze[4]=D>>>0&255,ze[5]=D>>>8&255,ze[6]=D>>>16&255,ze[7]=D>>>24&255,ze[8]=me>>>0&255,ze[9]=me>>>8&255,ze[10]=me>>>16&255,ze[11]=me>>>24&255,ze[12]=Oe>>>0&255,ze[13]=Oe>>>8&255,ze[14]=Oe>>>16&255,ze[15]=Oe>>>24&255,ze[16]=V>>>0&255,ze[17]=V>>>8&255,ze[18]=V>>>16&255,ze[19]=V>>>24&255,ze[20]=Z>>>0&255,ze[21]=Z>>>8&255,ze[22]=Z>>>16&255,ze[23]=Z>>>24&255,ze[24]=ce>>>0&255,ze[25]=ce>>>8&255,ze[26]=ce>>>16&255,ze[27]=ce>>>24&255,ze[28]=ue>>>0&255,ze[29]=ue>>>8&255,ze[30]=ue>>>16&255,ze[31]=ue>>>24&255}function L(ze,xe,Ge,_e){T(ze,xe,Ge,_e)}function F(ze,xe,Ge,_e){I(ze,xe,Ge,_e)}var $=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function O(ze,xe,Ge,_e,Be,qt,It){var mt=new Uint8Array(16),Ft=new Uint8Array(64),Tn,kn;for(kn=0;kn<16;kn++)mt[kn]=0;for(kn=0;kn<8;kn++)mt[kn]=qt[kn];for(;Be>=64;){for(L(Ft,mt,It,$),kn=0;kn<64;kn++)ze[xe+kn]=Ge[_e+kn]^Ft[kn];for(Tn=1,kn=8;kn<16;kn++)Tn=Tn+(mt[kn]&255)|0,mt[kn]=Tn&255,Tn>>>=8;Be-=64,xe+=64,_e+=64}if(Be>0)for(L(Ft,mt,It,$),kn=0;kn<Be;kn++)ze[xe+kn]=Ge[_e+kn]^Ft[kn];return 0}function U(ze,xe,Ge,_e,Be){var qt=new Uint8Array(16),It=new Uint8Array(64),mt,Ft;for(Ft=0;Ft<16;Ft++)qt[Ft]=0;for(Ft=0;Ft<8;Ft++)qt[Ft]=_e[Ft];for(;Ge>=64;){for(L(It,qt,Be,$),Ft=0;Ft<64;Ft++)ze[xe+Ft]=It[Ft];for(mt=1,Ft=8;Ft<16;Ft++)mt=mt+(qt[Ft]&255)|0,qt[Ft]=mt&255,mt>>>=8;Ge-=64,xe+=64}if(Ge>0)for(L(It,qt,Be,$),Ft=0;Ft<Ge;Ft++)ze[xe+Ft]=It[Ft];return 0}function Y(ze,xe,Ge,_e,Be){var qt=new Uint8Array(32);F(qt,_e,Be,$);for(var It=new Uint8Array(8),mt=0;mt<8;mt++)It[mt]=_e[mt+16];return U(ze,xe,Ge,It,qt)}function re(ze,xe,Ge,_e,Be,qt,It){var mt=new Uint8Array(32);F(mt,qt,It,$);for(var Ft=new Uint8Array(8),Tn=0;Tn<8;Tn++)Ft[Tn]=qt[Tn+16];return O(ze,xe,Ge,_e,Be,Ft,mt)}var Q=function(ze){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var xe,Ge,_e,Be,qt,It,mt,Ft;xe=ze[0]&255|(ze[1]&255)<<8,this.r[0]=xe&8191,Ge=ze[2]&255|(ze[3]&255)<<8,this.r[1]=(xe>>>13|Ge<<3)&8191,_e=ze[4]&255|(ze[5]&255)<<8,this.r[2]=(Ge>>>10|_e<<6)&7939,Be=ze[6]&255|(ze[7]&255)<<8,this.r[3]=(_e>>>7|Be<<9)&8191,qt=ze[8]&255|(ze[9]&255)<<8,this.r[4]=(Be>>>4|qt<<12)&255,this.r[5]=qt>>>1&8190,It=ze[10]&255|(ze[11]&255)<<8,this.r[6]=(qt>>>14|It<<2)&8191,mt=ze[12]&255|(ze[13]&255)<<8,this.r[7]=(It>>>11|mt<<5)&8065,Ft=ze[14]&255|(ze[15]&255)<<8,this.r[8]=(mt>>>8|Ft<<8)&8191,this.r[9]=Ft>>>5&127,this.pad[0]=ze[16]&255|(ze[17]&255)<<8,this.pad[1]=ze[18]&255|(ze[19]&255)<<8,this.pad[2]=ze[20]&255|(ze[21]&255)<<8,this.pad[3]=ze[22]&255|(ze[23]&255)<<8,this.pad[4]=ze[24]&255|(ze[25]&255)<<8,this.pad[5]=ze[26]&255|(ze[27]&255)<<8,this.pad[6]=ze[28]&255|(ze[29]&255)<<8,this.pad[7]=ze[30]&255|(ze[31]&255)<<8};Q.prototype.blocks=function(ze,xe,Ge){for(var _e=this.fin?0:2048,Be,qt,It,mt,Ft,Tn,kn,Gt,mn,gt,Wt,jn,kt,cn,Ce,m,p,N,A,k=this.h[0],P=this.h[1],D=this.h[2],V=this.h[3],Z=this.h[4],ce=this.h[5],ue=this.h[6],me=this.h[7],Ne=this.h[8],Ie=this.h[9],Le=this.r[0],Xe=this.r[1],Oe=this.r[2],$e=this.r[3],ae=this.r[4],he=this.r[5],Pe=this.r[6],Ve=this.r[7],Te=this.r[8],Ze=this.r[9];Ge>=16;)Be=ze[xe+0]&255|(ze[xe+1]&255)<<8,k+=Be&8191,qt=ze[xe+2]&255|(ze[xe+3]&255)<<8,P+=(Be>>>13|qt<<3)&8191,It=ze[xe+4]&255|(ze[xe+5]&255)<<8,D+=(qt>>>10|It<<6)&8191,mt=ze[xe+6]&255|(ze[xe+7]&255)<<8,V+=(It>>>7|mt<<9)&8191,Ft=ze[xe+8]&255|(ze[xe+9]&255)<<8,Z+=(mt>>>4|Ft<<12)&8191,ce+=Ft>>>1&8191,Tn=ze[xe+10]&255|(ze[xe+11]&255)<<8,ue+=(Ft>>>14|Tn<<2)&8191,kn=ze[xe+12]&255|(ze[xe+13]&255)<<8,me+=(Tn>>>11|kn<<5)&8191,Gt=ze[xe+14]&255|(ze[xe+15]&255)<<8,Ne+=(kn>>>8|Gt<<8)&8191,Ie+=Gt>>>5|_e,mn=0,gt=mn,gt+=k*Le,gt+=P*(5*Ze),gt+=D*(5*Te),gt+=V*(5*Ve),gt+=Z*(5*Pe),mn=gt>>>13,gt&=8191,gt+=ce*(5*he),gt+=ue*(5*ae),gt+=me*(5*$e),gt+=Ne*(5*Oe),gt+=Ie*(5*Xe),mn+=gt>>>13,gt&=8191,Wt=mn,Wt+=k*Xe,Wt+=P*Le,Wt+=D*(5*Ze),Wt+=V*(5*Te),Wt+=Z*(5*Ve),mn=Wt>>>13,Wt&=8191,Wt+=ce*(5*Pe),Wt+=ue*(5*he),Wt+=me*(5*ae),Wt+=Ne*(5*$e),Wt+=Ie*(5*Oe),mn+=Wt>>>13,Wt&=8191,jn=mn,jn+=k*Oe,jn+=P*Xe,jn+=D*Le,jn+=V*(5*Ze),jn+=Z*(5*Te),mn=jn>>>13,jn&=8191,jn+=ce*(5*Ve),jn+=ue*(5*Pe),jn+=me*(5*he),jn+=Ne*(5*ae),jn+=Ie*(5*$e),mn+=jn>>>13,jn&=8191,kt=mn,kt+=k*$e,kt+=P*Oe,kt+=D*Xe,kt+=V*Le,kt+=Z*(5*Ze),mn=kt>>>13,kt&=8191,kt+=ce*(5*Te),kt+=ue*(5*Ve),kt+=me*(5*Pe),kt+=Ne*(5*he),kt+=Ie*(5*ae),mn+=kt>>>13,kt&=8191,cn=mn,cn+=k*ae,cn+=P*$e,cn+=D*Oe,cn+=V*Xe,cn+=Z*Le,mn=cn>>>13,cn&=8191,cn+=ce*(5*Ze),cn+=ue*(5*Te),cn+=me*(5*Ve),cn+=Ne*(5*Pe),cn+=Ie*(5*he),mn+=cn>>>13,cn&=8191,Ce=mn,Ce+=k*he,Ce+=P*ae,Ce+=D*$e,Ce+=V*Oe,Ce+=Z*Xe,mn=Ce>>>13,Ce&=8191,Ce+=ce*Le,Ce+=ue*(5*Ze),Ce+=me*(5*Te),Ce+=Ne*(5*Ve),Ce+=Ie*(5*Pe),mn+=Ce>>>13,Ce&=8191,m=mn,m+=k*Pe,m+=P*he,m+=D*ae,m+=V*$e,m+=Z*Oe,mn=m>>>13,m&=8191,m+=ce*Xe,m+=ue*Le,m+=me*(5*Ze),m+=Ne*(5*Te),m+=Ie*(5*Ve),mn+=m>>>13,m&=8191,p=mn,p+=k*Ve,p+=P*Pe,p+=D*he,p+=V*ae,p+=Z*$e,mn=p>>>13,p&=8191,p+=ce*Oe,p+=ue*Xe,p+=me*Le,p+=Ne*(5*Ze),p+=Ie*(5*Te),mn+=p>>>13,p&=8191,N=mn,N+=k*Te,N+=P*Ve,N+=D*Pe,N+=V*he,N+=Z*ae,mn=N>>>13,N&=8191,N+=ce*$e,N+=ue*Oe,N+=me*Xe,N+=Ne*Le,N+=Ie*(5*Ze),mn+=N>>>13,N&=8191,A=mn,A+=k*Ze,A+=P*Te,A+=D*Ve,A+=V*Pe,A+=Z*he,mn=A>>>13,A&=8191,A+=ce*ae,A+=ue*$e,A+=me*Oe,A+=Ne*Xe,A+=Ie*Le,mn+=A>>>13,A&=8191,mn=(mn<<2)+mn|0,mn=mn+gt|0,gt=mn&8191,mn=mn>>>13,Wt+=mn,k=gt,P=Wt,D=jn,V=kt,Z=cn,ce=Ce,ue=m,me=p,Ne=N,Ie=A,xe+=16,Ge-=16;this.h[0]=k,this.h[1]=P,this.h[2]=D,this.h[3]=V,this.h[4]=Z,this.h[5]=ce,this.h[6]=ue,this.h[7]=me,this.h[8]=Ne,this.h[9]=Ie},Q.prototype.finish=function(ze,xe){var Ge=new Uint16Array(10),_e,Be,qt,It;if(this.leftover){for(It=this.leftover,this.buffer[It++]=1;It<16;It++)this.buffer[It]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(_e=this.h[1]>>>13,this.h[1]&=8191,It=2;It<10;It++)this.h[It]+=_e,_e=this.h[It]>>>13,this.h[It]&=8191;for(this.h[0]+=_e*5,_e=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=_e,_e=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=_e,Ge[0]=this.h[0]+5,_e=Ge[0]>>>13,Ge[0]&=8191,It=1;It<10;It++)Ge[It]=this.h[It]+_e,_e=Ge[It]>>>13,Ge[It]&=8191;for(Ge[9]-=8192,Be=(_e^1)-1,It=0;It<10;It++)Ge[It]&=Be;for(Be=~Be,It=0;It<10;It++)this.h[It]=this.h[It]&Be|Ge[It];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,qt=this.h[0]+this.pad[0],this.h[0]=qt&65535,It=1;It<8;It++)qt=(this.h[It]+this.pad[It]|0)+(qt>>>16)|0,this.h[It]=qt&65535;ze[xe+0]=this.h[0]>>>0&255,ze[xe+1]=this.h[0]>>>8&255,ze[xe+2]=this.h[1]>>>0&255,ze[xe+3]=this.h[1]>>>8&255,ze[xe+4]=this.h[2]>>>0&255,ze[xe+5]=this.h[2]>>>8&255,ze[xe+6]=this.h[3]>>>0&255,ze[xe+7]=this.h[3]>>>8&255,ze[xe+8]=this.h[4]>>>0&255,ze[xe+9]=this.h[4]>>>8&255,ze[xe+10]=this.h[5]>>>0&255,ze[xe+11]=this.h[5]>>>8&255,ze[xe+12]=this.h[6]>>>0&255,ze[xe+13]=this.h[6]>>>8&255,ze[xe+14]=this.h[7]>>>0&255,ze[xe+15]=this.h[7]>>>8&255},Q.prototype.update=function(ze,xe,Ge){var _e,Be;if(this.leftover){for(Be=16-this.leftover,Be>Ge&&(Be=Ge),_e=0;_e<Be;_e++)this.buffer[this.leftover+_e]=ze[xe+_e];if(Ge-=Be,xe+=Be,this.leftover+=Be,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(Ge>=16&&(Be=Ge-Ge%16,this.blocks(ze,xe,Be),xe+=Be,Ge-=Be),Ge){for(_e=0;_e<Ge;_e++)this.buffer[this.leftover+_e]=ze[xe+_e];this.leftover+=Ge}};function q(ze,xe,Ge,_e,Be,qt){var It=new Q(qt);return It.update(Ge,_e,Be),It.finish(ze,xe),0}function te(ze,xe,Ge,_e,Be,qt){var It=new Uint8Array(16);return q(It,0,Ge,_e,Be,qt),C(ze,xe,It,0)}function fe(ze,xe,Ge,_e,Be){var qt;if(Ge<32)return-1;for(re(ze,0,xe,0,Ge,_e,Be),q(ze,16,ze,32,Ge-32,ze),qt=0;qt<16;qt++)ze[qt]=0;return 0}function G(ze,xe,Ge,_e,Be){var qt,It=new Uint8Array(32);if(Ge<32||(Y(It,0,32,_e,Be),te(xe,16,xe,32,Ge-32,It)!==0))return-1;for(re(ze,0,xe,0,Ge,_e,Be),qt=0;qt<32;qt++)ze[qt]=0;return 0}function ie(ze,xe){var Ge;for(Ge=0;Ge<16;Ge++)ze[Ge]=xe[Ge]|0}function oe(ze){var xe,Ge,_e=1;for(xe=0;xe<16;xe++)Ge=ze[xe]+_e+65535,_e=Math.floor(Ge/65536),ze[xe]=Ge-_e*65536;ze[0]+=_e-1+37*(_e-1)}function K(ze,xe,Ge){for(var _e,Be=~(Ge-1),qt=0;qt<16;qt++)_e=Be&(ze[qt]^xe[qt]),ze[qt]^=_e,xe[qt]^=_e}function H(ze,xe){var Ge,_e,Be,qt=n(),It=n();for(Ge=0;Ge<16;Ge++)It[Ge]=xe[Ge];for(oe(It),oe(It),oe(It),_e=0;_e<2;_e++){for(qt[0]=It[0]-65517,Ge=1;Ge<15;Ge++)qt[Ge]=It[Ge]-65535-(qt[Ge-1]>>16&1),qt[Ge-1]&=65535;qt[15]=It[15]-32767-(qt[14]>>16&1),Be=qt[15]>>16&1,qt[14]&=65535,K(It,qt,1-Be)}for(Ge=0;Ge<16;Ge++)ze[2*Ge]=It[Ge]&255,ze[2*Ge+1]=It[Ge]>>8}function ee(ze,xe){var Ge=new Uint8Array(32),_e=new Uint8Array(32);return H(Ge,ze),H(_e,xe),S(Ge,0,_e,0)}function se(ze){var xe=new Uint8Array(32);return H(xe,ze),xe[0]&1}function pe(ze,xe){var Ge;for(Ge=0;Ge<16;Ge++)ze[Ge]=xe[2*Ge]+(xe[2*Ge+1]<<8);ze[15]&=32767}function Se(ze,xe,Ge){for(var _e=0;_e<16;_e++)ze[_e]=xe[_e]+Ge[_e]}function ge(ze,xe,Ge){for(var _e=0;_e<16;_e++)ze[_e]=xe[_e]-Ge[_e]}function ve(ze,xe,Ge){var _e,Be,qt=0,It=0,mt=0,Ft=0,Tn=0,kn=0,Gt=0,mn=0,gt=0,Wt=0,jn=0,kt=0,cn=0,Ce=0,m=0,p=0,N=0,A=0,k=0,P=0,D=0,V=0,Z=0,ce=0,ue=0,me=0,Ne=0,Ie=0,Le=0,Xe=0,Oe=0,$e=Ge[0],ae=Ge[1],he=Ge[2],Pe=Ge[3],Ve=Ge[4],Te=Ge[5],Ze=Ge[6],it=Ge[7],wt=Ge[8],Dt=Ge[9],Qt=Ge[10],xn=Ge[11],pn=Ge[12],An=Ge[13],or=Ge[14],$t=Ge[15];_e=xe[0],qt+=_e*$e,It+=_e*ae,mt+=_e*he,Ft+=_e*Pe,Tn+=_e*Ve,kn+=_e*Te,Gt+=_e*Ze,mn+=_e*it,gt+=_e*wt,Wt+=_e*Dt,jn+=_e*Qt,kt+=_e*xn,cn+=_e*pn,Ce+=_e*An,m+=_e*or,p+=_e*$t,_e=xe[1],It+=_e*$e,mt+=_e*ae,Ft+=_e*he,Tn+=_e*Pe,kn+=_e*Ve,Gt+=_e*Te,mn+=_e*Ze,gt+=_e*it,Wt+=_e*wt,jn+=_e*Dt,kt+=_e*Qt,cn+=_e*xn,Ce+=_e*pn,m+=_e*An,p+=_e*or,N+=_e*$t,_e=xe[2],mt+=_e*$e,Ft+=_e*ae,Tn+=_e*he,kn+=_e*Pe,Gt+=_e*Ve,mn+=_e*Te,gt+=_e*Ze,Wt+=_e*it,jn+=_e*wt,kt+=_e*Dt,cn+=_e*Qt,Ce+=_e*xn,m+=_e*pn,p+=_e*An,N+=_e*or,A+=_e*$t,_e=xe[3],Ft+=_e*$e,Tn+=_e*ae,kn+=_e*he,Gt+=_e*Pe,mn+=_e*Ve,gt+=_e*Te,Wt+=_e*Ze,jn+=_e*it,kt+=_e*wt,cn+=_e*Dt,Ce+=_e*Qt,m+=_e*xn,p+=_e*pn,N+=_e*An,A+=_e*or,k+=_e*$t,_e=xe[4],Tn+=_e*$e,kn+=_e*ae,Gt+=_e*he,mn+=_e*Pe,gt+=_e*Ve,Wt+=_e*Te,jn+=_e*Ze,kt+=_e*it,cn+=_e*wt,Ce+=_e*Dt,m+=_e*Qt,p+=_e*xn,N+=_e*pn,A+=_e*An,k+=_e*or,P+=_e*$t,_e=xe[5],kn+=_e*$e,Gt+=_e*ae,mn+=_e*he,gt+=_e*Pe,Wt+=_e*Ve,jn+=_e*Te,kt+=_e*Ze,cn+=_e*it,Ce+=_e*wt,m+=_e*Dt,p+=_e*Qt,N+=_e*xn,A+=_e*pn,k+=_e*An,P+=_e*or,D+=_e*$t,_e=xe[6],Gt+=_e*$e,mn+=_e*ae,gt+=_e*he,Wt+=_e*Pe,jn+=_e*Ve,kt+=_e*Te,cn+=_e*Ze,Ce+=_e*it,m+=_e*wt,p+=_e*Dt,N+=_e*Qt,A+=_e*xn,k+=_e*pn,P+=_e*An,D+=_e*or,V+=_e*$t,_e=xe[7],mn+=_e*$e,gt+=_e*ae,Wt+=_e*he,jn+=_e*Pe,kt+=_e*Ve,cn+=_e*Te,Ce+=_e*Ze,m+=_e*it,p+=_e*wt,N+=_e*Dt,A+=_e*Qt,k+=_e*xn,P+=_e*pn,D+=_e*An,V+=_e*or,Z+=_e*$t,_e=xe[8],gt+=_e*$e,Wt+=_e*ae,jn+=_e*he,kt+=_e*Pe,cn+=_e*Ve,Ce+=_e*Te,m+=_e*Ze,p+=_e*it,N+=_e*wt,A+=_e*Dt,k+=_e*Qt,P+=_e*xn,D+=_e*pn,V+=_e*An,Z+=_e*or,ce+=_e*$t,_e=xe[9],Wt+=_e*$e,jn+=_e*ae,kt+=_e*he,cn+=_e*Pe,Ce+=_e*Ve,m+=_e*Te,p+=_e*Ze,N+=_e*it,A+=_e*wt,k+=_e*Dt,P+=_e*Qt,D+=_e*xn,V+=_e*pn,Z+=_e*An,ce+=_e*or,ue+=_e*$t,_e=xe[10],jn+=_e*$e,kt+=_e*ae,cn+=_e*he,Ce+=_e*Pe,m+=_e*Ve,p+=_e*Te,N+=_e*Ze,A+=_e*it,k+=_e*wt,P+=_e*Dt,D+=_e*Qt,V+=_e*xn,Z+=_e*pn,ce+=_e*An,ue+=_e*or,me+=_e*$t,_e=xe[11],kt+=_e*$e,cn+=_e*ae,Ce+=_e*he,m+=_e*Pe,p+=_e*Ve,N+=_e*Te,A+=_e*Ze,k+=_e*it,P+=_e*wt,D+=_e*Dt,V+=_e*Qt,Z+=_e*xn,ce+=_e*pn,ue+=_e*An,me+=_e*or,Ne+=_e*$t,_e=xe[12],cn+=_e*$e,Ce+=_e*ae,m+=_e*he,p+=_e*Pe,N+=_e*Ve,A+=_e*Te,k+=_e*Ze,P+=_e*it,D+=_e*wt,V+=_e*Dt,Z+=_e*Qt,ce+=_e*xn,ue+=_e*pn,me+=_e*An,Ne+=_e*or,Ie+=_e*$t,_e=xe[13],Ce+=_e*$e,m+=_e*ae,p+=_e*he,N+=_e*Pe,A+=_e*Ve,k+=_e*Te,P+=_e*Ze,D+=_e*it,V+=_e*wt,Z+=_e*Dt,ce+=_e*Qt,ue+=_e*xn,me+=_e*pn,Ne+=_e*An,Ie+=_e*or,Le+=_e*$t,_e=xe[14],m+=_e*$e,p+=_e*ae,N+=_e*he,A+=_e*Pe,k+=_e*Ve,P+=_e*Te,D+=_e*Ze,V+=_e*it,Z+=_e*wt,ce+=_e*Dt,ue+=_e*Qt,me+=_e*xn,Ne+=_e*pn,Ie+=_e*An,Le+=_e*or,Xe+=_e*$t,_e=xe[15],p+=_e*$e,N+=_e*ae,A+=_e*he,k+=_e*Pe,P+=_e*Ve,D+=_e*Te,V+=_e*Ze,Z+=_e*it,ce+=_e*wt,ue+=_e*Dt,me+=_e*Qt,Ne+=_e*xn,Ie+=_e*pn,Le+=_e*An,Xe+=_e*or,Oe+=_e*$t,qt+=38*N,It+=38*A,mt+=38*k,Ft+=38*P,Tn+=38*D,kn+=38*V,Gt+=38*Z,mn+=38*ce,gt+=38*ue,Wt+=38*me,jn+=38*Ne,kt+=38*Ie,cn+=38*Le,Ce+=38*Xe,m+=38*Oe,Be=1,_e=qt+Be+65535,Be=Math.floor(_e/65536),qt=_e-Be*65536,_e=It+Be+65535,Be=Math.floor(_e/65536),It=_e-Be*65536,_e=mt+Be+65535,Be=Math.floor(_e/65536),mt=_e-Be*65536,_e=Ft+Be+65535,Be=Math.floor(_e/65536),Ft=_e-Be*65536,_e=Tn+Be+65535,Be=Math.floor(_e/65536),Tn=_e-Be*65536,_e=kn+Be+65535,Be=Math.floor(_e/65536),kn=_e-Be*65536,_e=Gt+Be+65535,Be=Math.floor(_e/65536),Gt=_e-Be*65536,_e=mn+Be+65535,Be=Math.floor(_e/65536),mn=_e-Be*65536,_e=gt+Be+65535,Be=Math.floor(_e/65536),gt=_e-Be*65536,_e=Wt+Be+65535,Be=Math.floor(_e/65536),Wt=_e-Be*65536,_e=jn+Be+65535,Be=Math.floor(_e/65536),jn=_e-Be*65536,_e=kt+Be+65535,Be=Math.floor(_e/65536),kt=_e-Be*65536,_e=cn+Be+65535,Be=Math.floor(_e/65536),cn=_e-Be*65536,_e=Ce+Be+65535,Be=Math.floor(_e/65536),Ce=_e-Be*65536,_e=m+Be+65535,Be=Math.floor(_e/65536),m=_e-Be*65536,_e=p+Be+65535,Be=Math.floor(_e/65536),p=_e-Be*65536,qt+=Be-1+37*(Be-1),Be=1,_e=qt+Be+65535,Be=Math.floor(_e/65536),qt=_e-Be*65536,_e=It+Be+65535,Be=Math.floor(_e/65536),It=_e-Be*65536,_e=mt+Be+65535,Be=Math.floor(_e/65536),mt=_e-Be*65536,_e=Ft+Be+65535,Be=Math.floor(_e/65536),Ft=_e-Be*65536,_e=Tn+Be+65535,Be=Math.floor(_e/65536),Tn=_e-Be*65536,_e=kn+Be+65535,Be=Math.floor(_e/65536),kn=_e-Be*65536,_e=Gt+Be+65535,Be=Math.floor(_e/65536),Gt=_e-Be*65536,_e=mn+Be+65535,Be=Math.floor(_e/65536),mn=_e-Be*65536,_e=gt+Be+65535,Be=Math.floor(_e/65536),gt=_e-Be*65536,_e=Wt+Be+65535,Be=Math.floor(_e/65536),Wt=_e-Be*65536,_e=jn+Be+65535,Be=Math.floor(_e/65536),jn=_e-Be*65536,_e=kt+Be+65535,Be=Math.floor(_e/65536),kt=_e-Be*65536,_e=cn+Be+65535,Be=Math.floor(_e/65536),cn=_e-Be*65536,_e=Ce+Be+65535,Be=Math.floor(_e/65536),Ce=_e-Be*65536,_e=m+Be+65535,Be=Math.floor(_e/65536),m=_e-Be*65536,_e=p+Be+65535,Be=Math.floor(_e/65536),p=_e-Be*65536,qt+=Be-1+37*(Be-1),ze[0]=qt,ze[1]=It,ze[2]=mt,ze[3]=Ft,ze[4]=Tn,ze[5]=kn,ze[6]=Gt,ze[7]=mn,ze[8]=gt,ze[9]=Wt,ze[10]=jn,ze[11]=kt,ze[12]=cn,ze[13]=Ce,ze[14]=m,ze[15]=p}function be(ze,xe){ve(ze,xe,xe)}function we(ze,xe){var Ge=n(),_e;for(_e=0;_e<16;_e++)Ge[_e]=xe[_e];for(_e=253;_e>=0;_e--)be(Ge,Ge),_e!==2&&_e!==4&&ve(Ge,Ge,xe);for(_e=0;_e<16;_e++)ze[_e]=Ge[_e]}function je(ze,xe){var Ge=n(),_e;for(_e=0;_e<16;_e++)Ge[_e]=xe[_e];for(_e=250;_e>=0;_e--)be(Ge,Ge),_e!==1&&ve(Ge,Ge,xe);for(_e=0;_e<16;_e++)ze[_e]=Ge[_e]}function Fe(ze,xe,Ge){var _e=new Uint8Array(32),Be=new Float64Array(80),qt,It,mt=n(),Ft=n(),Tn=n(),kn=n(),Gt=n(),mn=n();for(It=0;It<31;It++)_e[It]=xe[It];for(_e[31]=xe[31]&127|64,_e[0]&=248,pe(Be,Ge),It=0;It<16;It++)Ft[It]=Be[It],kn[It]=mt[It]=Tn[It]=0;for(mt[0]=kn[0]=1,It=254;It>=0;--It)qt=_e[It>>>3]>>>(It&7)&1,K(mt,Ft,qt),K(Tn,kn,qt),Se(Gt,mt,Tn),ge(mt,mt,Tn),Se(Tn,Ft,kn),ge(Ft,Ft,kn),be(kn,Gt),be(mn,mt),ve(mt,Tn,mt),ve(Tn,Ft,Gt),Se(Gt,mt,Tn),ge(mt,mt,Tn),be(Ft,mt),ge(Tn,kn,mn),ve(mt,Tn,c),Se(mt,mt,kn),ve(Tn,Tn,mt),ve(mt,kn,mn),ve(kn,Ft,Be),be(Ft,Gt),K(mt,Ft,qt),K(Tn,kn,qt);for(It=0;It<16;It++)Be[It+16]=mt[It],Be[It+32]=Tn[It],Be[It+48]=Ft[It],Be[It+64]=kn[It];var gt=Be.subarray(32),Wt=Be.subarray(16);return we(gt,gt),ve(Wt,Wt,gt),H(ze,Wt),0}function Re(ze,xe){return Fe(ze,xe,a)}function Qe(ze,xe){return r(xe,32),Re(ze,xe)}function Ye(ze,xe,Ge){var _e=new Uint8Array(32);return Fe(_e,Ge,xe),F(ze,s,_e,$)}var dt=fe,st=G;function at(ze,xe,Ge,_e,Be,qt){var It=new Uint8Array(32);return Ye(It,Be,qt),dt(ze,xe,Ge,_e,It)}function He(ze,xe,Ge,_e,Be,qt){var It=new Uint8Array(32);return Ye(It,Be,qt),st(ze,xe,Ge,_e,It)}var qe=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function vt(ze,xe,Ge,_e){for(var Be=new Int32Array(16),qt=new Int32Array(16),It,mt,Ft,Tn,kn,Gt,mn,gt,Wt,jn,kt,cn,Ce,m,p,N,A,k,P,D,V,Z,ce,ue,me,Ne,Ie=ze[0],Le=ze[1],Xe=ze[2],Oe=ze[3],$e=ze[4],ae=ze[5],he=ze[6],Pe=ze[7],Ve=xe[0],Te=xe[1],Ze=xe[2],it=xe[3],wt=xe[4],Dt=xe[5],Qt=xe[6],xn=xe[7],pn=0;_e>=128;){for(P=0;P<16;P++)D=8*P+pn,Be[P]=Ge[D+0]<<24|Ge[D+1]<<16|Ge[D+2]<<8|Ge[D+3],qt[P]=Ge[D+4]<<24|Ge[D+5]<<16|Ge[D+6]<<8|Ge[D+7];for(P=0;P<80;P++)if(It=Ie,mt=Le,Ft=Xe,Tn=Oe,kn=$e,Gt=ae,mn=he,gt=Pe,Wt=Ve,jn=Te,kt=Ze,cn=it,Ce=wt,m=Dt,p=Qt,N=xn,V=Pe,Z=xn,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=($e>>>14|wt<<18)^($e>>>18|wt<<14)^(wt>>>9|$e<<23),Z=(wt>>>14|$e<<18)^(wt>>>18|$e<<14)^($e>>>9|wt<<23),ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,V=$e&ae^~$e&he,Z=wt&Dt^~wt&Qt,ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,V=qe[P*2],Z=qe[P*2+1],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,V=Be[P%16],Z=qt[P%16],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,A=me&65535|Ne<<16,k=ce&65535|ue<<16,V=A,Z=k,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=(Ie>>>28|Ve<<4)^(Ve>>>2|Ie<<30)^(Ve>>>7|Ie<<25),Z=(Ve>>>28|Ie<<4)^(Ie>>>2|Ve<<30)^(Ie>>>7|Ve<<25),ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,V=Ie&Le^Ie&Xe^Le&Xe,Z=Ve&Te^Ve&Ze^Te&Ze,ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,gt=me&65535|Ne<<16,N=ce&65535|ue<<16,V=Tn,Z=cn,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=A,Z=k,ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,Tn=me&65535|Ne<<16,cn=ce&65535|ue<<16,Le=It,Xe=mt,Oe=Ft,$e=Tn,ae=kn,he=Gt,Pe=mn,Ie=gt,Te=Wt,Ze=jn,it=kt,wt=cn,Dt=Ce,Qt=m,xn=p,Ve=N,P%16===15)for(D=0;D<16;D++)V=Be[D],Z=qt[D],ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=Be[(D+9)%16],Z=qt[(D+9)%16],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,A=Be[(D+1)%16],k=qt[(D+1)%16],V=(A>>>1|k<<31)^(A>>>8|k<<24)^A>>>7,Z=(k>>>1|A<<31)^(k>>>8|A<<24)^(k>>>7|A<<25),ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,A=Be[(D+14)%16],k=qt[(D+14)%16],V=(A>>>19|k<<13)^(k>>>29|A<<3)^A>>>6,Z=(k>>>19|A<<13)^(A>>>29|k<<3)^(k>>>6|A<<26),ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,Be[D]=me&65535|Ne<<16,qt[D]=ce&65535|ue<<16;V=Ie,Z=Ve,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=ze[0],Z=xe[0],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,ze[0]=Ie=me&65535|Ne<<16,xe[0]=Ve=ce&65535|ue<<16,V=Le,Z=Te,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=ze[1],Z=xe[1],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,ze[1]=Le=me&65535|Ne<<16,xe[1]=Te=ce&65535|ue<<16,V=Xe,Z=Ze,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=ze[2],Z=xe[2],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,ze[2]=Xe=me&65535|Ne<<16,xe[2]=Ze=ce&65535|ue<<16,V=Oe,Z=it,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=ze[3],Z=xe[3],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,ze[3]=Oe=me&65535|Ne<<16,xe[3]=it=ce&65535|ue<<16,V=$e,Z=wt,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=ze[4],Z=xe[4],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,ze[4]=$e=me&65535|Ne<<16,xe[4]=wt=ce&65535|ue<<16,V=ae,Z=Dt,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=ze[5],Z=xe[5],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,ze[5]=ae=me&65535|Ne<<16,xe[5]=Dt=ce&65535|ue<<16,V=he,Z=Qt,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=ze[6],Z=xe[6],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,ze[6]=he=me&65535|Ne<<16,xe[6]=Qt=ce&65535|ue<<16,V=Pe,Z=xn,ce=Z&65535,ue=Z>>>16,me=V&65535,Ne=V>>>16,V=ze[7],Z=xe[7],ce+=Z&65535,ue+=Z>>>16,me+=V&65535,Ne+=V>>>16,ue+=ce>>>16,me+=ue>>>16,Ne+=me>>>16,ze[7]=Pe=me&65535|Ne<<16,xe[7]=xn=ce&65535|ue<<16,pn+=128,_e-=128}return _e}function yt(ze,xe,Ge){var _e=new Int32Array(8),Be=new Int32Array(8),qt=new Uint8Array(256),It,mt=Ge;for(_e[0]=1779033703,_e[1]=3144134277,_e[2]=1013904242,_e[3]=2773480762,_e[4]=1359893119,_e[5]=2600822924,_e[6]=528734635,_e[7]=1541459225,Be[0]=4089235720,Be[1]=2227873595,Be[2]=4271175723,Be[3]=1595750129,Be[4]=2917565137,Be[5]=725511199,Be[6]=4215389547,Be[7]=327033209,vt(_e,Be,xe,Ge),Ge%=128,It=0;It<Ge;It++)qt[It]=xe[mt-Ge+It];for(qt[Ge]=128,Ge=256-128*(Ge<112?1:0),qt[Ge-9]=0,y(qt,Ge-8,mt/536870912|0,mt<<3),vt(_e,Be,qt,Ge),It=0;It<8;It++)y(ze,8*It,_e[It],Be[It]);return 0}function Kt(ze,xe){var Ge=n(),_e=n(),Be=n(),qt=n(),It=n(),mt=n(),Ft=n(),Tn=n(),kn=n();ge(Ge,ze[1],ze[0]),ge(kn,xe[1],xe[0]),ve(Ge,Ge,kn),Se(_e,ze[0],ze[1]),Se(kn,xe[0],xe[1]),ve(_e,_e,kn),ve(Be,ze[3],xe[3]),ve(Be,Be,d),ve(qt,ze[2],xe[2]),Se(qt,qt,qt),ge(It,_e,Ge),ge(mt,qt,Be),Se(Ft,qt,Be),Se(Tn,_e,Ge),ve(ze[0],It,mt),ve(ze[1],Tn,Ft),ve(ze[2],Ft,mt),ve(ze[3],It,Tn)}function jt(ze,xe,Ge){var _e;for(_e=0;_e<4;_e++)K(ze[_e],xe[_e],Ge)}function un(ze,xe){var Ge=n(),_e=n(),Be=n();we(Be,xe[2]),ve(Ge,xe[0],Be),ve(_e,xe[1],Be),H(ze,_e),ze[31]^=se(Ge)<<7}function vn(ze,xe,Ge){var _e,Be;for(ie(ze[0],o),ie(ze[1],l),ie(ze[2],l),ie(ze[3],o),Be=255;Be>=0;--Be)_e=Ge[Be/8|0]>>(Be&7)&1,jt(ze,xe,_e),Kt(xe,ze),Kt(ze,ze),jt(ze,xe,_e)}function Hn(ze,xe){var Ge=[n(),n(),n(),n()];ie(Ge[0],f),ie(Ge[1],x),ie(Ge[2],l),ve(Ge[3],f,x),vn(ze,Ge,xe)}function ln(ze,xe,Ge){var _e=new Uint8Array(64),Be=[n(),n(),n(),n()],qt;for(Ge||r(xe,32),yt(_e,xe,32),_e[0]&=248,_e[31]&=127,_e[31]|=64,Hn(Be,_e),un(ze,Be),qt=0;qt<32;qt++)xe[qt+32]=ze[qt];return 0}var Nn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function dn(ze,xe){var Ge,_e,Be,qt;for(_e=63;_e>=32;--_e){for(Ge=0,Be=_e-32,qt=_e-12;Be<qt;++Be)xe[Be]+=Ge-16*xe[_e]*Nn[Be-(_e-32)],Ge=Math.floor((xe[Be]+128)/256),xe[Be]-=Ge*256;xe[Be]+=Ge,xe[_e]=0}for(Ge=0,Be=0;Be<32;Be++)xe[Be]+=Ge-(xe[31]>>4)*Nn[Be],Ge=xe[Be]>>8,xe[Be]&=255;for(Be=0;Be<32;Be++)xe[Be]-=Ge*Nn[Be];for(_e=0;_e<32;_e++)xe[_e+1]+=xe[_e]>>8,ze[_e]=xe[_e]&255}function rt(ze){var xe=new Float64Array(64),Ge;for(Ge=0;Ge<64;Ge++)xe[Ge]=ze[Ge];for(Ge=0;Ge<64;Ge++)ze[Ge]=0;dn(ze,xe)}function nt(ze,xe,Ge,_e){var Be=new Uint8Array(64),qt=new Uint8Array(64),It=new Uint8Array(64),mt,Ft,Tn=new Float64Array(64),kn=[n(),n(),n(),n()];yt(Be,_e,32),Be[0]&=248,Be[31]&=127,Be[31]|=64;var Gt=Ge+64;for(mt=0;mt<Ge;mt++)ze[64+mt]=xe[mt];for(mt=0;mt<32;mt++)ze[32+mt]=Be[32+mt];for(yt(It,ze.subarray(32),Ge+32),rt(It),Hn(kn,It),un(ze,kn),mt=32;mt<64;mt++)ze[mt]=_e[mt];for(yt(qt,ze,Ge+64),rt(qt),mt=0;mt<64;mt++)Tn[mt]=0;for(mt=0;mt<32;mt++)Tn[mt]=It[mt];for(mt=0;mt<32;mt++)for(Ft=0;Ft<32;Ft++)Tn[mt+Ft]+=qt[mt]*Be[Ft];return dn(ze.subarray(32),Tn),Gt}function Ut(ze,xe){var Ge=n(),_e=n(),Be=n(),qt=n(),It=n(),mt=n(),Ft=n();return ie(ze[2],l),pe(ze[1],xe),be(Be,ze[1]),ve(qt,Be,u),ge(Be,Be,ze[2]),Se(qt,ze[2],qt),be(It,qt),be(mt,It),ve(Ft,mt,It),ve(Ge,Ft,Be),ve(Ge,Ge,qt),je(Ge,Ge),ve(Ge,Ge,Be),ve(Ge,Ge,qt),ve(Ge,Ge,qt),ve(ze[0],Ge,qt),be(_e,ze[0]),ve(_e,_e,qt),ee(_e,Be)&&ve(ze[0],ze[0],g),be(_e,ze[0]),ve(_e,_e,qt),ee(_e,Be)?-1:(se(ze[0])===xe[31]>>7&&ge(ze[0],o,ze[0]),ve(ze[3],ze[0],ze[1]),0)}function wn(ze,xe,Ge,_e){var Be,qt=new Uint8Array(32),It=new Uint8Array(64),mt=[n(),n(),n(),n()],Ft=[n(),n(),n(),n()];if(Ge<64||Ut(Ft,_e))return-1;for(Be=0;Be<Ge;Be++)ze[Be]=xe[Be];for(Be=0;Be<32;Be++)ze[Be+32]=_e[Be];if(yt(It,ze,Ge),rt(It),vn(mt,Ft,It),Hn(Ft,xe.subarray(32)),Kt(mt,Ft),un(qt,mt),Ge-=64,S(xe,0,qt,0)){for(Be=0;Be<Ge;Be++)ze[Be]=0;return-1}for(Be=0;Be<Ge;Be++)ze[Be]=xe[Be+64];return Ge}var Jt=32,Vt=24,xt=32,We=16,Pt=32,Ke=32,ct=32,Nt=32,Ht=32,Rt=Vt,hn=xt,yn=We,Cn=64,En=32,Rn=64,Mn=32,Yn=64;e.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:re,crypto_stream:Y,crypto_stream_salsa20_xor:O,crypto_stream_salsa20:U,crypto_onetimeauth:q,crypto_onetimeauth_verify:te,crypto_verify_16:C,crypto_verify_32:S,crypto_secretbox:fe,crypto_secretbox_open:G,crypto_scalarmult:Fe,crypto_scalarmult_base:Re,crypto_box_beforenm:Ye,crypto_box_afternm:dt,crypto_box:at,crypto_box_open:He,crypto_box_keypair:Qe,crypto_hash:yt,crypto_sign:nt,crypto_sign_keypair:ln,crypto_sign_open:wn,crypto_secretbox_KEYBYTES:Jt,crypto_secretbox_NONCEBYTES:Vt,crypto_secretbox_ZEROBYTES:xt,crypto_secretbox_BOXZEROBYTES:We,crypto_scalarmult_BYTES:Pt,crypto_scalarmult_SCALARBYTES:Ke,crypto_box_PUBLICKEYBYTES:ct,crypto_box_SECRETKEYBYTES:Nt,crypto_box_BEFORENMBYTES:Ht,crypto_box_NONCEBYTES:Rt,crypto_box_ZEROBYTES:hn,crypto_box_BOXZEROBYTES:yn,crypto_sign_BYTES:Cn,crypto_sign_PUBLICKEYBYTES:En,crypto_sign_SECRETKEYBYTES:Rn,crypto_sign_SEEDBYTES:Mn,crypto_hash_BYTES:Yn,gf:n,D:u,L:Nn,pack25519:H,unpack25519:pe,M:ve,A:Se,S:be,Z:ge,pow2523:je,add:Kt,set25519:ie,modL:dn,scalarmult:vn,scalarbase:Hn};function Zn(ze,xe){if(ze.length!==Jt)throw new Error("bad key size");if(xe.length!==Vt)throw new Error("bad nonce size")}function Vn(ze,xe){if(ze.length!==ct)throw new Error("bad public key size");if(xe.length!==Nt)throw new Error("bad secret key size")}function tr(){for(var ze=0;ze<arguments.length;ze++)if(!(arguments[ze]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Sn(ze){for(var xe=0;xe<ze.length;xe++)ze[xe]=0}e.randomBytes=function(ze){var xe=new Uint8Array(ze);return r(xe,ze),xe},e.secretbox=function(ze,xe,Ge){tr(ze,xe,Ge),Zn(Ge,xe);for(var _e=new Uint8Array(xt+ze.length),Be=new Uint8Array(_e.length),qt=0;qt<ze.length;qt++)_e[qt+xt]=ze[qt];return fe(Be,_e,_e.length,xe,Ge),Be.subarray(We)},e.secretbox.open=function(ze,xe,Ge){tr(ze,xe,Ge),Zn(Ge,xe);for(var _e=new Uint8Array(We+ze.length),Be=new Uint8Array(_e.length),qt=0;qt<ze.length;qt++)_e[qt+We]=ze[qt];return _e.length<32||G(Be,_e,_e.length,xe,Ge)!==0?null:Be.subarray(xt)},e.secretbox.keyLength=Jt,e.secretbox.nonceLength=Vt,e.secretbox.overheadLength=We,e.scalarMult=function(ze,xe){if(tr(ze,xe),ze.length!==Ke)throw new Error("bad n size");if(xe.length!==Pt)throw new Error("bad p size");var Ge=new Uint8Array(Pt);return Fe(Ge,ze,xe),Ge},e.scalarMult.base=function(ze){if(tr(ze),ze.length!==Ke)throw new Error("bad n size");var xe=new Uint8Array(Pt);return Re(xe,ze),xe},e.scalarMult.scalarLength=Ke,e.scalarMult.groupElementLength=Pt,e.box=function(ze,xe,Ge,_e){var Be=e.box.before(Ge,_e);return e.secretbox(ze,xe,Be)},e.box.before=function(ze,xe){tr(ze,xe),Vn(ze,xe);var Ge=new Uint8Array(Ht);return Ye(Ge,ze,xe),Ge},e.box.after=e.secretbox,e.box.open=function(ze,xe,Ge,_e){var Be=e.box.before(Ge,_e);return e.secretbox.open(ze,xe,Be)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var ze=new Uint8Array(ct),xe=new Uint8Array(Nt);return Qe(ze,xe),{publicKey:ze,secretKey:xe}},e.box.keyPair.fromSecretKey=function(ze){if(tr(ze),ze.length!==Nt)throw new Error("bad secret key size");var xe=new Uint8Array(ct);return Re(xe,ze),{publicKey:xe,secretKey:new Uint8Array(ze)}},e.box.publicKeyLength=ct,e.box.secretKeyLength=Nt,e.box.sharedKeyLength=Ht,e.box.nonceLength=Rt,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(ze,xe){if(tr(ze,xe),xe.length!==Rn)throw new Error("bad secret key size");var Ge=new Uint8Array(Cn+ze.length);return nt(Ge,ze,ze.length,xe),Ge},e.sign.open=function(ze,xe){if(tr(ze,xe),xe.length!==En)throw new Error("bad public key size");var Ge=new Uint8Array(ze.length),_e=wn(Ge,ze,ze.length,xe);if(_e<0)return null;for(var Be=new Uint8Array(_e),qt=0;qt<Be.length;qt++)Be[qt]=Ge[qt];return Be},e.sign.detached=function(ze,xe){for(var Ge=e.sign(ze,xe),_e=new Uint8Array(Cn),Be=0;Be<_e.length;Be++)_e[Be]=Ge[Be];return _e},e.sign.detached.verify=function(ze,xe,Ge){if(tr(ze,xe,Ge),xe.length!==Cn)throw new Error("bad signature size");if(Ge.length!==En)throw new Error("bad public key size");var _e=new Uint8Array(Cn+ze.length),Be=new Uint8Array(Cn+ze.length),qt;for(qt=0;qt<Cn;qt++)_e[qt]=xe[qt];for(qt=0;qt<ze.length;qt++)_e[qt+Cn]=ze[qt];return wn(Be,_e,_e.length,Ge)>=0},e.sign.keyPair=function(){var ze=new Uint8Array(En),xe=new Uint8Array(Rn);return ln(ze,xe),{publicKey:ze,secretKey:xe}},e.sign.keyPair.fromSecretKey=function(ze){if(tr(ze),ze.length!==Rn)throw new Error("bad secret key size");for(var xe=new Uint8Array(En),Ge=0;Ge<xe.length;Ge++)xe[Ge]=ze[32+Ge];return{publicKey:xe,secretKey:new Uint8Array(ze)}},e.sign.keyPair.fromSeed=function(ze){if(tr(ze),ze.length!==Mn)throw new Error("bad seed size");for(var xe=new Uint8Array(En),Ge=new Uint8Array(Rn),_e=0;_e<32;_e++)Ge[_e]=ze[_e];return ln(xe,Ge,!0),{publicKey:xe,secretKey:Ge}},e.sign.publicKeyLength=En,e.sign.secretKeyLength=Rn,e.sign.seedLength=Mn,e.sign.signatureLength=Cn,e.hash=function(ze){tr(ze);var xe=new Uint8Array(Yn);return yt(xe,ze,ze.length),xe},e.hash.hashLength=Yn,e.verify=function(ze,xe){return tr(ze,xe),ze.length===0||xe.length===0||ze.length!==xe.length?!1:v(ze,0,xe,0,ze.length)===0},e.setPRNG=function(ze){r=ze},function(){var ze=typeof self<"u"?self.crypto||self.msCrypto:null;if(ze&&ze.getRandomValues){var xe=65536;e.setPRNG(function(Ge,_e){var Be,qt=new Uint8Array(_e);for(Be=0;Be<_e;Be+=xe)ze.getRandomValues(qt.subarray(Be,Be+Math.min(_e-Be,xe)));for(Be=0;Be<_e;Be++)Ge[Be]=qt[Be];Sn(qt)})}else typeof gCn<"u"&&(ze=vCn,ze&&ze.randomBytes&&e.setPRNG(function(Ge,_e){var Be,qt=ze.randomBytes(_e);for(Be=0;Be<_e;Be++)Ge[Be]=qt[Be];Sn(qt)}))}()})(t.exports?t.exports:self.nacl=self.nacl||{})}(HZ)),HZ.exports}var CCn=wCn();const NCn=Pi(CCn);function SCn(t){if(t.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let u=0;u<e.length;u++)e[u]=255;for(let u=0;u<t.length;u++){const d=t.charAt(u),f=d.charCodeAt(0);if(e[f]!==255)throw new TypeError(d+" is ambiguous");e[f]=u}const n=t.length,r=t.charAt(0),s=Math.log(n)/Math.log(256),a=Math.log(256)/Math.log(n);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let d=0,f=0,x=0;const g=u.length;for(;x!==g&&u[x]===0;)x++,d++;const y=(g-x)*a+1>>>0,v=new Uint8Array(y);for(;x!==g;){let T=u[x],I=0;for(let L=y-1;(T!==0||I<f)&&L!==-1;L--,I++)T+=256*v[L]>>>0,v[L]=T%n>>>0,T=T/n>>>0;if(T!==0)throw new Error("Non-zero carry");f=I,x++}let C=y-f;for(;C!==y&&v[C]===0;)C++;let S=r.repeat(d);for(;C<y;++C)S+=t.charAt(v[C]);return S}function l(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let d=0,f=0,x=0;for(;u[d]===r;)f++,d++;const g=(u.length-d)*s+1>>>0,y=new Uint8Array(g);for(;d<u.length;){const T=u.charCodeAt(d);if(T>255)return;let I=e[T];if(I===255)return;let L=0;for(let F=g-1;(I!==0||L<x)&&F!==-1;F--,L++)I+=n*y[F]>>>0,y[F]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");x=L,d++}let v=g-x;for(;v!==g&&y[v]===0;)v++;const C=new Uint8Array(f+(g-v));let S=f;for(;v!==g;)C[S++]=y[v++];return C}function c(u){const d=l(u);if(d)return d;throw new Error("Non-base"+n+" character")}return{encode:o,decodeUnsafe:l,decode:c}}var jCn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const ACn=SCn(jCn),_Cn=()=>{const{signMessageAsync:t}=zoe(),{address:e}=ds(),[n,r]=h.useState(!1),[s,a]=h.useState(null),o={chainId:"0x38",chainName:"BNB Chain",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:["https://bsc-dataseed.binance.org/"],blockExplorerUrls:["https://bscscan.com"]};async function l(){if(!window.ethereum)throw new Error("MetaMask not found");if(await window.ethereum.request({method:"eth_chainId"})!=="0x38")try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x38"}]})}catch(f){if(f.code===4902)await window.ethereum.request({method:"wallet_addEthereumChain",params:[o]});else throw f}}const c=d=>Array.from(d).map(f=>f.toString(16).padStart(2,"0")).join("");return{signIn:async d=>{try{if(r(!0),a(null),!e){fn.error("Wallet not connected");return}await l();const f=NCn.sign.keyPair(),x=ACn.encode(f.publicKey),g=f.secretKey.slice(0,32),y=c(g),C=await(await fetch("https://api.standx.com/v1/offchain/prepare-signin?chain=bsc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e,requestId:x})})).json();if(!C.signedData){fn.error("Failed to prepare signin");return}const S=C.signedData.split(".")[1],T=JSON.parse(atob(S)).message,I=await t({message:T}),L=C.signedData,$=await(await fetch("https://api.standx.com/v1/offchain/login?chain=bsc&addressType=eoa",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({signedData:L,signature:I})})).json();if($!=null&&$.token){const O="bsc",U=e.toLowerCase(),Y=`dextrabot_standx_auth_data_${U}`,re=`${O}_${U}`,Q=localStorage.getItem(Y),q=Q?JSON.parse(Q):{};return q[re]={address:e,chain:O,publicKey:$.publicKey,token:$.token,signingKeyHex:y,requestId:x},localStorage.setItem(Y,JSON.stringify(q)),d&&d({token:$.token,signingKeyHex:y,requestId:x}),{token:$.token,signingKeyHex:y,requestId:x}}else fn.error($.message||"Login failed")}catch(f){console.error("StandX signin failed:",f),a(f.message||"Signin failed")}finally{r(!1)}return null},loading:n,error:s}},ECn=()=>i.jsxs("div",{className:"flex flex-col gap-2 max-w-[240px] rounded-[12px] border border-[rgba(133,133,133,0.32)] bg-[#272729] shadow-[0_4px_4px_#050505] backdrop-blur-[18px] text-white text-[12px] leading-[14px] tracking-[-0.005em] font-normal px-[10px] py-[8px]",style:{fontFamily:"Inter, sans-serif"},children:[i.jsx("div",{className:"font-semibold text-[#eaf7ff] leading-[16px]",children:"Automatically places Take Profit and Stop Loss orders at a fixed basis-point offset from your quoting price."}),i.jsxs("div",{className:"text-left space-y-2",children:[i.jsx("div",{className:"font-semibold text-[#d7ffe9]",children:"Example"}),i.jsxs("ul",{className:"list-disc list-inside space-y-[2px] text-white/85",children:[i.jsxs("li",{children:["Quote BPS:"," ",i.jsx("span",{className:"font-semibold text-[#c6ffd5] drop-shadow-[0_0_6px_rgba(198,255,213,0.35)]",children:"5"})]}),i.jsxs("li",{children:["TP / SL Offset:"," ",i.jsx("span",{className:"font-semibold text-[#c6ffd5] drop-shadow-[0_0_6px_rgba(198,255,213,0.35)]",children:"2"})]})]}),i.jsx("div",{className:"pt-1 font-semibold text-[#d7ffe9]",children:"Orders placed:"}),i.jsxs("ul",{className:"list-disc list-inside space-y-[2px] text-white/85",children:[i.jsxs("li",{children:["Main order:"," ",i.jsx("span",{className:"font-semibold text-[#c6ffd5] drop-shadow-[0_0_6px_rgba(198,255,213,0.35)]",children:"5 bps"})]}),i.jsxs("li",{children:["Take Profit:"," ",i.jsx("span",{className:"font-semibold text-[#c6ffd5] drop-shadow-[0_0_6px_rgba(198,255,213,0.35)]",children:"3 bps"})," ",i.jsx("span",{className:"text-white/60",children:"(5 – 2)"})]}),i.jsxs("li",{children:["Stop Loss:"," ",i.jsx("span",{className:"font-semibold text-[#c6ffd5] drop-shadow-[0_0_6px_rgba(198,255,213,0.35)]",children:"7 bps"})," ",i.jsx("span",{className:"text-white/60",children:"(5 + 2)"})]})]})]})]}),SO="https://dextrabothypev2.nftinit.io",kCn="https://express-proxy-delta.vercel.app/proxy?url=https://perps.standx.com/api/query_balance",TCn=({fetchInfoOnOpen:t,setIsFilterWallet:e})=>{const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setMushboomerETH:a,setMushboomerSOL:o,setIsReferralCode:l,setIsReferralCodeName:c,setIsWhitelist:u,setHyperToken:d,setHyperAddress:f}=h.useContext(Qr),{signIn:x,loading:g}=_Cn(),y=x,[v,C]=h.useState(!1),[S,T]=h.useState(!1),[I,L]=h.useState(!1),[F,$]=h.useState(!1),[O,U]=h.useState(""),[Y,re]=h.useState(""),[Q]=h.useState(!1),[q,te]=h.useState(!1),[fe,G]=h.useState(""),[ie,oe]=h.useState(!1),[K,H]=h.useState(!1),[ee,se]=h.useState(null),[pe,Se]=h.useState(null),[ge,ve]=h.useState(null),[be,we]=h.useState(""),[je,Fe]=h.useState(""),[Re,Qe]=h.useState(null),[Ye,dt]=h.useState(""),[st,at]=h.useState(""),[He,qe]=h.useState(""),[vt,yt]=h.useState(""),[Kt,jt]=h.useState(""),[un,vn]=h.useState(""),[Hn,ln]=h.useState("size"),[Nn,dn]=h.useState(""),[rt,nt]=h.useState(""),[Ut,wn]=h.useState("size"),[Jt,Vt]=h.useState("");h.useState("");const[xt,We]=h.useState(!1),[Pt,Ke]=h.useState(!1),[ct,Nt]=h.useState(!1),[Ht,Rt]=h.useState(null),[hn,yn]=h.useState(""),[Cn,En]=h.useState(""),[Rn,Mn]=h.useState(null),[Yn,Zn]=h.useState(!1),[Vn,tr]=h.useState({coin:"",spread:"",per_side:"",order_size:"",max_per_side:"",tp_sl:"",budget:"",leverage:""}),Sn=Ht?(Ht==null?void 0:Ht.getTime())<=Date.now():!1;h.useEffect(()=>{Sn?yn("Please click on the refresh button for extending your token."):hn==="Please click on the refresh button for extending your token."&&yn("")},[Sn]),h.useEffect(()=>{const he=localStorage.getItem("hyperToken"),Pe=localStorage.getItem("hyperAddress");C(!!(he&&Pe));const Ve=setInterval(()=>{const Te=localStorage.getItem("hyperToken"),Ze=localStorage.getItem("hyperAddress");C(!!(Te&&Ze))},800);return()=>clearInterval(Ve)},[]),h.useEffect(()=>{G("")},[v]),h.useEffect(()=>{const he=()=>{var Ve;try{const Te=localStorage.getItem("hyperAddress");if(!Te)return Zn(!1);const Ze=localStorage.getItem(`dextrabot_standx_auth_data_${Te.toLowerCase()}`);if(!Ze)return Zn(!1);const it=JSON.parse(Ze),Dt=`bsc_${Te.toLowerCase()}`;Zn(!!((Ve=it==null?void 0:it[Dt])!=null&&Ve.token))}catch{Zn(!1)}};he();const Pe=setInterval(he,500);return()=>clearInterval(Pe)},[]);function ze(he){try{const Pe=he.split(".");if(Pe.length!==3)throw new Error("Invalid JWT format");const Te=Pe[1].replace(/-/g,"+").replace(/_/g,"/"),Ze=decodeURIComponent(atob(Te).split("").map(it=>"%"+("00"+it.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(Ze)}catch{return null}}h.useEffect(()=>{(()=>{var Te;const Pe=localStorage.getItem("hyperAddress");if(!Pe){Rt(null),yn("");return}const Ve=localStorage.getItem(`dextrabot_standx_auth_data_${Pe.toLowerCase()}`);if(!Ve){Rt(null),yn("");return}try{const Ze=JSON.parse(Ve),wt=`bsc_${Pe.toLowerCase()}`,Dt=(Te=Ze==null?void 0:Ze[wt])==null?void 0:Te.token;if(En(Dt),!Dt){Rt(null),yn("");return}const Qt=ze(Dt);if(Qt&&(Qt!=null&&Qt.exp)){const xn=new Date(Qt.exp*1e3);Rt(xn),xn.getTime()<=Date.now()?yn("Please click on the refresh button for extending your token."):yn("")}else Qt?(Rt(null),yn("The token's expiration date could not be found.")):(Rt(null),yn("Invalid token format."))}catch(Ze){console.error("Error checking token expiry:",Ze),Rt(null),yn("Error checking token.")}})()},[v,g]);const xe=h.useMemo(()=>[{value:"BTC",label:"BTC",icon:"https://app.hyperliquid.xyz/coins/BTC.svg",maxLeverage:40},{value:"ETH",label:"ETH",icon:"https://app.hyperliquid.xyz/coins/ETH.svg",maxLeverage:40},{value:"XAG",label:"XAG",icon:"https://app.lighter.xyz/assets/xag-DMALkKAA.png",maxLeverage:40},{value:"XAU",label:"XAU",icon:"https://app.lighter.xyz/assets/xau-DtjHfWRI.png",maxLeverage:40}],[]),Ge=he=>{var Pe;return((Pe=xe.find(Ve=>Ve.label===he))==null?void 0:Pe.maxLeverage)??100},_e=he=>{if(he==null||he==="")return"0.00";const Pe=Number(he);return Number.isNaN(Pe)?"0.00":Pe.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})},Be=he=>/^\d*$/.test(he),qt=(he,Pe=4)=>new RegExp(`^(0|[1-9]\\d*)(\\.\\d{0,${Pe}})?$`).test(he),It=he=>/^(0|[1-9]\d*)(\.\d{0,1})?$/.test(he),mt=he=>{["e","E","+","-"].includes(he.key)&&he.preventDefault()},Ft=h.useMemo(()=>O==="BTC"?4:3,[O]);h.useEffect(()=>{if(!Re||Hn!=="size")return;const he=Number(Kt);if(Number.isNaN(he)||Kt===""){vn("");return}const Pe=Number(Re),Ve=he*Pe;vn(Number.isFinite(Ve)&&Ve>0?Ve.toFixed(2):"")},[Kt,Re,Hn]),h.useEffect(()=>{if(!Re||Hn!=="usd")return;const he=Number(un);if(Number.isNaN(he)||un===""){jt("");return}const Pe=Number(Re);if(!Pe)return;const Ve=he/Pe,Te=Ve.toFixed(Ft);jt(Ve===0?"":Te)},[un,Re,Hn,Ft]),h.useEffect(()=>{if(!Re||Ut!=="size")return;const he=Number(Nn);if(Number.isNaN(he)||Nn===""){nt("");return}const Pe=Number(Re),Ve=he*Pe;nt(Number.isFinite(Ve)&&Ve>0?Ve.toFixed(2):"")},[Nn,Re,Ut]),h.useEffect(()=>{if(!Re||Ut!=="usd")return;const he=Number(rt);if(Number.isNaN(he)||rt===""){dn("");return}const Pe=Number(Re);if(!Pe)return;const Ve=he/Pe,Te=Ve.toFixed(Ft);dn(Ve===0?"":Te)},[rt,Re,Ut,Ft]),h.useEffect(()=>{if(!O)return;const he=Ft,Pe=Kt,Ve=Nn;if(Pe!==""&&Pe.includes(".")){const[Te,Ze]=Pe.split(".");if(Ze&&Ze.length>he){const it=`${Te}.${Ze.slice(0,he)}`;jt(it)}}if(Ve!==""&&Ve.includes(".")){const[Te,Ze]=Ve.split(".");if(Ze&&Ze.length>he){const it=`${Te}.${Ze.slice(0,he)}`;dn(it)}}},[O,Ft]),h.useEffect(()=>{if(!O)return;const he=Ge(O),Pe=Number(Ye);!Number.isNaN(Pe)&&Pe>he&&dt(String(he)),!Number.isNaN(Pe)&&Pe<1&&Ye!==""&&dt("1")},[O]);const Tn=h.useMemo(()=>{if(Ye==="")return!1;const he=Number(Ye),Pe=Ge(O);return Number.isInteger(he)&&he>=1&&he<=Pe},[Ye,O]);h.useEffect(()=>{if(!O)return;const he=Ge(O),Pe=Number(Ye);!Number.isNaN(Pe)&&Pe>he&&dt(String(he)),!Number.isNaN(Pe)&&Pe<1&&Ye!==""&&dt("1")},[O]);const kn=h.useMemo(()=>{if(st==="")return!1;const he=Number(st);if(Number.isNaN(he)||he<.1)return!1;if(ee!=null&&ee!=="0"){const Pe=Number(ee);if(!Number.isNaN(Pe)&&he>Pe)return!1}return!0},[st,ee]);h.useEffect(()=>{if(ee===null||ee==="0.00")return;const he=_e(ee),Pe=Number(st);!Number.isNaN(Pe)&&Pe>he&&at(he),!Number.isNaN(Pe)&&Pe<.1&&at("")},[ee]);const Gt=h.useMemo(()=>{if(He==="")return!1;const he=Number(He);return Number.isNaN(he)?!1:he>=.1&&he<=1e3},[He]),mn=h.useMemo(()=>{if(vt==="")return!1;const he=Number(vt);return Number.isNaN(he)?!1:he>=1&&he<=10},[vt]),gt=h.useMemo(()=>{if(Kt==="")return!1;const he=Number(Kt);return Number.isNaN(he)?!1:he>=1e-4},[Kt]),Wt=h.useMemo(()=>{if(Nn==="")return!1;const he=Number(Nn);return Number.isNaN(he)?!1:he>=1e-4},[Nn]),jn=h.useMemo(()=>{if(Jt===""||Jt==="0.0"||Jt==="0."||Jt==="0")return!1;const he=Number(Jt);if(Number.isNaN(he)||he<.1)return!1;if(He){const Pe=Number(He);if(!Number.isNaN(Pe)&&he>Pe)return!1}return!0},[Jt,He]);h.useEffect(()=>{if(!He)return;const he=Number(He),Pe=Number(Jt);!Number.isNaN(Pe)&&Pe>he&&Vt(he),!Number.isNaN(Pe)&&Pe<.1&&Vt("")},[He]);const kt=h.useMemo(()=>{if(!Re||!pe||!ge||!Kt||!vt||!Ye)return"";const he=Number(Kt)*Number(Re),Pe=Number(ge)/(2*Number(vt)),Ve=Pe-Pe*.05;return he<Ve?"":"Order size is too large for your available margin. Reduce order size or active orders (per side), or increase leverage."},[Re,pe,ge,Kt,vt,Ye]),cn=h.useMemo(()=>{if(!Re||!ge||!Nn)return"";const he=Number(Nn)*Number(Re),Pe=ge-ge*.05;return he<Pe?"":"Max net position (per side) exceeds your total available margin. Reduce max net position (per side) or increase leverage."},[Re,ge,Nn]),Ce=O!==""&&!Sn&&!hn&&v&&Tn&&Gt&&mn&>&&Wt&&Yn&&(st===""||kn)&&(Jt===""||jn);async function m(){if(v)try{We(!0);const he=window.localStorage.getItem("hyperToken"),Pe=window.localStorage.getItem("hyperAddress");if(!he||!Pe){C(!1),n(!0);return}const Te=await(await fetch(`${SO}/api/hyper/mmbot/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Pe.toLowerCase(),token:he})})).json();if(Te!=null&&Te.success&&(Te!=null&&Te.data)){const Ze=Te.data[0],it=(Ze==null?void 0:Ze.bot_params)||{};T(!0),Mn((Ze==null?void 0:Ze.id)??null),Ze!=null&&Ze.coin?(U(Ze.coin),re((it==null?void 0:it.coin)||Ze.coin)):it!=null&&it.coin&&(U(it.coin),re(it.coin)),(it==null?void 0:it.leverage)!=null&&dt(String(it.leverage)),(it==null?void 0:it.bps)!=null&&qe(String(it.bps)),(it==null?void 0:it.orders_per_side)!=null&&yt(String(it==null?void 0:it.orders_per_side)),(it==null?void 0:it.order_per_size)!=null&&jt(String(it==null?void 0:it.order_per_size)),(it==null?void 0:it.max_pos_size)!=null&&dn(String(it==null?void 0:it.max_pos_size)),(it==null?void 0:it.tp_sl_bps)!=null&&Vt(String(it==null?void 0:it.tp_sl_bps)),(it==null?void 0:it.budget)!=null&&at(String(it==null?void 0:it.budget))}}catch(he){console.error("Failed to load saved info:",he)}finally{We(!1)}}h.useEffect(()=>{Cn?p():(se(null),Se(null),we(""))},[Cn]),h.useEffect(()=>{v&&(t(),m(),Ie())},[v]);async function p({silent:he=!1}={}){try{we(""),he||(oe(!0),se(null),Se(null));const Pe=Cn;if(!Pe)throw new Error("StandX token missing. Please sign in again.");const Te=await(await fetch(kCn,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pe}`}})).json(),Ze=(Te==null?void 0:Te.balance)??null,it=(Te==null?void 0:Te.cross_available)??null;if(Ze==null||it==null)throw new Error("Balance not available.");se(Ze),Se(it)}catch(Pe){we(Pe.message||"Failed to load DUSD balance.")}finally{he||oe(!1)}}h.useEffect(()=>{if(!S||!Cn)return;p({silent:!0});const he=setInterval(()=>{p({silent:!0})},1e4);return()=>clearInterval(he)},[S,Cn]);async function N(){try{Fe(""),H(!0);const he=Y;if(!he)return;const Ve=await(await fetch(`https://express-proxy-delta.vercel.app/proxy?url=https://perps.standx.com/api/query_symbol_price?symbol=${he}-USD`,{method:"GET",headers:{"Content-Type":"application/json"}})).json(),Te=(Ve==null?void 0:Ve.mark_price)??null;if(Te==null)throw new Error("Margin not available.");Qe(Te)}catch(he){Fe(he.message||"Failed to load DUSD margin.")}finally{H(!1)}}h.useEffect(()=>{Y&&N()},[Y]),h.useEffect(()=>{ve(Ye&&pe?pe*Ye:null)},[Ye,pe]);function A(){Cn&&p(),Y&&N()}async function k(){var he,Pe,Ve;if(!v){n(!0);return}if(Ce)try{L(!0),G(""),Nt(!0);const Te=window.localStorage.getItem("hyperToken"),Ze=window.localStorage.getItem("hyperAddress");if(!Te||!Ze){C(!1),n(!0);return}let it=null,wt=null,Dt=null;try{const or=`dextrabot_standx_auth_data_${Ze.toLowerCase()}`,$t=window.localStorage.getItem(or);if($t){const bt=JSON.parse($t),rn=`bsc_${Ze.toLowerCase()}`;it=((he=bt==null?void 0:bt[rn])==null?void 0:he.signingKeyHex)||null,wt=((Pe=bt==null?void 0:bt[rn])==null?void 0:Pe.token)||null,Dt=((Ve=bt==null?void 0:bt[rn])==null?void 0:Ve.requestId)||null}}catch(or){console.warn("StandX auth data parse failed:",or)}const Qt={coin:Y,leverage:Number(Ye),bps:Number(He),orders_per_side:Number(vt),order_per_size:Number(Kt),max_pos_size:Number(Nn),tp_sl_bps:Number(Jt),budget:Number(st),standx_token:wt,signingKeyHex:it,requestId:Dt},xn={address:Ze.toLowerCase(),token:Te,coin:O,wallet_id:0,source_market:"standx",bot_params:Qt},An=await(await fetch(`${SO}/api/hyper/mmbot/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(xn)})).json();An!=null&&An.success?(t(),m(),fn.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"}}),T(!0),localStorage.setItem("standXMarketMakerStart","true")):(G((An==null?void 0:An.error_message)||"Start failed."),fn.error((An==null?void 0:An.error_message)||"Save failed."),T(!1))}catch(Te){G(Te.message||"An error occurred while saving.")}finally{L(!1),Ke(!1),Nt(!1),T(!1)}}async function P(){if(!v){n(!0);return}try{$(!0),G("");const he=window.localStorage.getItem("hyperToken"),Pe=window.localStorage.getItem("hyperAddress");if(!he||!Pe){n(!0);return}const Te=await(await fetch(`${SO}/api/hyper/mmbot/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Pe.toLowerCase(),token:he,source_market:"standx",coin:Y,wallet_id:0})})).json();Te!=null&&Te.success?(T(!1),m(),t(),localStorage.setItem("standXMarketMakerStart","false")):G((Te==null?void 0:Te.error_message)||"Stop failed.")}catch(he){G(he.message||"An error occurred while stopping.")}finally{$(!1),Ke(!1)}}const D=32,V={control:(he,Pe)=>({...he,backgroundColor:"#242424",borderColor:Pe.isFocused?"#67FFBD":"#353535",minHeight:D,height:D,boxShadow:"none",cursor:"pointer",alignItems:"center",minWidth:"max-content"}),valueContainer:he=>({...he,height:D,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:he=>({...he,height:D}),input:he=>({...he,color:"#FFFFFF",margin:0,padding:0}),singleValue:he=>({...he,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:he=>({...he,color:"#7F7F7F",fontSize:"12px"}),menu:he=>({...he,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:he=>({...he,paddingTop:0,paddingBottom:0,maxHeight:180}),option:(he,Pe)=>({...he,backgroundColor:Pe.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:D,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:he=>({...he,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:he=>({...he,backgroundColor:"#353535"})},Z=({max:he})=>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:[he,"x"]}),ce=he=>{var Pe;return i.jsx(ba.Option,{...he,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Pe=he.data)!=null&&Pe.icon?i.jsx("img",{src:he.data.icon,alt:he.data.label,className:"w-4 h-4",onError:Ve=>Ve.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:he.data.label}),i.jsx(Z,{max:he.data.maxLeverage})]})})},ue=he=>{var Pe;return i.jsx(ba.SingleValue,{...he,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Pe=he.data)!=null&&Pe.icon?i.jsx("img",{src:he.data.icon,alt:he.data.label,className:"w-4 h-4",onError:Ve=>Ve.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:he.data.label}),i.jsx(Z,{max:he.data.maxLeverage})]})})},me=(he,Pe)=>{U(he),re(Pe)},Ne=xe,Ie=async()=>{var Ve,Te;const he=window.localStorage.getItem("hyperToken"),Pe=window.localStorage.getItem("hyperAddress");if(!(!he||!Pe))try{te(!0);const Ze=await bi(Pe.toLowerCase(),he);Ze!=null&&Ze.success?(r(Ze==null?void 0:Ze.telegram_chat_id),s(Ze==null?void 0:Ze.subscriber_role),a((Ve=Ze==null?void 0:Ze.mushboomer_counts)==null?void 0:Ve.eth),o((Te=Ze==null?void 0:Ze.mushboomer_counts)==null?void 0:Te.sol),l(Ze==null?void 0:Ze.referral_code),c(Ze==null?void 0:Ze.refcode),u(Ze==null?void 0:Ze.whitelist),d(he),f(Pe),te(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),d(""),f(""),te(!1))}catch(Ze){console.error("Token verification error:",Ze),console.error(Ze.message||"An unknown error occurred."),te(!1)}};async function Le({standx_access_token:he,standx_sign_key:Pe,standx_request_id:Ve}){try{const Te=window.localStorage.getItem("hyperToken"),Ze=window.localStorage.getItem("hyperAddress");if(!Te||!Ze||!Rn)return;await fetch(`${SO}/api/hyper/standx/refresh_token/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Ze.toLowerCase(),token:Te,standx_bot_id:Rn,standx_access_token:he,standx_sign_key:Pe,standx_request_id:Ve})})}catch(Te){console.error("Failed to refresh StandX bot token:",Te)}}const Xe=async()=>{const he=await x();he!=null&&he.token&&(En(he.token),S&&await Le({standx_access_token:he.token,standx_sign_key:he.signingKeyHex,standx_request_id:he.requestId}))},Oe=Q||I||F,$e=S&&!F,ae=Ge(O);return i.jsxs(i.Fragment,{children:[i.jsx(xCn,{open:Pt,setOpen:Ke,makerStatus:S?P:k,isStatusWallet:"",info:"settings",modalLoading:ct,active:S,modalDataInfo:Vn}),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.jsxs("div",{className:"flex justify-between items-center gap-1",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-4 sm:leading-[8px]",children:"StandX Token"}),i.jsx(as,{content:"Your auth token, make sure to refresh it before the expiry date.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),Yn&&i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("div",{className:"flex items-center gap-1",children:i.jsx(as,{content:"The expiration time of your current token, you can refresh the expiry date by clicking on the refresh icon. Make sure sign before this date?",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative gap-1",children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5 ml-1"})})})}),i.jsx("span",{className:"text-[10px] text-[#CECECE] font-medium min-w-max",children:"Valid Until:"}),i.jsx("span",{className:"text-[11px] font-semibold min-w-max "+(Sn?"text-[#FF797C]":"text-[#F8D4AB]"),children:Ht==null?void 0:Ht.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),i.jsx("div",{onClick:()=>{g||Xe()},className:`flex justify-center items-center cursor-pointer ${g?"opacity-50 cursor-not-allowed":""}`,title:"Refresh / Valid Until",children:i.jsx(t1,{className:`w-4 h-4 text-[#7C7C7C] hover:text-white ${g?"animate-spin":""}`})})]})]}),Yn?i.jsxs(i.Fragment,{children:[i.jsx("input",{value:Cn.slice(0,10)+"..."+Cn.slice(-4),readOnly:!0,autoComplete:"off",type:"password",placeholder:"Wallet address (0x...)",onFocus:he=>he.target.blur(),onCopy:he=>he.preventDefault(),onCut:he=>he.preventDefault(),onPaste:he=>he.preventDefault(),className:`w-full h-8 px-3 rounded-md bg-[#444444] border border-[#404040]
text-[13px] text-[#7F7F7F] outline-none placeholder:text-[#7F7F7F]
select-none cursor-not-allowed`}),Ht&&i.jsxs("div",{className:"text-[12px] pl-[3px] flex justify-start items-center gap-2",children:[Sn&&i.jsx("span",{children:i.jsx("img",{src:Wo,alt:"",className:"w-3.5 h-3.5 min-w-max"})}),hn&&i.jsx("div",{className:"text-[10px] text-[#FF797C] mt-[2px] pl-[3px]",children:hn})]})]}):v?i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx("div",{className:"text-[12px] text-[#CECECE] font-semibold min-w-max",children:"Not signed in to StandX"}),i.jsx("button",{disabled:g,onClick:he=>{he.preventDefault(),S?Xe():y()},className:`w-full h-[28px] rounded-xl font-bold text-[12px] transition-opacity mb-2 flex items-center justify-center bg-[#67FFBD] text-black ${g?"opacity-50 cursor-not-allowed":""}`,children:g?"Signing...":"Confirm"})]}):i.jsx("div",{className:"flex justify-start items-center gap-4 max-w-full",children:i.jsx("div",{className:"text-[12px] text-[#CECECE] font-semibold",children:"You are not connected. Please connect your wallet to generate StandX token."})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("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.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-[8px]",children:"Select Coin"}),i.jsx(as,{content:"The perpetual market this market maker will provide liquidity for.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]})}),Y&&i.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-[#9B9B9B] font-manrope font-semibold min-w-max",children:[Y," Mark Price (DUSD):",i.jsx("span",{className:"text-white",children:K?"Loading...":je?"—":Y7(Re??"0")}),i.jsx("div",{onClick:A,className:"flex justify-center items-center cursor-pointer",title:"Refresh Mark Price",children:i.jsx(t1,{className:`w-4 h-4 text-[#7C7C7C] hover:text-white ${ie?"animate-spin":""}`})})]})]}),i.jsx(pl,{styles:V,components:{Option:ce,SingleValue:ue},isDisabled:Oe||$e,options:Ne,value:Ne.find(he=>he.label===O)||null,onChange:he=>me((he==null?void 0:he.label)??"",(he==null?void 0:he.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-[8px]",children:"Leverage"}),i.jsx(as,{content:"The leverage used for positions opened by the market maker. Higher leverage increases capital efficiency but also risk.",children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),i.jsx("input",{value:Ye,onChange:he=>{let Pe=he.target.value.trim();if(Pe==="")return dt("");Pe.startsWith("0")&&(Pe=Pe.replace(/^0+/,"")||"0"),Be(Pe)&&dt(Pe)},onKeyDown:mt,inputMode:"numeric",autoComplete:"off",placeholder:O?`1–${ae}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ye===""?"border-[#353535]":Tn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Oe||$e}),Ye!==""&&!Tn&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Leverage must be between 1 and ",ae,"."]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-[8px]",children:"Spread (Bps)"}),i.jsx(as,{content:"Base spread in basis points around the reference price, smaller BPS means your orders are closer to the mark price.",children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:He,onChange:he=>{let Pe=he.target.value.trim();if(Pe==="")return qe("");Pe.startsWith(".")&&(Pe=`0${Pe}`),It(Pe)&&qe(Pe)},onKeyDown:mt,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 4",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${He===""?"border-[#353535]":Gt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Oe||$e})}),He!==""&&!Gt&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Enter a number between 0.1 and 1000."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-[8px]",children:"Active Orders (Per Side)"}),i.jsx(as,{content:"How many limit orders to place on each side of the book (buy and sell). More orders create deeper liquidity but increase exposure.",children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),i.jsx("input",{value:vt,onChange:he=>{let Pe=he.target.value.trim();if(Pe==="")return yt("");Pe.startsWith("0")&&(Pe=Pe.replace(/^0+/,"")||"0"),Be(Pe)&&yt(Pe)},onKeyDown:mt,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 2",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${vt===""?"border-[#353535]":mn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Oe||$e}),vt!==""&&!mn&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Enter an integer between 1 and 10."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"w-1/2 space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsxs("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-4 sm:leading-[8px]",children:["Order Size ",O?`(${O})`:""]}),i.jsx(as,{content:"The size of each individual order.",children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:Kt,onChange:he=>{let Pe=he.target.value.trim();if(ln("size"),Pe===""){jt("");return}Pe.startsWith(".")&&(Pe=`0${Pe}`),qt(Pe,Ft)&&jt(Pe)},onKeyDown:mt,inputMode:"decimal",autoComplete:"off",placeholder:O?`e.g. 0.0001 ${O}`:"e.g. 0.0001",className:`w-full h-8 pl-3 pr-[50px] rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Kt===""?"border-[#353535]":gt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Oe||$e}),O&&i.jsx("span",{className:"absolute right-2 top-1/2 -translate-y-1/2 px-2 py-0.5 rounded-full bg-[#1c1c1c] border border-[#3a3a3a] text-[11px] text-[#9be7c4] font-semibold tracking-wide",children:O})]})]}),i.jsxs("div",{className:"w-1/2 space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-4 sm:leading-[8px]",children:"Order Value (DUSD)"}),i.jsx(as,{content:"Enter total order notional in DUSD, size is derived from mark price.",children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),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:un,onChange:he=>{let Pe=he.target.value.trim();if(ln("usd"),Pe===""){vn("");return}Pe.startsWith(".")&&(Pe=`0${Pe}`),qt(Pe,2)&&vn(Pe)},onKeyDown:mt,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 10.50",className:"w-full h-8 pl-6 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] border-[#353535]",disabled:Oe||$e})]})]})]}),Kt!==""&&!gt&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:O==="BTC"?"Enter a value greater than or equal to 0.0001":"Enter a value greater than or equal to 0.001"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"w-1/2 space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-[8px]",children:O?`Max Net Pos (Per Side) (${O})`:"Max Net Position (Per Side)"}),i.jsx(as,{content:"Maximum allowed net position on one side (long or short). This acts as a safety limit to prevent excessive exposure.",children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:Nn,onChange:he=>{let Pe=he.target.value.trim();if(wn("size"),Pe===""){dn("");return}Pe.startsWith(".")&&(Pe=`0${Pe}`),qt(Pe,O==="BTC"?4:3)&&dn(Pe)},onKeyDown:mt,inputMode:"decimal",autoComplete:"off",placeholder:O?`e.g. 0.0001 ${O}`:"e.g. 0.0001",className:`w-full h-8 pr-[50px] pl-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Nn===""?"border-[#353535]":Wt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Oe||$e}),O&&i.jsx("span",{className:"absolute right-2 top-1/2 -translate-y-1/2 px-2 py-0.5 rounded-full bg-[#1c1c1c] border border-[#3a3a3a] text-[11px] text-[#9be7c4] font-semibold tracking-wide",children:O})]})]}),i.jsxs("div",{className:"w-1/2 space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-[8px]",children:"Max Position Value (DUSD)"}),i.jsx(as,{content:"Enter max net position notional in DUSD, size is derived from mark price.",children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),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:he=>{let Pe=he.target.value.trim();if(wn("usd"),Pe===""){nt("");return}Pe.startsWith(".")&&(Pe=`0${Pe}`),qt(Pe,2)&&nt(Pe)},onKeyDown:mt,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 10.50",className:"w-full h-8 pl-6 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] border-[#353535]",disabled:Oe||$e})]})]})]}),Nn!==""&&!Wt&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:O==="BTC"?"Enter a value greater than or equal to 0.0001":"Enter a value greater than or equal to 0.001"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-[8px]",children:"TP-SL BPS"}),i.jsx(as,{content:i.jsx(ECn,{}),children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Jt,onChange:he=>{let Pe=he.target.value.trim();if(Pe==="")return Vt("");Pe.startsWith(".")&&(Pe=`0${Pe}`),It(Pe)&&Vt(Pe)},onKeyDown:mt,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 0.5",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Jt===""?"border-[#353535]":jn?"border-[#090808] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Oe||$e})}),Jt!==""&&!jn&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:He===""?"Enter a value greater than or equal to 0.1":`Enter a value between 0.1 and ${He}.`})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-start items-center h-4",children:[i.jsx("div",{className:"text-[13px] text-[#8A8A8A] font-manrope font-semibold leading-[8px]",children:"Budget (Loss Limit)"}),i.jsx(as,{content:"Stops the bot automatically once the total realized loss reaches this amount.",children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(us,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),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:st,onChange:he=>{let Pe=he.target.value.trim();if(Pe==="")return at("");Pe.startsWith(".")&&(Pe=`0${Pe}`),It(Pe)&&at(Pe)},onKeyDown:mt,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 100",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${st===""?"border-[#353535]":kn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Oe||$e})]}),st!==""&&!kn&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:ee===null||ee==="0"?"Enter a value greater than or equal to 0.1":`Enter a value between 0.1 and ${_e(ee)}`})]})]}),i.jsxs("div",{className:"flex flex-col lg:flex-row justify-end 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.jsx("div",{className:"flex w-full lg:basis-[92%] flex-col gap-1",children:v&&i.jsx("div",{className:"text-[12px] text-[#9B9B9B] flex items-start gap-2",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 p-2 sm:p-3 border border-[#353535] rounded-lg bg-[#1B1B1B]/60",children:[i.jsx("div",{onClick:A,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(t1,{className:`w-4 h-4 text-[#7C7C7C] hover:text-white ${ie?"animate-spin":""}`})}),i.jsxs("div",{className:"flex flex-col sm:flex-row sm:flex-wrap items-start sm:items-center gap-2 sm:gap-6 min-w-max",children:[i.jsxs("div",{className:"flex items-center gap-2",children:["Balance (DUSD):",i.jsx("span",{className:"text-white",children:ie?"Loading...":be?"—":Y7(ee??"0")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:["Available Balance (DUSD):",i.jsx("span",{className:"text-white",children:ie?"Loading...":be?"—":Y7(pe??"0")})]}),Ye&&i.jsxs("div",{className:"flex items-center gap-2",children:["Total Value (DUSD):",i.jsx("span",{className:"text-white",children:ie?"Loading...":be?"—":Y7(ge??"0")})]})]})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2",children:[kt&&!S&&i.jsxs("div",{className:"flex justify-start items-center gap-2 text-[12px] text-[#F59E0B] bg-[#3b2626] border border-[#D97706] rounded-md px-3 py-1.5 max-w-max",children:[i.jsx(CS,{className:"w-4 h-4 text-[#F59E0B]"}),i.jsx("div",{className:"text-[#F59E0B] text-[11px]",children:kt})]}),cn&&!S&&i.jsxs("div",{className:"flex justify-start items-center gap-2 text-[12px] text-[#F59E0B] bg-[#3b2626] border border-[#D97706] rounded-md px-3 py-1.5 max-w-max",children:[i.jsx(CS,{className:"w-4 h-4 text-[#F59E0B]"}),i.jsx("div",{className:"text-[#F59E0B] text-[11px]",children:cn})]})]})]})})}),i.jsx("div",{className:"flex flex-col items-end sm:flex-row sm:justify-end gap-2 sm:gap-4 w-full lg:basis-[8%]",children:i.jsx("div",{className:"flex justify-end items-center",children:v?S?i.jsx("button",{onClick:()=>{Ke(!0),tr({coin:O,spread:He,per_side:vt,order_size:Kt,max_per_side:Nn,tp_sl:Jt,leverage:Ye})},disabled:!Ce||Oe,className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Ce||Oe?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#ff4444] border-[#ff6666] hover:bg-[#ff3333] cursor-pointer"}`,children:F?"Stopping...":"Stop"}):i.jsx("button",{onClick:()=>{Ke(!0),tr({coin:O,spread:He,per_side:vt,order_size:Kt,max_per_side:Nn,tp_sl:Jt,budget:st,leverage:Ye})},disabled:!Ce||Oe,className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Ce||Oe?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer"}`,children:I?"Loading...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] font-semibold border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})})})]})]})},PCn=({data:t,setData:e,loading:n,error:r,fetchInfoOnOpen:s,isFilterWallet:a})=>{var be,we;h.useContext(Qr);const{isConnected:o,address:l}=ds();h.useState(null),h.useState(!1),h.useState(!1);const[c,u]=h.useState(!1),[d,f]=h.useState(!1),[x,g]=h.useState(()=>new Set);h.useState({}),h.useState(!1),h.useState({id:"",walletAddress:"",isDeleted:!1}),h.useState(!1);const[y,v]=h.useState("");h.useState([]),h.useState([]);const[C,S]=h.useState([]),[T,I]=h.useState(!1),[L,F]=h.useState(!1),[$,O]=h.useState(!1),[U,Y]=h.useState(!1),re=h.useRef(null),Q=h.useRef(null),q=h.useRef(null),te=h.useRef(null),fe=h.useRef(new Map),G=h.useRef(new Set);h.useState(!1);const ie="tag",[oe,K]=h.useState(ie),H=je=>{if(!c){let Fe=t;const Re=Fe==null?void 0:Fe.filter(Qe=>{var dt,st,at,He;const Ye=y.trim().toUpperCase();if(Ye&&!(((He=(at=(st=(dt=Qe==null?void 0:Qe.bot)==null?void 0:dt.symbol)==null?void 0:st.split("-"))==null?void 0:at[0])==null?void 0:He.toUpperCase())||"").includes(Ye))return!1;if(C.length>0){const qe={"Bot Started":"BOT_STARTED","Leverage Set":"LEVERAGE_SET","Orders Starting":"ORDERS_STARTING","Max Pos Reached":"MAX_POS_REACHED","Budget Exceeded":"BUDGET_EXCEEDED","Token Expiry":"TOKEN_EXPIRY","User Stopped":"USER_STOPPED"},vt=C.map(Kt=>qe[Kt]).filter(Boolean),yt=((Qe==null?void 0:Qe.event)||(Qe==null?void 0:Qe.status)||"").toString().toUpperCase();if(!vt.includes(yt))return!1}return!0});return Re==null?void 0:Re.sort((Qe,Ye)=>{var qe,vt,yt,Kt,jt,un,vn,Hn;const dt=((Kt=(yt=(vt=(qe=Qe==null?void 0:Qe.bot)==null?void 0:qe.symbol)==null?void 0:vt.split("-"))==null?void 0:yt[0])==null?void 0:Kt.toUpperCase())||"",st=((Hn=(vn=(un=(jt=Ye==null?void 0:Ye.bot)==null?void 0:jt.symbol)==null?void 0:un.split("-"))==null?void 0:vn[0])==null?void 0:Hn.toUpperCase())||"",at=Qe!=null&&Qe.ts?new Date(Qe==null?void 0:Qe.ts).getTime():0,He=Ye!=null&&Ye.ts?new Date(Ye==null?void 0:Ye.ts).getTime():0;return je==="coin"?dt<st?-1:dt>st?1:0:je==="-coin"?dt>st?-1:dt<st?1:0:je==="time"?at-He:je==="-time"?He-at:0})}return t},ee=["User Stopped","Bot Started","Leverage Set","Orders Starting","Max Pos Reached","Budget Exceeded","Token Expiry"],se=je=>{S(Fe=>Fe.includes(je)?Fe.filter(Re=>Re!==je):[...Fe,je])};h.useEffect(()=>{function je(Fe){re.current&&!re.current.contains(Fe.target)&&F(!1),Q.current&&!Q.current.contains(Fe.target)&&O(!1),te.current&&!te.current.contains(Fe.target)&&Y(!1),q.current&&!q.current.contains(Fe.target)&&I(!1)}return document.addEventListener("mousedown",je),()=>document.removeEventListener("mousedown",je)},[]);const pe=async()=>{try{const je=window.localStorage.getItem("hyperToken"),Fe=window.localStorage.getItem("hyperAddress");if(!je||!Fe)return;const Ye=await(await fetch("https://dextradata.nftinit.io/api/hyper/standx/logs/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:l?l.toLowerCase():Fe,token:je})})).json();Ye.success&&e((Ye==null?void 0:Ye.data)||[])}catch(je){fn.error(je.message||"Something went wrong")}finally{}},Se=()=>localStorage.getItem("standXMarketMakerStart")==="true";h.useEffect(()=>{let je=null,Fe=null;const Re=()=>{je||(pe(),je=setInterval(()=>{pe()},1e4))},Qe=()=>{Fe||(Fe=setTimeout(()=>{je&&(clearInterval(je),je=null),Fe=null},4e4))},Ye=()=>{Fe&&(clearTimeout(Fe),Fe=null)},dt=setInterval(()=>{Se()?(Ye(),Re()):je&&Qe()},1e3);return()=>{je&&clearInterval(je),Fe&&clearTimeout(Fe),clearInterval(dt)}},[]),h.useEffect(()=>()=>{fe.current.forEach(je=>clearTimeout(je)),fe.current.clear()},[]);const ge=(je,Fe)=>{var Re,Qe;return(je==null?void 0:je.ts_ms)||(je==null?void 0:je.ts)||(je==null?void 0:je.id)||`${(je==null?void 0:je.event)||"event"}-${((Re=je==null?void 0:je.bot)==null?void 0:Re.symbol)||"symbol"}-${((Qe=je==null?void 0:je.data)==null?void 0:Qe.message_en)||"message"}-${Fe}`};h.useEffect(()=>{const je=new Set((t||[]).map((Re,Qe)=>ge(Re,Qe))),Fe=G.current;if(Fe.size>0){const Re=[];je.forEach(Qe=>{Fe.has(Qe)||Re.push(Qe)}),Re.length>0&&(g(Qe=>{const Ye=new Set(Qe);return Re.forEach(dt=>Ye.add(dt)),Ye}),Re.forEach(Qe=>{fe.current.has(Qe)&&clearTimeout(fe.current.get(Qe));const Ye=setTimeout(()=>{g(dt=>{const st=new Set(dt);return st.delete(Qe),st}),fe.current.delete(Qe)},3e3);fe.current.set(Qe,Ye)}))}G.current=je},[t]),h.useEffect(()=>{const je=localStorage.getItem("hyperToken"),Fe=localStorage.getItem("hyperAddress");f(!!(je&&Fe));const Re=setInterval(()=>{const Qe=localStorage.getItem("hyperToken"),Ye=localStorage.getItem("hyperAddress");f(!!(Qe&&Ye))},800);return()=>clearInterval(Re)},[]);const ve={BTC:"https://app.hyperliquid.xyz/coins/BTC.svg",ETH:"https://app.hyperliquid.xyz/coins/ETH.svg",XAG:"https://app.lighter.xyz/assets/xag-DMALkKAA.png",XAU:"https://app.lighter.xyz/assets/xau-DtjHfWRI.png"};return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-3 text-white w-full font-manrope",children:[i.jsx("div",{className:"flex items-center justify-between w-full px-2 sm:px-1",children:i.jsx("div",{className:"text-white text-lg sm:text-xl font-semibold leading-[16px]",children:"History"})}),i.jsx("div",{className:"relative w-full h-full rounded-2xl border border-white/10 bg-gradient-to-b from-[#0c1311]/95 via-[#0a0f0e]/95 to-[#090d0c]/95 shadow-[0_20px_60px_rgba(0,0,0,0.4)] backdrop-blur",children:i.jsx("div",{className:"w-full h-full min-h-[380px] max-h-[540px] overflow-x-scroll relative overflow-y-scroll flex-grow rounded-2xl",children:i.jsxs("table",{className:"w-full relative mb-16 table-fixed min-w-[760px] ",children:[i.jsxs("colgroup",{children:[i.jsx("col",{className:"w-[150px]"}),i.jsx("col",{className:"w-[170px]"}),i.jsx("col",{className:"w-[180px]"}),i.jsx("col",{className:"w-[360px]"})]}),i.jsx("thead",{className:"sticky top-0 z-[3] backdrop-blur-md whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#d7dadb] text-[12px] sm:text-[13px] font-semibold uppercase tracking-[0.08em] bg-[#111814]/95",children:[i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#111814]/95 sm:left-0 h-10 pl-4 sm:pl-6 min-w-[140px] sm:min-w-[120px] z-[8] relative",children:i.jsxs("div",{className:"flex items-center gap-2 w-full min-w-max sticky left-0 h-10",children:[i.jsx(hi,{title:"Coin",sortKey:"coin",sortOption:oe,setSortOption:K,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>I(!T),className:`${y?"bg-[#18211d]":"bg-white/5"} inline-flex items-center p-1 rounded-md hover:bg-[#1d2722] focus:outline-none focus:ring-0 border border-white/10 transition-colors`,children:i.jsx(xd,{className:`w-4 h-4 ${y?"text-blue-500":"text-white"}`})}),T&&i.jsxs("div",{ref:q,className:"absolute left-[58px] mt-32 w-[208px] bg-[#0f1413] border border-[#1c2421] rounded-xl shadow-lg shadow-black/40 p-3 z-20 backdrop-blur",children:[i.jsxs("div",{className:"flex justify-between items-center px-1 pb-2 border-b border-white/10",children:[i.jsx("span",{className:"text-white text-sm font-semibold tracking-tight",children:"Filter"}),i.jsx("div",{onClick:()=>v(""),className:"h-6 px-2 py-1 bg-white/5 border border-white/10 rounded-md justify-start items-center gap-2 inline-flex cursor-pointer hover:bg-white/10 transition",children:i.jsx("div",{className:"text-[#d6d6d6] text-[11px] font-semibold font-manrope leading-[10px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"text",value:y,onChange:je=>v(je.target.value),className:"bg-[#251f1f] border border-white/10 rounded-md text-white py-2 px-3 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c] focus:border-white/30 w-[96%]",placeholder:"Coin"})]})]})]})}),i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#111814]/95 sm:left-[140px] h-10 px-3 min-w-[150px] sm:min-w-[170px] z-[7] relative",children:i.jsx("div",{className:"flex items-center justify-start w-full min-w-max h-10 gap-2",children:i.jsx(hi,{title:"Time",sortKey:"time",sortOption:oe,setSortOption:K,isFilterIcon:!1})})}),i.jsx("th",{scope:"col",className:"bg-[#111814]/95 h-10 px-3 min-w-[170px] z-[6] relative",children:i.jsxs("div",{className:"flex items-center justify-start w-full min-w-max h-10 gap-2",children:[i.jsx("div",{className:"flex items-center justify-start text-left pl-1.5",children:"Status"}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>Y(!U),className:`${C.length>0?"bg-[#18211d]":"bg-white/5"} ml-1 inline-flex items-center p-1 rounded-md hover:bg-[#1d2722] focus:outline-none focus:ring-0 border border-white/10 transition-colors`,children:i.jsx(xd,{className:`w-4 h-4 ${C.length>0?"text-blue-500":"text-white"}`})}),U&&i.jsxs("div",{ref:te,className:"absolute left-[58px] mt-80 w-[230px] bg-[#0f1413] border border-white/10 rounded-xl shadow-lg shadow-black/40 p-3 z-20 backdrop-blur",children:[i.jsxs("div",{className:"flex justify-between items-center px-1 pb-2 border-b border-white/10",children:[i.jsx("span",{className:"text-white text-sm font-semibold tracking-tight",children:"Filter"}),i.jsx("div",{onClick:()=>S([]),className:"h-6 px-2 py-1 bg-white/5 border border-white/10 rounded-md justify-start items-center gap-2 inline-flex cursor-pointer hover:bg-white/10 transition",children:i.jsx("div",{className:"text-[#d6d6d6] text-[11px] font-semibold font-manrope leading-[10px] pointer-events-none",children:"Clear All"})})]}),ee==null?void 0:ee.map(je=>i.jsxs("label",{className:"flex items-center gap-2 p-[8px] h-8 relative rounded hover:bg-white/5 cursor-pointer text-white text-[13px] font-semibold font-manrope leading-[16px] mt-2",children:[i.jsx("input",{type:"checkbox",checked:C.includes(je),onChange:()=>se(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 ${C.includes(je)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:C.includes(je)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),je]},je))]})]})]})}),i.jsx("th",{scope:"col",className:"bg-[#111814]/95 h-10 min-w-[200px] sm:min-w-[240px] md:min-w-[260px] md:w-[340px] md:max-w-[380px] z-[7] pr-6",children:i.jsx("div",{className:"flex items-center justify-start w-full md:max-w-[380px] pl-1",children:"Description"})})]})}),i.jsx("tbody",{children:!t||n?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:4,children:i.jsx("div",{className:"flex min-h-[40vh] flex-col justify-center items-center py-6",children:i.jsx(ka,{})})})}):r&&!t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:4,children:i.jsx("div",{className:"flex min-h-[25vh] flex-col justify-center items-center w-full py-8",children:i.jsx(El,{})})})}):((be=H(oe))==null?void 0:be.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:4,children:i.jsx("div",{className:"flex min-h-[24vh] flex-col justify-center items-center w-full py-8",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",children:[i.jsx("img",{src:Yl,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-[18px] pt-3 text-center",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-[18px] pt-3 text-center",children:"No results match your filters."})})]})})})})}):(we=H(oe))==null?void 0:we.map((je,Fe)=>{var at,He,qe,vt,yt,Kt,jt;const Re=Fe%2===0,Qe=Re?"bg-[#0b100f]":"bg-[#0c1310]",Ye=Re?"group-hover:bg-[#111814]":"group-hover:bg-[#141c17]",dt=ge(je,Fe),st=x.has(dt);return i.jsxs("tr",{className:`relative group h-[42px] border-b border-white/5 text-white transition ${Qe} hover:bg-[#131b18] ${st?"standx-new-row":""}`,children:[i.jsx("td",{scope:"row",className:`${Qe} sm:sticky sm:left-0 z-[2] ${Ye} ${st?"standx-new-cell":""}`,children:i.jsx("div",{className:"flex justify-start items-center gap-2.5 pl-4 sm:pl-6 h-[42px]",children:i.jsx("div",{onClick:()=>{var un,vn;window.open(`/terminal/${(vn=(un=je==null?void 0:je.bot)==null?void 0:un.symbol)==null?void 0:vn.split("-")[0]}`,"_blank")},className:"flex justify-start items-center gap-2 h-8 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:ve[(He=(at=je==null?void 0:je.bot)==null?void 0:at.symbol)==null?void 0:He.split("-")[0]]||Ha,alt:(qe=je==null?void 0:je.bot)==null?void 0:qe.symbol,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:un=>Zi(un)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:(yt=(vt=je==null?void 0:je.bot)==null?void 0:vt.symbol)==null?void 0:yt.split("-")[0]})]})})})}),i.jsx("td",{scope:"row",className:`${Qe} sm:sticky sm:left-[140px] z-[2] ${Ye} ${st?"standx-new-cell":""}`,children:i.jsx("div",{className:"flex justify-start items-center gap-2 pl-3 h-[42px]",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5 text-sm font-semibold font-manrope leading-[16px] tracking-[0.28px] text-[#e4e7ec]",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx("p",{children:$c(je==null?void 0:je.ts)})})})})}),i.jsx("td",{scope:"row",className:`${Qe} z-[2] ${Ye} ${st?"standx-new-cell":""}`,children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-[42px] px-3",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5",children:i.jsx(sa,{info1:je!=null&&je.event?je.event.replace(/_/g," "):"--",info1_Color:"text-white",rowTwo:!1})})})}),i.jsx("td",{scope:"row",className:`${Qe} z-[1] ${Ye} pr-6 min-w-[200px] sm:min-w-[240px] md:w-[340px] md:max-w-[380px] ${st?"standx-new-cell":""}`,children:i.jsx("div",{className:"flex justify-start items-center gap-4 min-h-[42px] w-full md:max-w-[380px]",children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-14 max-h-14 w-full",children:i.jsx("div",{className:"flex justify-start items-start gap-1.5 has-tooltip relative w-full md:max-w-[380px]",children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col gap-2 font-manrope w-full",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[20px] tracking-[0.28px] break-words whitespace-normal text-left",children:(Kt=je==null?void 0:je.data)!=null&&Kt.message_en?`${(jt=je==null?void 0:je.data)==null?void 0:jt.message_en}`:"--"})})})})})})]},dt)})})]})})})]})})},ICn="https://dextradata.nftinit.io",FCn=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState([]),[s,a]=h.useState(""),[o,l]=h.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(`${ICn}/api/hyper/standx/logs/`,{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-x-hidden bg-[#050505] min-h-screen",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(1400px 820px at 18% 30%, rgba(92,220,190,0.20), transparent 60%), radial-gradient(1300px 900px at 82% 65%, rgba(143,173,255,0.18), transparent 60%), linear-gradient(135deg, #07090f 0%, #080a10 50%, #06080e 100%)"}}),i.jsx("div",{className:"absolute inset-0 opacity-[0.08]",style:{background:"linear-gradient(120deg, #0a0c12 0%, #0b0f13 40%, #0a0c10 100%)"}})]}),i.jsxs("div",{className:"relative mx-auto flex w-full flex-col gap-4 pb-16 pt-2 px-4 sm:px-6",style:{fontFamily:"Manrope, ui-sans-serif"},children:[i.jsxs("div",{className:"relative mx-auto flex w-full flex-col gap-2",children:[i.jsxs("div",{className:"flex flex-col items-center justify-center sm:flex-row sm:justify-between sm:items-center w-full",children:[i.jsx("div",{className:"flex justify-start items-center gap-4 px-1 sm:px-0",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-8 w-8 rounded-md bg-[#1a1a1a] border border-white/10 shadow-[0_12px_40px_rgba(0,0,0,0.45)] grid place-items-center overflow-hidden",children:i.jsx("img",{src:"https://standx.com/logo_white.png",alt:"StandX",className:"h-4 w-4 object-contain",loading:"lazy"})}),i.jsx("div",{className:"flex flex-col",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h1",{className:"text-[22px] leading-[30px] font-semibold text-white",children:"StandX"}),i.jsx("span",{className:"rounded-full bg-white/5 border border-white/10 px-3 py-1 text-[11px] font-semibold text-[#9dd6ff]",children:"Dextrabot"})]})})]})}),i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C] mt-2"})]}),i.jsxs(Ya.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-full",style:{background:"radial-gradient(1200px 780px at 15% 20%, rgba(92,220,190,0.14), transparent 62%), radial-gradient(1100px 760px at 85% 70%, rgba(143,173,255,0.14), transparent 62%), radial-gradient(700px 260px at 50% 0%, rgba(255,255,255,0.06), transparent 78%)"}})}),i.jsx("div",{className:"relative z-10",children:i.jsx(TCn,{fetchInfoOnOpen:c,setIsFilterWallet:l})})]})]}),i.jsx("section",{className:"relative w-full rounded-[32px] border border-white/10 bg-[#050606]/70 shadow-[0_25px_80px_rgba(0,0,0,0.55)] backdrop-blur-2xl p-2",children:i.jsx("div",{className:"rounded-[28px] border border-white/5 bg-[#0b0c10]/85 py-4 px-6 shadow-inner",children:i.jsx(PCn,{data:n,setData:r,loading:t,error:s,fetchInfoOnOpen:c,isFilterWallet:o})})})]})]})},OCn=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setMushboomerETH:n,setIsWhitelist:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setHyperToken:l,setHyperAddress:c}=h.useContext(Qr),[u,d]=h.useState(!1),[f,x]=h.useState(!1);return h.useEffect(()=>{const g=localStorage.getItem("hyperToken"),y=localStorage.getItem("hyperAddress");d(!!(g&&y));const v=setInterval(()=>{const C=localStorage.getItem("hyperToken"),S=localStorage.getItem("hyperAddress");d(!!(C&&S))},800);return()=>clearInterval(v)},[]),h.useEffect(()=>{const g=()=>{var v;try{const C=localStorage.getItem("hyperAddress");if(!C)return x(!1);const S=localStorage.getItem(`dextrabot_standx_auth_data_${C.toLowerCase()}`);if(!S)return x(!1);const T=JSON.parse(S),L=`bsc_${C.toLowerCase()}`;x(!!((v=T==null?void 0:T[L])!=null&&v.token))}catch{x(!1)}};g();const y=setInterval(g,500);return()=>clearInterval(y)},[]),h.useEffect(()=>{(async()=>{var C,S;const y=window.localStorage.getItem("hyperToken"),v=window.localStorage.getItem("hyperAddress");if(!(!y||!v))try{const T=await bi(v.toLowerCase(),y);T!=null&&T.success?(t(T==null?void 0:T.telegram_chat_id),e(T==null?void 0:T.subscriber_role),n((C=T==null?void 0:T.mushboomer_counts)==null?void 0:C.eth),s((S=T==null?void 0:T.mushboomer_counts)==null?void 0:S.sol),a(T==null?void 0:T.referral_code),o(T==null?void 0:T.refcode),r(T==null?void 0:T.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),l(""),c(""))}catch(T){console.error("Token verification error:",T)}})()},[u]),i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{children:[i.jsx("title",{children:"StandX MM | Automated Market Making | Dextrabot"}),i.jsx("meta",{name:"description",content:`Automate market making on StandX. Generate trading volume and provide liquidity 24/7.
`}),i.jsx("meta",{property:"og:title",content:"StandX MM | Automated Market Making | Dextrabot"}),i.jsx("meta",{property:"og:description",content:`Automate market making on StandX. 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/standx-mm"})]})}),i.jsx("div",{style:{minHeight:"calc(100vh - 5rem)"},className:"flex justify-center items-start w-full h-full 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:i.jsx(FCn,{})})})]})},MCn=({open:t,setOpen:e,onConfirm:n,modalLoading:r,active:s,confirmDisabled:a,modalDataInfo:o})=>{var u;const l=o||{},c=[(l==null?void 0:l.coin)&&`${l!=null&&l.market_period?"Market Group":"Coin"} : ${l.coin.toUpperCase()}`,(l==null?void 0:l.side)!==""&&`Side : ${(u=l.side)==null?void 0:u.toUpperCase()}`,(l==null?void 0:l.base_shares)!==""&&(l==null?void 0:l.sizingMode)==="shares"&&`Initial Order (Shares) : ${l.base_shares}`,(l==null?void 0:l.base_price)!==""&&(l==null?void 0:l.sizingMode)==="usdc"&&`Initial Order (USDC) : ${l.base_price}`,(l==null?void 0:l.base_dca_shares)!==""&&(l==null?void 0:l.sizingMode)==="shares"&&`First DCA Purchase (Shares) : ${l.base_dca_shares}`,(l==null?void 0:l.base_dca_price)!==""&&(l==null?void 0:l.sizingMode)==="usdc"&&`First DCA Purchase (USDC) : ${l.base_dca_price}`,(l==null?void 0:l.min_price)!==""&&`Min Price : ${l.min_price}¢`,(l==null?void 0:l.max_price)!==""&&`Max Price : ${l.max_price}¢`,(l==null?void 0:l.dca_levels)!==""&&`DCA Levels : ${l.dca_levels}`,(l==null?void 0:l.near_step)!==""&&`DCA Level Spacing (¢) : ${l.near_step}`,(l==null?void 0:l.near_step_multiplier)!==""&&`Level Spacing Mult. : ${l.near_step_multiplier}`,(l==null?void 0:l.deep_multiplier)!==""&&`DCA Order Size Mult. : ${l.deep_multiplier}`,(l==null?void 0:l.tp_profit)!==""&&`Take Profit (¢) : ${l.tp_profit}`,(l==null?void 0:l.tp_block)!==""&&`Stop after TP : ${l.tp_block?"ON":"OFF"}`,(l==null?void 0:l.tp_limit)>0?`Profit Locking : ON (Min: ${l.tp_limit})`:"Profit Locking : OFF",(l==null?void 0:l.sl_loss)!==""&&`Stop Loss (¢) : ${l.sl_loss}`,(l==null?void 0:l.sl_spread)!==""&&`Min Price Distance (¢) : ${l.sl_spread}`,(l==null?void 0:l.cutoff_min)!==""&&`Cutoff Min : ${l.cutoff_min}`,(l==null?void 0:l.api_key)!==""&&(l==null?void 0:l.api_key)!==void 0?"Auto Claim : ACTIVE":"Auto Claim : INACTIVE"].filter(Boolean);return i.jsxs(ha,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(fa,{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(Ji,{transition:!0,className:"relative transform overflow-hidden bg-[radial-gradient(circle_at_top,_rgba(96,125,150,1),_rgba(18,20,23,1)_42%,_rgba(10,12,14,2)_100%)] text-left shadow-2xl shadow-black/50 border border-[#2a2f36] 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-[30px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-center gap-7 w-[420px] max-w-[90vw] h-max relative rounded-[30px] pt-4 pb-8 px-8",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-4 top-4",children:i.jsx("span",{className:"w-9 h-9 rounded-full p-[10px] flex justify-center items-center bg-white/5 hover:bg-white/10 border border-white/10 transition",children:i.jsx("img",{className:"w-full h-full",src:Na,alt:"Close"})})}),i.jsx("div",{className:"pt-2",children:i.jsx("div",{className:"w-20 h-20 rounded-3xl bg-gradient-to-tr from-[#7af8d3] via-[#7a7eff] to-[#ff69d6] p-[0.2px] shadow-[0_10px_40px_rgba(0,0,0,0.55)]",children:i.jsx("div",{className:"w-full h-full rounded-[26px] bg-[#111118] flex items-center justify-center",children:i.jsx("img",{src:Hi,alt:"",className:"w-[70%] h-[70%] object-contain drop-shadow-[0_0_12px_rgba(255,255,255,0.35)]"})})})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-3",children:[i.jsx("div",{className:"w-full text-center text-white text-[22px] font-semibold leading-7 -mt-3",children:l!=null&&l.coin?`${l.coin.toUpperCase()} PolyMarket DCA Bot`:"Are you sure?"}),i.jsx("div",{className:"w-full text-center text-white/70 text-[15px] font-medium leading-5 -mt-1",children:s?"Do you want to stop this bot?":"Do you want to start this bot?"}),(c==null?void 0:c.length)>0&&i.jsx("ul",{className:"mt-3 w-full max-w-[360px] space-y-2",children:c==null?void 0:c.map((d,f)=>{const x=d.split(":"),g=x.length>1,y=g?x[0].trim():"",v=g?x.slice(1).join(":").trim():d;return i.jsxs("li",{className:"flex items-center justify-between gap-3 px-2 w-full",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"h-[6px] w-[6px] rounded-full bg-[#67ffbd] shadow-[0_0_10px_rgba(103,255,189,1)] flex-shrink-0"}),g&&i.jsxs("span",{className:"text-[13px] font-medium text-white/75 truncate max-w-[150px]",children:[y,":"]})]}),i.jsx("span",{className:"text-[13px] font-semibold text-white px-2 py-0.5 rounded-lg bg-white/6 border border-white/10 backdrop-blur-sm shadow-[0_4px_12px_rgba(0,0,0,0.25)]",children:v})]},f)})})]}),i.jsxs("div",{className:"flex items-center justify-center gap-3 w-full max-w-[320px] pt-1",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"h-10 px-5 rounded-xl border border-white/25 bg-white/5 hover:bg-white/10 text-white text-[14px] font-semibold inline-flex items-center justify-center cursor-pointer transition select-none",children:"Cancel"}),i.jsx("div",{onClick:d=>{r||a||(d.preventDefault(),n==null||n())},className:`h-10 px-6 rounded-xl border flex items-center justify-center cursor-pointer transition text-[14px] font-semibold select-none ${r||a?"bg-[#444] border-[#666] text-white/70 cursor-not-allowed":s?"bg-[#ff4c4c] border-[#ff8080] hover:brightness-110 text-white":"bg-gradient-to-r from-[#7c5bff] to-[#a14dff] border-transparent shadow-[0_10px_30px_rgba(114,92,255,0.5)] hover:brightness-110 text-white"}`,children:r?i.jsx("span",{className:"animate-pulse",children:"Loading..."}):i.jsx("span",{children:s?"Stop":"Start"})})]})]})})})})]})},WC="https://dextrabothypev2.nftinit.io",YKe={market_source_type:"crypto",market_url:"",coin:"btc",market_period:"15m",side:"all",sizing_mode:"shares",base_shares:"6",base_price:"0",base_dca_shares:"6",base_dca_price:"0",dca_levels:"4",near_step:"10",near_step_multiplier:"1",deep_multiplier:"1",tp_profit:"",tp_block:!1,tp_limit:"",sl_loss:"",sl_spread:"",cutoff_min:"4",pkey:"",funder_address:"",api_key:"",api_secret:"",api_pass:"",min_price:"",max_price:""},LCn=()=>Array(4).fill(null).map(()=>({...YKe})),NAe=[{value:"crypto",label:"Crypto"},{value:"others",label:"Others"}],RCn=({data:t,bestBid:e,onBidChange:n,sizingMode:r})=>{if(!t.dca_levels||!t.near_step)return null;const s=[],a=parseInt(t.dca_levels)||0,o=parseFloat(t.near_step)?parseFloat(t.near_step)/100:0,l=parseFloat(t.near_step_multiplier)||1,c=parseFloat(t.deep_multiplier)||1,u=parseFloat(t.base_shares)||0,d=parseFloat(t.base_price)||0,f=parseFloat(t.base_dca_shares)||0,x=parseFloat(t.base_dca_price)||0,g=6,y=parseFloat(t.tp_profit)?parseFloat(t.tp_profit)/100:0,v=y>0&&!isNaN(y),C=parseFloat(t.sl_loss)?parseFloat(t.sl_loss)/100:0,S=C>0&&!isNaN(C),T=parseFloat(t.sl_spread)?parseFloat(t.sl_spread)/100:0,I=S&&T>0&&!isNaN(T);let L=e||.5,F=0,$=0,O=0,U=0,Y=0;r==="shares"?(F=u,$=F*L,O=F):($=d,O=L>0?$/L:0,F=Math.floor(O*100)/100),U+=F,Y+=$;const re=U>0?Y/U:0;s.push({level:0,price:Math.round(L*100)+"¢",size:F.toFixed(2),value:$.toFixed(2),avgPrice:Math.round(re*100)+"¢",tpPrice:v?Math.round(Math.min(.99,re+y)*100)+"¢":null,slPrice:S?Math.round(Math.max(.01,re-C)*100)+"¢":null,slSpreadPrice:I?Math.round(Math.max(.01,re-C-T)*100)+"¢":null,isLow:O<g});let Q=L;for(let q=1;q<=a;q++){const te=o*Math.pow(l,q-1);let fe=Q-te;fe>.99&&(fe=.99),fe<.01&&(fe=.01);let G=0,ie=0,oe=0;if(r==="shares"){const H=f*Math.pow(c,q-1);G=Math.floor(H*100)/100,ie=G*fe,oe=G}else ie=x*Math.pow(c,q-1),oe=fe>0?ie/fe:0,G=Math.floor(oe*100)/100;U+=G,Y+=ie;const K=U>0?Y/U:0;s.push({level:q,price:Math.round(fe*100)+"¢",size:G.toFixed(2),value:ie.toFixed(2),avgPrice:Math.round(K*100)+"¢",tpPrice:v?Math.round(Math.min(.99,K+y)*100)+"¢":null,slPrice:S?Math.round(Math.max(.01,K-C)*100)+"¢":null,slSpreadPrice:I?Math.round(Math.max(.01,K-C-T)*100)+"¢":null,isLow:oe<g}),Q=fe}return i.jsxs("div",{className:"mt-4 p-3 bg-[#0b0f15] rounded-lg border border-[#2b2f36]",children:[i.jsxs("div",{className:"flex justify-between items-center mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h4",{className:"text-xs font-bold text-gray-400 uppercase tracking-wide",children:"Ladder Preview"}),i.jsxs("div",{className:"flex items-center gap-1 bg-[#12161c] px-2 py-0.5 rounded border border-[#2b2f36]",children:[i.jsx("span",{className:"text-[10px] text-gray-400 font-semibold tracking-wide",children:"Est. Price:"}),i.jsx(as,{content:"This is an estimated price for preview purposes only. Actual execution prices will vary based on real-time market bid/ask volatility.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3 h-3 cursor-help"})})}),i.jsx("input",{type:"number",step:"1",min:"1",max:"99",value:Math.round(e*100),disabled:t.isLocked,onChange:q=>{let te=parseFloat(q.target.value);isNaN(te)&&(te=0),te>99&&(te=99),te<0&&(te=0),n&&n(te/100)},className:"w-12 bg-transparent text-[12px] font-mono text-[#34d399] font-bold outline-none text-right placeholder-gray-600 ml-1 disabled:opacity-50 disabled:cursor-not-allowed"}),i.jsx("span",{className:"text-[12px] font-mono text-[#34d399] font-bold ml-0.5",children:"¢"}),t.market_source_type==="others"&&t.onRefreshPrice&&i.jsx(as,{content:"Refresh price from Polymarket API",children:i.jsx("button",{type:"button",onClick:t.onRefreshPrice,disabled:t.isLocked,className:"p-1 hover:bg-[#2b2f36] rounded text-[#60a5fa] transition cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-3.5 h-3.5",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"})})})})]})]}),r==="usdc"&&i.jsx("span",{className:"text-[9px] text-gray-500 uppercase tracking-wider",children:"Size Mult. scales USDC Val"})]}),i.jsx("div",{className:"overflow-x-auto max-h-[240px] overflow-y-scroll",children:i.jsxs("table",{className:"w-full text-right text-[10px] text-gray-300",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-gray-500 border-b border-[#2b2f36]",children:[i.jsx("th",{className:"pb-1 text-left",children:"Lvl"}),i.jsx("th",{className:"pb-1",children:"Price"}),i.jsx("th",{className:"pb-1",children:"Avg Price"}),v&&i.jsx("th",{className:"pb-1 text-[#4ade80]",children:"TP Price"}),S&&i.jsx("th",{className:"pb-1 text-[#f87171]",children:"SL Price"}),I&&i.jsx("th",{className:"pb-1 text-[#f83131]",children:"SL Spread"}),i.jsx("th",{className:"pb-1",children:"Shares"}),i.jsx("th",{className:"pb-1",children:"Value (USDC)"})]})}),i.jsx("tbody",{children:s.map(q=>i.jsxs("tr",{className:`border-b border-[#2b2f36]/50 last:border-0 ${q.isLow?"text-yellow-500/80":""}`,children:[i.jsx("td",{className:"py-1 text-left font-mono",children:i.jsx("span",{className:q.level===0?"text-[#60a5fa] font-bold":"text-gray-400",children:q.level===0?"0 (Base)":q.level})}),i.jsx("td",{className:"py-1 font-mono",children:q.price}),i.jsx("td",{className:"py-1 font-mono text-gray-400",children:q.avgPrice}),v&&i.jsx("td",{className:"py-1 font-mono text-[#4ade80]",children:q.tpPrice}),S&&i.jsx("td",{className:"py-1 font-mono text-[#f87171]",children:q.slPrice}),I&&i.jsx("td",{className:"py-1 font-mono text-[#f83131]",children:q.slSpreadPrice}),i.jsxs("td",{className:"py-1 font-mono",children:[q.size,q.isLow&&i.jsx("span",{className:"ml-1 text-[8px] opacity-70",children:"(<Min)"})]}),i.jsxs("td",{className:"py-1 font-mono text-gray-400",children:["$",q.value]})]},q.level))}),i.jsx("tfoot",{children:i.jsxs("tr",{className:"border-t border-[#2b2f36]/80 text-[#e2e8f0] bg-[#12161c]",children:[i.jsx("td",{colSpan:3+(v?1:0)+(S?1:0)+(I?1:0),className:"py-1.5 text-left font-bold pl-2 uppercase tracking-wider text-[10px]",children:"Total:"}),i.jsx("td",{className:"py-1.5 font-mono font-bold text-[#60a5fa]",children:s.reduce((q,te)=>q+parseFloat(te.size),0).toFixed(2)}),i.jsxs("td",{className:"py-1.5 font-mono font-bold text-[#4ade80]",children:["$",s.reduce((q,te)=>q+parseFloat(te.value),0).toFixed(2)]})]})})]})}),t.market_source_type==="others"&&t.original_side==="all"&&i.jsx("div",{className:"mt-3 text-[10px] text-yellow-500/90 leading-tight font-medium",children:"Note: When 'ALL' is selected, the actual execution price for each side will be used at the time of purchase. This averaged value is for preview purposes only."})]})},DCn=()=>{var m,p,N,A,k,P,D,V,Z,ce,ue,me,Ne,Ie,Le,Xe,Oe,$e,ae,he,Pe,Ve,Te,Ze,it,wt,Dt,Qt,xn,pn,An,or,$t,bt,rn,ur,gr,br,Br,Gr,Or,Lt,nn,Ot,en,Fn,yr,hr,lt,Ct,On,qn,_r,jr,Fr,nr,vr,Yr,dr,rs,gs,ms;const{setSignModalOpen:t}=h.useContext(Qr),[e,n]=h.useState(!1),[r,s]=h.useState(!1),[a,o]=h.useState(null),[l,c]=h.useState(0),[u,d]=h.useState("bot-1"),[f,x]=h.useState(Array(4).fill(null).map(()=>({...YKe}))),g=f[l],[y,v]=h.useState(Array(4).fill(!1)),C=y[l],[S,T]=h.useState(!1),[I,L]=h.useState(Array(4).fill([])),[F,$]=h.useState(!1),O=h.useRef(null),U=h.useRef(null),[Y,re]=h.useState(!1),[Q,q]=h.useState(!1),[te,fe]=h.useState(""),[G,ie]=h.useState(!1),[oe,K]=h.useState(Array(4).fill("")),[H,ee]=h.useState(Array(4).fill(null).map(()=>({coinOptions:[],sideOptions:[],markets:[]}))),[se,pe]=h.useState({}),[Se,ge]=h.useState("shares");h.useState(!1);const[ve,be]=h.useState(Array(4).fill(.55)),we=oe[l]||"",je=(At,pt=l)=>{K(le=>{const Me=[...le];return Me[pt]=At,Me})},Fe=At=>{if(!At)return 0;const pt=String(At).replace(",","."),le=parseFloat(pt);return isNaN(le)?0:le},Re=(At,pt)=>{const le={},Me={},bn=Fe(At.base_shares),Gn=Fe(At.base_price),rr=Fe(At.base_dca_shares),Jn=Fe(At.base_dca_price);pt==="shares"?(At.base_shares===""||At.base_shares==null?le.base_shares="Base shares is required in Shares mode.":bn<1||bn<6?le.base_shares="Base shares cannot be smaller than 6.":bn>500&&(Me.base_shares="Base shares is very high. Exposure may grow quickly."),At.base_dca_shares===""||At.base_dca_shares==null?le.base_dca_shares="DCA shares is required in Shares mode.":rr<1||rr<6?le.base_dca_shares="DCA shares cannot be smaller than 6.":rr>500&&(Me.base_dca_shares="DCA shares is very high. Exposure may grow quickly.")):(At.base_price===""||At.base_price==null?le.base_price="Base price is required in USDC mode.":(Gn<.06||Gn<.06)&&(le.base_price=`Base price cannot be smaller than ${.06}.`),ve[l]>0&&Gn/ve[l]<6&&(Me.base_price="At current price, base order may round to 0 shares."),At.base_dca_price===""||At.base_dca_price==null?le.base_dca_price="DCA price is required in USDC mode.":(Jn<.06||Jn<.06)&&(le.base_dca_price=`DCA price cannot be smaller than ${.06}.`),ve[l]>0&&Jn/ve[l]<6&&(Me.base_dca_price="At current price, DCA order may round to 0 shares."));const Xn=Fe(At.dca_levels),Zr=Fe(At.near_step),$r=Fe(At.near_step_multiplier),wr=Fe(At.deep_multiplier);At.dca_levels===""||At.dca_levels==null?le.dca_levels="DCA levels is required.":Number.isInteger(Xn)?(Xn<0||Xn>20)&&(le.dca_levels="Allowed range: 0 to 20."):le.dca_levels="DCA levels must be a whole number.";let pr=98;if(ve[l]>0&&Xn>0){let Ln=0;for(let ht=0;ht<Xn;ht++)Ln+=Math.pow($r,ht);Ln>0&&(pr=Math.floor((ve[l]-.01)/Ln*100)),pr>98&&(pr=98),pr<1&&(pr=1)}if(At.near_step===""||At.near_step==null?le.near_step="Next step is required.":Zr<1?le.near_step="Next step must be ≥ 1.":Zr>98?le.near_step="Next step must be ≤ 98":ve[l]>0&&Zr>pr&&(le.near_step=`Next step is too large. Allowed: 1 to ${pr} (anchor=${ve[l]}, levels=${Xn}, mult=${$r}).`),At.near_step_multiplier===""||At.near_step_multiplier==null?le.near_step_multiplier="Step multiplier is required.":$r<.01||$r>5?le.near_step_multiplier="Allowed range: 0.01 to 5":$r>2&&(Me.near_step_multiplier="Spacing grows quickly; deep levels may clamp to 0.01"),At.deep_multiplier===""||At.deep_multiplier==null?le.deep_multiplier="Deep multiplier is required.":wr<.01||wr>5?le.deep_multiplier="Allowed range: 0.01 to 5":wr>=2&&(Me.deep_multiplier="Aggressive martingale sizing. Exposure can increase very quickly."),At.min_price!==""&&At.min_price!=null){const Ln=Fe(At.min_price);Number.isInteger(Ln)?(Ln<0||Ln>=100)&&(le.min_price="Allowed range: 0 to 99"):le.min_price="Must be a whole number"}if(At.max_price!==""&&At.max_price!=null){const Ln=Fe(At.max_price);Number.isInteger(Ln)?(Ln<=0||Ln>100)&&(le.max_price="Allowed range: 1 to 100"):le.max_price="Must be a whole number"}if(At.min_price!==""&&At.max_price!==""){const Ln=Fe(At.min_price),ht=Fe(At.max_price);Number.isInteger(Ln)&&Number.isInteger(ht)&&Ln>=ht&&(le.max_price="Max Price must be > Min Price")}const ar=Fe(At.tp_profit),Vr=Fe(At.sl_loss),Ur=Fe(At.sl_spread),bs=Fe(At.cutoff_min);ar<0?le.tp_profit="TP profit cannot be negative.":ar>98&&(le.tp_profit="TP profit must be between 0 and 98."),Vr<0?le.sl_loss="SL loss cannot be negative.":Vr>98&&(le.sl_loss="SL loss must be between 0 and 98."),Vr>0&&Ur>0&&Ur>=Vr&&(le.sl_spread=`SL Spread must be less than SL Loss (${Vr}).`),Ur<0&&(le.sl_spread="SL Spread cannot be negative.");let Sr=15;if(At.market_period){if(typeof At.market_period=="number")Sr=At.market_period;else if(typeof At.market_period=="string"){const Ln=parseInt(At.market_period.replace(/\D/g,""));!isNaN(Ln)&&Ln>0&&(Sr=Ln)}}const Pn=At.market_source_type==="others";return Pn||At.cutoff_min!==""&&At.cutoff_min!=null&&(Number.isInteger(bs)?bs<0||bs>=Sr?le.cutoff_min=`Allowed range: 0 to ${Sr-1}.`:bs>=Sr*.66&&(Me.cutoff_min="Cutoff is early; BUYs may be disabled for most of the window."):le.cutoff_min="Cutoff minutes must be a whole number."),Pn?((!At.market_url||!String(At.market_url).trim())&&(le.market_url="Market URL is required for Others mode."),(!At.side||!String(At.side).trim())&&(le.side="Side is required.")):(!At.side||!["up","down","all"].includes(At.side))&&(le.side="Side must be UP, DOWN, or ALL."),{errors:le,warnings:Me}};h.useEffect(()=>{const{errors:At,warnings:pt}=Re(g,Se);pe({errors:At,warnings:pt})},[g,Se,ve,l]);const Qe=At=>{ge(At),x(pt=>{const le=[...pt],Me=le[l];let ft={};return At==="usdc"?ft={base_price:Me.base_shares,base_dca_price:Me.base_dca_shares}:At==="shares"&&(ft={base_shares:Me.base_price,base_dca_shares:Me.base_dca_price}),le[l]={...Me,sizing_mode:At,...ft},le})};h.useEffect(()=>{const At=(g==null?void 0:g.sizing_mode)==="usdc"||(g==null?void 0:g.sizing_mode)==="shares"?g.sizing_mode:"shares";At!==Se&&ge(At)},[l,g==null?void 0:g.sizing_mode,Se]);const[Ye,dt]=h.useState(!1),[st,at]=h.useState(!1),[He,qe]=h.useState(!1),[vt,yt]=h.useState(!1),[Kt,jt]=h.useState(""),[un,vn]=h.useState(!1),Hn=h.useRef(null),ln=h.useRef(null),Nn=h.useRef(null),dn=h.useRef(null);h.useEffect(()=>{const At=localStorage.getItem("hyperToken"),pt=localStorage.getItem("hyperAddress");n(!!(At&&pt));const le=setInterval(()=>{const Me=localStorage.getItem("hyperToken"),ft=localStorage.getItem("hyperAddress");n(!!(Me&&ft))},800);return()=>clearInterval(le)},[]),h.useEffect(()=>{const At=pt=>{Hn.current&&!Hn.current.contains(pt.target)&&at(!1),ln.current&&!ln.current.contains(pt.target)&&qe(!1),Nn.current&&!Nn.current.contains(pt.target)&&yt(!1),dn.current&&!dn.current.contains(pt.target)&&vn(!1)};return document.addEventListener("mousedown",At),()=>document.removeEventListener("mousedown",At)},[]);const rt=h.useMemo(()=>/^0x[a-fA-F0-9]{40}$/.test(g.funder_address),[g.funder_address]),nt=h.useMemo(()=>String(g.pkey||"").trim().length>60,[g.pkey]),Ut=At=>!isNaN(parseFloat(At))&&isFinite(At),wn=e&&g.coin&&g.market_period&&g.side&&rt&&nt&&(Se!=="shares"||g.base_shares!==""&&g.base_dca_shares!=="")&&(Se!=="usdc"||g.base_price!==""&&g.base_dca_price!=="")&&Ut(g.dca_levels)&&Ut(g.near_step)&&Ut(g.near_step_multiplier)&&Ut(g.deep_multiplier)&&Object.keys(se.errors||{}).length===0&&(g.api_key&&g.api_secret&&g.api_pass||!g.api_key&&!g.api_secret&&!g.api_pass),Jt=[{value:"btc",label:"BTC"},{value:"eth",label:"ETH"},{value:"sol",label:"SOL"},{value:"xrp",label:"XRP"}],Vt=[{value:"5m",label:"5 min"},{value:"15m",label:"15 min"},{value:"60m",label:"1h"},{value:"240m",label:"4h"},{value:"1440m",label:"1d"}],xt=At=>String(At??"").normalize("NFKC").replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/\s+/g," ").trim().toLowerCase(),We=(At,pt)=>xt(At)===xt(pt),Pt=At=>String((At==null?void 0:At.groupItemTitle)||(At==null?void 0:At.question)||"").trim(),Ke=(At,pt)=>{var le;return((le=At.find(Me=>We(Me==null?void 0:Me.value,pt)))==null?void 0:le.label)||"Select"},ct=g.market_source_type||"crypto",Nt=ct==="others",Ht=H[l]||{coinOptions:[],sideOptions:[],markets:[]},Rt=Nt?(Ht.markets||[]).find(At=>We(Pt(At),g.coin))||(Ht.markets||[])[0]:null,hn=Rt&&Array.isArray(Rt.outcomes)?Rt.outcomes.map(At=>String(At||"").trim()).filter(Boolean).map(At=>({value:At,label:At})):Ht.sideOptions,yn=Ht.coinOptions.length>0&&hn.length>0,Cn=Nt&&(G||!String(g.market_url||"").trim()||!yn),En=!!String(g.market_url||"").trim(),Rn=Nt?Ht.coinOptions:Jt,Mn=Nt?[...hn,...hn.some(At=>String(At==null?void 0:At.value).toLowerCase()==="all")?[]:[{value:"all",label:"ALL",disabled:!0}]]:[{value:"up",label:"UP"},{value:"down",label:"DOWN"},{value:"all",label:"ALL",disabled:!0}];h.useEffect(()=>{Nt&&!String(g.market_url||"").trim()&&(ee(pt=>{const le=pt[l]||{coinOptions:[],sideOptions:[],markets:[]};if(!le.coinOptions.length&&!le.sideOptions.length&&!le.markets.length)return pt;const Me=[...pt];return Me[l]={coinOptions:[],sideOptions:[],markets:[]},Me}),x(pt=>{const le=pt[l];if(!le||!le.coin&&!le.side)return pt;const Me=[...pt];return Me[l]={...le,coin:"",side:""},Me}))},[l,g.market_url,Nt]);const Yn=At=>/^(0|[1-9]\d*)(\.\d{0,2})?$/.test(At),Zn=At=>/^\d*$/.test(At),Vn=new Set(["base_shares","base_price","base_dca_shares","base_dca_price","near_step_multiplier","deep_multiplier"]),tr=new Set(["dca_levels","cutoff_min","near_step","tp_profit","tp_limit","sl_loss","sl_spread"]),Sn=At=>pt=>{let le=pt.target.value;if((tr.has(At)||Vn.has(At))&&le.includes(",")&&(le=le.replace(",",".")),tr.has(At)){let Me=le.trim();if(Me!==""&&!Zn(Me))return;le=Me}if(Vn.has(At)){let Me=le.trim();if(Me!==""&&!Yn(Me))return;le=Me}x(Me=>{const ft=[...Me],ut={...ft[l],[At]:le};if(At==="base_shares"&&le!==""&&(ut.base_price="0"),At==="base_price"&&le!==""&&(ut.base_shares="0"),At==="base_dca_shares"&&le!==""&&(ut.base_dca_price="0"),At==="base_dca_price"&&le!==""&&(ut.base_dca_shares="0"),At==="tp_profit"&&Fe(le)<=0&&(ut.tp_block=!1),At==="coin"&&ut.market_source_type==="others"){const on=H[l]||{markets:[]},bn=on.markets.find(Gn=>We(Pt(Gn),le))||on.markets[0];if(bn&&Array.isArray(bn.outcomes)){const Gn=bn.outcomes.map(Jn=>String(Jn||"").trim()).filter(Boolean);[...Gn.map(Jn=>Jn.toLowerCase()),"all"].includes(String(ut.side||"").toLowerCase())||(ut.side=Gn[0]||"all")}}return ft[l]=ut,ft})},ze=At=>{je(""),qe(!1),yt(!1),vn(!1),x(pt=>{var on,bn;const le=[...pt],Me=le[l],ft=H[l]||{coinOptions:[],sideOptions:[],markets:[]},ut={...Me,market_source_type:At};if(At==="others")ut.market_period="market",ut.coin=((on=ft.coinOptions[0])==null?void 0:on.value)||"",ut.side=((bn=ft.sideOptions[0])==null?void 0:bn.value)||"";else{const Gn=String(Me.coin||"").toLowerCase(),rr=Jt.some(Jn=>String((Jn==null?void 0:Jn.value)||"").toLowerCase()===Gn);ut.market_period=Me.market_period==="market"?"15m":Me.market_period,ut.coin=rr?Me.coin:"btc",ut.side=Me.side&&["up","down","all"].includes(Me.side)?Me.side:"all"}return le[l]=ut,le})},xe=async(At,pt=l,{infoSideHint:le=null,infoCoinHint:Me=null}={})=>{var on,bn,Gn;const ft=Number.isInteger(pt)?pt:l,ut=String((At??((on=f[ft])==null?void 0:on.market_url))||"").trim();if(!ut){je("Market URL is required.",ft);return}try{ie(!0),je("",ft);const rr=()=>{ee(Vr=>{const Ur=[...Vr];return Ur[ft]={coinOptions:[],sideOptions:[],markets:[]},Ur}),x(Vr=>{const Ur=[...Vr];return Ur[ft]={...Ur[ft],coin:"",side:""},Ur})},Jn=window.localStorage.getItem("hyperToken"),Xn=window.localStorage.getItem("hyperAddress");if(!Jn||!Xn)throw new Error("Please connect your account first.");const Zr=await fetch(`${WC}/api/hyper/polymarketdca_bot/markets/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Xn.toLowerCase(),token:Jn,market_url:ut})});let $r=null;try{$r=await Zr.json()}catch{$r=null}if(!Zr.ok){rr(),je(($r==null?void 0:$r.error_message)||`Request failed (${Zr.status})`,ft);return}if(($r==null?void 0:$r.success)===!1){rr(),je(($r==null?void 0:$r.error_message)||"Failed to load market URL.",ft);return}const wr=Array.isArray((bn=$r==null?void 0:$r.data)==null?void 0:bn.markets)?$r.data.markets:[];if(!wr.length)throw new Error("markets array not found in response.");const pr=wr.map(Vr=>{const Ur=Pt(Vr);if(!Ur)return null;const bs=String(Vr.groupItemTitle||""),Sr=bs.includes("↑")||bs.includes("HIGH"),Pn=bs.includes("↓")||bs.includes("LOW"),Ln=bs.match(/\$\s*([\d,.]+)/),ht=Ln?parseFloat(Ln[1].replace(/,/g,"")):0;return{value:Ur,label:Ur,question:Vr.question||"",_id:Number(Vr.id)||0,_isHigh:Sr,_isLow:Pn,_amt:ht}}).filter(Boolean).filter((Vr,Ur,bs)=>bs.findIndex(Sr=>We(Sr.value,Vr.value))===Ur).sort((Vr,Ur)=>{if((Vr._isHigh||Vr._isLow)&&(Ur._isHigh||Ur._isLow)){if(Vr._isHigh&&Ur._isLow)return-1;if(Vr._isLow&&Ur._isHigh)return 1;if(Vr._isHigh&&Ur._isHigh||Vr._isLow&&Ur._isLow)return Ur._amt-Vr._amt}return Vr._id-Ur._id}),ar=(Array.isArray((Gn=wr[0])==null?void 0:Gn.outcomes)?wr[0].outcomes:[]).map(Vr=>String(Vr||"").trim()).filter(Boolean).map(Vr=>({value:Vr,label:Vr}));ee(Vr=>{const Ur=[...Vr];return Ur[ft]={coinOptions:pr,sideOptions:ar,markets:wr},Ur}),x(Vr=>{var sr,Mr,Lr,ss;const Ur=[...Vr],bs=String(Me||((sr=Ur[ft])==null?void 0:sr.coin)||""),Sr=String(le||((Mr=Ur[ft])==null?void 0:Mr.side)||""),Pn=pr.find(ys=>We(ys==null?void 0:ys.value,bs)),Ln=(Pn==null?void 0:Pn.value)||((Lr=pr[0])==null?void 0:Lr.value)||bs,ht=wr.find(ys=>We(Pt(ys),Ln)),Yt=ht?(Array.isArray(ht.outcomes)?ht.outcomes:[]).map(ys=>String(ys||"").trim()).filter(Boolean).map(ys=>({value:ys,label:ys})):ar,lr=Yt.find(ys=>String((ys==null?void 0:ys.value)||"").toLowerCase()===Sr.toLowerCase());return Ur[ft]={...Ur[ft],market_source_type:"others",market_period:"market",coin:Ln,side:(lr==null?void 0:lr.value)||((ss=Yt[0])==null?void 0:ss.value)||Ur[ft].side},Ur})}catch(rr){ee(Jn=>{const Xn=[...Jn];return Xn[ft]={coinOptions:[],sideOptions:[],markets:[]},Xn}),x(Jn=>{const Xn=[...Jn];return Xn[ft]={...Xn[ft],coin:"",side:""},Xn}),je((rr==null?void 0:rr.message)||"Failed to load market URL.",ft)}finally{ie(!1)}},Ge=(At,pt,le)=>{const Me=At.find(Gn=>We(Pt(Gn),pt));if(!Me||!Array.isArray(Me.outcomes)||!Array.isArray(Me.outcomePrices))throw new Error("Market details or outcome data not found");const ft={up:["yes","over","up","long"],down:["no","under","down","short"]},ut=String(le||"").toLowerCase();if(ut==="all")if(Me.outcomePrices.length>=2){const Gn=Number(Me.outcomePrices[0]),rr=Number(Me.outcomePrices[1]);if(isNaN(Gn)||isNaN(rr)||Gn<=0||rr<=0)throw new Error("Invalid prices found for averaging.");return{price:(Gn+rr)/2,matchText:`Averaged '${Me.outcomes[0]}' & '${Me.outcomes[1]}'`}}else throw new Error("Not enough outcomes to average for 'ALL' side.");let on=Me.outcomes.findIndex(Gn=>(ft[ut]||[ut]).includes(String(Gn).toLowerCase().trim()));if(on===-1&&ut!=="all"&&(on=Me.outcomes.findIndex(Gn=>String(Gn).toLowerCase().trim()===ut)),on===-1)throw new Error(`Could not map side '${le}' to market outcomes: ${Me.outcomes.join(", ")}`);const bn=Number(Me.outcomePrices[on]);if(isNaN(bn)||bn<=0)throw new Error(`Invalid price returned: ${Me.outcomePrices[on]}`);return{price:bn,matchText:`'${Me.outcomes[on]}'`}},_e=async At=>{var le;const pt=f[At];if(pt.market_source_type!=="others"||!pt.market_url||!pt.coin||!pt.side){fn.error("Missing market url, group, or side for fetching price");return}try{const Me=window.localStorage.getItem("hyperToken"),ft=window.localStorage.getItem("hyperAddress");if(!Me||!ft)throw new Error("Please connect your account first.");fn.loading("Fetching live price...",{id:"fetch_price"});const on=await(await fetch(`${WC}/api/hyper/polymarketdca_bot/markets/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ft.toLowerCase(),token:Me,market_url:pt.market_url})})).json();if(!(on!=null&&on.success))throw new Error((on==null?void 0:on.error_message)||"Failed to load market");const bn=Array.isArray((le=on==null?void 0:on.data)==null?void 0:le.markets)?on.data.markets:[],{price:Gn,matchText:rr}=Ge(bn,pt.coin,pt.side);be(Jn=>{const Xn=[...Jn];return Xn[At]=Gn,Xn}),ee(Jn=>{const Xn=[...Jn];return Xn[At]={...Xn[At],markets:bn},Xn}),fn.success(`Matched ${rr} @ ${Math.round(Gn*100)}¢`,{id:"fetch_price"})}catch(Me){fn.error(Me.message,{id:"fetch_price"})}},Be=h.useMemo(()=>JSON.stringify({market_source_type:g.market_source_type,market_url:g.market_url,coin:g.coin,side:g.side}),[g.market_source_type,g.market_url,g.coin,g.side]);h.useEffect(()=>{var pt;const At=f[l];if(At.market_source_type==="others"&&At.coin&&At.side){const le=(pt=H[l])==null?void 0:pt.markets;if(le&&le.length>0)try{const{price:Me}=Ge(le,At.coin,At.side);be(ft=>{if(ft[l]===Me)return ft;const ut=[...ft];return ut[l]=Me,ut})}catch{}}},[Be,l]);const qt=(At,pt)=>{if(!At)return;const le=At,Me=(le==null?void 0:le.bot_params)||le;x(ft=>{const ut=[...ft],on=Me==null?void 0:Me.market_period,bn=Number(on)===5||String(on)==="5m"?"5m":Number(on)===15||String(on)==="15m"?"15m":Number(on)===60||String(on)==="60m"?"60m":Number(on)===240||String(on)==="240m"?"240m":Number(on)===1440||String(on)==="1440m"?"1440m":ut[pt].market_period,Gn=(Me==null?void 0:Me.base_shares)!==void 0&&(Me==null?void 0:Me.base_shares)!==null?String(Me.base_shares):"",rr=(Me==null?void 0:Me.base_price)!==void 0&&(Me==null?void 0:Me.base_price)!==null?String(Me.base_price):"",Jn=(Me==null?void 0:Me.base_dca_shares)!==void 0&&(Me==null?void 0:Me.base_dca_shares)!==null?String(Me.base_dca_shares):"",Xn=(Me==null?void 0:Me.base_dca_price)!==void 0&&(Me==null?void 0:Me.base_dca_price)!==null?String(Me.base_dca_price):"",Zr=String((Me==null?void 0:Me.coin)||"").trim()||String((Me==null?void 0:Me.market_group)||"").trim()||ut[pt].coin;return ut[pt]={...ut[pt],market_period:bn,market_source_type:(Me==null?void 0:Me.market_source_type)??"crypto",market_url:(Me==null?void 0:Me.market_url)??"",coin:Zr,side:(Me==null?void 0:Me.side)??ut[pt].side??"all",sizing_mode:(Me==null?void 0:Me.sizing_mode)??"shares",pkey:(Me==null?void 0:Me.pkey)||ut[pt].pkey,funder_address:(Me==null?void 0:Me.funder_address)||ut[pt].funder_address,api_key:(Me==null?void 0:Me.api_key)||ut[pt].api_key,api_secret:(Me==null?void 0:Me.api_secret)||ut[pt].api_secret,api_pass:(Me==null?void 0:Me.api_pass)||ut[pt].api_pass,base_shares:Gn,base_price:rr,base_dca_shares:Jn,base_dca_price:Xn,dca_levels:(Me==null?void 0:Me.dca_levels)??ut[pt].dca_levels,near_step:(Me==null?void 0:Me.near_step)!==void 0&&(Me==null?void 0:Me.near_step)!==null?String(Number(Me.near_step)*100):"",near_step_multiplier:(Me==null?void 0:Me.near_step_multiplier)??ut[pt].near_step_multiplier,deep_multiplier:(Me==null?void 0:Me.deep_multiplier)??ut[pt].deep_multiplier,tp_profit:(Me==null?void 0:Me.tp_profit)!==void 0&&(Me==null?void 0:Me.tp_profit)!==null?String(Number(Me.tp_profit)*100):"",tp_block:(Me==null?void 0:Me.tp_block)??ut[pt].tp_block,tp_limit:(Me==null?void 0:Me.stop_when_profitable)!==void 0?Me!=null&&Me.stop_when_profitable?Me==null?void 0:Me.min_profit_threshold:"":(Me==null?void 0:Me.tp_limit)??"",sl_loss:(Me==null?void 0:Me.sl_loss)!==void 0&&(Me==null?void 0:Me.sl_loss)!==null?String(Number(Me.sl_loss)*100):"",sl_spread:(Me==null?void 0:Me.sl_spread)!==void 0&&(Me==null?void 0:Me.sl_spread)!==null?String(Number(Me.sl_spread)*100):"",cutoff_min:(Me==null?void 0:Me.cutoff_min)??ut[pt].cutoff_min,min_price:(Me==null?void 0:Me.min_price)!==void 0&&(Me==null?void 0:Me.min_price)!==null?String(Math.round(Number(Me.min_price)*100)):"",max_price:(Me==null?void 0:Me.max_price)!==void 0&&(Me==null?void 0:Me.max_price)!==null?String(Math.round(Number(Me.max_price)*100)):""},Me!=null&&Me.est_price&&be($r=>{const wr=[...$r];return wr[pt]=Number(Me.est_price),wr}),ut})},It=async({silent:At=!1}={})=>{try{q(!0);const pt=window.localStorage.getItem("hyperToken"),le=window.localStorage.getItem("hyperAddress"),Me=await fetch(`${WC}/api/hyper/polymarketdca_bot/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:le,token:pt})});if(!Me.ok){console.error("Fetch info failed:",Me.status,Me.statusText),v(Array(4).fill(!1));return}const ft=Me.headers.get("content-type");if(!ft||!ft.includes("application/json")){v(Array(4).fill(!1));return}const ut=await Me.json();if(!(ut!=null&&ut.success)){v(Array(4).fill(!1));return}const on=Array.isArray(ut==null?void 0:ut.data)?ut.data:[],bn=Array(4).fill(null),Gn=Array(4).fill(!1);on.forEach(rr=>{const Jn=Number(rr==null?void 0:rr.slot_number);Jn>=1&&Jn<=4&&(bn[Jn-1]=rr,Gn[Jn-1]=!(rr!=null&&rr.is_deleted))}),v(Gn),bn.forEach((rr,Jn)=>{if(!rr)return;qt(rr,Jn);const Xn=(rr==null?void 0:rr.bot_params)||rr,Zr=(Xn==null?void 0:Xn.market_source_type)??"crypto",$r=String((Xn==null?void 0:Xn.market_url)||"").trim();if(Zr==="others"&&$r&&At){const wr=String((Xn==null?void 0:Xn.coin)||"").trim()||String((Xn==null?void 0:Xn.market_group)||"").trim(),pr=(Xn==null?void 0:Xn.side)??null;xe($r,Jn,{infoSideHint:pr,infoCoinHint:wr})}})}catch(pt){console.error(pt)}finally{q(!1)}},mt=At=>{At!==l&&(x(pt=>{const le=[...pt],Me=le[At],ft=le[l];return Me?(le[l]={...ft,...Me},le):pt}),be(pt=>{const le=[...pt];return le[l]=pt[At],le}),fn.success(`Settings copied from Slot ${At+1}`))},Ft=async()=>{try{re(!0),fe("");for(let Gn=0;Gn<f.length;Gn++)if(Gn!==l&&y[Gn]){const rr=f[Gn],Jn=(rr.market_source_type||"crypto")===(g.market_source_type||"crypto"),Xn=(rr.coin||"").trim().toLowerCase()===(g.coin||"").trim().toLowerCase(),Zr=(rr.pkey||"").trim().toLowerCase()===(g.pkey||"").trim().toLowerCase();if(Jn&&Xn&&Zr){const $r=(rr.side||"").toLowerCase(),wr=(g.side||"").toLowerCase();if($r===wr||$r==="all"||wr==="all"){fn.error(`Cannot start: Conflict with Bot-${Gn+1} (Same market & overlap with same PKey)`,{position:"bottom-right",style:{background:"#1e2329",color:"#ef4444",fontSize:"12px",border:"1px solid #ef4444"}}),re(!1);return}}}const At=window.localStorage.getItem("hyperToken"),pt=window.localStorage.getItem("hyperAddress");if(!At||!pt){fe("Please connect your account first.");return}if(!rt){fe("Funder address format is invalid.");return}if(!nt){fe("Please enter a valid private key.");return}const le=(g.market_source_type||"crypto")==="others",Me=le&&(Ht.markets||[]).find(Gn=>We(Pt(Gn),g.coin))||null,ft={market_source_type:g.market_source_type||"crypto",market_url:g.market_url||"",markets:Me,market_period:Number(String(g.market_period).replace("m","")),coin:le?"":g.coin,market_group:le?g.coin:"",side:g.side,pkey:g.pkey,funder_address:g.funder_address,api_key:g.api_key,api_secret:g.api_secret,api_pass:g.api_pass,base_shares:Se==="shares"?Number(g.base_shares):0,base_price:Se==="usdc"?Number(g.base_price):0,base_dca_shares:Se==="shares"?Number(g.base_dca_shares):0,base_dca_price:Se==="usdc"?Number(g.base_dca_price):0,dca_levels:Number(g.dca_levels),near_step:Number(g.near_step)/100,near_step_multiplier:Number(g.near_step_multiplier),deep_multiplier:Number(g.deep_multiplier),tp_profit:Number(g.tp_profit)>0?Number(g.tp_profit)/100:null,tp_block:!!g.tp_block,tp_limit:le?null:Number(g.tp_limit)>0?Number(g.tp_limit)/100:null,stop_when_profitable:Number(g.tp_limit)>0,min_profit_threshold:Number(g.tp_limit)>0?Number(g.tp_limit):0,sl_loss:Number(g.sl_loss)>0?Number(g.sl_loss)/100:null,sl_spread:Number(g.sl_loss)>0&&Number(g.sl_spread)>=0?Number(g.sl_spread)/100:0,min_price:g.min_price!==""&&g.min_price!=null?Number(g.min_price)/100:0,max_price:g.max_price!==""&&g.max_price!=null?Number(g.max_price)/100:1,cutoff_min:le?0:Number(g.cutoff_min)||0,sizing_mode:Se,est_price:Number(ve[l])},ut={address:pt.toLowerCase(),token:At,coin:g.coin,bot_params:ft,slot_number:u.split("-")[1]&&Number(u.split("-")[1])},bn=await(await fetch(`${WC}/api/hyper/polymarketdca_bot/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ut)})).json();if(!(bn!=null&&bn.success)){fe((bn==null?void 0:bn.error_message)||"Start failed."),fn.error((bn==null?void 0:bn.error_message)||"Start failed."),dt(!1);return}v(Gn=>{const rr=[...Gn];return rr[l]=!0,rr}),dt(!1),await It()}catch(At){fe(At.message||"Start request failed."),dt(!1)}finally{re(!1)}},Tn=async()=>{try{re(!0),fe("");const At=window.localStorage.getItem("hyperToken"),pt=window.localStorage.getItem("hyperAddress"),le=u.split("-")[1]?Number(u.split("-")[1]):null;let Me=g.coin||"",ft={...g,market_source_type:g.market_source_type||"crypto",market_url:g.market_url||"",coin:(g.market_source_type||"crypto")==="others"?"":g.coin,market_group:(g.market_source_type||"crypto")==="others"?g.coin:""};try{const Gn=await fetch(`${WC}/api/hyper/polymarketdca_bot/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:pt,token:At})});if(Gn.ok){const rr=await Gn.json();if(rr!=null&&rr.success&&Array.isArray(rr.data)){const Jn=rr.data.find(Xn=>Number(Xn.slot_number)===le);Jn&&(Jn.coin&&(Me=Jn.coin),Jn.bot_params&&(ft=Jn.bot_params))}}}catch(Gn){console.warn("Failed to fetch authoritative info before stop",Gn)}const ut={address:pt.toLowerCase(),token:At,coin:Me,bot_params:ft,slot_number:le},bn=await(await fetch(`${WC}/api/hyper/polymarketdca_bot/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ut)})).json();if(!(bn!=null&&bn.success)){fe((bn==null?void 0:bn.error_message)||"Stop failed.");return}v(Gn=>{const rr=[...Gn];return rr[l]=!1,rr}),dt(!1),await It()}catch(At){fe(At.message||"Stop request failed.")}finally{re(!1)}},kn=At=>{At.preventDefault();const{errors:pt}=Re(g,Se),le=Object.keys(pt).length>0;if(!C&&(le||!wn)&&e){const Me=[];le&&Object.values(pt).forEach(on=>Me.push(on)),g.coin||Me.push("Coin selection is missing"),g.market_period||Me.push("Market Period is missing"),rt||Me.push("Funder Address invalid"),nt||Me.push("Private Key invalid"),(g.api_key||g.api_secret||g.api_pass)&&!(g.api_key&&g.api_secret&&g.api_pass)&&Me.push("Incomplete API Credentials");const ut=[...new Set(Me)];ut.length>0?fe(`Errors: ${ut.join(", ")}`):fe("Please populate required fields.");return}dt(!0)};h.useEffect(()=>{e?e&&It({silent:!0}):(x(LCn()),v(Array(4).fill(!1)),fe(""),T(!1),s(!1),yt(!1),vn(!1))},[e]);const Gt={...g,sizingMode:Se},mn=h.useMemo(()=>y.filter(Boolean).length,[y]),gt=C||Y||Q,jn=!(Fe(g.tp_profit)>0)&&!g.tp_block,kt=jn||gt;h.useEffect(()=>{const At=window.localStorage.getItem("hyperAddress");if(!At){if(U.current){try{U.current.disconnect()}catch{}U.current=null}$(!1);return}if(U.current){const pt=U.current;pt.connected&&pt.emit("subscribe_poly_dca",{login_address:At.toLowerCase()})}else{const pt=K0("https://dextrabothypesocketv2.nftinit.io/",{transports:["websocket"]});U.current=pt,pt.on("connect",()=>{$(!0),pt.emit("subscribe_poly_dca",{login_address:At.toLowerCase()})}),pt.on("disconnect",()=>{$(!1)}),pt.on("connect_error",()=>{$(!1)}),pt.on("poly_dca_get_message",le=>{var rr,Jn,Xn,Zr,$r,wr;const Me=(le==null?void 0:le.data)||le;if(!Me||!Me.message)return;const ft=Number(Me.slot_number||((rr=Me.data)==null?void 0:rr.slot_number)),ut=Me.raw_message||((Jn=Me.data)==null?void 0:Jn.raw_message)||Me.message||((Xn=Me.data)==null?void 0:Xn.message),on=Me.timestamp||((Zr=Me.data)==null?void 0:Zr.timestamp)||new Date().toISOString(),bn=Me.level||(($r=Me.data)==null?void 0:$r.level)||"INFO",Gn=Me.logger_name||((wr=Me.data)==null?void 0:wr.logger_name)||"";if(ut&&!isNaN(ft)&&ft>=1&&ft<=4){const pr=ft-1;L(ar=>{var Ln,ht;const Vr=[...ar],Ur=Vr[pr]||[];if(Ur.length>0&&((Ln=Ur[Ur.length-1])==null?void 0:Ln.msg)===ut&&((ht=Ur[Ur.length-1])==null?void 0:ht.rawTimestamp)===on)return ar;let Sr="";try{const Yt=new Date(on),lr=String(Yt.getHours()).padStart(2,"0"),sr=String(Yt.getMinutes()).padStart(2,"0"),Mr=String(Yt.getSeconds()).padStart(2,"0");Sr=`${lr}:${sr}:${Mr}`}catch{Sr="00:00:00"}const Pn={time:Sr,rawTimestamp:on,msg:ut,level:bn,logger:Gn};return Vr[pr]=[...Ur,Pn].slice(-500),Vr})}})}return()=>{if(U.current){U.current.off("connect"),U.current.off("disconnect"),U.current.off("connect_error"),U.current.off("poly_dca_get_message");try{U.current.disconnect()}catch{}U.current=null}}},[window.localStorage.getItem("hyperAddress")]),h.useEffect(()=>{if(C&&O.current){const At=O.current.parentElement;At&&(At.scrollTop=At.scrollHeight)}},[I,C,l]);const cn=["up","down","yes","no"].includes(String(g.side||"").toLowerCase());h.useEffect(()=>{cn&&String(g.tp_limit??"").trim()&&x(At=>{const pt=At[l];if(!pt||!String(pt.tp_limit??"").trim())return At;const le=[...At];return le[l]={...pt,tp_limit:""},le})},[l,g.tp_limit,cn]);let Ce=15;if(g.market_period){if(typeof g.market_period=="number")Ce=g.market_period;else if(typeof g.market_period=="string"){const At=parseInt(g.market_period.replace(/\D/g,""));!isNaN(At)&&At>0&&(Ce=At)}}return i.jsxs("div",{className:"flex justify-center items-start w-full px-2 sm:px-4 font-manrope",children:[i.jsx(MCn,{open:Ye,setOpen:dt,onConfirm:C?Tn:Ft,modalLoading:Y,active:C,confirmDisabled:!C&&!wn,modalDataInfo:Gt}),i.jsx("div",{className:"w-full max-w-[1440px] pt-2 pb-6",children:i.jsxs("div",{className:"flex flex-col gap-6 rounded-2xl border border-[#2a2f36] bg-[radial-gradient(circle_at_top,_rgba(96,165,250,0.08),_rgba(18,20,23,0.92)_45%,_rgba(10,12,14,0.98)_100%)] p-6 md:px-8 md:py-5 shadow-[0_24px_70px_rgba(0,0,0,0.5)]",children:[i.jsx("div",{className:"flex flex-col gap-2",children:i.jsxs("div",{className:"flex justify-between items-center gap-1",children:[i.jsx("div",{className:"flex flex-col",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:lL,alt:"Polymarket Logo",className:"w-6 h-6 rounded-md"}),i.jsx("h1",{className:"text-[22px] leading-[30px] font-semibold text-white",children:"Polymarket DCA Bot"}),i.jsx("span",{className:"rounded-full bg-white/5 border border-white/10 px-3 py-1 text-[11px] font-semibold text-[#9dd6ff]",children:"Dextrabot"}),i.jsx(as,{content:"Configure the DCA strategy parameters. The bot will automatically place orders based on the configured levels and multipliers.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]})}),i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:`text-[11px] uppercase tracking-[0.2em] px-3 py-1 rounded-full border ${C?"border-[#60a5fa]/40 text-[#fff] bg-[#164bb4]":"border-[#2f2f2f] text-[#b0b0b0] bg-[#151515]"}`,children:`${u.toUpperCase()} ${C?"Running":"Idle"}`})})]})}),i.jsxs("form",{onSubmit:kn,className:"grid grid-cols-1 lg:grid-cols-[1.2fr_1fr] xl:grid-cols-[1.25fr_1fr] items-start gap-6 mt-1",children:[i.jsxs("div",{className:"flex flex-col gap-10 min-w-0",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2",children:[i.jsx("div",{className:"flex flex-wrap items-center gap-2",children:["Bot-1","Bot-2","Bot-3","Bot-4"].map((At,pt)=>{const le=l===pt,Me=y[pt];return i.jsx("button",{type:"button",onClick:()=>{c(pt),d(At.toLowerCase())},className:`h-10 px-5 rounded-lg border text-[12px] font-semibold uppercase tracking-[0.2em] transition shadow-md ${le?"border-[#60a5fa]/80 bg-[#3971d7] text-[#fff] transition-all duration-200 scale-105":"border-[#4b5563] bg-[#1a212b] text-[#e2e8f0] hover:border-[#60a5fa]/60 hover:text-white hover:bg-[#223045]"} `,children:i.jsxs("span",{className:"flex items-center gap-2",children:[At,Me&&le?i.jsx("span",{className:"grid h-4 w-4 place-items-center rounded-full bg-[#2dd4bf] text-[#0b1a16]",children:i.jsx("svg",{viewBox:"0 0 16 16",className:"h-3 w-3",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}):Me&&!le&&i.jsx("span",{className:"rounded-full bg-[#2dd4bf] w-2 h-2"})]})},At)})}),i.jsxs("span",{className:"text-[11px] uppercase tracking-[0.2em] px-3 py-1 rounded-full border border-[#1f3a2a] text-[#cbd5e1] bg-[#0f1512] shadow-[0_0_0_1px_rgba(34,197,94,0.15),0_8px_16px_rgba(0,0,0,0.35)]",children:["Active Bots"," ",i.jsx("span",{className:"text-[#4ade80] font-bold text-[12px]",children:`${mn}/4`})]})]}),i.jsxs("div",{className:"flex flex-col gap-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{className:"flex items-center gap-1",children:i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Market Type"})}),i.jsxs("div",{className:"relative",ref:Hn,children:[i.jsxs("button",{type:"button",onClick:()=>!gt&&at(!st),disabled:gt,className:"h-11 w-full rounded-lg bg-[#12161c] border border-[#2b2f36] text-white px-4 text-[14px] font-medium outline-none transition justify-between flex items-center hover:border-[#3a3a3a] disabled:opacity-50 disabled:cursor-not-allowed",children:[Ke(NAe,ct),i.jsx("svg",{className:`h-4 w-4 transition ${st?"rotate-180":""}`,fill:"none",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),st&&!gt&&i.jsx("div",{className:"absolute z-20 mt-2 px-2 w-full rounded-xl border border-[#22324a] bg-[#0a0f16]",children:i.jsx("div",{className:"py-2",children:NAe.map(At=>i.jsx("button",{type:"button",onClick:()=>{ze(At.value),at(!1)},className:`w-full px-4 py-2 mb-1 text-left text-[13px] font-bold tracking-[0.08em] hover:bg-[#0f2c52] hover:text-white transition ${ct===At.value?"bg-[#123a66] text-[#e8f2ff]":"text-[#c6d4ea]"}`,children:At.label},At.value))})})]})]}),i.jsxs("div",{className:`flex flex-col gap-2 ${Nt?"md:col-span-3":""}`,children:[i.jsx("div",{className:"flex items-center gap-1",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:g.market_source_type==="crypto"?"Market Period":"Polymarket Url"}),i.jsx(as,{content:"Select the expiration grouping (e.g. 15m, 1h). The bot will trade markets matching this timeframe.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]})}),!Nt&&i.jsxs("div",{className:"relative",ref:ln,children:[i.jsxs("button",{type:"button",onClick:()=>!gt&&qe(!He),disabled:gt,className:"h-11 w-full rounded-lg bg-[#12161c] border border-[#2b2f36] text-white px-4 text-[14px] font-medium outline-none transition justify-between flex items-center hover:border-[#3a3a3a] disabled:opacity-50 disabled:cursor-not-allowed",children:[Ke(Vt,g.market_period),i.jsx("svg",{className:`h-4 w-4 transition ${He?"rotate-180":""}`,fill:"none",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),He&&!gt&&i.jsx("div",{className:"absolute z-20 mt-2 px-2 w-full rounded-xl border border-[#22324a] bg-[#0a0f16]",children:i.jsx("div",{className:"py-2",children:Vt.map(At=>i.jsx("button",{type:"button",onClick:()=>{Sn("market_period")({target:{value:At.value}}),qe(!1)},className:`w-full px-4 py-2 mb-1 text-left text-[13px] font-bold tracking-[0.08em] hover:bg-[#0f2c52] hover:text-white transition ${g.market_period===At.value?"bg-[#123a66] text-[#e8f2ff]":"text-[#c6d4ea]"}`,children:At.label},At.value))})})]}),Nt&&i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx("input",{type:"url",value:g.market_url||"",onChange:Sn("market_url"),placeholder:"Paste Polymarket API/market URL",disabled:gt||G,className:"h-10 w-full rounded-lg bg-[#12161c] border border-[#2b2f36] text-white pl-3 pr-16 text-[12px] outline-none transition focus:border-[#4a4a4a] disabled:opacity-50"}),!!g.market_url&&i.jsx("button",{type:"button",onClick:()=>{je(""),Sn("market_url")({target:{value:""}})},disabled:gt||G,className:"absolute right-2 top-1/2 -translate-y-1/2 h-6 w-6 rounded-md border border-[#2b2f36] bg-[#10151d] text-[#9aa4b2] hover:text-white hover:border-[#3a3a3a] transition disabled:opacity-50 flex items-center justify-center leading-none","aria-label":"Clear market url",children:i.jsx("span",{className:"text-sm leading-none",children:"X"})})]}),i.jsx("button",{type:"button",onClick:()=>xe(),disabled:gt||G,className:`h-10 px-2.5 rounded-lg border text-[11px] uppercase tracking-[0.16em] disabled:opacity-50 transition ${En?"border-[#1d4f8f] bg-[#16304f] text-[#e8f2ff] hover:border-[#2b6cb0]":"border-[#2b2f36] bg-[#182333] text-[#8ea4c4]"}`,children:G?"Loading":"Load"})]}),we&&i.jsx("div",{className:"text-[11px] text-[#fca5a5]",children:we}),!we&&g.market_url==""&&i.jsx("div",{className:"text-[11px] text-[#fca5a5]",children:"Market URL is required."})]})]}),i.jsxs("div",{className:`${Nt?"hidden":""} flex flex-col gap-2`,children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:g.market_source_type==="crypto"?"Coin":"Market Group"}),i.jsx(as,{content:"Select the target asset (e.g. BTC, ETH). The bot filters markets based on this selection.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsxs("div",{className:"relative",ref:Nn,children:[i.jsxs("button",{type:"button",onClick:()=>!gt&&yt(!vt),disabled:gt,className:"h-11 w-full rounded-lg bg-[#12161c] border border-[#2b2f36] text-white px-4 text-[14px] font-medium outline-none transition justify-between flex items-center hover:border-[#3a3a3a] disabled:opacity-50 disabled:cursor-not-allowed min-w-0",children:[i.jsx("span",{className:"block truncate pr-2",title:Ke(Rn,g.coin),children:Ke(Rn,g.coin)}),i.jsx("svg",{className:`h-4 w-4 transition ${vt?"rotate-180":""}`,fill:"none",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),vt&&!gt&&i.jsxs("div",{className:"absolute z-20 mt-2 px-2 w-full rounded-xl border border-[#22324a] bg-[#0a0f16] max-h-60 overflow-y-auto pt-2 pb-1 shadow-xl",children:[i.jsx("div",{className:"px-2 pb-2 sticky top-0 bg-[#0a0f16] z-10 pt-1",children:i.jsx("input",{type:"text",value:Kt,onChange:At=>jt(At.target.value),onClick:At=>At.stopPropagation(),placeholder:"Search coin...",autoFocus:!0,className:"w-full bg-[#12161c] border border-[#2b2f36] rounded-md text-white text-[12px] px-3 py-1.5 outline-none focus:border-[#4a4a4a] placeholder:text-[#6b7280] transition"})}),i.jsx("div",{className:"py-1",children:Rn.filter(At=>(At.label||"").toLowerCase().includes(Kt.toLowerCase())||(At.value||"").toLowerCase().includes(Kt.toLowerCase())).map(At=>i.jsx("button",{type:"button",onClick:()=>{Sn("coin")({target:{value:At.value}}),yt(!1),jt("")},className:`w-full px-4 py-2 mb-1 text-left text-[13px] font-semibold tracking-[0.08em] hover:bg-[#0f2c52] hover:text-white transition ${We(g.coin,At.value)?"bg-[#123a66] text-[#e8f2ff]":"text-[#c6d4ea]"}`,title:At.label,children:i.jsx("span",{className:"block truncate",children:At.label})},At.value))})]})]})]}),i.jsxs("div",{className:`${Nt?"hidden":""} flex flex-col gap-2`,children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Side"}),i.jsx(as,{content:"Choose which side(s) the bot will trade. UP = only YES side, DOWN = only NO side, ALL = both sides.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("div",{className:"flex bg-[#0b0f15] h-11 p-1 rounded-lg border border-[#2b2f36] items-center gap-1",children:Mn.map(At=>{const pt=At.value,le=["up","down","all"].includes(String(pt).toLowerCase()),Me=String(pt).toLowerCase(),ft=i.jsx("span",{className:`flex flex-1 ${At.disabled?"cursor-not-allowed":""}`,children:i.jsx("button",{type:"button",onClick:()=>{At.disabled||x(ut=>{const on=[...ut];return on[l]={...on[l],side:pt},on})},disabled:gt||At.disabled,className:`w-full py-1.5 text-[11px] font-bold uppercase rounded-md transition ${At.disabled?"text-[#3a3f4a] pointer-events-none opacity-40":g.side===pt?Me==="up"||Me==="yes"?"bg-[#22c55e] text-white":Me==="down"||Me==="no"?"bg-[#ef4444] text-white":le?"bg-[#3971d7] text-white":"bg-[#334155] text-white":"text-[#6b7280] hover:text-white"}`,children:String(At.label||pt).toUpperCase()})},pt);return At.disabled?i.jsx(as,{content:"ALL option is not available currently",children:ft},pt):ft})})]})]}),Nt&&i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`flex flex-col gap-2 ${Cn?"opacity-50":""}`,children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:g.market_source_type==="crypto"?"Coin":"Market Group"}),i.jsx(as,{content:"Select the target asset (e.g. BTC, ETH). The bot filters markets based on this selection.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsxs("div",{className:"relative",ref:dn,children:[i.jsxs("button",{type:"button",onClick:()=>!gt&&!Cn&&vn(!un),disabled:gt||Cn,className:"h-11 w-full rounded-lg bg-[#12161c] border border-[#2b2f36] text-white px-4 text-[14px] font-medium outline-none transition justify-between flex items-center hover:border-[#3a3a3a] disabled:opacity-50 disabled:cursor-not-allowed min-w-0",children:[i.jsx("span",{className:"block truncate pr-2",title:Ke(Rn,g.coin),children:Ke(Rn,g.coin)}),i.jsx("svg",{className:`h-4 w-4 transition ${un?"rotate-180":""}`,fill:"none",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),un&&!gt&&!Cn&&i.jsxs("div",{className:"absolute z-20 mt-2 px-2 w-full rounded-xl border border-[#22324a] bg-[#0a0f16] max-h-60 overflow-y-auto pt-2 pb-1 shadow-xl",children:[i.jsx("div",{className:"px-2 pb-2 sticky top-0 bg-[#0a0f16] z-10 pt-1",children:i.jsx("input",{type:"text",value:Kt,onChange:At=>jt(At.target.value),onClick:At=>At.stopPropagation(),placeholder:"Search market...",autoFocus:!0,className:"w-full bg-[#12161c] border border-[#2b2f36] rounded-md text-white text-[12px] px-3 py-1.5 outline-none focus:border-[#4a4a4a] placeholder:text-[#6b7280] transition"})}),i.jsx("div",{className:"py-1",children:Rn.filter(At=>(At.label||"").toLowerCase().includes(Kt.toLowerCase())||(At.value||"").toLowerCase().includes(Kt.toLowerCase())||(At.question||"").toLowerCase().includes(Kt.toLowerCase())).map(At=>i.jsxs("button",{type:"button",onClick:()=>{Sn("coin")({target:{value:At.value}}),vn(!1),jt("")},className:`w-full px-4 py-2 mb-1 text-left hover:bg-[#0f2c52] transition ${We(g.coin,At.value)?"bg-[#123a66]":""}`,title:At.label,children:[i.jsx("span",{className:`block truncate text-[13px] font-semibold tracking-[0.08em] ${We(g.coin,At.value)?"text-[#e8f2ff]":"text-[#c6d4ea]"}`,children:At.label}),At.question&&i.jsxs("span",{className:`block truncate text-[10px] tracking-wide mt-0.5 ${We(g.coin,At.value)?"text-[#a0c4f2]":"text-[#7a8ca6]"}`,children:["Q: ",At.question]})]},At.value))})]})]})]}),i.jsxs("div",{className:`flex flex-col gap-2 ${Cn?"opacity-50":""}`,children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Side"}),i.jsx(as,{content:"Choose which side(s) the bot will trade. UP = only YES side, DOWN = only NO side, ALL = both sides.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("div",{className:"flex bg-[#0b0f15] h-11 p-1 rounded-lg border border-[#2b2f36] items-center gap-1",children:Mn.map(At=>{const pt=At.value,le=["up","down","all"].includes(String(pt).toLowerCase()),Me=String(pt).toLowerCase(),ft=i.jsx("span",{className:`flex flex-1 ${At.disabled?"cursor-not-allowed":""}`,children:i.jsx("button",{type:"button",onClick:()=>{At.disabled||x(ut=>{const on=[...ut];return on[l]={...on[l],side:pt},on})},disabled:gt||Cn||At.disabled,className:`w-full py-1.5 text-[11px] font-bold uppercase rounded-md transition ${At.disabled?"text-[#3a3f4a] pointer-events-none opacity-40":g.side===pt?Me==="up"||Me==="yes"?"bg-[#22c55e] text-white":Me==="down"||Me==="no"?"bg-[#ef4444] text-white":le?"bg-[#3971d7] text-white":"bg-[#334155] text-white":"text-[#6b7280] hover:text-white"}`,children:String(At.label||pt).toUpperCase()})},pt);return At.disabled?i.jsx(as,{content:"ALL option is not available currently",children:ft},pt):ft})})]})]}),i.jsxs("div",{className:"border border-[#2a2f36] rounded-xl p-4 bg-[#11161d]",children:[i.jsxs("div",{className:"flex items-center gap-4 mb-4 border-b border-[#2a2f36] pb-2",children:[i.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-wider",children:"Base Sizing"}),i.jsxs("div",{className:"flex bg-[#0b0f15] p-1 rounded-lg border border-[#2b2f36] gap-1",children:[i.jsx("button",{type:"button",onClick:()=>Qe("shares"),disabled:gt,className:`px-3 py-1 text-[10px] font-bold uppercase rounded-md transition ${Se==="shares"?"bg-[#3971d7] text-white":"text-[#6b7280] hover:text-white"} ${gt?"cursor-not-allowed":""}`,children:"Shares"}),i.jsx("button",{type:"button",onClick:()=>Qe("usdc"),disabled:gt,className:`px-3 py-1 text-[10px] font-bold uppercase rounded-md transition ${Se==="usdc"?"bg-[#3971d7] text-white":"text-[#6b7280] hover:text-white"} ${gt?"cursor-not-allowed":""}`,children:"USDC"})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Initial Order (Anchor Point)"}),i.jsx(as,{content:Se==="shares"?"Number of shares executed immediately as the initial market entry.":"USDC amount used for the initial market entry.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("input",{type:"text",value:Se==="shares"?g.base_shares:g.base_price,onChange:Sn(Se==="shares"?"base_shares":"base_price"),disabled:gt,placeholder:Se==="shares"?"Shares":"USDC",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${Se==="shares"?(m=se.errors)!=null&&m.base_shares?"border-red-500 focus:border-red-500":(p=se.warnings)!=null&&p.base_shares?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]":(N=se.errors)!=null&&N.base_price?"border-red-500 focus:border-red-500":(A=se.warnings)!=null&&A.base_price?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]"}
`}),(((k=se.errors)==null?void 0:k.base_shares)||((P=se.errors)==null?void 0:P.base_price))&&i.jsx("span",{className:"text-[10px] text-red-500",children:Se==="shares"?se.errors.base_shares:se.errors.base_price}),(((D=se.warnings)==null?void 0:D.base_shares)||((V=se.warnings)==null?void 0:V.base_price))&&!((Z=se.errors)!=null&&Z.base_shares||(ce=se.errors)!=null&&ce.base_price)&&i.jsx("span",{className:"text-[10px] text-yellow-500",children:Se==="shares"?se.warnings.base_shares:se.warnings.base_price})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"First DCA Purchase"}),i.jsx(as,{content:Se==="shares"?"Number of shares placed at DCA Level 1 (deeper levels scale from this).":"USDC amount used at DCA Level 1 (deeper levels scale from this).",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("input",{type:"text",value:Se==="shares"?g.base_dca_shares:g.base_dca_price,onChange:Sn(Se==="shares"?"base_dca_shares":"base_dca_price"),disabled:gt,placeholder:Se==="shares"?"Shares":"USDC",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${Se==="shares"?(ue=se.errors)!=null&&ue.base_dca_shares?"border-red-500 focus:border-red-500":(me=se.warnings)!=null&&me.base_dca_shares?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]":(Ne=se.errors)!=null&&Ne.base_dca_price?"border-red-500 focus:border-red-500":(Ie=se.warnings)!=null&&Ie.base_dca_price?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]"}
`}),(((Le=se.errors)==null?void 0:Le.base_dca_shares)||((Xe=se.errors)==null?void 0:Xe.base_dca_price))&&i.jsx("span",{className:"text-[10px] text-red-500",children:Se==="shares"?se.errors.base_dca_shares:se.errors.base_dca_price}),(((Oe=se.warnings)==null?void 0:Oe.base_dca_shares)||(($e=se.warnings)==null?void 0:$e.base_dca_price))&&!((ae=se.errors)!=null&&ae.base_dca_shares||(he=se.errors)!=null&&he.base_dca_price)&&i.jsx("span",{className:"text-[10px] text-yellow-500",children:Se==="shares"?se.warnings.base_dca_shares:se.warnings.base_dca_price})]})]})]}),i.jsxs("div",{className:"border border-[#2a2f36] rounded-xl p-4 bg-[#11161d]",children:[i.jsx("h3",{className:"text-sm font-bold text-white mb-4 uppercase tracking-wider border-b border-[#2a2f36] pb-2",children:"DCA Strategy"}),i.jsxs("div",{className:"mb-6",children:[i.jsxs("div",{className:"flex flex-col gap-1 mb-3",children:[i.jsx("div",{className:"flex items-center gap-1",children:i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c] uppercase",children:"ENTRY RANGE (optional)"})}),i.jsx("span",{className:"text-[11px] text-[#6b7280]",children:"Bot will start placing orders only when the market price enters this range."})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{className:"flex items-center gap-1",children:i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Min Price (¢)"})}),i.jsx("input",{type:"text",value:g.min_price,onChange:Sn("min_price"),disabled:gt,placeholder:"0",title:"If empty, backend defaults to 0",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${(Pe=se.errors)!=null&&Pe.min_price?"border-red-500 focus:border-red-500":"border-[#2b2f36] focus:border-[#60a5fa]"}`}),((Ve=se.errors)==null?void 0:Ve.min_price)&&i.jsx("span",{className:"text-[10px] text-red-500",children:se.errors.min_price})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{className:"flex items-center gap-1",children:i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Max Price (¢)"})}),i.jsx("input",{type:"text",value:g.max_price,onChange:Sn("max_price"),disabled:gt,placeholder:"100",title:"If empty, backend defaults to 100",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${(Te=se.errors)!=null&&Te.max_price?"border-red-500 focus:border-red-500":"border-[#2b2f36] focus:border-[#60a5fa]"}`}),((Ze=se.errors)==null?void 0:Ze.max_price)&&i.jsx("span",{className:"text-[10px] text-red-500",children:se.errors.max_price})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"DCA Levels"}),i.jsx(as,{content:"Number of DCA ladder levels. The bot typically places an initial order plus this many deeper levels (sequentially). More levels increases coverage and potential exposure.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("input",{type:"text",value:g.dca_levels,onChange:Sn("dca_levels"),disabled:gt,placeholder:"",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${(it=se.errors)!=null&&it.dca_levels?"border-red-500 focus:border-red-500":(wt=se.warnings)!=null&&wt.dca_levels?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]"}
`}),((Dt=se.errors)==null?void 0:Dt.dca_levels)&&i.jsx("span",{className:"text-[10px] text-red-500",children:se.errors.dca_levels}),((Qt=se.warnings)==null?void 0:Qt.dca_levels)&&!((xn=se.errors)!=null&&xn.dca_levels)&&i.jsx("span",{className:"text-[10px] text-yellow-500",children:se.warnings.dca_levels})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"DCA Level Spacing (¢)"}),i.jsx(as,{content:"How far apart each buy level is from the previous one by a fixed amount. 5 = 5 Cents lower than the previous level.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("input",{type:"text",value:g.near_step,onChange:Sn("near_step"),disabled:gt,placeholder:"",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${(pn=se.errors)!=null&&pn.near_step?"border-red-500 focus:border-red-500":(An=se.warnings)!=null&&An.near_step?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]"}
`}),((or=se.errors)==null?void 0:or.near_step)&&i.jsx("span",{className:"text-[10px] text-red-500",children:se.errors.near_step}),(($t=se.warnings)==null?void 0:$t.near_step)&&!((bt=se.errors)!=null&&bt.near_step)&&i.jsx("span",{className:"text-[10px] text-yellow-500",children:se.warnings.near_step})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Level Spacing Multiplier"}),i.jsx(as,{content:"Above 1.0 = levels spread out. Below 1.0 = levels get closer.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("input",{type:"text",value:g.near_step_multiplier,onChange:Sn("near_step_multiplier"),disabled:gt,placeholder:"",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${(rn=se.errors)!=null&&rn.near_step_multiplier?"border-red-500 focus:border-red-500":(ur=se.warnings)!=null&&ur.near_step_multiplier?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]"}`}),((gr=se.errors)==null?void 0:gr.near_step_multiplier)&&i.jsx("span",{className:"text-[10px] text-red-500",children:se.errors.near_step_multiplier}),((br=se.warnings)==null?void 0:br.near_step_multiplier)&&!((Br=se.errors)!=null&&Br.near_step_multiplier)&&i.jsx("span",{className:"text-[10px] text-yellow-500",children:se.warnings.near_step_multiplier})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"DCA Order Size Mult."}),i.jsx(as,{content:"Controls how order size increases at deeper levels. 1.0 = same size each level. 2.0 = doubles each level. 3.0 = aggressive scaling. ⚠ Increases exposure quickly",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("input",{type:"text",value:g.deep_multiplier,onChange:Sn("deep_multiplier"),disabled:gt,placeholder:"",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${(Gr=se.errors)!=null&&Gr.deep_multiplier?"border-red-500 focus:border-red-500":(Or=se.warnings)!=null&&Or.deep_multiplier?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]"}
`}),((Lt=se.errors)==null?void 0:Lt.deep_multiplier)&&i.jsx("span",{className:"text-[10px] text-red-500",children:se.errors.deep_multiplier}),((nn=se.warnings)==null?void 0:nn.deep_multiplier)&&!((Ot=se.errors)!=null&&Ot.deep_multiplier)&&i.jsx("span",{className:"text-[10px] text-yellow-500",children:se.warnings.deep_multiplier})]})]}),i.jsx(RCn,{data:{...g,side:(g.market_source_type||"crypto")==="others"?"yes":g.side,original_side:g.side,isLocked:gt,onRefreshPrice:()=>_e(l)},bestBid:ve[l]||.55,onBidChange:At=>{be(pt=>{const le=[...pt];return le[l]=At,le})},sizingMode:Se})]}),i.jsxs("div",{className:"border border-[#2a2f36] rounded-xl p-4 bg-[#11161d]",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(g.market_source_type||"crypto")==="crypto"&&i.jsxs("div",{className:"flex items-center justify-between border-b border-[#2a2f36] pb-2 mb-4 md:col-span-2",children:[i.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-wider",children:"Risk Management"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-[10px] font-semibold tracking-[0.15em] text-[#8c8c8c] uppercase",children:"Cutoff Min"}),i.jsx(as,{content:"How many minutes before market expiry the bot stops placing BUY orders. When cutoff is active, the bot cancels BUY orders and does not place new ones. TP/SL sell logic can still run.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3 h-3"})})})]}),i.jsx("input",{type:"text",value:g.cutoff_min,onChange:Sn("cutoff_min"),disabled:gt,placeholder:`Max: ${Ce-1}`,title:`0 to ${Ce-1}`,className:`h-8 w-16 rounded-md bg-[#0b0f15] border px-2 text-center text-white text-xs placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${(en=se.errors)!=null&&en.cutoff_min?"border-red-500 focus:border-red-500":(Fn=se.warnings)!=null&&Fn.cutoff_min?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]"}`}),((yr=se.errors)==null?void 0:yr.cutoff_min)&&i.jsx("span",{className:"text-[9px] text-red-500",children:se.errors.cutoff_min}),((hr=se.warnings)==null?void 0:hr.cutoff_min)&&!((lt=se.errors)!=null&<.cutoff_min)&&i.jsx("span",{className:"text-[9px] text-yellow-500",children:se.warnings.cutoff_min})]})]}),(g.market_source_type||"crypto")==="others"&&i.jsx("div",{className:"flex items-center justify-between border-b border-[#2a2f36] pb-2 mb-4 md:col-span-2",children:i.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-wider",children:"Risk Management"})}),i.jsx("div",{className:"rounded-xl border border-[#2b2f36] bg-[#0e141d] p-3",children:i.jsxs("div",{className:"flex flex-col gap-2 relative",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Take Profit (¢)"}),i.jsx(as,{content:"Profit distance added to your average entry before closing the position.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsxs("div",{className:"relative flex items-center w-full",children:[i.jsx("input",{type:"text",value:g.tp_profit,onChange:At=>{let pt=At.target.value.trim();pt!==""&&!/^\d*$/.test(pt)||x(le=>{const Me=[...le];return Me[l]={...Me[l],tp_profit:pt,tp_block:Fe(pt)>0},Me})},disabled:gt,placeholder:"",className:`w-full h-11 rounded-lg bg-[#0b0f15] border px-4 pr-32 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${(Ct=se.errors)!=null&&Ct.tp_profit?"border-red-500 focus:border-red-500":(On=se.warnings)!=null&&On.tp_profit?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]"}`}),i.jsxs("div",{className:`absolute right-1 flex items-center justify-between gap-1 p-1 rounded-md bg-[#11161d] border border-[#2b2f36] h-9 transition ${jn?"opacity-40 grayscale pointer-events-none":kt?"opacity-60":"hover:border-[#3a3a3a]"}`,children:[i.jsx(as,{content:"When enabled, once a Take Profit is triggered on this side, the bot will not re-open a new position for the same side in the current market. The bot effectively locks out that side after a successful TP exit.",children:i.jsxs("div",{className:"flex items-center gap-1 px-1 cursor-help",children:[i.jsx("div",{className:"w-5 h-5 rounded-md border border-[#254c3a] bg-[#0d1b16] flex items-center justify-center",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3 text-[#4ade80]",children:[i.jsx("path",{d:"M7 10V8.5C7 5.46243 9.46243 3 12.5 3C15.5376 3 18 5.46243 18 8.5V10",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),i.jsx("rect",{x:"5",y:"10",width:"15",height:"11",rx:"2.5",stroke:"currentColor",strokeWidth:"1.8"})]})}),i.jsxs("div",{className:"text-[8px] font-bold text-[#7ee3a5] uppercase leading-none whitespace-nowrap",children:["Stop",i.jsx("br",{}),"after TP"]})]})}),i.jsx("button",{type:"button",role:"switch","aria-checked":!!g.tp_block,onClick:()=>{kt||x(At=>{const pt=[...At];return pt[l]={...pt[l],tp_block:!pt[l].tp_block},pt})},disabled:kt,className:`relative inline-flex h-5 w-9 items-center rounded-full border p-0 transition-colors shrink-0 ${g.tp_block?"bg-[#1d4ed8]/70 border-[#60a5fa]":"bg-[#1b2230] border-[#3b4250]"} ${kt?"cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{className:`inline-block h-3 w-3 shrink-0 transform rounded-full bg-white shadow transition-transform ${g.tp_block?"translate-x-5":"translate-x-1"}`})})]})]}),((qn=se.errors)==null?void 0:qn.tp_profit)&&i.jsx("span",{className:"text-[10px] text-red-500 mt-[-4px]",children:se.errors.tp_profit}),((_r=se.warnings)==null?void 0:_r.tp_profit)&&!((jr=se.errors)!=null&&jr.tp_profit)&&i.jsx("span",{className:"text-[10px] text-yellow-500 mt-[-4px]",children:se.warnings.tp_profit})]})}),i.jsx("div",{className:"rounded-xl border border-[#2b2f36] bg-[#0e141d] p-3",children:i.jsxs("div",{className:`flex flex-col gap-2 justify-center transition-opacity duration-200 ${cn?"opacity-40 grayscale cursor-not-allowed":"opacity-100"}`,children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Profit Locking"}),i.jsx(as,{content:"Freezes the strategy once guaranteed resolution profit is reached (ALL mode only).",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("input",{type:"text",value:g.tp_limit,onChange:Sn("tp_limit"),disabled:gt||cn,placeholder:"",className:`h-11 rounded-lg bg-[#0b0f15] border border-[#2b2f36] px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed focus:border-[#60a5fa] ${cn?"cursor-not-allowed":""}`})]})})]}),i.jsx("div",{className:"grid grid-cols-1 gap-4 mt-4",children:i.jsx("div",{className:"rounded-xl border border-[#2b2f36] bg-[#0e141d] p-3",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Stop Loss (¢)"}),i.jsx(as,{content:"Maximum loss distance below your average entry before exiting the position.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("input",{type:"text",value:g.sl_loss,onChange:Sn("sl_loss"),disabled:gt,placeholder:"",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${(Fr=se.errors)!=null&&Fr.sl_loss?"border-red-500 focus:border-red-500":(nr=se.warnings)!=null&&nr.sl_loss?"border-yellow-500/50 focus:border-yellow-500":"border-[#2b2f36] focus:border-[#60a5fa]"}`}),((vr=se.errors)==null?void 0:vr.sl_loss)&&i.jsx("span",{className:"text-[10px] text-red-500",children:se.errors.sl_loss}),((Yr=se.warnings)==null?void 0:Yr.sl_loss)&&!((dr=se.errors)!=null&&dr.sl_loss)&&i.jsx("span",{className:"text-[10px] text-yellow-500",children:se.warnings.sl_loss})]}),i.jsxs("div",{className:`flex flex-col gap-2 transition-opacity duration-200 ${Fe(g.sl_loss)>0?"opacity-100":"opacity-40 grayscale cursor-not-allowed"}`,children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c]",children:"Min Price Distance (MPD) (¢)"}),i.jsx(as,{content:"Maximum allowed deviation between the current market price and your entry price for order placement.",children:i.jsx("span",{children:i.jsx(us,{className:"text-[#7C7C7C] w-3.5 h-3.5"})})})]}),i.jsx("input",{type:"text",value:g.sl_spread,onChange:Sn("sl_spread"),disabled:gt||Fe(g.sl_loss)<=0,placeholder:"",className:`h-11 rounded-lg bg-[#0b0f15] border px-4 text-white placeholder-gray-500 outline-none transition disabled:cursor-not-allowed ${Fe(g.sl_loss)<=0?"cursor-not-allowed ":""}${(rs=se.errors)!=null&&rs.sl_spread?"border-red-500 focus:border-red-500":"border-[#2b2f36] focus:border-[#60a5fa]"}`}),((gs=se.errors)==null?void 0:gs.sl_spread)&&i.jsx("span",{className:"text-[10px] text-red-500",children:se.errors.sl_spread})]})]})})})]})]})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-[#2b2f36] bg-[#10151d] p-4 mb-4",children:[i.jsx("span",{className:"text-xs font-semibold tracking-[0.2em] text-[#8c8c8c] uppercase",children:"Copy Settings From:"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:[0,1,2,3].map(At=>At===l?null:i.jsxs("button",{type:"button",disabled:C,onClick:()=>mt(At),className:`h-8 px-3 rounded-lg border text-[11px] font-bold transition flex items-center gap-1.5 ${C?"border-[#2b2f36] bg-[#0b0f15] text-[#4a4a4a] cursor-not-allowed":"border-[#3b4250] bg-[#1a202c] text-[#a0aec0] hover:border-[#60a5fa] hover:text-[#60a5fa]"}`,children:[i.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${y[At]?"bg-[#22c55e] shadow-[0_0_4px_#22c55e]":"bg-[#ef4444] shadow-[0_0_4px_#ef4444]"}`}),i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3 h-3",children:[i.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),i.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Slot ",At+1]},At))}),i.jsx("span",{className:"text-[9px] text-gray-500 mt-1",children:"Copies all strategy, sizing, risk, and API settings. Keeps Market/Coin/Side intact."})]}),i.jsxs("div",{className:"flex flex-col gap-3 rounded-2xl border border-[#243245] bg-gradient-to-b from-[#141b26] to-[#0f141c] p-3",children:[C?i.jsx("div",{className:"flex flex-col gap-2 mb-2",children:(()=>{var le,Me,ft,ut;let At="";const pt=(le=g.pkey)==null?void 0:le.trim();if(pt&&pt.length>=64)try{const on=pt.startsWith("0x")?pt:`0x${pt}`;At=new fE(on).address}catch{}return i.jsxs("div",{className:"flex flex-wrap items-center justify-between pb-1 w-full opacity-70 hover:opacity-100 transition",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-[9px] text-gray-500 uppercase tracking-widest font-semibold",children:"Polymarket Addr:"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("span",{className:"text-[10px] font-mono text-[#c4c4c4]",children:[(Me=g.funder_address)==null?void 0:Me.slice(0,6),"...",(ft=g.funder_address)==null?void 0:ft.slice(-4)]}),i.jsx("button",{type:"button",onClick:()=>{g.funder_address&&(navigator.clipboard.writeText(g.funder_address),fn.success("Polymarket Address copied!",{position:"bottom-right",style:{background:"#1e2329",color:"#fff",fontSize:"12px"}}))},className:"text-[#6b7280] hover:text-[#2dd4bf] transition p-0 m-0 bg-transparent border-none appearance-none outline-none focus:outline-none flex items-center justify-center",title:"Copy Polymarket Address",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-3 h-3",children:[i.jsx("path",{d:"M7 3.5A1.5 1.5 0 0 1 8.5 2h3.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12A1.5 1.5 0 0 1 17 6.622V12.5a1.5 1.5 0 0 1-1.5 1.5h-1v-3.379a3 3 0 0 0-.879-2.121L10.5 5.379A3 3 0 0 0 8.379 4.5H7v-1Z"}),i.jsx("path",{d:"M4.5 6A1.5 1.5 0 0 0 3 7.5v9A1.5 1.5 0 0 0 4.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L9.44 6.439A1.5 1.5 0 0 0 8.378 6H4.5Z"})]})})]})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-[9px] text-gray-500 uppercase tracking-widest font-semibold",children:"Private Key:"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("span",{className:"text-[10px] font-mono text-[#c4c4c4]",children:["****",(ut=g.pkey)==null?void 0:ut.slice(-4)]}),i.jsx("button",{type:"button",onClick:()=>{g.pkey&&(navigator.clipboard.writeText(g.pkey),fn.success("Private Key copied!",{position:"bottom-right",style:{background:"#1e2329",color:"#fff",fontSize:"12px"}}))},className:"text-[#6b7280] hover:text-[#2dd4bf] transition p-0 m-0 bg-transparent border-none appearance-none outline-none focus:outline-none flex items-center justify-center",title:"Copy Private Key",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-3 h-3",children:[i.jsx("path",{d:"M7 3.5A1.5 1.5 0 0 1 8.5 2h3.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12A1.5 1.5 0 0 1 17 6.622V12.5a1.5 1.5 0 0 1-1.5 1.5h-1v-3.379a3 3 0 0 0-.879-2.121L10.5 5.379A3 3 0 0 0 8.379 4.5H7v-1Z"}),i.jsx("path",{d:"M4.5 6A1.5 1.5 0 0 0 3 7.5v9A1.5 1.5 0 0 0 4.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L9.44 6.439A1.5 1.5 0 0 0 8.378 6H4.5Z"})]})})]})]}),At&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-[9px] text-[#2dd4bf] uppercase tracking-widest font-semibold",children:"Wallet:"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("span",{className:"text-[10px] font-mono text-[#2dd4bf]",children:[At.slice(0,6),"...",At.slice(-4)]}),i.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(At),fn.success("Wallet copied!",{position:"bottom-right",style:{background:"#1e2329",color:"#fff",fontSize:"12px"}})},className:"text-[#6b7280] hover:text-[#2dd4bf] transition p-0 m-0 bg-transparent border-none appearance-none outline-none focus:outline-none flex items-center justify-center",title:"Copy Wallet",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-3 h-3",children:[i.jsx("path",{d:"M7 3.5A1.5 1.5 0 0 1 8.5 2h3.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12A1.5 1.5 0 0 1 17 6.622V12.5a1.5 1.5 0 0 1-1.5 1.5h-1v-3.379a3 3 0 0 0-.879-2.121L10.5 5.379A3 3 0 0 0 8.379 4.5H7v-1Z"}),i.jsx("path",{d:"M4.5 6A1.5 1.5 0 0 0 3 7.5v9A1.5 1.5 0 0 0 4.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L9.44 6.439A1.5 1.5 0 0 0 8.378 6H4.5Z"})]})})]})]})]})})()}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("label",{className:"text-xs uppercase tracking-[0.2em] text-[#8c8c8c]",children:"Private Key"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("input",{type:S?"text":"password",value:g.pkey,onChange:Sn("pkey"),placeholder:"Enter Private Key",disabled:gt,className:"h-8 flex-1 rounded-lg bg-[#12161c] border border-[#2b2f36] text-white px-4 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-2 focus:ring-white/10 hover:border-[#3a3a3a] placeholder:text-[#6b7280] disabled:opacity-50 disabled:cursor-not-allowed"}),i.jsx("button",{type:"button",onClick:()=>{g.pkey&&(navigator.clipboard.writeText(g.pkey),o("pkey"),setTimeout(()=>o(null),1500))},className:"relative h-8 w-8 min-w-8 rounded-lg border border-[#2b2f36] bg-[#12161c] text-[#c4c4c4] hover:border-[#3a3a3a] hover:text-white transition",title:"Copy Private Key",children:a==="pkey"?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"absolute left-1/2 top-1/2 w-3.5 h-3.5 -translate-x-1/2 -translate-y-1/2 text-[#2dd4bf]",children:i.jsx("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"})}):i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"absolute left-1/2 top-1/2 w-3.5 h-3.5 -translate-x-1/2 -translate-y-1/2",children:[i.jsx("path",{d:"M7 3.5A1.5 1.5 0 0 1 8.5 2h3.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12A1.5 1.5 0 0 1 17 6.622V12.5a1.5 1.5 0 0 1-1.5 1.5h-1v-3.379a3 3 0 0 0-.879-2.121L10.5 5.379A3 3 0 0 0 8.379 4.5H7v-1Z"}),i.jsx("path",{d:"M4.5 6A1.5 1.5 0 0 0 3 7.5v9A1.5 1.5 0 0 0 4.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L9.44 6.439A1.5 1.5 0 0 0 8.378 6H4.5Z"})]})}),i.jsx("button",{type:"button",onClick:()=>T(At=>!At),className:"h-8 px-4 rounded-lg border border-[#2b2f36] bg-[#12161c] text-xs uppercase tracking-[0.2em] text-[#c4c4c4] hover:border-[#3a3a3a] hover:text-white transition disabled:opacity-50 disabled:cursor-not-allowed",children:S?"Hide":"Show"})]}),(()=>{var le;let At="";const pt=(le=g.pkey)==null?void 0:le.trim();if(pt&&pt.length>=64)try{const Me=pt.startsWith("0x")?pt:`0x${pt}`;At=new fE(Me).address}catch{}return At?i.jsx("div",{className:"flex flex-col gap-1 mt-1",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-[10px] text-[#2dd4bf] font-mono tracking-widest pl-1",children:["Wallet: ",At.slice(0,6),"...",At.slice(-4)]}),i.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(At),fn.success("Wallet address copied!",{position:"bottom-right",style:{background:"#1e2329",color:"#fff",fontSize:"12px"}})},className:"text-[#6b7280] hover:text-[#2dd4bf] transition",title:"Copy Wallet Address",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:[i.jsx("path",{d:"M7 3.5A1.5 1.5 0 0 1 8.5 2h3.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12A1.5 1.5 0 0 1 17 6.622V12.5a1.5 1.5 0 0 1-1.5 1.5h-1v-3.379a3 3 0 0 0-.879-2.121L10.5 5.379A3 3 0 0 0 8.379 4.5H7v-1Z"}),i.jsx("path",{d:"M4.5 6A1.5 1.5 0 0 0 3 7.5v9A1.5 1.5 0 0 0 4.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L9.44 6.439A1.5 1.5 0 0 0 8.378 6H4.5Z"})]})})]})}):null})(),g.pkey&&!nt&&i.jsx("span",{className:"text-[11px] text-[#ff6b6b]",children:"Please enter a valid private key."}),(g.pkey===""||!g.pkey)&&i.jsx("div",{className:"text-[#FF797C] text-[10px] -mt-1",children:"Private Key is required"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("label",{className:"text-xs uppercase tracking-[0.2em] text-[#8c8c8c]",children:"Polymarket Address"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("input",{type:"text",value:g.funder_address,onChange:Sn("funder_address"),placeholder:"0x...",disabled:gt,className:"h-8 flex-1 rounded-lg bg-[#12161c] border border-[#2b2f36] text-white px-4 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-2 focus:ring-white/10 hover:border-[#3a3a3a] placeholder:text-[#6b7280] disabled:opacity-50 disabled:cursor-not-allowed"}),i.jsx("button",{type:"button",onClick:()=>{g.funder_address&&(navigator.clipboard.writeText(g.funder_address),o("funder"),setTimeout(()=>o(null),1500))},className:"relative h-8 w-8 min-w-8 rounded-lg border border-[#2b2f36] bg-[#12161c] text-[#c4c4c4] hover:border-[#3a3a3a] hover:text-white transition",title:"Copy Funder Address",children:a==="funder"?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"absolute left-1/2 top-1/2 w-3.5 h-3.5 -translate-x-1/2 -translate-y-1/2 text-[#2dd4bf]",children:i.jsx("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"})}):i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"absolute left-1/2 top-1/2 w-3.5 h-3.5 -translate-x-1/2 -translate-y-1/2",children:[i.jsx("path",{d:"M7 3.5A1.5 1.5 0 0 1 8.5 2h3.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12A1.5 1.5 0 0 1 17 6.622V12.5a1.5 1.5 0 0 1-1.5 1.5h-1v-3.379a3 3 0 0 0-.879-2.121L10.5 5.379A3 3 0 0 0 8.379 4.5H7v-1Z"}),i.jsx("path",{d:"M4.5 6A1.5 1.5 0 0 0 3 7.5v9A1.5 1.5 0 0 0 4.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L9.44 6.439A1.5 1.5 0 0 0 8.378 6H4.5Z"})]})})]}),g.funder_address&&!rt&&i.jsx("span",{className:"text-[11px] text-[#ff6b6b]",children:"Invalid address. Format: 0x + 40 hex chars."}),(g.funder_address===""||!g.funder_address)&&i.jsx("div",{className:"text-[#FF797C] text-[10px] -mt-1",children:"Polymarket Address is required"})]})]}),i.jsx("div",{className:"flex flex-col gap-2 rounded-xl border border-[#2b2f36] bg-[#10151d] p-3",children:C?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex flex-col items-start gap-1 w-full pb-1",children:i.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[i.jsxs("span",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.2em] text-[#8c8c8c]",children:["Live Logs",i.jsx("span",{className:`w-2 h-2 rounded-full ${F?"bg-[#22c55e] blur-[1px]":"bg-[#ef4444]"}`})]}),i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("button",{type:"button",onClick:()=>{L(At=>{const pt=[...At];return pt[l]=[],pt})},className:"h-6 px-2 rounded-lg border border-[#2b2f36] bg-[#12161c] text-[10px] uppercase tracking-[0.2em] text-[#c4c4c4] hover:border-[#3a3a3a] hover:text-white transition",children:"Clear"})})]})}),i.jsxs("div",{className:"flex flex-col gap-1 w-full h-[300px] sm:h-[350px] bg-[#0a0d14] border border-[#1e2329] rounded-lg p-2 overflow-y-auto font-mono text-[10px] leading-tight select-text",children:[((ms=I[l])==null?void 0:ms.length)>0?I[l].map((At,pt)=>{var ut,on,bn,Gn;if(typeof At=="string")return i.jsx("div",{className:"break-all whitespace-pre-wrap text-[#34d399]",children:At.replace("[INFO](poly_dca_user) ","").replace("[INFO](poly_dca_user)","").replace("[WARNING](poly_dca_user) ","").replace("[WARNING](poly_dca_user)","").replace("[ERROR](poly_dca_user) ","").replace("[ERROR](poly_dca_user)","")},pt);const le=((ut=At.level)==null?void 0:ut.includes("ERROR"))||((on=At.level)==null?void 0:on.includes("CRITICAL")),Me=((bn=At.level)==null?void 0:bn.includes("WARNING"))||((Gn=At.level)==null?void 0:Gn.includes("WARN"));let ft="text-[#34d399]";return le?ft="text-[#ef4444]":Me&&(ft="text-[#fbbf24]"),i.jsxs("div",{className:`flex gap-2 break-all whitespace-pre-wrap ${ft}`,children:[i.jsxs("span",{className:"opacity-50 shrink-0",children:["[",At.time,"]"]}),At.logger&&At.logger!=="poly_dca_user"&&i.jsxs("span",{className:"opacity-75 italic shrink-0",children:["(",At.logger,")"]}),i.jsx("span",{children:At.msg})]},pt)}):i.jsxs("div",{className:"text-[#6b7280] italic",children:["Waiting for logs from slot ",l+1,"..."]}),i.jsx("div",{ref:O})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col items-start gap-1 w-full",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[i.jsx("span",{className:"text-xs uppercase tracking-[0.2em] text-[#8c8c8c]",children:"API Credentials"}),i.jsx("button",{type:"button",onClick:()=>s(At=>!At),className:"h-8 px-3 rounded-lg border border-[#2b2f36] bg-[#12161c] text-[11px] uppercase tracking-[0.2em] text-[#c4c4c4] hover:border-[#3a3a3a] hover:text-white transition",children:r?"Hide":"Show"})]}),i.jsx("p",{className:"text-[11px] text-[#9aa4b2]",children:"This is required for the automated claim process."})]}),i.jsxs("div",{className:"flex flex-col gap-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://polymarket.com/settings?tab=builder",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsx("input",{type:r?"text":"password",value:g.api_key,onChange:Sn("api_key"),placeholder:"API key",disabled:gt,className:"h-7 rounded-lg bg-[#12161c] border border-[#2b2f36] text-white px-4 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-2 focus:ring-white/10 hover:border-[#3a3a3a] placeholder:text-[#6b7280] disabled:opacity-50 disabled:cursor-not-allowed"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Secret"}),i.jsx("input",{type:r?"text":"password",value:g.api_secret,onChange:Sn("api_secret"),placeholder:"API secret",disabled:gt,className:"h-7 rounded-lg bg-[#12161c] border border-[#2b2f36] text-white px-4 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-2 focus:ring-white/10 hover:border-[#3a3a3a] placeholder:text-[#6b7280] disabled:opacity-50 disabled:cursor-not-allowed"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Passphrase"}),i.jsx("input",{type:r?"text":"password",value:g.api_pass,onChange:Sn("api_pass"),placeholder:"API passphrase",disabled:gt,className:"h-7 rounded-lg bg-[#12161c] border border-[#2b2f36] text-white px-4 text-[12px] font-medium outline-none transition focus:border-[#4a4a4a] focus:ring-2 focus:ring-white/10 hover:border-[#3a3a3a] placeholder:text-[#6b7280] disabled:opacity-50 disabled:cursor-not-allowed"})]})]})}),e?i.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[i.jsx("button",{type:"submit",disabled:Y||Q||!C&&!wn,className:`h-11 px-6 rounded-lg text-white text-[14px] font-semibold tracking-[0.02em] transition ${C?"bg-[#ff5f2c]":!C&&!wn?"bg-[#2a2a2a] border-[#3a3a3a]":"bg-[#7446FF] border border-[#8861FF]"} ${Y||Q||!C&&!wn?"opacity-60 cursor-not-allowed":"hover:opacity-90"}`,children:Y||Q?"Please wait...":C?"Stop":"Start"}),i.jsx("span",{className:"text-xs text-[#7a7a7a]",children:C?"Bot is running. Click to stop.":"Click start to run the bot."})]}):i.jsx("button",{type:"button",onClick:()=>t(!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"}),te&&i.jsx("div",{className:"text-xs text-[#ff6b6b]",children:te})]})]})]})]})})]})},BCn=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setMushboomerETH:n,setIsWhitelist:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setHyperToken:l,setHyperAddress:c}=h.useContext(Qr),[u,d]=h.useState(!1),[f,x]=h.useState(!1),[g,y]=h.useState(""),[v,C]=h.useState(!1),[S,T]=h.useState(""),[I,L]=h.useState(!1);h.useEffect(()=>{const $=localStorage.getItem("hyperToken"),O=localStorage.getItem("hyperAddress");d(!!($&&O));const U=setInterval(()=>{const Y=localStorage.getItem("hyperToken"),re=localStorage.getItem("hyperAddress");d(!!(Y&&re))},800);return()=>clearInterval(U)},[]),h.useEffect(()=>{(async()=>{var Y,re;const O=window.localStorage.getItem("hyperToken"),U=window.localStorage.getItem("hyperAddress");if(!(!O||!U))try{L(!0);const Q=await bi(U.toLowerCase(),O);Q!=null&&Q.success?(t(Q==null?void 0:Q.telegram_chat_id),e(Q==null?void 0:Q.subscriber_role),n((Y=Q==null?void 0:Q.mushboomer_counts)==null?void 0:Y.eth),s((re=Q==null?void 0:Q.mushboomer_counts)==null?void 0:re.sol),a(Q==null?void 0:Q.referral_code),o(Q==null?void 0:Q.refcode),r(Q==null?void 0:Q.whitelist),x(Q==null?void 0:Q.polymarket_dca_alpha_code),L(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),l(""),c(""),L(!1))}catch(Q){console.error("Token verification error:",Q),L(!1)}})()},[u]);const F=async()=>{var U,Y,re,Q;const $=window.localStorage.getItem("hyperToken"),O=window.localStorage.getItem("hyperAddress");if(!g.trim()){fn.error("Please enter your alpha code");return}if(!(!$||!O)){C(!0),T("");try{const q={address:O==null?void 0:O.toLowerCase(),token:$,alpha_code:g.trim(),source_market:"polymarket",app_type:"side_bot"},fe=(await Ns.post("https://dextrabothypev2.nftinit.io/api/subscriber/alpha_code/set_polymarket/",q)).data||{};if(fe.success){const G=fe.message||"Alpha code added successfully";fn.success(`${G}`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}}),T(G),x(!0)}else{const G=fe.error_message||fe.message||"This alpha code is invalid";fn.success(`${G}.`,{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(G)}}catch(q){const te=((Y=(U=q==null?void 0:q.response)==null?void 0:U.data)==null?void 0:Y.error_message)||((Q=(re=q==null?void 0:q.response)==null?void 0:re.data)==null?void 0:Q.message)||q.message||"Failed to validate alpha code";fn.success(`${te}.`,{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(te)}finally{C(!1)}}};return i.jsxs(i.Fragment,{children:[i.jsx(za,{children:i.jsxs(Va,{children:[i.jsx("title",{children:"Polymarket DCA | Automated Market Making | Dextrabot"}),i.jsx("meta",{name:"description",content:"Automate market making on PolyMarket with DCA strategy. Generate trading volume and provide liquidity 24/7."}),i.jsx("meta",{property:"og:title",content:"PolyMarket DCA | Automated Market Making | Dextrabot"}),i.jsx("meta",{property:"og:description",content:"Automate market making on PolyMarket with DCA strategy. 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/polymarket-dca"})]})}),i.jsx("div",{style:{minHeight:"calc(100vh - 5rem)"},className:"flex justify-center items-start w-full h-full pb-6 bg-gradient-to-b from-[#0b0f14] via-[#07090c] to-[#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 px-4 md:px-6",children:f&&u?i.jsx(DCn,{}):i.jsx(KKe,{code:g,onCodeChange:y,onSubmit:F,loading:v,loadingCheckAccount:I,message:S,connected:u})})})]})},jO="#basedapp-farming",AO="#aster-farming",_O="#lighter-farming",EO="#apex-farming",kO="#variational-farming",TO="#extended-farming",PO="#paradex-farming",IO="#pacifica-farming";function $Cn(){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}=h.useContext(Qr),r=Pl(),s=yo(),[a,o]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState(!1),[f,x]=h.useState(!1),g=r.hash===jO,y=r.hash===AO,v=r.hash===_O,C=r.hash===EO,S=r.hash===kO,T=r.hash===TO,I=r.hash===PO,L=r.hash===IO,F=ke.useCallback(te=>{te?r.hash!==jO&&s(r.pathname+r.search+jO,{replace:!0}):r.hash===jO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),$=ke.useCallback(te=>{te?r.hash!==AO&&s(r.pathname+r.search+AO,{replace:!0}):r.hash===AO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),O=ke.useCallback(te=>{te?r.hash!==_O&&s(r.pathname+r.search+_O,{replace:!0}):r.hash===_O&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),U=ke.useCallback(te=>{te?r.hash!==EO&&s(r.pathname+r.search+EO,{replace:!0}):r.hash===EO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),Y=ke.useCallback(te=>{te?r.hash!==kO&&s(r.pathname+r.search+kO,{replace:!0}):r.hash===kO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),re=ke.useCallback(te=>{te?r.hash!==TO&&s(r.pathname+r.search+TO,{replace:!0}):r.hash===TO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),Q=ke.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]),q=ke.useCallback(te=>{te?r.hash!==IO&&s(r.pathname+r.search+IO,{replace:!0}):r.hash===IO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]);return h.useEffect(()=>{const te=localStorage.getItem("dailyPicksDismissedAt"),fe=localStorage.getItem("dailyPicksBlockedUntil"),G=Date.now();if(fe&&G<parseInt(fe)){o(!1);return}if(te){const ie=new Date(parseInt(te)).toDateString(),oe=new Date().toDateString();if(ie===oe){o(!1);return}}o(!0)},[r.pathname,e]),h.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 G=localStorage.getItem(`lighterCopyTradeDismissedAt_${fe}`);if(G){const ie=new Date(parseInt(G)).toDateString(),oe=new Date().toDateString();if(ie===oe){window.location.pathname==="/my-profile"?c(!0):c(!1);return}}c(!0)},[r.pathname,e,n]),h.useEffect(()=>{const te=localStorage.getItem("strategySelectorModalDismissedAt");if(te){const fe=new Date(parseInt(te)).toDateString(),G=new Date().toDateString();if(fe===G){d(!1);return}}d(!0)},[r.pathname,e]),h.useEffect(()=>{if(localStorage.getItem("lighterReportModalDismissed")==="true"){x(!1);return}x(!0)},[r.pathname]),i.jsxs(i.Fragment,{children:[i.jsx("div",{children:i.jsx(CJe,{})}),i.jsxs("div",{children:[i.jsx(dcn,{}),i.jsxs(yZe,{children:[i.jsx(Xi,{path:"/",element:i.jsx(Pun,{})}),i.jsx(Xi,{path:"/sitemap",element:i.jsx(Lun,{})}),i.jsx(Xi,{path:"/videos",element:i.jsx(Run,{})}),t.map(({from:te,to:fe})=>i.jsx(Xi,{path:te,element:i.jsx(_he,{to:fe,replace:!0})},te)),i.jsxs(Xi,{element:i.jsx(zan,{}),children:[i.jsx(Xi,{path:"/mobile-auth",element:i.jsx(Mun,{})}),i.jsx(Xi,{path:"discover-wallets",element:i.jsx(vln,{})}),i.jsx(Xi,{path:"/hyperliquid-vaults",element:i.jsx(Dun,{})}),i.jsx(Xi,{path:"/back-testing",element:i.jsx(vwn,{})}),i.jsx(Xi,{path:"/hyperliquid-whale-trades",element:i.jsx(lwn,{})}),i.jsx(Xi,{path:"wallet-details/:walletAddress",element:i.jsx(ccn,{})}),i.jsx(Xi,{path:"tracked-wallets",element:i.jsx(hcn,{})}),i.jsx(Xi,{path:"tracker",element:i.jsx(Pcn,{})}),i.jsx(Xi,{path:"referral/:code?",element:i.jsx(Rcn,{})}),i.jsx(Xi,{path:"wallet-management",element:i.jsx(Qcn,{})}),i.jsx(Xi,{path:"copy-trade",element:i.jsx(eun,{})}),i.jsx(Xi,{path:"leaderboard",element:i.jsx(aun,{})}),i.jsx(Xi,{path:"ticker",element:i.jsx(zun,{})}),i.jsx(Xi,{path:"terminal",element:i.jsx(_he,{to:"/terminal/hyperliquid/BTC",replace:!0})}),i.jsx(Xi,{path:"terminal/:coin",element:i.jsx(UCn,{})}),i.jsx(Xi,{path:"terminal/:exchange/:coin",element:i.jsx(abn,{})}),i.jsx(Xi,{path:"telegram-verify",element:i.jsx(uwn,{})}),i.jsx(Xi,{path:"telegram-api-wallet",element:i.jsx(Cwn,{})}),i.jsx(Xi,{path:"subscribe",element:i.jsx(m3n,{})}),i.jsx(Xi,{path:"my-profile",element:i.jsx(_3n,{})}),i.jsx(Xi,{path:"hyperliquid-fee-calculator",element:i.jsx(p8e,{})}),i.jsx(Xi,{path:"hyperliquid-fee-calculator/:walletAddress",element:i.jsx(p8e,{})}),i.jsx(Xi,{path:"market-maker",element:i.jsx(S3n,{})}),i.jsx(Xi,{path:"dca-bot",element:i.jsx(h3n,{})}),i.jsx(Xi,{path:"standx-mm",element:i.jsx(OCn,{})}),i.jsx(Xi,{path:"funding",element:i.jsx(k3n,{})}),i.jsx(Xi,{path:"funding-history/:pair",element:i.jsx(Y6n,{})}),i.jsx(Xi,{path:"polymarket",element:i.jsx(mCn,{})}),i.jsx(Xi,{path:"polymarket-dca",element:i.jsx(BCn,{})})]}),i.jsx(Xi,{path:"*",element:i.jsx(zCn,{url:"https://dextrabot.com/"})})]}),i.jsx(Mce,{open:g,setOpen:F}),i.jsx(Q6n,{open:l,setOpen:c}),i.jsx(Z6n,{open:u,setOpen:d}),i.jsx(J6n,{open:f,setOpen:x}),i.jsx(Lce,{open:y,setOpen:$}),i.jsx(Rce,{open:v,setOpen:O}),i.jsx(Dce,{open:C,setOpen:U}),i.jsx(Bce,{open:S,setOpen:Y}),i.jsx(MU,{open:T,setOpen:re}),i.jsx($ce,{open:I,setOpen:Q}),i.jsx(Uce,{open:L,setOpen:q})]})]})}function UCn(){const{coin:t}=v2(),e=yo();return h.useEffect(()=>{const n=t||"BTC",r=typeof window<"u"&&window.location.hash||"";e(`/terminal/hyperliquid/${n}${r}`,{replace:!0})},[t,e]),null}function zCn({url:t}){return ke.useEffect(()=>{window.location.replace(t)},[t]),i.jsx(za,{children:i.jsxs(Va,{children:[i.jsx("meta",{name:"prerender-status-code",content:"301"}),i.jsx("meta",{name:"prerender-header",content:`Location: ${t}`})]})})}const HCn="4953aed406a7fd4457496250b7e4efbc",VCn=n$t({appName:"Dextrabot",projectId:HCn,chains:[WE,aye,iye,sye],transports:{[WE.id]:X7(),[aye.id]:X7(),[iye.id]:X7(),[sye.id]:X7()},ssr:!1}),WCn=new Yyt,qCn=document.getElementById("root"),GCn=die.createRoot(qCn);GCn.render(i.jsx(EZe,{children:i.jsx(Nyt,{config:VCn,children:i.jsx(g2t,{client:WCn,children:i.jsx(NDt,{modalSize:"compact",theme:pDe({borderRadius:"large",fontStack:"rounded",overlayBlur:"large"}),children:i.jsx(h3t,{children:i.jsx($Cn,{})})})})})}));const SAe=Object.freeze(Object.defineProperty({__proto__:null,default:Ene},Symbol.toStringTag,{value:"Module"}));export{Hr as B,Loe as E,T_ as H,ACn as V,ps as _,B4n as a,g1 as b,N$ as c,O0t as d,A2 as e,ox as f,Jae as g,Pi as h,goe as i,CQe as j,Lu as k,qke as l,vCn as m,cyt as n,kLt as r,Lc as s,lNn as t};